summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-04 02:48:07 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-04 02:48:07 +0000
commitac9d4ef5fe49eee863019e0167743f71b8602aaa (patch)
treec39e16d7c9e39894da20a4e4a9d17e4f6db6d04e
parent96491cb4728bdc311be15e9e58eae36c19657406 (diff)
downloadacf-postfix-ac9d4ef5fe49eee863019e0167743f71b8602aaa.tar.bz2
acf-postfix-ac9d4ef5fe49eee863019e0167743f71b8602aaa.tar.xz
Fix sort by filesize in logfiles/status
-rw-r--r--postfix-listfiles-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/postfix-listfiles-html.lsp b/postfix-listfiles-html.lsp
index 43c5914..3f5cfb7 100644
--- a/postfix-listfiles-html.lsp
+++ b/postfix-listfiles-html.lsp
@@ -3,6 +3,20 @@ htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
+<%
+function convertsize(size)
+ if string.find(size, "k$") then
+ return tonumber(string.match(size, "[%d.]*")) * 1024.0
+ elseif string.find(size, "M$") then
+ return tonumber(string.match(size, "[%d.]*")) * 1024.0 * 1024.0
+ elseif string.find(size, "G$") then
+ return tonumber(string.match(size, "[%d.]*")) + 1024.0 * 1024.0 * 1024.0
+ else
+ return tonumber(string.match(size, "[%d.]*"))
+ end
+end
+%>
+
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
@@ -44,7 +58,7 @@ end %>
<% if file.filename ~= "/etc/mail/aliases" then %><%= html.link{value = "deletefile?submit=true&filename=" .. file.filename, label="Delete "} %><% end %>
</td>
<td><%= html.html_escape(file.filename) %></td>
- <td><%= html.html_escape(file.filesize) %></td>
+ <td><span style="display:none"><%= convertsize(file.filesize) %>b</span><%= html.html_escape(file.filesize) %></td>
<td><%= html.html_escape(file.mtime) %></td>
</tr>
<% end %>