summaryrefslogtreecommitdiffstats
path: root/interfaces-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
commitfc0cc711e84e211c818e7c6f034d13992aa05da1 (patch)
tree26a72b198c9fa0b5aa106eb0f5d9268845ea2127 /interfaces-controller.lua
parentc3c75ad9973061cbd4fd56849bc071dd937e4a8f (diff)
downloadacf-alpine-baselayout-fc0cc711e84e211c818e7c6f034d13992aa05da1.tar.bz2
acf-alpine-baselayout-fc0cc711e84e211c818e7c6f034d13992aa05da1.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/alpine-baselayout/trunk@1037 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'interfaces-controller.lua')
-rw-r--r--interfaces-controller.lua45
1 files changed, 6 insertions, 39 deletions
diff --git a/interfaces-controller.lua b/interfaces-controller.lua
index 90f0fe7..4c8c2dd 100644
--- a/interfaces-controller.lua
+++ b/interfaces-controller.lua
@@ -2,40 +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 = "config"
- 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 ("interfaces controller on_load has finished")
-
-end
-
-
-mvc.pre_exec = function (self)
- --logit ("interfaces-controller pre_exec activated")
- -- pvt.parent_on_exec ()
-
-end
-
-mvc.post_exec = function ( self )
- --logit ("interfaces-controller post_exec activated")
- return pvt.parent_on_exec()
-end
+default_action = "read"
read = function (self )
local iface = self.model.get_all_interfaces()
@@ -74,7 +41,7 @@ update = function(self)
-- If interface is not found, return to list
result, data = self.model.get_iface_by_name ( iface )
if result == false then
- list_redir(self)
+ redirect(self)
end
-- If the "cmd" button was used, then attempt to do the update
@@ -90,7 +57,7 @@ update = function(self)
-- If validation worked then return to list
if result == true then
- list_redir(self)
+ redirect(self)
end
end
@@ -134,7 +101,7 @@ delete = function(self)
-- If the interface doesn't exist, return to the list now
result, data = self.model.get_iface_by_name ( iface )
if result == false then
- list_redir(self)
+ redirect(self)
end
@@ -143,7 +110,7 @@ delete = function(self)
if self.clientdata.cmd == "delete" then
self.model.delete_iface_by_name (iface)
end
- list_redir(self)
+ redirect(self)
end
-- Otherwise, return a form
@@ -181,7 +148,7 @@ create = function(self)
result, data = self.model.create_iface_by_name ( iface, data )
if result then
- list_redir(self)
+ redirect(self)
end
end