summaryrefslogtreecommitdiffstats
path: root/rrdtool-listgraphcfg-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-03-04 02:48:26 +0000
committerTed Trask <ttrask01@yahoo.com>2014-03-04 02:48:26 +0000
commit8214b8f27def51f43d72bc04271b16d1a7b2e0df (patch)
treebc57a798f4aff457b68fc36c1ca0eebd96ca9265 /rrdtool-listgraphcfg-html.lsp
parent45ceb4770df9774a37346f7e0d1ef4f8acec46a9 (diff)
downloadacf-rrdtool-8214b8f27def51f43d72bc04271b16d1a7b2e0df.tar.bz2
acf-rrdtool-8214b8f27def51f43d72bc04271b16d1a7b2e0df.tar.xz
Fix sort by filesize in logfiles/status
Diffstat (limited to 'rrdtool-listgraphcfg-html.lsp')
-rw-r--r--rrdtool-listgraphcfg-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/rrdtool-listgraphcfg-html.lsp b/rrdtool-listgraphcfg-html.lsp
index 0beebc4..db6ef05 100644
--- a/rrdtool-listgraphcfg-html.lsp
+++ b/rrdtool-listgraphcfg-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>');
@@ -55,7 +69,7 @@ function javascript_confirm_graph(formID,filename) {
if viewlibrary.check_permission("editgraphcfg") then io.write(html.link{value = "editgraphcfg?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end
%>
</td>
- <td><%= html.html_escape(file.value.filesize.value) %></td>
+ <td><span style="display:none"><%= convertsize(file.value.filesize.value) %>b</span><%= html.html_escape(file.value.filesize.value) %></td>
<td><%= html.html_escape(file.value.mtime.value) %></td>
<td><%= html.html_escape(string.gsub(file.value.filename.value, "^.*/", "")) %></td>
</tr>