summaryrefslogtreecommitdiffstats
path: root/logfiles-controller.lua
blob: 400756e6a9227431c3ae41793ef479b9dfae7be8 (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
32
33
34
35
36
37
38
module (..., package.seeall)

default_action = "status"

-- Public methods

status = function (self )
	return self.model.get()
end

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

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

download = function (self)
	local filestatus = view(self)
	local filecontent = filestatus.value.filecontent
	filecontent.label = basename(filestatus.value.filename.value)
	self.conf.viewtype = "stream"
	
	return filecontent
end