libs: merge libs/cbi into libs/web
[project/luci.git] / libs / web / luasrc / view / cbi / tsection.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15
16 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
17 <% if self.title and #self.title > 0 then -%>
18 <legend><%=self.title%></legend>
19 <%- end %>
20 <div class="cbi-section-descr"><%=self.description%></div>
21 <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
22 <% if self.addremove then -%>
23 <div class="cbi-section-remove right">
24 <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:Delete%>" />
25 </div>
26 <%- end %>
27
28 <%- section = k; isempty = false -%>
29
30 <% if not self.anonymous then -%>
31 <h3><%=section:upper()%></h3>
32 <%- end %>
33
34 <%+cbi/tabmenu%>
35
36 <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
37 <%+cbi/ucisection%>
38 </fieldset>
39 <br />
40 <%- end %>
41
42 <% if isempty then -%>
43 <em><%:This section contains no values yet%><br /><br /></em>
44 <%- end %>
45
46 <% if self.addremove then -%>
47 <% if self.template_addremove then include(self.template_addremove) else -%>
48 <div class="cbi-section-create">
49 <% if self.anonymous then -%>
50 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:Add%>" />
51 <%- else -%>
52 <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
53 <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
54 <input type="submit" class="cbi-button cbi-button-add" value="<%:Add%>" />
55 <% if self.invalid_cts then -%>
56 <br /><%:Invalid%></div>
57 <%- end %>
58 <%- end %>
59 </div>
60 <%- end %>
61 <%- end %>
62 </fieldset>