summaryrefslogtreecommitdiffstats
path: root/logfiles-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-07-02 20:24:35 +0000
committerTed Trask <ttrask01@yahoo.com>2008-07-02 20:24:35 +0000
commit7947f17ad4ba8e0b3c41a9ace736e005c66017c2 (patch)
treeaf1b0f5d6fa2ef8a01454403592b4e4d245a15c2 /logfiles-model.lua
parented1007285faee68e39640bf3e2c59726c37eb943 (diff)
downloadacf-alpine-baselayout-7947f17ad4ba8e0b3c41a9ace736e005c66017c2.tar.bz2
acf-alpine-baselayout-7947f17ad4ba8e0b3c41a9ace736e005c66017c2.tar.xz
Changed logfiles to use controllerfunctions and standard html-lsp files.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1270 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'logfiles-model.lua')
-rw-r--r--logfiles-model.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/logfiles-model.lua b/logfiles-model.lua
index 6ef6a1d..2ac4f5d 100644
--- a/logfiles-model.lua
+++ b/logfiles-model.lua
@@ -1,13 +1,14 @@
-- acf model for displaying logfiles
module (..., package.seeall)
require("fs")
+require("modelfunctions")
-- Function to get detailed information on a specific file.
local function file_info ( path )
-- Check if file is in use
local st = fs.stat(path)
- local size = st.size
- local lastmod = st.mtime
+ local size = st.size or "0"
+ local lastmod = st.mtime or "---"
local file_inuse = io.popen("fuser " .. path )
local fileinuseresult = file_inuse:read("*a") or "unknown"
file_inuse:close()
@@ -64,11 +65,14 @@ get_filedetails = function (path)
local available_files = get()
for i,file in ipairs(available_files.value) do
if ( file.value.filename.value == path ) then
- filedetails = file
- filedetails.value.filecontent = cfe({ type="longtext", value=fs.read_file(path), label="File content" })
+ filedetails = modelfunctions.getfiledetails(path)
break
end
end
+ if not filedetails then
+ filedetails = modelfunctions.getfiledetails("")
+ filedetails.value.filename.value = path
+ end
return filedetails
end