summaryrefslogtreecommitdiffstats
path: root/logfiles-controller.lua
blob: 3a7900a454abd6121d6af7733ed2bb184c252111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module (..., package.seeall)

default_action = "status"

-- Public methods

status = function (self )
	return ({logfile = self.model:get(), url = self.conf.script .. self.conf.prefix .. self.conf.controller} )
end

delete = function (self)
	local filetodelete = self.clientdata.name or ""
	local me = ({deletestatus = self.model:delete(filetodelete)})
	if (me.deletestatus.errtxt) then
		return me
	else
		redirect(self)
	end
end

view = function (self)
	local filetoview = self.clientdata.name or ""
	local content = { logfile=self.model:get_filedetails(filetoview)}
	if (filetoview ~= "") and (content.logfile.name ~= nil) then
		return content
	else
		redirect(self)
	end
end

download = view