Commit 8d72c0b6 authored by Ted Trask's avatar Ted Trask

Change downloadweblog/adhocquery to use proper cfe and new stream template

parent 0b1838c5
......@@ -45,14 +45,15 @@ end
function mymodule.downloadweblog(self)
local retval = mymodule.viewweblog(self)
local file = cfe({ type="longtext", value="", label="Weblog-"..os.date()..".tab" })
local file = cfe({ type="raw", value="", label="Weblog-"..os.date()..".tab" })
local content = {"sourcename\tclientuserid\tclientip\tlogdatetime\turi\tbytes\treason\tscore\tshortreason\tbadyesno\tdeniedyesno\tbypassyesno"}
for i,log in ipairs(retval.value.log.value) do
content[#content+1] = string.format("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s",
log.sourcename, log.clientuserid, log.clientip, log.logdatetime, log.uri, log.bytes, log.reason, log.score, log.shortreason or "", log.badyesno, log.deniedyesno, log.bypassyesno)
end
file.value = table.concat(content, "\n")
return file
retval.value.file = file
return retval
end
function mymodule.updateselected(self)
......@@ -84,8 +85,8 @@ function mymodule.downloadadhocquery(self)
self.handle_clientdata(retval, self.clientdata)
retval = self.model.adhocquery(self, retval)
local file = cfe({ type="longtext", value="", label="weblogadhocquery.tab" })
if retval.value.result and #retval.value.result.value > 0 then
local file = cfe({ type="raw", value="", label="weblogadhocquery.tab" })
local content = {table.concat(retval.value.names.value, "\t")}
for i,entry in ipairs(retval.value.result.value) do
local line = {}
......@@ -95,9 +96,10 @@ function mymodule.downloadadhocquery(self)
content[#content+1] = table.concat(line, "\t")
end
file.value = table.concat(content, "\n")
retval.value.file = file
end
return file
return retval
end
function mymodule.status(self)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment