diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index 7370a04c46..6123e273b6 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -316,7 +316,7 @@ NamedSection = class(AbstractSection)
function NamedSection.__init__(self, map, section, type, ...)
AbstractSection.__init__(self, map, type, ...)
Node._i18n(self, map.config, section, nil, ...)
-
+
self.template = "cbi/nsection"
self.section = section
self.addremove = false
@@ -378,7 +378,7 @@ function TypedSection.cfgsections(self)
function (section)
if self:checkscope(section[".name"]) then
table.insert(sections, section[".name"])
- end
+ end
end)
return sections
@@ -554,7 +554,25 @@ function AbstractValue.render(self, s, scope)
if not self.optional or self:cfgvalue(s) or self:formcreated(s) then
scope = scope or {}
scope.section = s
-
+ scope.cbid = "cbid." .. self.config ..
+ "." .. s ..
+ "." .. self.option
+
+ scope.ifattr = function(cond,key,val)
+ if cond then
+ return string.format(
+ ' %s="%s"', tostring(key),
+ tostring( val or scope[key] or self[key] or "" )
+ )
+ else
+ return ''
+ end
+ end
+
+ scope.attr = function(...)
+ return scope.ifattr( true, ... )
+ end
+
Node.render(self, scope)
end
end
@@ -731,7 +749,7 @@ function MultiValue.valuelist(self, section)
end
function MultiValue.validate(self, val)
- val = (type(val) == "table") and val or {val}
+ val = (type(val) == "table") and val or {val}
local result
diff --git a/libs/cbi/luasrc/view/cbi/cell_valuefooter.htm b/libs/cbi/luasrc/view/cbi/cell_valuefooter.htm
index 045866d7b7..fbe266ebe5 100644
--- a/libs/cbi/luasrc/view/cbi/cell_valuefooter.htm
+++ b/libs/cbi/luasrc/view/cbi/cell_valuefooter.htm
@@ -13,15 +13,15 @@ $Id$
-%>
- <%- if self.tag_invalid[section] then -%>
+ <% if self.tag_invalid[section] then -%>
<%:cbi_invalid%>
- <%- end -%>
+ <%- end %>
-<%- if #self.deps > 0 then -%>
+<% if #self.deps > 0 then -%>
-<%- end -%>
+<%- end %>
diff --git a/libs/cbi/luasrc/view/cbi/cell_valueheader.htm b/libs/cbi/luasrc/view/cbi/cell_valueheader.htm
index 7b8f0a5d69..ecfeee6d95 100644
--- a/libs/cbi/luasrc/view/cbi/cell_valueheader.htm
+++ b/libs/cbi/luasrc/view/cbi/cell_valueheader.htm
@@ -12,4 +12,5 @@ You may obtain a copy of the License at
$Id$
-%>
+
">
diff --git a/libs/cbi/luasrc/view/cbi/dvalue.htm b/libs/cbi/luasrc/view/cbi/dvalue.htm
index 54555bfcdb..7d22fe0d9d 100644
--- a/libs/cbi/luasrc/view/cbi/dvalue.htm
+++ b/libs/cbi/luasrc/view/cbi/dvalue.htm
@@ -12,6 +12,7 @@ You may obtain a copy of the License at
$Id$
-%>
+
<%+cbi/valueheader%>
<% if self.value then
if type(self.value) == "function" then %>
diff --git a/libs/cbi/luasrc/view/cbi/footer.htm b/libs/cbi/luasrc/view/cbi/footer.htm
index 7e9056aabb..4d21fd1684 100644
--- a/libs/cbi/luasrc/view/cbi/footer.htm
+++ b/libs/cbi/luasrc/view/cbi/footer.htm
@@ -12,10 +12,11 @@ You may obtain a copy of the License at
$Id$
-%>
-
-
-
-
-
-
-<%+footer%>
\ No newline at end of file
+
+
+
+
+
+
+
+<%+footer%>
diff --git a/libs/cbi/luasrc/view/cbi/full_valuefooter.htm b/libs/cbi/luasrc/view/cbi/full_valuefooter.htm
index 2db6bbdb1a..8924beccdf 100644
--- a/libs/cbi/luasrc/view/cbi/full_valuefooter.htm
+++ b/libs/cbi/luasrc/view/cbi/full_valuefooter.htm
@@ -12,11 +12,21 @@ You may obtain a copy of the License at
$Id$
-%>
- <% if #self.description > 0 then %>
<%=self.description%>
<% end %>
-
- <% if self.tag_invalid[section] then %>
<%:cbi_invalid%>
<% end %>
-
- <% if #self.deps > 0 then %><% end %>
+
+ <% if #self.description > 0 then -%>
+
<%=self.description%>
+ <%- end %>
+
+
+ <% if self.tag_invalid[section] then -%>
+
<%:cbi_invalid%>
+ <%- end %>
+
+
+<% if #self.deps > 0 then -%>
+
+<%- end %>
diff --git a/libs/cbi/luasrc/view/cbi/full_valueheader.htm b/libs/cbi/luasrc/view/cbi/full_valueheader.htm
index 40fce65ba9..566e236ed1 100644
--- a/libs/cbi/luasrc/view/cbi/full_valueheader.htm
+++ b/libs/cbi/luasrc/view/cbi/full_valueheader.htm
@@ -12,6 +12,7 @@ You may obtain a copy of the License at
$Id$
-%>
-
">
-
-
\ No newline at end of file
+
+
">
+
+
diff --git a/libs/cbi/luasrc/view/cbi/fvalue.htm b/libs/cbi/luasrc/view/cbi/fvalue.htm
index 1e53f24038..f34550061c 100644
--- a/libs/cbi/luasrc/view/cbi/fvalue.htm
+++ b/libs/cbi/luasrc/view/cbi/fvalue.htm
@@ -13,5 +13,5 @@ $Id$
-%>
<%+cbi/valueheader%>
- " name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == self.enabled then %> checked="checked"<% end %> value="1" />
-<%+cbi/valuefooter%>
\ No newline at end of file
+ value="1" />
+<%+cbi/valuefooter%>
diff --git a/libs/cbi/luasrc/view/cbi/header.htm b/libs/cbi/luasrc/view/cbi/header.htm
index afd2048820..ce5d66d77a 100644
--- a/libs/cbi/luasrc/view/cbi/header.htm
+++ b/libs/cbi/luasrc/view/cbi/header.htm
@@ -12,10 +12,11 @@ You may obtain a copy of the License at
$Id$
-%>
+
<%+header%>
-