summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-03 22:15:52 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-03 22:15:52 +0000
commitb0f4fadb7b62297b6dbd574b2a7d8eee0f990eb4 (patch)
tree7e658ca64e81c1ab1b48f066a16b5a5fdf1396bd
parentdb50c4a219e0199bebd8a9fd70a87a4d3c6a123e (diff)
downloadacf-alpine-baselayout-b0f4fadb7b62297b6dbd574b2a7d8eee0f990eb4.tar.bz2
acf-alpine-baselayout-b0f4fadb7b62297b6dbd574b2a7d8eee0f990eb4.tar.xz
Fix sort by filesize in logfiles/status
-rw-r--r--logfiles-status-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/logfiles-status-html.lsp b/logfiles-status-html.lsp
index a8282bf..bd45435 100644
--- a/logfiles-status-html.lsp
+++ b/logfiles-status-html.lsp
@@ -2,6 +2,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>');
@@ -54,7 +68,7 @@
<td><%= html.link{value = "view?filename="..file.value.filename.value, label="View" } %></td>
<td><%= html.link{value = "tail?filename="..file.value.filename.value, label="Tail" } %></td>
<td><%= html.link{value = "download?viewtype=stream&filename="..file.value.filename.value, label="Download" } %></td>
- <td><%= html.html_escape(file.value.filesize.value) %></td>
+ <td><span style="display:none"><%= convertsize(file.value.filesize.value) %>b</span><%= html.html_escape(file.value.filesize.value) %></td>
<td><%= html.html_escape(file.value.mtime.value) %></td>
<td><%= html.html_escape(file.value.filename.value) %></td>
</tr>