summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-11-20 18:19:02 +0000
committerTed Trask <ttrask01@yahoo.com>2013-11-20 18:19:02 +0000
commit9daf92dbb111397c19bcf3e93f52842e5b1e75c6 (patch)
treea8572ec9fe894bc8d52ba16dde0d8842c6bf7f57
parent9f05813581b3b7ba519c5fa0f7189438830c0e9c (diff)
downloadacf-weblog-9daf92dbb111397c19bcf3e93f52842e5b1e75c6.tar.bz2
acf-weblog-9daf92dbb111397c19bcf3e93f52842e5b1e75c6.tar.xz
Modify listfiles to use tablesorter
-rw-r--r--weblog-listfiles-html.lsp49
1 files changed, 41 insertions, 8 deletions
diff --git a/weblog-listfiles-html.lsp b/weblog-listfiles-html.lsp
index 2139c2b..fcca5b3 100644
--- a/weblog-listfiles-html.lsp
+++ b/weblog-listfiles-html.lsp
@@ -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>