modules/admin-full: Rewrote route configuration page
[project/luci.git] / libs / cbi / luasrc / view / cbi / tblsection.htm
index 84d2603..d03d6f4 100644 (file)
-                               <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
-                                       <h2><%=self.title%></h2>
-                                       <div class="cbi-section-descr"><%=self.description%></div>
-                                       <div class="cbi-section-node">
-                                               <div class="cbi-section-row">
-<% for i, k in pairs(self.children) do %>
-                                               <div class="cbi-section-row-head"><%=k.title%></div>                    
-<% end %>
-                                               </div>
-                                               <div class="cbi-section-row">
-<% for i, k in pairs(self.children) do %>
-                                               <div class="cbi-section-row-descr"><%=k.description%></div>                     
-<% end %>
-                                               </div>
-<% for i, k in ipairs(self:cfgsections()) do%>
-                                               <% if not self.anonymous then %><h3 class="table-cell"><%=k%></h3><% end %>
-<%
-section = k 
-scope = {valueheader = "cbi/tiny_valueheader", valuefooter = "cbi/tiny_valuefooter"}
-%>
-<div class="cbi-section-row" id="cbi-<%=self.config%>-<%=section%>">
-<%+cbi/ucisection%>
-                                               <% if self.addremove then %><div class="cbi-section-remove table-cell">
-                                                       <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="X" />
-                                               </div><% end %>
-</div>
-<% end %>
-<% if self.addremove then %>
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<%-
+local rowcnt = 1
+function rowstyle()
+       rowcnt = rowcnt + 1
+       return (rowcnt % 2) + 1
+end
+-%>
+
+<!-- tblsection -->
+<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+       <% if self.title and #self.title > 0 then -%>
+               <legend><%=self.title%></legend>
+       <%- end %>
+       <div class="cbi-section-descr"><%=self.description%></div>
+       <div class="cbi-section-node">
+               <%- local count = 0 -%>
+               <table class="cbi-section-table">
+                       <tr class="cbi-section-table-titles">
+                       <%- if not self.anonymous then -%>
+                               <th>&nbsp;</th>
+                       <%- end -%>
+                       <%- for i, k in pairs(self.children) do if not k.optional then -%>
+                               <th class="cbi-section-table-cell">
+                               <%- if k.titleref then -%><a title="<%=self.titledesc or translate('cbi_gorel')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%>
+                                       <%-=k.title-%>
+                               <%- if k.titleref then -%></a><%- end -%>
+                               </th>
+                       <%- count = count + 1; end; end; if self.extedit or self.addremove then -%>
+                               <th class="cbi-section-table-cell">&nbsp;</th>
+                       <%- count = count + 1; end -%>
+                       </tr>
+                       <tr class="cbi-section-table-descr">
+                       <%- if not self.anonymous then -%>
+                               <th></th>
+                       <%- end -%>
+                       <%- for i, k in pairs(self.children) do if not k.optional then -%>
+                               <th class="cbi-section-table-cell"><%=k.description%></th>
+                       <%- end; end; if self.extedit or self.addremove then -%>
+                               <th class="cbi-section-table-cell"></th>
+                       <%- end -%>
+                       </tr>
+                       <%- local isempty = true
+                           for i, k in ipairs(self:cfgsections()) do
+                                       section = k
+                                       isempty = false
+                                       scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
+                       -%>
+                       <tr class="cbi-section-table-row<% if self.extedit or self.rowcolors then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>">
+                               <% if not self.anonymous then -%>
+                                       <th><h3><%=k%></h3></th>
+                               <%- end %>
+
+
+                               <%-
+                                       for k, node in ipairs(self.children) do
+                                               if not node.optional then
+                                                       node:render(section, scope or {})
+                                               end
+                                       end
+                               -%>
+
+                               <%- if self.extedit or self.addremove then -%>
+                                       <td class="cbi-section-table-cell">
+                                               <%- if self.extedit then -%>
+                                                       <a href="<%=self.extedit:format(section)%>" title="<%:edit%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:edit%>" /></a>
+                                               <%- end; if self.addremove then %>
+                                                       <input type="image" value="<%:cbi_del%>" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" />
+                                               <%- end -%>
+                                       </td>
+                               <%- end -%>
+                       </tr>
+                       <%- end -%>
+
+                       <%- if isempty then -%>
+                       <tr class="cbi-section-table-row">
+                               <td colspan="<%=count%>"><em><br /><%:cbi_sectempty%></em></td>
+                       </tr>
+                       <%- end -%>
+               </table>
+                       <%- if self.addremove then -%>
+                       <div class="cbi-section-table-row">
+                               <td colspan="<%=count%>" class="cbi-section-table-optionals">
                                        <div class="cbi-section-create">
                                                <% if self.anonymous then %>
-                                                       <input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add%>" />
+                                                       <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" title="<%:cbi_add%>" />
                                                <% else %>
                                                        <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
-                                                       <input type="submit" value="<%:cbi_add%>" />
-                                               <% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid%></div><% end %>
+                                                       <input class="cbi-button cbi-button-add" type="submit" value="<%:cbi_add%>" title="<%:cbi_add%>" />
+                                               <% end %>
+
+                                               <% if self.err_invalid then %>
+                                                       <div class="cbi-error"><%:cbi_invalid%></div>
+                                               <% end %>
                                        </div>
-                                       </div>
-<% end %>
-                               </div>
+                               </td>
+                       </div>
+                       <%- end -%>
+       </div>
+</fieldset>
+<!-- /tblsection -->