summaryrefslogtreecommitdiffstats
path: root/extjsdemo-controller.lua
diff options
context:
space:
mode:
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
+
+