+ end
+
+ local pageaction = true
+ http.header("X-CBI-State", state or 0)
+ tpl.render("cbi/header", {state = state})
+ for i, res in ipairs(maps) do
+ res:render()
+ if res.pageaction == false then
+ pageaction = false
+ end
+ end
+ tpl.render("cbi/footer", {pageaction=pageaction, state = state, autoapply = config.autoapply})
+end
+
+--- Create a CBI model dispatching target.
+-- @param model CBI model to be rendered
+function cbi(model, config)
+ return {type = "cbi", config = config, model = model, target = _cbi}
+end
+
+
+local function _arcombine(self, ...)
+ local argv = {...}
+ local target = #argv > 0 and self.targets[2] or self.targets[1]
+ setfenv(target.target, self.env)
+ target:target(unpack(argv))
+end
+
+--- Create a combined dispatching target for non argv and argv requests.
+-- @param trg1 Overview Target
+-- @param trg2 Detail Target
+function arcombine(trg1, trg2)
+ return {type = "arcombine", env = getfenv(), target = _arcombine, targets = {trg1, trg2}}
+end
+
+
+local function _form(self, ...)
+ local cbi = require "luci.cbi"
+ local tpl = require "luci.template"
+ local http = require "luci.http"