diff options
-rw-r--r-- | shorewall-edit-html.lsp | 11 | ||||
-rw-r--r-- | shorewall-list-html.lsp | 2 | ||||
-rw-r--r-- | shorewall-model.lua | 19 |
3 files changed, 19 insertions, 13 deletions
diff --git a/shorewall-edit-html.lsp b/shorewall-edit-html.lsp index 3e12554..f1c4958 100644 --- a/shorewall-edit-html.lsp +++ b/shorewall-edit-html.lsp @@ -12,17 +12,22 @@ <dd><?= view.filecontent.filedetails.size ?></dd> <dt>Last modified</dt> -<dd><?= view.filecontent.filedetails.mtime ?></dd> +<dd><?= view.filecontent.filedetails.mtimelong ?></dd> <dt>Mode</dt> <dd><?= view.filecontent.filedetails.mode ?></dd> <dt>Owner:Group</dt> -<dd><?= view.filecontent.filedetails.uid ?>:<?= view.filecontent.filedetails.gid ?></dd> +<dd><?= view.filecontent.filedetails.gid ?>:<?= view.filecontent.filedetails.group ?></dd> <h2>Content</h2> <textarea name="" style="width:100%;height:400px;"><?= view.filecontent.value ?></textarea> - +<h2>DEUB INFO</h2> +<? +for a,b in pairs(view.filecontent.filedetails) do +print (a,b .. "<BR>") +end +?> </body> </html> diff --git a/shorewall-list-html.lsp b/shorewall-list-html.lsp index 424349a..dc18373 100644 --- a/shorewall-list-html.lsp +++ b/shorewall-list-html.lsp @@ -6,5 +6,5 @@ <? for i = 1, table.maxn(view.filelist) do ?> <dt><?= html.link{value = view.url .. "/edit?name=" .. view.filelist[i].name , label=view.filelist[i].name } ?></dt> - <dd><i>Last modified:</i> <?= view.filelist[i].filedetails.mtime ?></dd> + <dd><i>Last modified:</i> <?= view.filelist[i].filedetails.mtimelong ?></dd> <? end ?> diff --git a/shorewall-model.lua b/shorewall-model.lua index bf42891..ce436c4 100644 --- a/shorewall-model.lua +++ b/shorewall-model.lua @@ -1,20 +1,21 @@ -- shorewall model methods module (..., package.seeall) -local function XXXfile_info ( path ) - local file = io.popen("ls -lh " .. path ) - local file_info_result = file:read("*a") or "unknown" - file:close() - local size,lastmod = string.match(file_info_result, "^%S+%s+%S+%s+%S+%s+%S+%s+(%S+)%s+(%S+%s+%S+%s+%S+)" ) - return {lastmod=lastmod,size=size, longname=path} -end local function file_info ( path ) require("posix") - filedetails = posix.stat(path) - filedetails.longname = path + modfiledetails = {} + local filedetails = posix.stat(path) + filedetails["owner"]=rawget((posix.getgroup(filedetails["uid"])),"1") + filedetails["group"]=rawget((posix.getgroup(filedetails["gid"])),"name") + filedetails["atimelong"]=os.date("%c", filedetails["atime"]) + filedetails["mtimelong"]=os.date("%c", filedetails["mtime"]) + filedetails["longname"]=path + return filedetails end +-- ################################################################################ +-- PUBLIC FUNCTIONS function get_status () local f,error = io.popen("/sbin/shorewall status") |