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