Commit 1eeac166 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 8e8a385f
module(..., package.seeall)
local mymodule = {}
default_action = "status"
mymodule.default_action = "status"
function status(self)
function mymodule.status(self)
return self.model.getstatus()
end
function startstop(self)
function mymodule.startstop(self)
return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end
function details(self)
function mymodule.details(self)
return self.model.getstatusdetails()
end
function expert(self)
function mymodule.expert(self)
return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Dovecot Config", "Configuration Set")
end
return mymodule
module(..., package.seeall)
local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
......@@ -18,26 +18,28 @@ local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-- ################################################################################
-- PUBLIC FUNCTIONS
function get_startstop(self, clientdata)
function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
function startstop_service(self, startstop, action)
function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
function getstatus()
function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, "Dovecot Status")
end
function getstatusdetails()
function mymodule.getstatusdetails()
return cfe({ type="longtext", value="", label="Dovecot Status Details" })
end
function get_filedetails()
function mymodule.get_filedetails()
return modelfunctions.getfiledetails(configfile)
end
function update_filedetails(self, filedetails)
function mymodule.update_filedetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
return mymodule
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