Extend CBI state handling
This commit is contained in:
parent
ae6fd93b8c
commit
c7a06b61c7
2 changed files with 11 additions and 3 deletions
|
@ -352,13 +352,15 @@ function Map.parse(self)
|
|||
|
||||
if self:submitstate() then
|
||||
if self.save then
|
||||
return self.changed and FORM_CHANGED or FORM_VALID
|
||||
self.state = self.changed and FORM_CHANGED or FORM_VALID
|
||||
else
|
||||
return FORM_INVALID
|
||||
self.state = FORM_INVALID
|
||||
end
|
||||
else
|
||||
return FORM_NODATA
|
||||
self.state = FORM_NODATA
|
||||
end
|
||||
|
||||
return self.state
|
||||
end
|
||||
|
||||
function Map.render(self, ...)
|
||||
|
|
|
@ -521,6 +521,12 @@ function cbi(model, config)
|
|||
end
|
||||
end
|
||||
|
||||
if config.state_handler then
|
||||
if not config.state_handler(state, maps) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local pageaction = true
|
||||
http.header("X-CBI-State", state or 0)
|
||||
luci.template.render("cbi/header", {state = state})
|
||||
|
|
Loading…
Reference in a new issue