Commit 3cf639c4 authored by Ted Trask's avatar Ted Trask

Fix sort by filesize in logfiles/status

parent 86b646ce
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment