From 0818e8ec1ce0a2e3f71e7b0e551e0f4071ebfd2d Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 1 Feb 2008 14:40:45 +0000 Subject: added extjs demo git-svn-id: svn://svn.alpinelinux.org/acf/sandbox/trunk@679 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 4 ++ extjsdemo-controller.lua | 52 +++++++++++++++++++++++ extjsdemo-html.lsp | 107 +++++++++++++++++++++++++++++++++++++++++++++++ extjsdemo-model.lua | 25 +++++++++++ extjsdemo.menu | 1 + 5 files changed, 189 insertions(+) create mode 100644 extjsdemo-controller.lua create mode 100644 extjsdemo-html.lsp create mode 100644 extjsdemo-model.lua create mode 100644 extjsdemo.menu diff --git a/Makefile b/Makefile index 89e8603..74c7d53 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ APP_DIST=\ bar-controller.lua \ bar-html.lsp \ bar.menu \ + extjsdemo-controller.lua\ + extjsdemo-model.lua \ + extjsdemo-html.lsp \ + extjsdemo.menu \ foo-controller.lua \ foo-html.lsp \ foo.menu \ 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 + + diff --git a/extjsdemo-html.lsp b/extjsdemo-html.lsp new file mode 100644 index 0000000..7fd9534 --- /dev/null +++ b/extjsdemo-html.lsp @@ -0,0 +1,107 @@ + + + + + + +

Extjs Test

+
+
+ diff --git a/extjsdemo-model.lua b/extjsdemo-model.lua new file mode 100644 index 0000000..7103e2d --- /dev/null +++ b/extjsdemo-model.lua @@ -0,0 +1,25 @@ +-- ipsec controller + +module(..., package.seeall) + +require("posix") + +--------------------------------------------------------- +-- privileged funcs + +priv = {} +function priv.getuid() + return posix.getpid().euid +end + + + +------------------------------------------------------------- +-- Unprivileged funcs + +function getuid(self) + return posix.getpid().euid +end + + + diff --git a/extjsdemo.menu b/extjsdemo.menu new file mode 100644 index 0000000..540b463 --- /dev/null +++ b/extjsdemo.menu @@ -0,0 +1 @@ +Test ExtJS_Demo Define test -- cgit v1.2.3