summaryrefslogtreecommitdiffstats
path: root/tinydns-listfiles-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'tinydns-listfiles-html.lsp')
-rw-r--r--tinydns-listfiles-html.lsp16
1 files changed, 15 insertions, 1 deletions
diff --git a/tinydns-listfiles-html.lsp b/tinydns-listfiles-html.lsp
index 33c7860..151a1e7 100644
--- a/tinydns-listfiles-html.lsp
+++ b/tinydns-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>');
@@ -44,7 +58,7 @@ html = require("acf.html")
if viewlibrary.check_permission("editfile") then io.write(html.link{value = "editfile?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Expert " }) 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>