From: Steven Barth Date: Thu, 30 Jul 2009 16:05:12 +0000 (+0000) Subject: Fix delegators X-Git-Tag: 0.10.0~1277 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=d7a90e994a1aa214e881c06e7e5d0a3f272a63ce;hp=12400496cc4a15fe1e7afbe0795f9ab3f4207790 Fix delegators --- diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index f3c481cf8..3a687e5aa 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -286,6 +286,11 @@ function Template.render(self) luci.template.render(self.template, {self=self}) end +function Template.parse(self, readinput) + self.readinput = (readinput ~= false) + return Map.formvalue(self, "cbi.submit") and FORM_DONE or FORM_NODATA +end + --[[ Map - A map describing a configuration file @@ -499,6 +504,7 @@ function Delegator.__init__(self, ...) self.defaultpath = {} self.pageaction = false self.readinput = true + self.allow_reset = false self.allow_back = false self.allow_finish = false self.template = "cbi/delegator" @@ -573,8 +579,10 @@ function Delegator.parse(self, ...) newcurrent = self:get_next(self.current) end end - - if not newcurrent or not self:get(newcurrent) then + + if not Map.formvalue(self, "cbi.submit") then + return FORM_NODATA + elseif not newcurrent or not self:get(newcurrent) then return FORM_DONE else self.current = newcurrent diff --git a/libs/cbi/luasrc/view/cbi/delegator.htm b/libs/cbi/luasrc/view/cbi/delegator.htm index 523eebcda..95fd270f8 100644 --- a/libs/cbi/luasrc/view/cbi/delegator.htm +++ b/libs/cbi/luasrc/view/cbi/delegator.htm @@ -20,7 +20,9 @@ $Id$ <% if self.allow_back and self:get_prev(self.current) then %> <% end %> +<% if self.allow_reset then %> +<% end %> <% if self.allow_finish and not self:get_next(self.current) then %> <% elseif self:get_next(self.current) then %>