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