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