2 LuCI - Lua Configuration Interface
3 (c) 2009 Daniel Dickinson
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
18 return (rowcnt % 2) + 1
23 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
24 <% if self.title and #self.title > 0 then -%>
25 <legend><%=self.title%></legend>
27 <div class="cbi-section-descr"><%=self.description%></div>
28 <div class="cbi-section-node">
29 <%- local count = 0 -%>
30 <table class="cbi-section-table">
31 <tr class="cbi-section-table-titles">
32 <%- if not self.anonymous then -%>
33 <%- if self.sectionhead then -%>
34 <th class="cbi-section-table-cell"><%=self.sectionhead%></th>
39 <%- for i, k in pairs(self.children) do if not k.optional then -%>
40 <th class="cbi-section-table-cell">
41 <%- if k.titleref then -%><a title="<%=self.titledesc or translate('cbi_gorel')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%>
43 <%- if k.titleref then -%></a><%- end -%>
45 <%- count = count + 1; end; end; if self.extedit or self.addremove then -%>
46 <th class="cbi-section-table-cell"> </th>
47 <%- count = count + 1; end -%>
49 <tr class="cbi-section-table-descr">
50 <%- if not self.anonymous then -%>
51 <%- if self.sectiondesc then -%>
52 <th class="cbi-section-table-cell"><%=self.sectiondesc%></th>
57 <%- for i, k in pairs(self.children) do if not k.optional then -%>
58 <th class="cbi-section-table-cell"><%=k.description%></th>
59 <%- end; end; if self.extedit or self.addremove then -%>
60 <th class="cbi-section-table-cell"></th>
63 <%- local isempty = true
64 for i, k in ipairs(self:cfgsections()) do
67 scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
69 <tr class="cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>">
70 <% if not self.anonymous then -%>
71 <th><h3><%=k%></h3></th>
74 <%- for k, node in ipairs(self.children) do -%>
75 <%- if not node.optional then -%>
76 <%- nodevalue = node:cfgvalue(section) -%>
77 <%- if nodevalue and ( nodevalue ~= "" ) and string.find(nodevalue, 'http://', 1, plain) then
79 node.template = "diag/smapvalue"
82 <%- node:render(section, scope or {}) -%>
86 <%- if self.extedit or self.addremove then -%>
87 <td class="cbi-section-table-cell">
88 <%- if self.extedit then -%>
90 <%- if type(self.extedit) == "string" then -%>
91 <%=self.extedit:format(section)%>
92 <%- elseif type(self.extedit) == "function" then -%>
93 <%=self:extedit(section)%>
95 " title="<%:edit%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:edit%>" /></a>
96 <%- end; if self.addremove then %>
97 <input type="image" value="<%:cbi_del%>" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" />
104 <%- if isempty then -%>
105 <tr class="cbi-section-table-row">
106 <td colspan="<%=count%>"><em><br /><%:sectempty%></em></td>
111 <% if self.error then %>
112 <div class="cbi-section-error">
113 <ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
114 <li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li>
119 <%- if self.addremove then -%>
120 <% if self.template_addremove then include(self.template_addremove) else -%>
121 <div class="cbi-section-create cbi-smapsection-create">
122 <% if self.anonymous then %>
123 <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:cbi_add%>" />
125 <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
126 <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
127 <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" title="<%:cbi_add%>" />
128 <% if self.invalid_cts then -%>
129 <br /><%:cbi_invalid%></div>
137 <!-- /smapsection -->