summaryrefslogtreecommitdiffstats
path: root/dhcp-controller.lua
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
commitc1f39235bf596b8b96ca35d0c56f86d1c9692ccb (patch)
tree1082717ce92912ddb505aeb339d7825b1bf767b6 /dhcp-controller.lua
parent8bd7b867f2bbfa3079a54741a79196ac9c717556 (diff)
downloadacf-dhcp-c1f39235bf596b8b96ca35d0c56f86d1c9692ccb.tar.bz2
acf-dhcp-c1f39235bf596b8b96ca35d0c56f86d1c9692ccb.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/dhcp/trunk@1037 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'dhcp-controller.lua')
-rw-r--r--dhcp-controller.lua49
1 files changed, 10 insertions, 39 deletions
diff --git a/dhcp-controller.lua b/dhcp-controller.lua
index 9e0d428..6ba93ce 100644
--- a/dhcp-controller.lua
+++ b/dhcp-controller.lua
@@ -2,36 +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 = "status"
- 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
- -- logit ("dhcpd controller on_load has finished")
-end
-
-
-mvc.pre_exec = function( self )
- -- logit ("dhcpd-controller pre_exec activated")
- -- pvt.parent_on_exec ()
-end
-
-mvc.post_exec = function( self )
- -- logit ("dhcpd-controller post_exec activated")
- return pvt.parent_on_exec()
-end
+default_action = "status"
dep = function( self )
@@ -59,10 +30,10 @@ delnet = function( self )
local net = {}
if not self.clientdata.cmd then
- list_redir(self)
+ redirect(self)
end
if not self.clientdata.network then
- list_redir(self)
+ redirect(self)
end
local option = { script = ENV["SCRIPT_NAME"],
@@ -75,7 +46,7 @@ delnet = function( self )
if self.clientdata.cmd == "delete" then
if self.clientdata.confirm == "yes" then
msg = self.model.subnet_delete( self.clientdata.network )
- list_redir(self)
+ redirect(self)
else
net = self.model.subnet_read( self.clientdata.network );
return ( cfe({ option = option, value = net, msg = msg }) )
@@ -86,7 +57,7 @@ end
settings = function( self )
if not self.clientdata.cmd then
- list_redir(self)
+ redirect(self)
end
local settings = {}
@@ -111,10 +82,10 @@ end
editnet = function ( self )
if not self.clientdata.cmd then
- list_redir(self)
+ redirect(self)
else
if self.clientdata.cmd == "back" then
- list_redir(self)
+ redirect(self)
end
end
@@ -128,7 +99,7 @@ editnet = function ( self )
if self.clientdata.network then
if self.clientdata.network == "choose" then
- list_redir(self)
+ redirect(self)
end
end
@@ -155,7 +126,7 @@ end
editspc = function ( self )
if not self.clientdata.cmd then
- list_redir( self )
+ redirect( self )
end
local option = { script = ENV["SCRIPT_NAME"],
@@ -185,7 +156,7 @@ end
createnet = function ( self )
if not self.clientdata.cmd then
- list_redir(self)
+ redirect(self)
end
local option = { script = ENV["SCRIPT_NAME"],