diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-03-04 02:46:23 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-03-04 02:46:23 +0000 |
commit | e26f18b8a777a41bfe67c39b460b85a55df45e3d (patch) | |
tree | 0804f6a458119285a1e645cd556be0190b8892c2 | |
parent | 8b46e0e7673456ac6c72a271d155be2442a2b51c (diff) | |
download | acf-lighttpd-e26f18b8a777a41bfe67c39b460b85a55df45e3d.tar.bz2 acf-lighttpd-e26f18b8a777a41bfe67c39b460b85a55df45e3d.tar.xz |
Fix sort by filesize in logfiles/status
-rw-r--r-- | lighttpd-listfiles-html.lsp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lighttpd-listfiles-html.lsp b/lighttpd-listfiles-html.lsp index bd20584..41849e2 100644 --- a/lighttpd-listfiles-html.lsp +++ b/lighttpd-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>'); @@ -38,7 +52,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 %> |