summaryrefslogtreecommitdiffstats
path: root/syslog-controller.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-07-04 13:35:07 +0000
committerTed Trask <ttrask01@yahoo.com>2008-07-04 13:35:07 +0000
commit9fcda9ad78f8c42ed291c10e8bfea3e3000c30a3 (patch)
tree82e16c3a24e531d759062933e3dcaa714ccfcbd9 /syslog-controller.lua
parent32d91ea7a92c5edee22900e8da1cafda058ca400 (diff)
downloadacf-alpine-baselayout-9fcda9ad78f8c42ed291c10e8bfea3e3000c30a3.tar.bz2
acf-alpine-baselayout-9fcda9ad78f8c42ed291c10e8bfea3e3000c30a3.tar.xz
Modified syslog to use controllerfunctions, modelfunctions, and common lsp files. Changed status->loginfo and basicstatus->status. Stopped expert from adding blank lines to the end.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1274 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'syslog-controller.lua')
-rw-r--r--syslog-controller.lua64
1 files changed, 7 insertions, 57 deletions
diff --git a/syslog-controller.lua b/syslog-controller.lua
index 12a7929..5bd65c4 100644
--- a/syslog-controller.lua
+++ b/syslog-controller.lua
@@ -1,75 +1,25 @@
module(..., package.seeall)
+require("controllerfunctions")
-default_action = "status"
+default_action = "loginfo"
-function status(self)
+function loginfo(self)
return self.model.getlogging()
end
function config(self)
- local config = self.model.getconfig()
- if self.clientdata.Save then
- 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"
- config.label = "Edit config"
- config.option = "Save"
-
- return config
+ return controllerfunctions.handle_form(self, self.model.getconfig, self.model.updateconfig, self.clientdata, "Save", "Edit config", "Configuration Set")
end
function expert(self)
- -- Save changes
- local config = self.model.get_filedetails()
- if self.clientdata.Save 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
- end
-
- config.type = "form"
- config.label = "Edit config"
- config.option = "Save"
-
- return config
+ return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit config", "Configuration Set")
end
function startstop(self)
- local result
- if self.clientdata.action then
- result = self.model:startstop_service(self.clientdata.action)
- self.sessiondata.syslogstartstopresult = result
- self.redirect_to_referrer(self)
- end
-
- local status = self.model.getstatus()
- if self.sessiondata.syslogstartstopresult then
- result = self.sessiondata.syslogstartstopresult
- self.sessiondata.syslogstartstopresult = nil
- end
-
- return cfe({ type="group", value={status=status, result=result} })
+ return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata)
end
-function basicstatus(self)
+function status(self)
status = self.model.getstatus()
version = self.model.getversion()
return cfe({ type="group", value={status=status, version=version} })