Overall CBI improvements: DummyValue handling, dependency conflicts, ...
This commit is contained in:
parent
7d0ebeb7d0
commit
712424dc0c
4 changed files with 19 additions and 14 deletions
|
@ -26,11 +26,9 @@ function cbi_d_add(field, dep, next) {
|
||||||
|
|
||||||
function cbi_d_checkvalue(target, ref) {
|
function cbi_d_checkvalue(target, ref) {
|
||||||
var t = document.getElementById(target);
|
var t = document.getElementById(target);
|
||||||
var value
|
var value;
|
||||||
|
|
||||||
if (!t) {
|
if (!t || !t.value) {
|
||||||
return true
|
|
||||||
} else if (!t.value) {
|
|
||||||
value = "";
|
value = "";
|
||||||
} else {
|
} else {
|
||||||
value = t.value;
|
value = t.value;
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ function AbstractValue.cfgvalue(self, section)
|
||||||
return value[1]
|
return value[1]
|
||||||
end
|
end
|
||||||
elseif self.cast == "table" then
|
elseif self.cast == "table" then
|
||||||
return {value}
|
return luci.util.split(value, "%s+", nil, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1065,6 +1065,20 @@ function DummyValue.__init__(self, ...)
|
||||||
self.value = nil
|
self.value = nil
|
||||||
end
|
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)
|
function DummyValue.parse(self)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,15 +15,8 @@ $Id$
|
||||||
|
|
||||||
<%+cbi/valueheader%>
|
<%+cbi/valueheader%>
|
||||||
<% if self.href then %><a href="<%=self.href%>"><% end -%>
|
<% 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))%>
|
<%=luci.util.pcdata(self:cfgvalue(section))%>
|
||||||
<% end -%>
|
|
||||||
<%- if self.href then %></a><%end%>
|
<%- if self.href then %></a><%end%>
|
||||||
 
|
 
|
||||||
|
<input type="hidden" id="<%=cbid%>" value="<%=luci.util.pcdata(self:cfgvalue(section))%>" />
|
||||||
<%+cbi/valuefooter%>
|
<%+cbi/valuefooter%>
|
||||||
|
|
|
@ -43,7 +43,7 @@ $Id$
|
||||||
<select id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>">
|
<select id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>">
|
||||||
<option><%:cbi_addopt%></option>
|
<option><%:cbi_addopt%></option>
|
||||||
<% for key, val in pairs(self.optionals[section]) do -%>
|
<% 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 %>
|
<%- end %>
|
||||||
</select>
|
</select>
|
||||||
<script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
|
<script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
|
||||||
|
|
Loading…
Reference in a new issue