diff options
author | Steven Barth <steven@midlink.org> | 2008-10-31 09:35:11 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-10-31 09:35:11 +0000 |
commit | 8c4492db5fac28d1c143931316e4ccb7f877e6ec (patch) | |
tree | 39f27af314d0c04dcfa3699203d35163d673652e /libs | |
parent | 676966f78bbe4aa42f819b991586dca0bac8c554 (diff) |
Removed UCI Save/Apply cache from Essentials
Made CBI controllers configurable
Diffstat (limited to 'libs')
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 2 | ||||
-rw-r--r-- | libs/cbi/luasrc/view/cbi/footer.htm | 4 | ||||
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 8 |
3 files changed, 10 insertions, 4 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 94ac96483..316b74f35 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -322,7 +322,7 @@ function Map.parse(self) for i, config in ipairs(self.parsechain) do self.uci:save(config) end - if luci.http.formvalue("cbi.apply") then + if self:submitstate() and (self.autoapply or luci.http.formvalue("cbi.apply")) then for i, config in ipairs(self.parsechain) do self.uci:commit(config) diff --git a/libs/cbi/luasrc/view/cbi/footer.htm b/libs/cbi/luasrc/view/cbi/footer.htm index da5926601..6f90bb9cf 100644 --- a/libs/cbi/luasrc/view/cbi/footer.htm +++ b/libs/cbi/luasrc/view/cbi/footer.htm @@ -14,7 +14,9 @@ $Id$ -%> <div class="cbi-page-actions"> - <input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:saveapply%>" /> + <% if not autoapply then%> + <input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:saveapply%>" /> + <% end %> <input class="cbi-button cbi-button-save" type="submit" value="<%:save%>" /> <input class="cbi-button cbi-button-reset" type="reset" value="<%:reset%>" /> <script type="text/javascript">cbi_d_update();</script> diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 03e7c7d65..645ea972e 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -499,7 +499,8 @@ end --- Create a CBI model dispatching target. -- @param model CBI model tpo be rendered -function cbi(model) +function cbi(model, config) + config = config or {} return function(...) require("luci.cbi") require("luci.template") @@ -510,6 +511,9 @@ function cbi(model) local state = nil for i, res in ipairs(maps) do + if config.autoapply then + res.autoapply = config.autoapply + end local cstate = res:parse() if not state or cstate < state then state = cstate @@ -521,7 +525,7 @@ function cbi(model) for i, res in ipairs(maps) do res:render() end - luci.template.render("cbi/footer", {state = state}) + luci.template.render("cbi/footer", {state = state, autoapply = config.autoapply}) end end |