From b49907bb90004ddd89420e1714bdac631d4cf4bd Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Tue, 15 Jan 2008 17:32:29 +0000 Subject: Cleaned up the code and using some librarys instead. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@582 ab2d0c66-481e-0410-8bed-d214d4d58bed --- logfiles-controller.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'logfiles-controller.lua') diff --git a/logfiles-controller.lua b/logfiles-controller.lua index 1a5ca30..c5a5896 100644 --- a/logfiles-controller.lua +++ b/logfiles-controller.lua @@ -4,7 +4,7 @@ module (..., package.seeall) -- We use the self.conf table because it already has prefix,controller,etc -- The redir code is defined in the application error handler (acf-controller) local list_redir = function (self) - self.conf.action = "read" + self.conf.action = "status" self.conf.type = "redir" error (self.conf) end @@ -18,7 +18,7 @@ end -- Public methods -read = function (self ) +status = function (self ) return ({logfile = self.model:get(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} ) end @@ -34,11 +34,11 @@ end view = function (self) local filetoview = self.clientdata.name or "" - local content = ({logfile = self.model:view(filetoview)} ) - if content.logfile.name == "" then - list_redir(self) - else + local content = { logfile=self.model:get_filedetails(filetoview)} + if (filetoview ~= "") and (content.logfile.name ~= nil) then return content + else + list_redir(self) end end -- cgit v1.2.3