summaryrefslogtreecommitdiffstats
path: root/provisioning-listfiles-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-04 02:47:21 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-04 02:47:21 +0000
commit9e6bec69bac4ee45a8355aa5993bbd3f1c71dfcf (patch)
tree3752a3b7b46aa140bf94f0e4d21f7ab2ffb19241 /provisioning-listfiles-html.lsp
parente5f62555031d500d50405ba395e330223ac28e9f (diff)
downloadacf-provisioning-9e6bec69bac4ee45a8355aa5993bbd3f1c71dfcf.tar.bz2
acf-provisioning-9e6bec69bac4ee45a8355aa5993bbd3f1c71dfcf.tar.xz
Fix sort by filesize in logfiles/status
Diffstat (limited to 'provisioning-listfiles-html.lsp')
-rw-r--r--provisioning-listfiles-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/provisioning-listfiles-html.lsp b/provisioning-listfiles-html.lsp
index cc9e02a..b1c0e5e 100644
--- a/provisioning-listfiles-html.lsp
+++ b/provisioning-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>');
@@ -33,7 +47,7 @@ html = require("acf.html")
</thead><tbody>
<%
for k,v in ipairs( view.value ) do
- io.write( "<tr><td><a href=\"" .. html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) .. "/editfile?filename=" .. html.html_escape(v.filename) .. "&redir=" .. html.html_escape(page_info.orig_action) .. "\">" .. html.html_escape(v.filename) .. "</a></td><td>" .. html.html_escape(v.size) .."</td><td>" .. html.html_escape(v.mtime) .."</td></tr>\n" )
+ io.write( "<tr><td><a href=\"" .. html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) .. "/editfile?filename=" .. html.html_escape(v.filename) .. "&redir=" .. html.html_escape(page_info.orig_action) .. "\">" .. html.html_escape(v.filename) .. '</a></td><td><span style="display:none">'..convertsize(v.size).."b</span>" .. html.html_escape(v.size) .."</td><td>" .. html.html_escape(v.mtime) .."</td></tr>\n" )
end
%>
</tbody></table>