Commit 6443949d authored by Ted Trask's avatar Ted Trask

Updated for handle_form now passing self to get and set functions

parent aa8f6a9b
......@@ -27,7 +27,7 @@ function editentry(self)
end
function createentry(self)
return self.handle_form(self, self.model.readentry, self.model.createentry, self.clientdata, "Create", "Create Entry", "Entry Created")
return self.handle_form(self, function() return self.model.readentry() end, self.model.createentry, self.clientdata, "Create", "Create Entry", "Entry Created")
end
function deleteentry(self)
......
......@@ -388,12 +388,12 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
function get_startstop(clientdata)
function get_startstop(self, clientdata)
local actions = {"Run", "Test"}
return cfe({ type="group", label="Management", value={}, option=actions })
end
function startstop_service(startstop, action)
function startstop_service(self, startstop, action)
if action and (action:lower() == "run" or action:lower() == "test") then
local cmd
if action:lower() == "run" then
......@@ -419,9 +419,9 @@ function get_filedetails()
return modelfunctions.getfiledetails(configfile)
end
function update_filecontent(filedetails)
function update_filecontent(self, filedetails)
-- FIXME - validation
local retval = modelfunctions.setfiledetails(filedetails, {configfile})
local retval = modelfunctions.setfiledetails(self, filedetails, {configfile})
posix.chmod(configfile, "rw-------")
posix.chown(configfile, posix.getpasswd("fetchmail", "uid") or 0)
config = nil
......@@ -450,7 +450,7 @@ function getconfig()
return cfe({ type="group", value={interval=interval, postmaster=postmaster, bounceerrors=bounceerrors}, label="Fetchmail Global Config" })
end
function updateconfig(conf)
function updateconfig(self, conf)
local success, conf = validateconfig(conf)
if success then
......@@ -573,7 +573,7 @@ function readentry(entryname, meth, remotemailbx, localdom)
return cfe({ type="group", value={enabled=enabled, method=method, remotehost=remotehost, remotemailbox=remotemailbox, remotepassword=remotepassword, localhost=localhost, localmailbox=localmailbox, localdomain=localdomain, ssl=ssl, envelope=envelope}, label="Fetchmail Entry" })
end
function updateentry(entrystruct)
function updateentry(self, entrystruct)
local success, entrystruct = validateentry(entrystruct)
local entry = findentryline(entrystruct.value.remotehost.value, entrystruct.value.method.value, entrystruct.value.remotemailbox.value, entrystruct.value.localdomain.value)
if not entry then
......@@ -590,7 +590,7 @@ function updateentry(entrystruct)
return entrystruct
end
function createentry(entrystruct)
function createentry(self, entrystruct)
local success, entrystruct = validateentry(entrystruct)
local entry = findentryline(entrystruct.value.remotehost.value, entrystruct.value.method.value, entrystruct.value.remotemailbox.value, entrystruct.value.localdomain.value)
if entry then
......
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