summaryrefslogtreecommitdiffstats
path: root/logfiles-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'logfiles-controller.lua')
-rw-r--r--logfiles-controller.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/logfiles-controller.lua b/logfiles-controller.lua
index 3a7900a..400756e 100644
--- a/logfiles-controller.lua
+++ b/logfiles-controller.lua
@@ -5,14 +5,14 @@ default_action = "status"
-- Public methods
status = function (self )
- return ({logfile = self.model:get(), url = self.conf.script .. self.conf.prefix .. self.conf.controller} )
+ return self.model.get()
end
delete = function (self)
local filetodelete = self.clientdata.name or ""
- local me = ({deletestatus = self.model:delete(filetodelete)})
- if (me.deletestatus.errtxt) then
- return me
+ local deletestatus = self.model.delete(filetodelete)
+ if (deletestatus.errtxt) then
+ return deletestatus
else
redirect(self)
end
@@ -20,12 +20,19 @@ 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
+ local content = self.model.get_filedetails(filetoview)
+ if (filetoview ~= "") and content then
return content
else
redirect(self)
end
end
-download = view
+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