mvalue.htm 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <%
  2. local i, key
  3. local v = self:valuelist(section) or {}
  4. -%>
  5. <%+cbi/valueheader%>
  6. <% if self.widget == "select" then %>
  7. <select class="cbi-input-select" multiple="multiple" data-update="click change"<%=
  8. attr("id", cbid) ..
  9. attr("name", cbid) ..
  10. ifattr(self.size, "size")
  11. %>>
  12. <% for i, key in pairs(self.keylist) do -%>
  13. <option<%=
  14. attr("id", cbid.."-"..key) ..
  15. attr("value", key) ..
  16. attr("data-index", i) ..
  17. attr("data-depends", self:deplist2json(section, self.deplist[i])) ..
  18. ifattr(luci.util.contains(v, key), "selected", "selected")
  19. %>><%=pcdata(self.vallist[i])%></option>
  20. <%- end %>
  21. </select>
  22. <% elseif self.widget == "checkbox" then %>
  23. <div>
  24. <% for i, key in pairs(self.keylist) do %>
  25. <label<%=
  26. attr("data-index", i) ..
  27. attr("data-depends", self:deplist2json(section, self.deplist[i]))
  28. %>>
  29. <input class="cbi-input-checkbox" type="checkbox" data-update="click change"<%=
  30. attr("id", cbid.."-"..key) ..
  31. attr("name", cbid) ..
  32. attr("value", key) ..
  33. ifattr(luci.util.contains(v, key), "checked", "checked")
  34. %> />
  35. <label<%= attr("for", cbid.."-"..key)%>></label>
  36. <%=pcdata(self.vallist[i])%>
  37. </label>
  38. <% if self.size and (i % self.size) == 0 then write('<br />') end %>
  39. <% end %>
  40. </div>
  41. <% end %>
  42. <%+cbi/valuefooter%>