Commit 364262a1 authored by Ted Trask's avatar Ted Trask

Remove all calls to 'module' in preparation for move to Lua 5.2

Use mymodule parameter for module definition.
This was also helpful in revealing places where the code relied on the global environment.
parent 6e7e6c4b
module(..., package.seeall)
local mymodule = {}
default_action = "viewauditstats"
mymodule.default_action = "viewauditstats"
function config(self)
function mymodule.config(self)
return self.handle_form(self, self.model.getconfig, self.model.updateconfig, self.clientdata, "Save", "Edit Configuration", "Configuration Saved")
end
function listsources(self)
function mymodule.listsources(self)
return self.model.getsourcelist()
end
function createsource(self)
function mymodule.createsource(self)
return self.handle_form(self, self.model.getnewsource, self.model.createsource, self.clientdata, "Create", "Create new source", "New source created")
end
function deletesource(self)
function mymodule.deletesource(self)
return self.handle_form(self, self.model.getdeletesource, self.model.deletesource, self.clientdata, "Delete", "Delete source", "Source deleted")
end
function editsource(self)
function mymodule.editsource(self)
return self.handle_form(self, function() return self.model.getsource(self.clientdata.sourcename) end, self.model.updatesource, self.clientdata, "Save", "Edit Source", "Source Saved")
end
function testsource(self)
function mymodule.testsource(self)
return self.handle_form(self, self.model.gettestsource, self.model.testsource, self.clientdata, "Test", "Test Source")
end
function importlogs(self)
function mymodule.importlogs(self)
return self.handle_form(self, self.model.getimportlogs, self.model.importlogs, self.clientdata, "Import", "Import Logs")
end
function viewactivitylog(self)
function mymodule.viewactivitylog(self)
return self.model.getactivitylog()
end
function viewweblog(self)
function mymodule.viewweblog(self)
local retval = self.handle_form(self, self.model.getweblogparameters, self.model.getweblog, self.clientdata, "Update", "Display Weblog")
-- We want to get the weblog even if form wasn't submitted
if not self.clientdata.Update then
......@@ -44,8 +44,8 @@ function viewweblog(self)
return retval
end
function downloadweblog(self)
local retval = viewweblog(self)
function mymodule.downloadweblog(self)
local retval = mymodule.viewweblog(self)
local file = cfe({ type="longtext", 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
......@@ -56,31 +56,31 @@ function downloadweblog(self)
return file
end
function updateselected(self)
function mymodule.updateselected(self)
return self.handle_form(self, self.model.geteditselected, self.model.editselected, self.clientdata, "Submit", "Submit select update", "Select fields updated")
end
function clearselected(self)
function mymodule.clearselected(self)
return self.handle_form(self, self.model.getclearselected, self.model.clearselected, self.clientdata, "Clear", "Clear select fields", "Select fields cleared")
end
function viewusagestats(self)
function mymodule.viewusagestats(self)
return self.model.getusagestats()
end
function viewauditstats(self)
function mymodule.viewauditstats(self)
return self.model.getauditstats()
end
function completeaudit(self)
function mymodule.completeaudit(self)
return self.handle_form(self, self.model.getcompleteaudit, self.model.completeaudit, self.clientdata, "Complete", "Complete Audit", "Audit completed")
end
function adhocquery(self)
function mymodule.adhocquery(self)
return self.handle_form(self, self.model.getnewadhocquery, self.model.adhocquery, self.clientdata, "Submit", "Submit ad-hoc query")
end
function downloadadhocquery(self)
function mymodule.downloadadhocquery(self)
local retval = self.model.getnewadhocquery(self, self.clientdata)
self.handle_clientdata(retval, self.clientdata)
retval = self.model.adhocquery(self, retval)
......@@ -105,18 +105,20 @@ function downloadadhocquery(self)
return file
end
function status(self)
function mymodule.status(self)
return self.model.testdatabase()
end
function createdatabase(self)
function mymodule.createdatabase(self)
return self.handle_form(self, self.model.getnewdatabase, self.model.create_database, self.clientdata, "Create", "Create New Database", "Database Created")
end
function listfiles(self)
function mymodule.listfiles(self)
return self.model.listfiles(self)
end
function editfile(self)
function mymodule.editfile(self)
return self.handle_form(self, self.model.readfile, self.model.updatefile, self.clientdata, "Save", "Edit Weblog File", "Weblog File Saved" )
end
return mymodule
This diff is collapsed.
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