summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-04 02:47:55 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-04 02:47:55 +0000
commit48a78f25883f5453df50c0607fec4541a71a6294 (patch)
tree2d51515e1d07b897bf5e45824a80124344bf5c9f
parentc66c23b68b7b19972da15014f7ebf96cd290fb57 (diff)
downloadacf-asterisk-48a78f25883f5453df50c0607fec4541a71a6294.tar.bz2
acf-asterisk-48a78f25883f5453df50c0607fec4541a71a6294.tar.xz
Fix sort by filesize in logfiles/status
-rw-r--r--asterisk-listfiles-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/asterisk-listfiles-html.lsp b/asterisk-listfiles-html.lsp
index be70876..c22a110 100644
--- a/asterisk-listfiles-html.lsp
+++ b/asterisk-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 %>
</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) .. "/edit?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) .. "/edit?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>