diff options
author | Steven Barth <steven@midlink.org> | 2008-10-20 22:35:11 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-10-20 22:35:11 +0000 |
commit | de4b0abeb9825f6d7438b0f563623a048782258e (patch) | |
tree | 56c812b65dcd736e58ed04820bcce817fdc6b6e1 /libs/web/luasrc/dispatcher.lua | |
parent | 76f8a9cfd2a3c17f3967351b3c6e027b7f864908 (diff) |
Propagate CBI status via HTTP-Header
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index a54685fefa..d199d41e4c 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -487,13 +487,20 @@ function cbi(model) return function(...) require("luci.cbi") require("luci.template") + local http = require "luci.http" maps = luci.cbi.load(model, ...) + local state = nil + for i, res in ipairs(maps) do - res:parse() + local cstate = res:parse() + if not state or cstate < state then + state = cstate + end end + http.header("X-CBI-State", state or 0) luci.template.render("cbi/header") for i, res in ipairs(maps) do res:render() @@ -508,13 +515,20 @@ function form(model) return function(...) require("luci.cbi") require("luci.template") + local http = require "luci.http" maps = luci.cbi.load(model, ...) + local state = nil + for i, res in ipairs(maps) do - res:parse() + local cstate = res:parse() + if not state or cstate < state then + state = cstate + end end + http.header("X-CBI-State", state or 0) luci.template.render("header") for i, res in ipairs(maps) do res:render() |