summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--postgresql-listfiles-html.lsp18
-rw-r--r--postgresql-model.lua7
2 files changed, 6 insertions, 19 deletions
diff --git a/postgresql-listfiles-html.lsp b/postgresql-listfiles-html.lsp
index 6b7fc9c..11f904d 100644
--- a/postgresql-listfiles-html.lsp
+++ b/postgresql-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>');
@@ -59,8 +45,8 @@ end %>
htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="expert"}), page_info, -1)
%></td>
<td><%= html.html_escape(file.filename) %></td>
- <td><span class="hide"><%= convertsize(file.filesize) %>b</span><%= html.html_escape(file.filesize) %></td>
- <td><%= html.html_escape(file.mtime) %></td>
+ <td><span class="hide"><%= html.html_escape(file.size or 0) %>b</span><%= format.formatfilesize(file.size) %></td>
+ <td><%= format.formattime(file.mtime) %></td>
</tr>
<% end %>
</tbody></table>
diff --git a/postgresql-model.lua b/postgresql-model.lua
index 8bfe047..d2e3988 100644
--- a/postgresql-model.lua
+++ b/postgresql-model.lua
@@ -88,13 +88,14 @@ function mymodule.getfilelist()
local listed_files = {}
for i,name in ipairs(determinefilelist()) do
- local filedetails = fs.stat(name) or {}
- table.insert ( listed_files , {filename=name, mtime=filedetails.mtime or "---", filesize=filedetails.size or "0"} )
+ local filedetails = posix.stat(name) or {}
+ filedetails.filename = name
+ table.insert(listed_files, filedetails)
end
table.sort(listed_files, function (a,b) return (a.filename < b.filename) end )
- return cfe({ type="list", value=listed_files, label="Postgresql File List" })
+ return cfe({ type="structure", value=listed_files, label="Postgresql File List" })
end
function mymodule.getfiledetails(filename)