diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-04-09 13:23:31 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-04-09 13:23:31 +0000 |
commit | f83a1a729f68ab79138857a884308084e23cd595 (patch) | |
tree | 2850811ad13f0ba62a22b36435d34c8377be6f46 /lbu-controller.lua | |
parent | 17b2b7ad8ab66c4911cff345ddcbf1594cd2418e (diff) | |
download | acf-alpine-conf-f83a1a729f68ab79138857a884308084e23cd595.tar.bz2 acf-alpine-conf-f83a1a729f68ab79138857a884308084e23cd595.tar.xz |
Cleaning up the code.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@966 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lbu-controller.lua')
-rw-r--r-- | lbu-controller.lua | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lbu-controller.lua b/lbu-controller.lua index 6bca902..f258f5f 100644 --- a/lbu-controller.lua +++ b/lbu-controller.lua @@ -1,22 +1,29 @@ module(..., package.seeall) -local list_redir = function(self) +-- Set variables +local cfgfile + +-- ################################################################################ +-- LOCAL FUNCTIONS + +local function list_redir (self) self.conf.action = "status" self.conf.type = "redir" error(self.conf) end -local cfgfile +-- ################################################################################ +-- PUBLIC FUNCTIONS mvc={} -mvc.on_load = function(self, parent) +function mvc.on_load (self, parent) cfgfile = self:new("cfgfile") if (self.worker[self.conf.action] == nil) or (self.conf.action == "init") then self.worker[self.conf.action] = list_redir(self) end end -status = function (self) +function status (self) local cmd = self.clientdata.cmd local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller local status, errors = self.model:getstatus() @@ -26,7 +33,7 @@ status = function (self) url = url, } ) end -config = function (self) +function config (self) local errors = {} local cmdresult if (self.clientdata.cmd_delete_excluded) and (self.clientdata.lbu_excluded) then @@ -145,12 +152,7 @@ function commit(self) end local status, errors = self.model:getstatus() ---[[ if (errors.last) then - self.conf.action = "config" - self.conf.type = "redir" - return config(self) - end ---]] + -- Add buttons status["lbusimulate"] = cfe({ name="lbusimulate", @@ -182,7 +184,7 @@ function commit(self) clientdata = self.clientdata, url = url, } ) end -expert = function (self) +function expert (self) local modifications = self.clientdata.filecontent or "" if ( self.clientdata.cmdsave) then modifications = self.model:update_filecontent(modifications) |