46f7e5115d714876caea627d5e2365fcbc01c90d
[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 <!-- tblsection -->
17 <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
18 <h2><%=self.title%></h2>
19 <div class="cbi-section-descr"><%=self.description%></div>
20 <div class="cbi-section-node">
21 <%- local count = 0 -%>
22 <table class="cbi-section-table">
23 <tr class="cbi-section-table-titles">
24 <%- if not self.anonymous then -%>
25 <th>&nbsp;</th>
26 <%- end -%>
27 <%- for i, k in pairs(self.children) do -%>
28 <th class="cbi-section-table-cell"><%=k.title%></th>
29 <%- count = count + 1; end; if self.extedit then -%>
30 <th class="cbi-section-table-cell">&nbsp;</th>
31 <%- count = count + 1; end; if self.addremove then -%>
32 <th class="cbi-section-table-cell">&nbsp;</th>
33 <%- count = count + 1; end -%>
34 </tr>
35 <tr class="cbi-section-table-descr">
36 <%- if not self.anonymous then -%>
37 <th>&nbsp;</th>
38 <%- end -%>
39 <%- for i, k in pairs(self.children) do -%>
40 <th class="cbi-section-table-cell"><%=k.description%></th>
41 <%- end; if self.extedit then -%>
42 <th class="cbi-section-table-cell">&nbsp;</th>
43 <%- end; if self.addremove then -%>
44 <th class="cbi-section-table-cell">&nbsp;</th>
45 <%- end -%>
46 </tr>
47 <%- local isempty = true
48 for i, k in ipairs(self:cfgsections()) do
49 section = k
50 isempty = false
51 scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
52 -%>
53 <tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
54 <% if not self.anonymous then -%>
55 <th><h3><%=k%></h3></th>
56 <%- end %>
57 <%-+cbi/ucisection-%>
58 <%- if self.extedit or self.addremove then -%>
59 <td class="cbi-section-table-cell">
60 <%- if self.extedit then -%>
61 <a href="<%=self.extedit:format(section)%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:edit%>" /></a>
62 <%- end; if self.addremove then %>
63 <button class="clean" type="submit" value="1" name="cbi.rts.<%=self.config%>.<%=k%>" title="<%:delete%>"><img src="<%=resource%>/cbi/remove.gif" alt="<%:delete%>" /></button>
64 <%- end -%>
65 </td>
66 <%- end -%>
67 <%- if self.addremove then -%>
68 <td class="cbi-section-table-cell">
69
70 </td>
71 <%- end -%>
72 </tr>
73 <%- end -%>
74
75 <%- if isempty then -%>
76 <tr class="cbi-section-table-row">
77 <td colspan="<%=count%>"><em><br /><%:cbi_sectempty%></em></td>
78 </tr>
79 <%- end -%>
80 </table>
81 <%- if self.addremove then -%>
82 <br />
83 <div class="cbi-section-table-row">
84 <td colspan="<%=count%>" class="cbi-section-table-optionals">
85 <div class="cbi-section-create">
86 <% if self.anonymous then %>
87 <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
88 <% else %>
89 <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
90 <input type="submit" value="<%:cbi_add%>" />
91 <% end %>
92
93 <% if self.err_invalid then %>
94 <div class="cbi-error"><%:cbi_invalid%></div>
95 <% end %>
96 </div>
97 </td>
98 </div>
99 <%- end -%>
100 </div>
101 </div>
102 <!-- /tblsection -->