tabmap_nsections.htm 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%>
  2. <div class="errorbox"><%=pcdata(msg)%></div>
  3. <%- end end -%>
  4. <%-+cbi/apply_xhr-%>
  5. <div class="cbi-map" id="cbi-<%=self.config%>">
  6. <% if self.title and #self.title > 0 then %><h2 name="content"><%=self.title%></h2><% end %>
  7. <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
  8. <%- if firstmap and applymap then cbi_apply_xhr(self.config, parsechain, redirect) end -%>
  9. <% if self.tabbed then %>
  10. <ul class="cbi-tabmenu map">
  11. <%- self.selected_tab = luci.http.formvalue("tab.m-" .. self.config) %>
  12. <% for i, section in ipairs(self.children) do %>
  13. <%- if not self.selected_tab then self.selected_tab = section.sectiontype end %>
  14. <li id="tab.m-<%=self.config%>.<%=section.section or section.sectiontype%>" class="cbi-tab<%=(section.sectiontype == self.selected_tab) and '' or '-disabled'%>">
  15. <a onclick="this.blur(); return cbi_t_switch('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')" href="<%=REQUEST_URI%>?tab.m-<%=self.config%>=<%=section.section or section.sectiontype%>"><%=section.title or section.section or section.sectiontype %></a>
  16. <% if section.sectiontype == self.selected_tab then %><input type="hidden" id="tab.m-<%=self.config%>" name="tab.m-<%=self.config%>" value="<%=section.section or section.sectiontype%>" /><% end %>
  17. </li>
  18. <% end %>
  19. </ul>
  20. <br />
  21. <% for i, section in ipairs(self.children) do %>
  22. <div class="cbi-tabcontainer" id="container.m-<%=self.config%>.<%=section.section or section.sectiontype%>"<% if section.sectiontype ~= self.selected_tab then %> style="display:none"<% end %>>
  23. <% section:render() %>
  24. </div>
  25. <script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')</script>
  26. <% end %>
  27. <% else %>
  28. <%- self:render_children() %>
  29. <% end %>
  30. <% if not self.save then -%>
  31. <div class="cbi-section-error">
  32. <% for _, section in ipairs(self.children) do %>
  33. <% if section.error and section.error[section.section] then -%>
  34. <ul><li>
  35. <%:One or more missing/invalid fields on tab%>:&nbsp;<%=section.title or section.section or section.sectiontype%>
  36. </li></ul>
  37. <%- end %>
  38. <% end %>
  39. </div>
  40. <%- end %>
  41. <br />
  42. </div>