summaryrefslogtreecommitdiffhomepage
path: root/libs/cbi
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-07-15 17:27:58 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-07-15 17:27:58 +0000
commit05d3bf06b4ae6f07ed1c55fd1f7b4e97cb0e2d3d (patch)
treec113e7631018a7f9a46098419fa9b894fa6d0477 /libs/cbi
parent8bb8b7c09cee818246312a637d846be491e171d3 (diff)
* luci/libs/cbi: various template cleanups
Diffstat (limited to 'libs/cbi')
-rw-r--r--libs/cbi/luasrc/cbi.lua26
-rw-r--r--libs/cbi/luasrc/view/cbi/cell_valuefooter.htm8
-rw-r--r--libs/cbi/luasrc/view/cbi/cell_valueheader.htm1
-rw-r--r--libs/cbi/luasrc/view/cbi/dvalue.htm1
-rw-r--r--libs/cbi/luasrc/view/cbi/footer.htm15
-rw-r--r--libs/cbi/luasrc/view/cbi/full_valuefooter.htm26
-rw-r--r--libs/cbi/luasrc/view/cbi/full_valueheader.htm7
-rw-r--r--libs/cbi/luasrc/view/cbi/fvalue.htm4
-rw-r--r--libs/cbi/luasrc/view/cbi/header.htm13
-rw-r--r--libs/cbi/luasrc/view/cbi/lvalue.htm21
-rw-r--r--libs/cbi/luasrc/view/cbi/map.htm13
-rw-r--r--libs/cbi/luasrc/view/cbi/mvalue.htm19
-rw-r--r--libs/cbi/luasrc/view/cbi/nsection.htm38
-rw-r--r--libs/cbi/luasrc/view/cbi/tblsection.htm117
-rw-r--r--libs/cbi/luasrc/view/cbi/tsection.htm56
-rw-r--r--libs/cbi/luasrc/view/cbi/ucisection.htm40
-rw-r--r--libs/cbi/luasrc/view/cbi/value.htm2
17 files changed, 228 insertions, 179 deletions
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 -%>
<div class="cbi-error"><%:cbi_invalid%></div>
- <%- end -%>
+ <%- end %>
</td>
-<%- if #self.deps > 0 then -%>
+<% if #self.deps > 0 then -%>
<script type="text/javascript">
<% for j, d in ipairs(self.deps) do -%>
cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
<%- end %>
</script>
-<%- 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$
-%>
+
<td class="cbi-value-field" id="cbi-<%=self.config.."-"..section.."-"..self.option%>">
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$
-%>
- <div>
- <input type="submit" value="<%:save%>" />
- <input type="reset" value="<%:reset%>" />
- <script type="text/javascript">cbi_d_init();</script>
- </div>
- </form>
-<%+footer%> \ No newline at end of file
+
+ <div>
+ <input type="submit" value="<%:save%>" />
+ <input type="reset" value="<%:reset%>" />
+ <script type="text/javascript">cbi_d_init();</script>
+ </div>
+</form>
+<%+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 %><div class="cbi-value-description"><%=self.description%></div><% end %>
- </div>
- <% if self.tag_invalid[section] then %><div class="cbi-error"><%:cbi_invalid%></div><% end %>
- </div>
- <% if #self.deps > 0 then %><script type="text/javascript">
- <% for j, d in ipairs(self.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
- <% end %>
- </script><% end %>
+
+ <% if #self.description > 0 then -%>
+ <div class="cbi-value-description"><%=self.description%></div>
+ <%- end %>
+ </div>
+
+ <% if self.tag_invalid[section] then -%>
+ <div class="cbi-error"><%:cbi_invalid%></div>
+ <%- end %>
+</div>
+
+<% if #self.deps > 0 then -%>
+ <script type="text/javascript">
+ <% for j, d in ipairs(self.deps) do -%>
+ cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
+ <%- end %>
+ </script>
+<%- 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$
-%>
- <div class="cbi-value" id="cbi-<%=self.config.."-"..section.."-"..self.option%>">
- <label for="cbid.<%=self.config.."."..section.."."..self.option%>" class="cbi-value-title"><%=self.title%></label>
- <div class="cbi-value-field"> \ No newline at end of file
+
+<div class="cbi-value" id="cbi-<%=self.config.."-"..section.."-"..self.option%>">
+ <label class="cbi-value-title"<%= attr("for", cbid) %>><%=self.title%></label>
+ <div class="cbi-value-field">
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%>
- <input onchange="cbi_d_update(this.id)" type="checkbox" id="cbid.<%=self.config.."."..section.."."..self.option%>" 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
+ <input onchange="cbi_d_update(this.id)" type="checkbox"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr(self:cfgvalue(section) == self.enabled, "checked", "checked") %> 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%>
- <form method="post" action="<%=luci.http.getenv("REQUEST_URI")%>">
- <div>
- <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
- <input type="hidden" name="cbi.submit" value="1" />
- <input type="submit" value="<%:save%>" class="hidden" />
- </div>
+<form method="post" action="<%=luci.http.getenv("REQUEST_URI")%>">
+ <div>
+ <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+ <input type="hidden" name="cbi.submit" value="1" />
+ <input type="submit" value="<%:save%>" class="hidden" />
+ </div>
diff --git a/libs/cbi/luasrc/view/cbi/lvalue.htm b/libs/cbi/luasrc/view/cbi/lvalue.htm
index 637151e7b2..cb41f53d13 100644
--- a/libs/cbi/luasrc/view/cbi/lvalue.htm
+++ b/libs/cbi/luasrc/view/cbi/lvalue.htm
@@ -14,18 +14,19 @@ $Id$
-%>
<%+cbi/valueheader%>
<% if self.widget == "select" then %>
- <select onchange="cbi_d_update(this.id)" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self.size then %> size="<%=self.size%>"<% end %>>
-<%for i, key in pairs(self.keylist) do%>
- <option<% if self:cfgvalue(section) == key then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
-<% end %>
- </select>
+ <select onchange="cbi_d_update(this.id)"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr(self.size, "size") %>>
+ <% for i, key in pairs(self.keylist) do -%>
+ <option<%= attr("value", key) .. ifattr(self:cfgvalue(section) == key, "selected", "selected") %>><%=self.vallist[i]%></option>
+ <%- end %>
+ </select>
<% elseif self.widget == "radio" then
- local c = 0;
+ local c = 0
for i, key in pairs(self.keylist) do
- c = c + 1%>
- <input type="radio" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == key then %> checked="checked"<% end %> value="<%=key%>" />
- <label for="cbid.<%=self.config.."."..section.."."..self.option%>"><%=self.vallist[i]%></label><br />
+ c = c + 1
+%>
+ <input type="radio"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr(self:cfgvalue(section) == key, "checked", "checked") %> />
+ <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label><br />
<% if c == self.size then c = 0 %><br />
<% end end %>
<% end %>
-<%+cbi/valuefooter%> \ No newline at end of file
+<%+cbi/valuefooter%>
diff --git a/libs/cbi/luasrc/view/cbi/map.htm b/libs/cbi/luasrc/view/cbi/map.htm
index c45f39f08c..e29b4fc746 100644
--- a/libs/cbi/luasrc/view/cbi/map.htm
+++ b/libs/cbi/luasrc/view/cbi/map.htm
@@ -12,9 +12,10 @@ You may obtain a copy of the License at
$Id$
-%>
- <div class="cbi-map" id="cbi-<%=self.config%>">
- <h1><%=self.title%></h1>
- <div class="cbi-map-descr"><%=self.description%></div>
-<% self:render_children() %>
- <br />
- </div>
+
+<div class="cbi-map" id="cbi-<%=self.config%>">
+ <h1><%=self.title%></h1>
+ <div class="cbi-map-descr"><%=self.description%></div>
+ <%- self:render_children() %>
+ <br />
+</div>
diff --git a/libs/cbi/luasrc/view/cbi/mvalue.htm b/libs/cbi/luasrc/view/cbi/mvalue.htm
index 9580d87f79..092d2290f5 100644
--- a/libs/cbi/luasrc/view/cbi/mvalue.htm
+++ b/libs/cbi/luasrc/view/cbi/mvalue.htm
@@ -13,21 +13,22 @@ $Id$
-%>
<%
-local v = self:valuelist(section)
+local v = self:valuelist(section)
%>
<%+cbi/valueheader%>
<% if self.widget == "select" then %>
- <select multiple="multiple" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self.size then %> size="<%=self.size%>"<% end %>>
-<%for i, key in pairs(self.keylist) do %>
- <option<% if luci.util.contains(v, key) then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
-<% end %>
- </select>
+ <select multiple="multiple"<%= attr("name", cbid) .. ifattr(self.size, "size") %>>
+ <% for i, key in pairs(self.keylist) do -%>
+ <option<%= attr("value", key) .. ifattr(luci.util.contains(v, key), "selected", "selected") %>><%=self.vallist[i]%></option>
+ <%- end %>
+ </select>
<% elseif self.widget == "checkbox" then
local c = 0;
for i, key in pairs(self.keylist) do
- c = c + 1%>
- <input type="checkbox" id="cbid.<%=self.config.."."..section.."."..self.option.."."..i%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if luci.util.contains(v, key) then %> checked="checked"<% end %> value="<%=key%>" />
- <label for="cbid.<%=self.config.."."..section.."."..self.option.."."..i%>"><%=self.vallist[i]%></label><br />
+ c = c + 1
+%>
+ <input type="checkbox"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr(luci.util.contains(v, key), "checked", "checked") />
+ <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label><br />
<% if c == self.size then c = 0 %><br />
<% end end %>
<% end %>
diff --git a/libs/cbi/luasrc/view/cbi/nsection.htm b/libs/cbi/luasrc/view/cbi/nsection.htm
index 0153c32cf1..a999e47b57 100644
--- a/libs/cbi/luasrc/view/cbi/nsection.htm
+++ b/libs/cbi/luasrc/view/cbi/nsection.htm
@@ -12,23 +12,25 @@ You may obtain a copy of the License at
$Id$
-%>
-<% if self:cfgvalue(self.section) then
-section = self.section %>
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=section%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
- <% if self.addremove then %><div class="cbi-section-remove right">
- <input type="submit" name="cbi.rns.<%=self.config%>.<%=section%>" value="<%:cbi_del%>" />
- </div><% end %>
-<div class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
-<%+cbi/ucisection%>
-</div>
-<br />
- </div>
+
+<% if self:cfgvalue(self.section) then section = self.section %>
+ <div class="cbi-section" id="cbi-<%=self.config%>-<%=section%>">
+ <h2><%=self.title%></h2>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <% if self.addremove then -%>
+ <div class="cbi-section-remove right">
+ <input type="submit" name="cbi.rns.<%=self.config%>.<%=section%>" value="<%:cbi_del%>" />
+ </div>
+ <%- end %>
+ <div class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
+ <%+cbi/ucisection%>
+ </div>
+ <br />
+ </div>
<% elseif self.addremove then %>
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
- <input type="submit" name="cbi.cns.<%=self.config%>.<%=self.section%>" value="<%:cbi_add%>" />
- </div>
+ <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
+ <h2><%=self.title%></h2>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <input type="submit" name="cbi.cns.<%=self.config%>.<%=self.section%>" value="<%:cbi_add%>" />
+ </div>
<% end %>
diff --git a/libs/cbi/luasrc/view/cbi/tblsection.htm b/libs/cbi/luasrc/view/cbi/tblsection.htm
index 367af80b88..6f2029e3bb 100644
--- a/libs/cbi/luasrc/view/cbi/tblsection.htm
+++ b/libs/cbi/luasrc/view/cbi/tblsection.htm
@@ -12,64 +12,65 @@ You may obtain a copy of the License at
$Id$
-%>
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
- <div class="cbi-section-node">
- <%- local count = 0 -%>
- <table class="cbi-section-table">
- <tr class="cbi-section-table-titles">
- <%- for i, k in pairs(self.children) do -%>
- <th class="cbi-section-table-cell"><%=k.title%></th>
- <%- count = count + 1; end; if self.addremove then -%>
- <th class="cbi-section-table-cell">&nbsp;</th>
- <%- count = count + 1; end -%>
- </tr>
- <tr class="cbi-section-table-descr">
- <%- for i, k in pairs(self.children) do -%>
- <th class="cbi-section-table-cell"><%=k.description%></th>
- <%- end; if self.addremove then -%>
- <th class="cbi-section-table-cell">&nbsp;</th>
- <%- end -%>
- </tr>
- <%- for i, k in ipairs(self:cfgsections()) do
- if not self.anonymous then
- -%>
- <tr class="cbi-section-table-title">
- <th colspan="<%=count%>"><h3><%=k%></h3></th>
- </tr>
- <%- end
- section = k
- scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
- -%>
- <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
- <%-+cbi/ucisection-%>
- <%- if self.addremove then -%>
- <td class="cbi-section-table-cell">
- <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="X" />
- </td>
- <%- end -%>
- </tr>
- <%- end -%>
- <%- if self.addremove then -%>
- <tr class="cbi-section-table-row">
- <td colspan="<%=count%>" class="cbi-section-table-optionals">
- <div class="cbi-section-create">
- <% if self.anonymous then %>
- <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
- <% else %>
- <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
- <input type="submit" value="<%:cbi_add%>" />
- <% end %>
+<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+ <h2><%=self.title%></h2>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <div class="cbi-section-node">
+ <%- local count = 0 -%>
+ <table class="cbi-section-table">
+ <tr class="cbi-section-table-titles">
+ <%- for i, k in pairs(self.children) do -%>
+ <th class="cbi-section-table-cell"><%=k.title%></th>
+ <%- count = count + 1; end; if self.addremove then -%>
+ <th class="cbi-section-table-cell">&nbsp;</th>
+ <%- count = count + 1; end -%>
+ </tr>
+ <tr class="cbi-section-table-descr">
+ <%- for i, k in pairs(self.children) do -%>
+ <th class="cbi-section-table-cell"><%=k.description%></th>
+ <%- end; if self.addremove then -%>
+ <th class="cbi-section-table-cell">&nbsp;</th>
+ <%- end -%>
+ </tr>
+ <%- for i, k in ipairs(self:cfgsections()) do
+ if not self.anonymous then
+ -%>
+ <tr class="cbi-section-table-title">
+ <th colspan="<%=count%>"><h3><%=k%></h3></th>
+ </tr>
+ <%- end
+ section = k
+ scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
+ -%>
+ <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
+ <%-+cbi/ucisection-%>
+ <%- if self.addremove then -%>
+ <td class="cbi-section-table-cell">
+ <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="X" />
+ </td>
+ <%- end -%>
+ </tr>
+ <%- end -%>
- <% if self.err_invalid then %>
- <div class="cbi-error"><%:cbi_invalid%></div>
- <% end %>
- </div>
- </td>
- </tr>
- <%- end -%>
- </table>
+ <%- if self.addremove then -%>
+ <tr class="cbi-section-table-row">
+ <td colspan="<%=count%>" class="cbi-section-table-optionals">
+ <div class="cbi-section-create">
+ <% if self.anonymous then %>
+ <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
+ <% else %>
+ <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input type="submit" value="<%:cbi_add%>" />
+ <% end %>
+
+ <% if self.err_invalid then %>
+ <div class="cbi-error"><%:cbi_invalid%></div>
+ <% end %>
</div>
- </div>
+ </td>
+ </tr>
+ <%- end -%>
+ </table>
+ </div>
+</div>
diff --git a/libs/cbi/luasrc/view/cbi/tsection.htm b/libs/cbi/luasrc/view/cbi/tsection.htm
index 7cc5dd34e3..9f4f2a50d7 100644
--- a/libs/cbi/luasrc/view/cbi/tsection.htm
+++ b/libs/cbi/luasrc/view/cbi/tsection.htm
@@ -12,28 +12,36 @@ You may obtain a copy of the License at
$Id$
-%>
- <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
- <h2><%=self.title%></h2>
- <div class="cbi-section-descr"><%=self.description%></div>
-<% for i, k in ipairs(self:cfgsections()) do%>
- <% if self.addremove then %><div class="cbi-section-remove right">
- <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del%>" />
- </div><% end %>
- <% if not self.anonymous then %><h3><%=k%></h3><% end %>
-<% section = k %>
-<div class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
-<%+cbi/ucisection%>
-</div>
-<br />
-<% end %>
-<% if self.addremove then %>
- <div class="cbi-section-create">
- <% if self.anonymous then %>
- <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
- <% else %>
- <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
- <input type="submit" value="<%:cbi_add%>" />
- <% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid%></div><% end %>
- </div>
-<% end %>
+
+<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+ <h2><%=self.title%></h2>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <% for i, k in ipairs(self:cfgsections()) do -%>
+ <% if self.addremove then -%>
+ <div class="cbi-section-remove right">
+ <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del%>" />
</div>
+ <%- end %>
+ <% if not self.anonymous then %><h3><%=k%></h3><% end %>
+ <% section = k %>
+ <div class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
+ <%+cbi/ucisection%>
+ </div>
+ <br />
+ <%- end %>
+
+ <% if self.addremove then -%>
+ <div class="cbi-section-create">
+ <% if self.anonymous then -%>
+ <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
+ <%- else -%>
+ <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <input type="submit" value="<%:cbi_add%>" />
+ <%- end %>
+
+ <% if self.err_invalid then -%>
+ <div class="cbi-error"><%:cbi_invalid%></div>
+ <%- end %>
+ </div>
+ <%- end %>
+ </div>
diff --git a/libs/cbi/luasrc/view/cbi/ucisection.htm b/libs/cbi/luasrc/view/cbi/ucisection.htm
index f6652fb0a2..eb581cab78 100644
--- a/libs/cbi/luasrc/view/cbi/ucisection.htm
+++ b/libs/cbi/luasrc/view/cbi/ucisection.htm
@@ -12,23 +12,25 @@ You may obtain a copy of the License at
$Id$
-%>
+
<% self:render_children(section, scope or {}) %>
- <% if #self.optionals[section] > 0 or self.dynamic then %>
- <div class="cbi-optionals">
- <% if self.dynamic then %>
- <input type="text" name="cbi.opt.<%=self.config%>.<%=section%>" />
- <% else %>
- <select 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%>"><%=val.title%></option>
- <% end %>
- </select>
- <script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
- <% if #val.deps > 0 then %><% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..val.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
- <% end %><% end %>
- <% end %></script>
- <% end %>
- <input type="submit" value="<%:add%>" />
- </div>
- <% end %> \ No newline at end of file
+
+<% if #self.optionals[section] > 0 or self.dynamic then %>
+ <div class="cbi-optionals">
+ <% if self.dynamic then %>
+ <input type="text" name="cbi.opt.<%=self.config%>.<%=section%>" />
+ <% else %>
+ <select 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%>"><%=val.title%></option>
+ <% end %>
+ </select>
+ <script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
+ <% if #val.deps > 0 then %><% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..val.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>");
+ <% end %><% end %>
+ <% end %></script>
+ <% end %>
+ <input type="submit" value="<%:add%>" />
+ </div>
+<% end %>
diff --git a/libs/cbi/luasrc/view/cbi/value.htm b/libs/cbi/luasrc/view/cbi/value.htm
index 9bde6bc4ba..5a7339d835 100644
--- a/libs/cbi/luasrc/view/cbi/value.htm
+++ b/libs/cbi/luasrc/view/cbi/value.htm
@@ -13,5 +13,5 @@ $Id$
-%>
<%+cbi/valueheader%>
- <input type="text" onchange="cbi_d_update(this.id)" <% if self.size then %>size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" id="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=self:cfgvalue(section)%>" />
+ <input type="text" onchange="cbi_d_update(this.id)"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section)) .. ifattr(self.size, "size") .. ifattr(self.maxlength, "maxlength") %> />
<%+cbi/valuefooter%>