Commit 9daf92db authored by Ted Trask's avatar Ted Trask
Browse files

Modify listfiles to use tablesorter

parent 9f058135
......@@ -3,18 +3,51 @@ htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>
<%
function convertsize(size)
if string.find(size, "k$") then
return tonumber(string.match(size, "%d*")) * 1024
elseif string.find(string.match(size, "%d*"), "M$") then
return tonumber(size) * 1024 * 1024
elseif string.find(size, "G$") then
return tonumber(string.match(size, "%d*")) + 1024 * 1024 * 1024
else
return tonumber(size)
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>');
}
</script>
<script type="text/javascript">
if (typeof $.tablesorter == 'undefined') {
document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
}
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#files").tablesorter({headers: {1:{sorter: 'digit'}, 2:{sorter: 'usLongDate'}}, widgets: ['zebra']});
});
</script>
<% htmlviewfunctions.displaycommandresults({"editfile"}, session) %>
<H1>File List</H1>
<DL>
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">File</TD>
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Size</TD>
<TD style="white-space:nowrap;text-align:left;" class="header">Last Modified</TD>
</TR>
<TABLE id="files" class="tablesorter"><THEAD>
<TR>
<TH>File</TH>
<TH>Size</TH>
<TH>Last Modified</TH>
</TR>
</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 %>
</TABLE>
</TBODY></TABLE>
</DL>
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