libs/web: rework DynamicList widget to support dynamic lists composed of comboboxes
[project/luci.git] / libs / web / luasrc / view / cbi / dynlist.htm
index 5914186..fd626a4 100644 (file)
@@ -1,17 +1,3 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
 <%+cbi/valueheader%>
 <div>
 <%
@@ -27,21 +13,14 @@ $Id$
 <% end end %>
 </div>
 <script type="text/javascript">
-cbi_dynlist_init('<%=cbid%>');
-<% if self.datatype then -%>
-       <% if #self.keylist > 0 then -%>
-               cbi_combobox_init('<%=cbid .. "." .. i%>', {
+cbi_dynlist_init(
+       '<%=cbid%>', '<%=resource%>', '<%=self.datatype%>',
+       <%=tostring(self.optional or self.rmempty)%>
+       <%- if #self.keylist > 0 then -%>, [{
                <%- for i, k in ipairs(self.keylist) do -%>
                        <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
                        <%-if i<#self.keylist then-%>,<%-end-%>
                <%-     end     -%>
-               }, '<%- if not self.rmempty and not self.optional then -%>
-                       <%-:cbi_select-%>
-               <%- end -%>', '<%: -- custom -- %>');
-       <% end -%>
-       <% for i=1, #vals + 1 do -%>
-       cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring((self.optional or self.rmempty) == true or i > #vals)%>, '<%=self.datatype%>');
-       <%- end %>
-<% end -%>
+       }, '<%: -- custom -- %>']<% end -%>);
 </script>
 <%+cbi/valuefooter%>