diff options
author | Steven Barth <steven@midlink.org> | 2009-11-09 11:22:29 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-11-09 11:22:29 +0000 |
commit | 284f85fb4e185bf743c404161d0a83be858420c6 (patch) | |
tree | 34acaaf415122244926421317d58d76d3e0e174a | |
parent | ca6a1fc3bc97f75aefec751aba48526e39d7d38b (diff) |
CBI: Fix subdependencies
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 3 | ||||
-rw-r--r-- | libs/cbi/luasrc/view/cbi/full_valuefooter.htm | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 8ca9e5c8d..f6a2694b2 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -1265,6 +1265,7 @@ function AbstractValue.__init__(self, map, section, option, ...) self.tag_reqerror = {} self.tag_error = {} self.deps = {} + self.subdeps = {} --self.cast = "string" self.track_missing = false @@ -1595,7 +1596,7 @@ function ListValue.value(self, key, val, ...) table.insert(self.vallist, tostring(val)) for i, deps in ipairs({...}) do - table.insert(self.deps, {add = "-"..key, deps=deps}) + self.subdeps[#self.subdeps + 1] = {add = "-"..key, deps=deps} end end diff --git a/libs/cbi/luasrc/view/cbi/full_valuefooter.htm b/libs/cbi/luasrc/view/cbi/full_valuefooter.htm index bdcd31484..9130a99f9 100644 --- a/libs/cbi/luasrc/view/cbi/full_valuefooter.htm +++ b/libs/cbi/luasrc/view/cbi/full_valuefooter.htm @@ -27,8 +27,21 @@ $Id$ <%- end -%> </div> -<% if #self.deps > 0 then -%> + +<% if #self.deps > 0 or #self.subdeps > 0 then -%> <script type="text/javascript" id="cbip-<%=self.config.."-"..section.."-"..self.option%>"> + <% for j, d in ipairs(self.subdeps) do -%> + cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option..d.add%>", { + <%- + for k,v in pairs(d.deps) do + -%> + <%-=string.format('"cbid.%s.%s.%s"', self.config, section, k) .. ":" .. string.format("%q", v)-%> + <%-if next(d.deps, k) then-%>,<%-end-%> + <%- + end + -%> + }, "cbip-<%=self.config.."-"..section.."-"..self.option..d.add%>"); + <%- end %> <% for j, d in ipairs(self.deps) do -%> cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option..d.add%>", { <%- |