diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-03-04 02:44:06 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-03-04 02:44:06 +0000 |
commit | 5c241915dc49b7ecee0fd3f09d34dd2b0766904b (patch) | |
tree | d98842af747d637d0318decd16b2da6a8e1578d2 | |
parent | accdc5b2ac969092e0a21bef5cff679875d2430c (diff) | |
download | acf-dhcp-5c241915dc49b7ecee0fd3f09d34dd2b0766904b.tar.bz2 acf-dhcp-5c241915dc49b7ecee0fd3f09d34dd2b0766904b.tar.xz |
Fix sort by filesize in logfiles/status
-rw-r--r-- | dhcp-listfiles-html.lsp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/dhcp-listfiles-html.lsp b/dhcp-listfiles-html.lsp index 3b9b2fe..3e1bb65 100644 --- a/dhcp-listfiles-html.lsp +++ b/dhcp-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>'); @@ -40,7 +54,7 @@ end %> <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 %> |