summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-04-24 20:31:58 +0000
committerTed Trask <ttrask01@yahoo.com>2008-04-24 20:31:58 +0000
commitbc4158632c789053cab11f96ae8fafb921f51587 (patch)
treea826194c901925cc6198bfc9f3b6b1c272fae795
parentc3ace10988f3340d90c961510711eb32cead7243 (diff)
downloadacf-dansguardian-bc4158632c789053cab11f96ae8fafb921f51587.tar.bz2
acf-dansguardian-bc4158632c789053cab11f96ae8fafb921f51587.tar.xz
Replaced all list_redir functions with redirect in mvc.lua, implemented a default_action string in each controller, removing the on_load functions
git-svn-id: svn://svn.alpinelinux.org/acf/dansguardian/trunk@1037 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--dansguardian-controller.lua31
1 files changed, 3 insertions, 28 deletions
diff --git a/dansguardian-controller.lua b/dansguardian-controller.lua
index 8160131..bcb7bed 100644
--- a/dansguardian-controller.lua
+++ b/dansguardian-controller.lua
@@ -2,32 +2,7 @@
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)
- self.conf.action = "general"
- self.conf.type = "redir"
- error (self.conf)
-end
-
-local pvt = {}
-mvc= {}
-mvc.on_load = function( self, parent )
- -- If they try to run a bogus action, send them to read
- if ( rawget(self.worker, self.conf.action) == nil ) then
- list_redir(self)
- end
- pvt.parent_on_exec = parent.worker.mvc.post_exec
-end
-
-mvc.pre_exec = function( self )
- -- pvt.parent_on_exec ()
-end
-
-mvc.post_exec = function( self )
- return pvt.parent_on_exec()
-end
+default_action = "general"
general = function( self )
@@ -131,7 +106,7 @@ end
edit = function( self )
if not self.clientdata.name then
- list_redir( self )
+ redirect( self )
end
local option = { script = ENV["SCRIPT_NAME"],
@@ -154,7 +129,7 @@ edit = function( self )
service.name = self.clientdata.name
if service.cfgerr == "Hacker" then
- list_redir( self )
+ redirect( self )
end
return ( cfe ({ option = option, service = service }) )