1
0

tsection.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
  2. <% if self.title and #self.title > 0 then -%>
  3. <legend><%=self.title%></legend>
  4. <%- end %>
  5. <% if self.error_msg and #self.error_msg > 0 then -%>
  6. <div class="cbi-section-error">
  7. <%=self.error_msg%>
  8. </div>
  9. <%- end %>
  10. <% if self.description and #self.description > 0 then -%>
  11. <div class="cbi-section-descr"><%=self.description%></div>
  12. <%- end %>
  13. <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
  14. <% if self.addremove then -%>
  15. <div class="cbi-section-remove right">
  16. <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" class="cbi-button" />
  17. </div>
  18. <%- end %>
  19. <%- section = k; isempty = false -%>
  20. <% if not self.anonymous then -%>
  21. <h3><%=section:upper()%></h3>
  22. <%- end %>
  23. <div class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
  24. <%+cbi/ucisection%>
  25. </div>
  26. <%- end %>
  27. <% if isempty then -%>
  28. <em><%:This section contains no values yet%><br /><br /></em>
  29. <%- end %>
  30. <% if self.addremove then -%>
  31. <% if self.template_addremove then include(self.template_addremove) else -%>
  32. <div class="cbi-section-create">
  33. <% if self.anonymous then -%>
  34. <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
  35. <%- else -%>
  36. <% if self.invalid_cts then -%>
  37. <div class="cbi-section-error"><%:Invalid%></div>
  38. <%- end %>
  39. <div>
  40. <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>." data-type="uciname" data-optional="true" />
  41. </div>
  42. <input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
  43. <%- end %>
  44. </div>
  45. <%- end %>
  46. <%- end %>
  47. </div>