summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--postfix-listfiles-html.lsp18
-rw-r--r--postfix-model.lua7
2 files changed, 7 insertions, 18 deletions
diff --git a/postfix-listfiles-html.lsp b/postfix-listfiles-html.lsp
index 2a5a0c4..d21b875 100644
--- a/postfix-listfiles-html.lsp
+++ b/postfix-listfiles-html.lsp
@@ -3,20 +3,6 @@ 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>');
@@ -31,7 +17,7 @@ end
<script type="text/javascript">
$(document).ready(function() {
- $("#list").tablesorter({widgets: ['zebra']});
+ $("#list").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
});
</script>
@@ -63,7 +49,7 @@ end %>
<% end %>
</td>
<td><%= html.html_escape(file.filename) %></td>
- <td><span class="hide"><%= convertsize(file.filesize) %>b</span><%= html.html_escape(file.filesize) %></td>
+ <td><span class="hide"><%= html.html_escape(file.orig_size) %>b</span><%= html.html_escape(file.size) %></td>
<td><%= html.html_escape(file.mtime) %></td>
</tr>
<% end %>
diff --git a/postfix-model.lua b/postfix-model.lua
index 06436e5..1c71401 100644
--- a/postfix-model.lua
+++ b/postfix-model.lua
@@ -66,8 +66,11 @@ function mymodule.getfilelist()
local listed_files = {}
for i,name in ipairs(geteditablefilelist()) do
- local filedetails = fs.stat(name) or {}
- table.insert ( listed_files , {filename=name, mtime=filedetails.mtime or "---", filesize=filedetails.size or "0"} )
+ local filedetails = fs.stat(name)
+ if filedetails then
+ filedetails.filename = name
+ table.insert ( listed_files, filedetails )
+ end
end
table.sort(listed_files, function (a,b) return (a.filename < b.filename) end )