X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fdispatcher.lua;h=d199d41e4c951332e0cbd75162784120f2131acd;hp=a54685fefa121cb3d68bf77be2b24ae6724d9c59;hb=de4b0abeb9825f6d7438b0f563623a048782258e;hpb=76f8a9cfd2a3c17f3967351b3c6e027b7f864908 diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index a54685fef..d199d41e4 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()