diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-22 00:32:54 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-22 00:32:54 +0000 |
commit | 9c3db58ee44dfd411336d7d460d0f7a6a10f0ee3 (patch) | |
tree | 01b289ffac9c5939d85aeeab6d0393b902f444f0 /libs/web/luasrc/dispatcher.lua | |
parent | cf6bda5c9634c60ee7237b95c7e283872c20d122 (diff) |
libs/web: combine apply actions of all maps on a page, prevents concurrent XHR
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index d10b5c0b5..589cb731f 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -718,21 +718,45 @@ local function _cbi(self, ...) end end - local redirect - local pageaction = true http.header("X-CBI-State", state or 0) + if not config.noheader then tpl.render("cbi/header", {state = state}) end + + local redirect + local applymap = false + local pageaction = true + local parsechain = { } + for i, res in ipairs(maps) do - res:render() - if res.pageaction == false then - pageaction = false + if res.apply_needed and res.parsechain then + local c + for _, c in ipairs(res.parsechain) do + parsechain[#parsechain+1] = c + end + applymap = true end + if res.redirect then redirect = redirect or res.redirect end + + if res.pageaction == false then + pageaction = false + end end + + for i, res in ipairs(maps) do + res:render({ + firstmap = (i == 1), + applymap = applymap, + redirect = redirect, + pageaction = pageaction, + parsechain = parsechain + }) + end + if not config.nofooter then tpl.render("cbi/footer", { flow = config, |