summaryrefslogtreecommitdiffstats
path: root/extjsdemo-controller.lua
diff options
context:
space:
mode:
authorNatanael Copa <natanael.copa@gmail.com>2008-02-01 14:40:45 +0000
committerNatanael Copa <natanael.copa@gmail.com>2008-02-01 14:40:45 +0000
commit0818e8ec1ce0a2e3f71e7b0e551e0f4071ebfd2d (patch)
tree8dbeb4225ed6d39467e6d39b6bdbe31755a1cc8b /extjsdemo-controller.lua
parentfffed594467064f07b480b0d651a541612b35a7f (diff)
downloadacf-sandbox-0818e8ec1ce0a2e3f71e7b0e551e0f4071ebfd2d.tar.bz2
acf-sandbox-0818e8ec1ce0a2e3f71e7b0e551e0f4071ebfd2d.tar.xz
added extjs demo
git-svn-id: svn://svn.alpinelinux.org/acf/sandbox/trunk@679 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'extjsdemo-controller.lua')
-rw-r--r--extjsdemo-controller.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/extjsdemo-controller.lua b/extjsdemo-controller.lua
new file mode 100644
index 0000000..6a7a13e
--- /dev/null
+++ b/extjsdemo-controller.lua
@@ -0,0 +1,52 @@
+-- ipsec controller
+
+module(..., package.seeall)
+
+require("posix")
+require("json")
+
+function test(self)
+ local a = {}
+-- a.path = posix.cwd()
+ return a
+end
+
+-- quick and dirty json resolver. could be done with viewtype?
+-- anyway... the file would be a oneliner anyway...
+local function json_resolver(self)
+ io.write("\n\n"..json.encode(self).."\n")
+end
+
+function submit(self)
+ -- overwrite resolver. quick and dirty...
+ view_resolver = function(self)
+ return json_resolver
+ end
+
+ local ret = {}
+
+ -- only validation here is we test if mask is 'aaa'
+ if self.clientdata.mask == "aaa" then
+ ret.success = false
+ ret.errors = { mask = "'aaa' is a netmask...?" }
+ else
+ ret.success = true
+ end
+
+ return ret
+end
+
+function load(self)
+ -- overwrite resolver. quick and dirty...
+ view_resolver = function(self)
+ return json_resolver
+ end
+
+ local ret = {}
+ -- we must define 'success' and 'data' fields
+ ret.success = "true"
+ ret.data = { address = "1.2.3.4", mask = "255.255.255.0" }
+ return ret
+end
+
+