summaryrefslogtreecommitdiffstats
path: root/syslog-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'syslog-controller.lua')
-rw-r--r--syslog-controller.lua31
1 files changed, 21 insertions, 10 deletions
diff --git a/syslog-controller.lua b/syslog-controller.lua
index 48e7b56..12a7929 100644
--- a/syslog-controller.lua
+++ b/syslog-controller.lua
@@ -7,11 +7,19 @@ function status(self)
end
function config(self)
- local config
+ local config = self.model.getconfig()
if self.clientdata.Save then
- config = self.model.updateconfig(self.clientdata)
- else
- config = self.model.getconfig()
+ for name,value in pairs(config.value) do
+ if value.type == "boolean" then
+ value.value = (self.clientdata[name] ~= nil)
+ elseif clientdata[name] then
+ value.value = clientdata[name]
+ end
+ end
+ config = self.model.updateconfig(config)
+ if not config.errtxt then
+ config.descr = "Saved config"
+ end
end
config.type = "form"
@@ -23,15 +31,18 @@ end
function expert(self)
-- Save changes
- local config
- local modifications = self.clientdata.filecontent or ""
+ local config = self.model.get_filedetails()
if self.clientdata.Save then
- config = self.model:update_filecontent(modifications)
- if not config.errtxt then
+ local modifications = self.clientdata.filecontent or ""
+ local result = self.model.update_filecontent(modifications)
+ if not result.value then
+ config.value.filecontent.value = modifications
+ config.value.filecontent.errtxt = result.errtxt
+ config.errtxt = "Failed to save config!"
+ else
+ config = self.model.get_filedetails()
config.descr = "Saved File"
end
- else
- config = self.model:get_filedetails()
end
config.type = "form"