modules/admin-full: fix arp lookup in wifi overview
[project/luci.git] / libs / cbi / luasrc / view / cbi / dynlist.htm
index 1368872..826e2e6 100644 (file)
@@ -1,7 +1,7 @@
 <%#
 LuCI - Lua Configuration Interface
 Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+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.
@@ -13,15 +13,16 @@ $Id$
 
 -%>
 <%+cbi/valueheader%>
-       local vals = self:cfgvalue(section)
+<%
+       local vals = self:cfgvalue(section) or {}
        for i=1, #vals + 1 do
                local val = vals[i]
 %>
-       <input onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(val, "value") .. ifattr(self.size, "size")%> />
+       <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size")%> />
        <% if i <= #vals then %>
-               <input type="image" value="<%:cbi_del%>" name="cbi.rle.<%=section .. "." .. self.option .. "." i%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" />
+               <input class="cbi-input-image" type="image" value="<%:Delete%>" name="cbi.rle.<%=section .. "." .. self.option .. "." .. i%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" />
        <% else %>
-               <input type="image" value="<%:cbi_add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:cbi_add%>" title="<%:cbi_add%>" src="<%=resource%>/cbi/add.gif" />
+               <input class="cbi-input-image" type="image" value="<%:Add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:Add%>" title="<%:Add%>" src="<%=resource%>/cbi/add.gif" />
        <% end %>
        <% if #self.keylist > 0 then -%>
                <script type="text/javascript">
@@ -29,16 +30,23 @@ $Id$
                        <%-
                                for i, k in ipairs(self.keylist) do
                        -%>
-                               <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>,
+                               <%-=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 -%>', '<%:cbi_manual%>');
+                       <%- end -%>', '<%: -- custom -- %>');
                </script>
        <% end -%>
-       <br />
 <% if i <= #vals then %><br />
 <% end end %>
+<% if self.datatype then -%>
+       <script type="text/javascript">
+               <% for i=1, #vals + 1 do -%>
+               cbi_validate_field('<%=cbid%>.<%=i%>', <%=tostring(self.optional == true or i > #vals)%>, '<%=self.datatype%>');
+               <%- end %>
+       </script>
+<% end -%>
 <%+cbi/valuefooter%>