diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-03-04 02:43:30 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-03-04 02:43:30 +0000 |
commit | 56be0f97c913af09bdd7312bd8075ff352426be1 (patch) | |
tree | 4781efc7e70951849844f509e5008b71dda0a17e /clamav-listfiles-html.lsp | |
parent | 2eb2895972d0b37cbc271d8551bc4d263611b72d (diff) | |
download | acf-clamav-56be0f97c913af09bdd7312bd8075ff352426be1.tar.bz2 acf-clamav-56be0f97c913af09bdd7312bd8075ff352426be1.tar.xz |
Fix sort by filesize in logfiles/status
Diffstat (limited to 'clamav-listfiles-html.lsp')
-rw-r--r-- | clamav-listfiles-html.lsp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clamav-listfiles-html.lsp b/clamav-listfiles-html.lsp index a858d5e..d07bb2d 100644 --- a/clamav-listfiles-html.lsp +++ b/clamav-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>'); @@ -39,7 +53,7 @@ end %> <% for i,file in ipairs(data.value) do %> <tr> <td><%= html.link{value = "expert?filename=" .. file.filename.."&redir="..page_info.orig_action, label=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 %> |