diff options
author | Ted Trask <ttrask01@yahoo.com> | 2012-04-28 12:04:44 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2012-04-28 12:04:44 +0000 |
commit | b3a4a11493c00569791884b02f334b3504eba4d8 (patch) | |
tree | d733fb07dac91a5e1f1f03caf567a210b0301b26 | |
parent | 7a58a33cdd8bb51e1b7a9f52ad1dbf87221642b2 (diff) | |
download | acf-dnscache-b3a4a11493c00569791884b02f334b3504eba4d8.tar.bz2 acf-dnscache-b3a4a11493c00569791884b02f334b3504eba4d8.tar.xz |
Updated for handle_form now passing self to get and set functions
-rw-r--r-- | dnscache-controller.lua | 2 | ||||
-rw-r--r-- | dnscache-model.lua | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/dnscache-controller.lua b/dnscache-controller.lua index 978b3b3..4182bbf 100644 --- a/dnscache-controller.lua +++ b/dnscache-controller.lua @@ -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 diff --git a/dnscache-model.lua b/dnscache-model.lua index 5e02a1e..89685e3 100644 --- a/dnscache-model.lua +++ b/dnscache-model.lua @@ -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, |