diff options
author | Steven Barth <steven@midlink.org> | 2008-09-19 10:42:02 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-09-19 10:42:02 +0000 |
commit | 712424dc0cf17a60f3d77024b892cc04146f6295 (patch) | |
tree | 63677bdcfedf5088b0522543c39136e206f14e93 /libs/cbi/luasrc | |
parent | 7d0ebeb7d008e49de31ce825be79371ba394a874 (diff) |
Overall CBI improvements: DummyValue handling, dependency conflicts, ...
Diffstat (limited to 'libs/cbi/luasrc')
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 16 | ||||
-rw-r--r-- | libs/cbi/luasrc/view/cbi/dvalue.htm | 9 | ||||
-rw-r--r-- | libs/cbi/luasrc/view/cbi/ucisection.htm | 2 |
3 files changed, 17 insertions, 10 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 6432a2590d..d2de8685b5 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -1011,7 +1011,7 @@ function AbstractValue.cfgvalue(self, section) return value[1] end elseif self.cast == "table" then - return {value} + return luci.util.split(value, "%s+", nil, true) end end @@ -1065,6 +1065,20 @@ function DummyValue.__init__(self, ...) self.value = nil end +function DummyValue.cfgvalue(self, section) + local value + if self.value then + if type(self.value) == "function" then + value = self:value(section) + else + value = self.value + end + else + value = AbstractValue.cfgvalue(self, section) + end + return value +end + function DummyValue.parse(self) end diff --git a/libs/cbi/luasrc/view/cbi/dvalue.htm b/libs/cbi/luasrc/view/cbi/dvalue.htm index 88f38ca7b6..28cd9ab948 100644 --- a/libs/cbi/luasrc/view/cbi/dvalue.htm +++ b/libs/cbi/luasrc/view/cbi/dvalue.htm @@ -15,15 +15,8 @@ $Id$ <%+cbi/valueheader%> <% if self.href then %><a href="<%=self.href%>"><% end -%> -<%- if self.value then - if type(self.value) == "function" then %> - <%=luci.util.pcdata(self:value(section))%> -<% else %> - <%=luci.util.pcdata(self.value)%> -<% end -else %> <%=luci.util.pcdata(self:cfgvalue(section))%> -<% end -%> <%- if self.href then %></a><%end%>   +<input type="hidden" id="<%=cbid%>" value="<%=luci.util.pcdata(self:cfgvalue(section))%>" /> <%+cbi/valuefooter%> diff --git a/libs/cbi/luasrc/view/cbi/ucisection.htm b/libs/cbi/luasrc/view/cbi/ucisection.htm index 5504a7476c..5d53436ce1 100644 --- a/libs/cbi/luasrc/view/cbi/ucisection.htm +++ b/libs/cbi/luasrc/view/cbi/ucisection.htm @@ -43,7 +43,7 @@ $Id$ <select id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>"> <option><%:cbi_addopt%></option> <% for key, val in pairs(self.optionals[section]) do -%> - <option id="cbi-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=striptags(val.title)%></option> + <option id="cbid-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=striptags(val.title)%></option> <%- end %> </select> <script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %> |