1368872d94fad65d99bd4f608a6238bda10b3bcc
[project/luci.git] / libs / cbi / luasrc / view / cbi / dynlist.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15 <%+cbi/valueheader%>
16         local vals = self:cfgvalue(section)
17         for i=1, #vals + 1 do
18                 local val = vals[i]
19 %>
20         <input onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(val, "value") .. ifattr(self.size, "size")%> />
21         <% if i <= #vals then %>
22                 <input type="image" value="<%:cbi_del%>" name="cbi.rle.<%=section .. "." .. self.option .. "." i%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" />
23         <% else %>
24                 <input type="image" value="<%:cbi_add%>" name="cbi.ale.<%=section .. "." .. self.option%>" alt="<%:cbi_add%>" title="<%:cbi_add%>" src="<%=resource%>/cbi/add.gif" />
25         <% end %>
26         <% if #self.keylist > 0 then -%>
27                 <script type="text/javascript">
28                         cbi_combobox_init('<%=cbid .. "." .. i%>', {
29                         <%-
30                                 for i, k in ipairs(self.keylist) do
31                         -%>
32                                 <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>,
33                         <%-
34                                 end
35                         -%>
36                         }, '<%- if not self.rmempty and not self.optional then -%>
37                                 <%-:cbi_select-%>
38                         <%- end -%>', '<%:cbi_manual%>');
39                 </script>
40         <% end -%>
41         <br />
42 <% if i <= #vals then %><br />
43 <% end end %>
44 <%+cbi/valuefooter%>