diff options
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | bar-controller.lua | 35 | ||||
-rw-r--r-- | bar-html.lsp | 3 | ||||
-rw-r--r-- | bar.menu | 3 | ||||
-rw-r--r-- | foo-controller.lua | 36 | ||||
-rw-r--r-- | foo-html.lsp | 3 | ||||
-rw-r--r-- | foo.menu | 2 |
7 files changed, 91 insertions, 3 deletions
@@ -3,9 +3,15 @@ PACKAGE=acf-$(APP_NAME) VERSION=0.1 APP_DIST=\ - privdemo-controller.lua \ - privdemo-model.lua \ - privdemo-html.lsp \ + bar-controller.lua \ + bar-html.lsp \ + bar.menu \ + foo-controller.lua \ + foo-html.lsp \ + foo.menu \ + privdemo-controller.lua \ + privdemo-model.lua \ + privdemo-html.lsp \ privdemo.menu EXTRA_DIST=Makefile config.mk diff --git a/bar-controller.lua b/bar-controller.lua new file mode 100644 index 0000000..e0b9999 --- /dev/null +++ b/bar-controller.lua @@ -0,0 +1,35 @@ +-- A standin controller for testing + +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 = "read" + self.conf.type = "redir" + error (self.conf) +end + + +--init ( init by definition is a public method) +init = function(self, parent) + -- If they specify an invalid action or try to run init, then redirect + -- to the read function. + if ( self.conf.action == nil or self.conf.action == "init" ) then + list_redir(self) + end + -- Make a function by the action name + self.worker[self.conf.action] = function () + return cfe ( {name=self.conf.action, value=self.conf.action} ) + + end + +end + + +read = function (self ) + return ( { } ) +end + + diff --git a/bar-html.lsp b/bar-html.lsp new file mode 100644 index 0000000..708e1ad --- /dev/null +++ b/bar-html.lsp @@ -0,0 +1,3 @@ +<? view = ... ?> +<h1>Action <?= view.name ?></h1> +<p>This is a null controller for menu and authorization testing.</p> diff --git a/bar.menu b/bar.menu new file mode 100644 index 0000000..287641c --- /dev/null +++ b/bar.menu @@ -0,0 +1,3 @@ +# Prefix and controller are already known at this point +# Cat Group Tab Action +Test Bar_controller bar read diff --git a/foo-controller.lua b/foo-controller.lua new file mode 100644 index 0000000..f25cbaf --- /dev/null +++ b/foo-controller.lua @@ -0,0 +1,36 @@ +-- A standin controller for testing + +module (..., package.seeall) + +x = require ("session") + +-- 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 = "read" + self.conf.type = "redir" + error (self.conf) +end + + +mvc.on_load = function(self, parent) + -- If they specify an invalid action or try to run init, then redirect + -- to the read function. + if ( self.conf.action == nil or self.conf.action == "init" ) then + list_redir(self) + end + -- Make a function by the action name + self.worker[self.conf.action] = function () + return cfe ( {name=self.conf.action, value=self.conf.action} ) + + end + +end + + +read = function (self ) + return ( { } ) +end + + diff --git a/foo-html.lsp b/foo-html.lsp new file mode 100644 index 0000000..708e1ad --- /dev/null +++ b/foo-html.lsp @@ -0,0 +1,3 @@ +<? view = ... ?> +<h1>Action <?= view.name ?></h1> +<p>This is a null controller for menu and authorization testing.</p> diff --git a/foo.menu b/foo.menu new file mode 100644 index 0000000..fd64636 --- /dev/null +++ b/foo.menu @@ -0,0 +1,2 @@ +#cat Group tab action +Test foo_controller foo read |