Commit b3a4a114 authored by Ted Trask's avatar Ted Trask

Updated for handle_form now passing self to get and set functions

parent 7a58a33c
......@@ -31,7 +31,7 @@ function createdomain(self)
end
function editdomain(self)
return self.handle_form(self, function(form) return self.model.getDomain(self.clientdata.domain) end,
return self.handle_form(self, function() return self.model.getDomain(self.clientdata.domain) end,
self.model.setDomain, self.clientdata, "Save", "Edit Domain Entry", "Domain Saved")
end
......
......@@ -59,11 +59,11 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
function get_startstop(clientdata)
function get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
function startstop_service(startstop, action)
function startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
......@@ -83,7 +83,7 @@ function getconfig()
return cfe({ type="group", value=output, label="DNS Cache Config" })
end
function setconfig(config)
function setconfig(self, config)
local success, config = validateconfig(config)
if success then
......@@ -109,9 +109,9 @@ function getconfigfile()
return modelfunctions.getfiledetails(configfile)
end
function setconfigfile(filedetails)
function setconfigfile(self, filedetails)
-- FIXME Validate
return modelfunctions.setfiledetails(filedetails, {configfile})
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
function getIPs()
......@@ -129,7 +129,7 @@ function getIPs()
return cfe({ type="group", value={iplist=iplist} })
end
function setIPs(iplist)
function setIPs(self, iplist)
local reverseIPs = {}
for i,name in ipairs(iplist.value.iplist.value) do
-- check if a valid (or partial) ip
......@@ -178,7 +178,7 @@ function getNewDomain()
return cfe({ type="group", value={domain=domain} })
end
function setNewDomain(domain)
function setNewDomain(self, domain)
if "" ~= string.gsub(domain.value.domain.value..".", "%w+%.", "") then
domain.value.domain.errtxt = "Invalid domain"
domain.errtxt = "Failed to create domain"
......@@ -211,7 +211,7 @@ function getDomain(getdomainname)
return cfe({ type="group", value={domain=domain, iplist=iplist} })
end
function setDomain(domain)
function setDomain(self, domain)
local success, domain = validatedomain(domain)
if success then
fs.write_file(baseurl.."servers/"..domain.value.domain.value,
......
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