From 3d147095862a73e2139ec1c32e83e1e945628b46 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Wed, 9 Apr 2008 13:24:21 +0000 Subject: Cleaning up the code. git-svn-id: svn://svn.alpinelinux.org/acf/devtools/trunk@967 ab2d0c66-481e-0410-8bed-d214d4d58bed --- acfupdate-controller.lua | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'acfupdate-controller.lua') 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 -- cgit v1.2.3