summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/dispatcher.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-10-20 22:35:11 +0000
committerSteven Barth <steven@midlink.org>2008-10-20 22:35:11 +0000
commitde4b0abeb9825f6d7438b0f563623a048782258e (patch)
tree56c812b65dcd736e58ed04820bcce817fdc6b6e1 /libs/web/luasrc/dispatcher.lua
parent76f8a9cfd2a3c17f3967351b3c6e027b7f864908 (diff)
Propagate CBI status via HTTP-Header
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r--libs/web/luasrc/dispatcher.lua18
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()