db723f92aad5224eeb028e2d982a04d5860875aa
[project/luci.git] / libs / cbi / 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="<%:cbi_del%>" />
25                         </div>
26                 <%- end %>
27                 <% section = k; isempty = false %>
28
29                 <% if not self.anonymous then -%>
30                         <h3><%=k:upper()%></h3>
31                 <%- end %>
32
33                 <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
34                         <%+cbi/ucisection%>
35                 </fieldset>
36                 <br />
37         <%- end %>
38
39         <% if isempty then -%>
40                 <em><%:cbi_sectempty%><br /><br /></em>
41         <%- end %>
42
43         <% if self.addremove then -%>
44                 <% if self.template_addremove then include(self.template_addremove) else -%>
45                 <div class="cbi-section-create">
46                         <% if self.anonymous then -%>
47                                 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
48                         <%- else -%>
49                                 <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
50                                 <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
51                                 <input type="submit" class="cbi-button cbi-button-add" value="<%:cbi_add%>" />
52                                 <% if self.invalid_cts then -%>
53                                         <br /><%:cbi_invalid%></div>
54                                 <%- end %>
55                         <%- end %>
56                 </div>
57                 <%- end %>
58         <%- end %>
59 </fieldset>