summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-04 02:45:35 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-04 02:45:35 +0000
commitcb12a51c84b10711f17dc86ccd1829f902357f96 (patch)
tree84e8fc9356d91289c638f09f0d9ad55747e89085
parent36de5febb51584cb853e2281c0b947ec75c0a790 (diff)
downloadacf-postgresql-cb12a51c84b10711f17dc86ccd1829f902357f96.tar.bz2
acf-postgresql-cb12a51c84b10711f17dc86ccd1829f902357f96.tar.xz
Fix sort by filesize in logfiles/status
-rw-r--r--postgresql-listfiles-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/postgresql-listfiles-html.lsp b/postgresql-listfiles-html.lsp
index bd20584..41849e2 100644
--- a/postgresql-listfiles-html.lsp
+++ b/postgresql-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 %>
<% for i,file in ipairs(data.value) do %>
<tr>
<td><%= html.link{value = "expert?filename=" .. file.filename.."&redir="..page_info.orig_action, label=file.filename} %></td>
- <td><%= html.html_escape(file.filesize) %></td>
+ <td><span style="display:none"><%= convertsize(file.filesize) %>b</span><%= html.html_escape(file.filesize) %></td>
<td><%= html.html_escape(file.mtime) %></td>
</tr>
<% end %>