build: introduce luci-base
[project/luci.git] / modules / base / luasrc / luasrc / view / cbi / tsection.htm
1 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
2         <% if self.title and #self.title > 0 then -%>
3                 <legend><%=self.title%></legend>
4         <%- end %>
5         <div class="cbi-section-descr"><%=self.description%></div>
6         <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
7                 <% if self.addremove then -%>
8                         <div class="cbi-section-remove right">
9                                 <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" class="cbi-button" />
10                         </div>
11                 <%- end %>
12
13                 <%- section = k; isempty = false -%>
14
15                 <% if not self.anonymous then -%>
16                         <h3><%=section:upper()%></h3>
17                 <%- end %>
18
19                 <%+cbi/tabmenu%>
20
21                 <fieldset class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
22                         <%+cbi/ucisection%>
23                 </fieldset>
24                 <br />
25         <%- end %>
26
27         <% if isempty then -%>
28                 <em><%:This section contains no values yet%><br /><br /></em>
29         <%- end %>
30
31         <% if self.addremove then -%>
32                 <% if self.template_addremove then include(self.template_addremove) else -%>
33                 <div class="cbi-section-create">
34                         <% if self.anonymous then -%>
35                                 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
36                         <%- else -%>
37                                 <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
38                                 <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" />
39                                 <script type="text/javascript">cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname');</script>
40                                 <input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
41                                 <% if self.invalid_cts then -%>
42                                         <br /><%:Invalid%></div>
43                                 <%- end %>
44                         <%- end %>
45                 </div>
46                 <%- end %>
47         <%- end %>
48 </fieldset>