* luci/libs/cbi: implement addremove_template
[project/luci.git] / libs / cbi / luasrc / view / cbi / tsection.htm
index 9f4f2a5..db723f9 100644 (file)
@@ -13,35 +13,47 @@ $Id$
 
 -%>
 
-<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
-       <h2><%=self.title%></h2>
+<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+       <% if self.title and #self.title > 0 then -%>
+               <legend><%=self.title%></legend>
+       <%- end %>
        <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%>
+       <% local isempty = true 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>
-                       <br />
                <%- end %>
+               <% section = k; isempty = false %>
 
-               <% 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 not self.anonymous then -%>
+                       <h3><%=k:upper()%></h3>
+               <%- end %>
 
-                               <% if self.err_invalid then -%>
-                                       <div class="cbi-error"><%:cbi_invalid%></div>
+               <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
+                       <%+cbi/ucisection%>
+               </fieldset>
+               <br />
+       <%- end %>
+
+       <% if isempty then -%>
+               <em><%:cbi_sectempty%><br /><br /></em>
+       <%- end %>
+
+       <% if self.addremove then -%>
+               <% if self.template_addremove then include(self.template_addremove) else -%>
+               <div class="cbi-section-create">
+                       <% if self.anonymous then -%>
+                               <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
+                       <%- else -%>
+                               <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
+                               <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+                               <input type="submit" class="cbi-button cbi-button-add" value="<%:cbi_add%>" />
+                               <% if self.invalid_cts then -%>
+                                       <br /><%:cbi_invalid%></div>
                                <%- end %>
-                       </div>
+                       <%- end %>
+               </div>
                <%- end %>
-       </div>
+       <%- end %>
+</fieldset>