From 83314ddee80f13f6f58dbcc4ab77b9052ec1e939 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 30 Dec 2015 14:15:40 +0000 Subject: Change file actions filesize to size, size and mtime not user-friendly, use posix.stat over fs.stat, use new format functions --- tinydns-controller.lua | 9 +-------- tinydns-edit-html.lsp | 2 +- tinydns-listfiles-html.lsp | 22 ++++------------------ tinydns-model.lua | 9 ++++++++- 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/tinydns-controller.lua b/tinydns-controller.lua index 9af5d36..1e1953e 100644 --- a/tinydns-controller.lua +++ b/tinydns-controller.lua @@ -31,14 +31,7 @@ function mymodule.newfile(self) end function mymodule.listfiles(self) - local configfiles = self.model.getfilelist(self, self.sessiondata.userinfo.userid) - local config = {} - for k,v in pairs(configfiles.value) do - local filedetails = self.model.get_filedetails(self, v, self.sessiondata.userinfo.userid) - table.insert(config,filedetails) - end - - return cfe({ type="list", value=config, label="Config files" }) + return self.model.getfilelist(self, self.sessiondata.userinfo.userid) end function mymodule.edit(self) diff --git a/tinydns-edit-html.lsp b/tinydns-edit-html.lsp index 0b14b36..212f222 100644 --- a/tinydns-edit-html.lsp +++ b/tinydns-edit-html.lsp @@ -211,7 +211,7 @@ end header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="File Details"}), page_info, htmlviewfunctions.incrementheader(header_level)) htmlviewfunctions.displayitem(form.value.filename) -htmlviewfunctions.displayitem(form.value.filesize) +htmlviewfunctions.displayitem(form.value.size) htmlviewfunctions.displayitem(form.value.mtime) if form.value.grep and form.value.grep.value and form.value.grep.value ~= "" then htmlviewfunctions.displayitem(form.value.grep) diff --git a/tinydns-listfiles-html.lsp b/tinydns-listfiles-html.lsp index 098b97a..8a35d4f 100644 --- a/tinydns-listfiles-html.lsp +++ b/tinydns-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 -%> -