CBI-UVL Validation Integration part #1
[project/luci.git] / libs / cbi / luasrc / view / cbi / tblsection.htm
index 979a135..a557c58 100644 (file)
@@ -21,20 +21,26 @@ end
 -%>
 
 <!-- tblsection -->
-<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
-       <h2><%=self.title%></h2>
+<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>
+                               <th>&#160;</th>
                        <%- end -%>
                        <%- for i, k in pairs(self.children) do if not k.optional then -%>
-                               <th class="cbi-section-table-cell"><%=k.title%></th>
+                               <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>
+                               <th class="cbi-section-table-cell">&#160;</th>
                        <%- count = count + 1; end -%>
                        </tr>
                        <tr class="cbi-section-table-descr">
@@ -53,7 +59,7 @@ end
                                        isempty = false
                                        scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
                        -%>
-                       <tr class="cbi-section-table-row<% if self.extedit then %> cbi-rowstyle-<%=rowstyle()%><% end %>" id="cbi-<%=self.config%>-<%=section%>">
+                       <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 %>
@@ -70,13 +76,32 @@ end
                                <%- if self.extedit or self.addremove then -%>
                                        <td class="cbi-section-table-cell">
                                                <%- if self.extedit then -%>
-                                                       <a href="<%=self.extedit:format(section)%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:edit%>" /></a>
+                                                       <a href="
+                                                       <%- if type(self.extedit) == "string" then -%>
+                                                               <%=self.extedit:format(section)%>
+                                                       <%- elseif type(self.extedit) == "function" then -%>
+                                                               <%=self:extedit(section)%>
+                                                       <%- end -%>
+                                                       " 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>
+                       <% if self.tag_deperror[section] or self.tag_invalid[section] or self.tag_error[section] then %>
+                               <tr class="cbi-section-table-row">
+                                       <td colspan="<%=count%>">
+                               <%- if self.tag_deperror[section] then -%>
+                                       <div class="cbi-error"><%:cbi_deperror%></div>
+                               <%- elseif self.tag_invalid[section] then -%>
+                                       <div class="cbi-error"><%:cbi_invalid_section%></div>
+                               <%- elseif self.tag_error[section] then -%>
+                                       <div class="cbi-error"><%=self.tag_error[section]%></div>
+                               <%- end -%>
+                                       </td>
+                               </tr>
+                       <% end %>
                        <%- end -%>
 
                        <%- if isempty then -%>
@@ -104,5 +129,5 @@ end
                        </div>
                        <%- end -%>
        </div>
-</div>
+</fieldset>
 <!-- /tblsection -->