summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-04 02:46:01 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-04 02:46:01 +0000
commit3cf639c412f6ddee6dd36711e5879f038b2e8668 (patch)
tree3ef3300a4c28e394f69fdbea49bdaff518e85217
parent86b646ce7823f614db0884a330e82a45d6d85ffa (diff)
downloadacf-dansguardian-3cf639c412f6ddee6dd36711e5879f038b2e8668.tar.bz2
acf-dansguardian-3cf639c412f6ddee6dd36711e5879f038b2e8668.tar.xz
Fix sort by filesize in logfiles/status
-rw-r--r--dansguardian-listfiles-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/dansguardian-listfiles-html.lsp b/dansguardian-listfiles-html.lsp
index 5339110..930f3b3 100644
--- a/dansguardian-listfiles-html.lsp
+++ b/dansguardian-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>');
@@ -37,7 +51,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>