From 7947f17ad4ba8e0b3c41a9ace736e005c66017c2 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 2 Jul 2008 20:24:35 +0000 Subject: 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 --- logfiles-model.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'logfiles-model.lua') 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 -- cgit v1.2.3