summaryrefslogtreecommitdiffstats
path: root/acfupdate-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acfupdate-controller.lua')
-rw-r--r--acfupdate-controller.lua43
1 files changed, 27 insertions, 16 deletions
diff --git a/acfupdate-controller.lua b/acfupdate-controller.lua
index 65c3f60..def2ba7 100644
--- a/acfupdate-controller.lua
+++ b/acfupdate-controller.lua
@@ -1,40 +1,51 @@
module (..., package.seeall)
--- Cause an http redirect to our "read" action
--- We use the self.conf table because it already has prefix,controller,etc
--- The redir code is defined in the application error handler (acf-controller)
-local list_redir = function (self)
+-- ################################################################################
+-- LOCAL FUNCTIONS
+
+local function list_redir (self)
self.conf.action = "read"
self.conf.type = "redir"
error (self.conf)
end
+-- ################################################################################
+-- PUBLIC FUNCTIONS
+
mvc={}
-mvc.on_load = function(self, parent)
+function mvc.on_load(self, parent)
if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
self.worker[self.conf.action] = list_redir(self)
end
end
--- Public methods
-read = function (self )
- return ({projects = self.model:get(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
+function read (self )
+ return ({projects = self.model:get(),
+ url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end
-update = function (self )
- return ({projects = self.model:get(),updates = self.model:update(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
+function update (self )
+ return ({projects = self.model:get(),
+ updates = self.model:update(),
+ url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end
-diff = function (self )
- return ({projects = self.model:get(),updates = self.model:diffs(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
+function diff (self )
+ return ({projects = self.model:get(),
+ updates = self.model:diffs(),
+ url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end
-status = function (self )
- return ({projects = self.model:get(),updates = self.model:status(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
+function status (self )
+ return ({projects = self.model:get(),
+ updates = self.model:status(),
+ url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end
-log = function (self )
- return ({projects = self.model:get(),updates = self.model:log(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
+function log (self )
+ return ({projects = self.model:get(),
+ updates = self.model:log(),
+ url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} )
end