summaryrefslogtreecommitdiffstats
path: root/lbu-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-controller.lua')
-rw-r--r--lbu-controller.lua26
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)