diff options
author | Steven Barth <steven@midlink.org> | 2009-11-10 16:02:48 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-11-10 16:02:48 +0000 |
commit | 7aed1e4b9d3d608389a8b15ea800b8e75be967ef (patch) | |
tree | 9c87318822ab98bff3f91a7a8ab52618e89a6d6c /libs | |
parent | 4c08e29387ea675b230d87d4f4226b18389265cf (diff) |
NIU: More pages
Diffstat (limited to 'libs')
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 13 | ||||
-rw-r--r-- | libs/uci/luasrc/model/uci.lua | 5 | ||||
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index f6a2694b2c..5a1d923853 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -222,6 +222,12 @@ function Node.__init__(self, title, description) end -- hook helper +function Node._run_hook(self, hook) + if type(self[hook]) == "function" then + return self[hook](self) + end +end + function Node._run_hooks(self, ...) local f local r = false @@ -528,9 +534,9 @@ function Delegator.add(self, name, node) end function Delegator.insert_after(self, name, after) - local n = #self.chain + local n = #self.chain + 1 for k, v in ipairs(self.chain) do - if v == state then + if v == after then n = k + 1 break end @@ -599,8 +605,7 @@ function Delegator.parse(self, ...) return FORM_NODATA elseif stat > FORM_PROCEED and (not newcurrent or not self:get(newcurrent)) then - self:_run_hooks("on_done") - return FORM_DONE + return self:_run_hook("on_done") or FORM_DONE else self.current = newcurrent or self.current self.active = self:get(self.current) diff --git a/libs/uci/luasrc/model/uci.lua b/libs/uci/luasrc/model/uci.lua index c927b4ca5a..66bd0a026e 100644 --- a/libs/uci/luasrc/model/uci.lua +++ b/libs/uci/luasrc/model/uci.lua @@ -58,7 +58,10 @@ function cursor_state() end -local Cursor = getmetatable(cursor()) +inst = cursor() +inst_state = cursor_state() + +local Cursor = getmetatable(inst) --- Applies UCI configuration changes -- @param configlist List of UCI configurations diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index e3d7ec9748..8b7cdb8286 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -34,6 +34,7 @@ local nixio = require "nixio", require "nixio.util" module("luci.dispatcher", package.seeall) context = util.threadlocal() +uci = require "luci.model.uci" authenticator = {} |