44ff589d7c27bfa4153dccd30f7664f698eb5bed
[project/luci.git] / libs / cbi / luasrc / view / cbi / tblsection.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 <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
17 <h2><%=self.title%></h2>
18 <div class="cbi-section-descr"><%=self.description%></div>
19 <div class="cbi-section-node">
20 <%- local count = 0 -%>
21 <table class="cbi-section-table">
22 <tr class="cbi-section-table-titles">
23 <%- for i, k in pairs(self.children) do -%>
24 <th class="cbi-section-table-cell"><%=k.title%></th>
25 <%- count = count + 1; end; if self.addremove then -%>
26 <th class="cbi-section-table-cell">&nbsp;</th>
27 <%- count = count + 1; end -%>
28 </tr>
29 <tr class="cbi-section-table-descr">
30 <%- for i, k in pairs(self.children) do -%>
31 <th class="cbi-section-table-cell"><%=k.description%></th>
32 <%- end; if self.addremove then -%>
33 <th class="cbi-section-table-cell">&nbsp;</th>
34 <%- end -%>
35 </tr>
36 <%- local isempty = true
37 for i, k in ipairs(self:cfgsections()) do
38 isempty = false
39
40 if not self.anonymous then
41 -%>
42 <tr class="cbi-section-table-title">
43 <th colspan="<%=count%>"><h3><%=k%></h3></th>
44 </tr>
45 <%- end
46 section = k
47 scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
48 -%>
49 <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
50 <%-+cbi/ucisection-%>
51 <%- if self.addremove then -%>
52 <td class="cbi-section-table-cell">
53 <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="X" title="<%:delete%>" />
54 </td>
55 <%- end -%>
56 </tr>
57 <%- end -%>
58
59 <%- if isempty then -%>
60 <tr class="cbi-section-table-row">
61 <td colspan="<%=count%>"><em><%:cbi_sectempty%></em></td>
62 </tr>
63 <%- end -%>
64
65 <%- if self.addremove then -%>
66 <tr class="cbi-section-table-row">
67 <td colspan="<%=count%>" class="cbi-section-table-optionals">
68 <div class="cbi-section-create">
69 <% if self.anonymous then %>
70 <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
71 <% else %>
72 <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
73 <input type="submit" value="<%:cbi_add%>" />
74 <% end %>
75
76 <% if self.err_invalid then %>
77 <div class="cbi-error"><%:cbi_invalid%></div>
78 <% end %>
79 </div>
80 </td>
81 </tr>
82 <%- end -%>
83 </table>
84 </div>
85 </div>