80cbee83948f14eac07f45bd3f4c3e9ddd94ea93
[project/luci.git] / modules / luci-base / luasrc / view / cbi / dynlist.htm
1 <%+cbi/valueheader%>
2 <div>
3 <%
4 local vals = self:cfgvalue(section) or {}
5 for i=1, #vals + 1 do
6 local val = vals[i]
7 if (val and #val > 0) or (i == 1) then
8 %>
9 <input class="cbi-input-text" value="<%=pcdata(val)%>" data-update="change" type="text"<%=
10 attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size") ..
11 ifattr(i == 1 and self.placeholder, "placeholder", self.placeholder)
12 %> /><br />
13 <% end end %>
14 </div>
15 <script type="text/javascript">
16 cbi_dynlist_init(
17 '<%=cbid%>', '<%=resource%>', '<%=self.datatype%>',
18 <%=tostring(self.optional or self.rmempty)%>,
19 '<%=url('admin/filebrowser')%>',
20 '<%=self.default_path and self.default_path%>'
21 <%- if #self.keylist > 0 then -%>, [{
22 <%- for i, k in ipairs(self.keylist) do -%>
23 <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
24 <%-if i<#self.keylist then-%>,<%-end-%>
25 <%- end -%>
26 }, '<%: -- custom -- %>']<% end -%>);
27 </script>
28 <%+cbi/valuefooter%>