libs/web: remove license comments from cbi templates, saves around 50% of their size
[project/luci.git] / libs / web / luasrc / view / cbi / network_netlist.htm
1 <%+cbi/valueheader%>
2
3 <%-
4         local utl = require "luci.util"
5         local nwm = require "luci.model.network".init()
6
7         local net, iface
8         local networks = nwm:get_networks()
9         local value = self:formvalue(section)
10
11         if not value or value == "-" then
12                 value = self:cfgvalue(section) or self.default
13         end
14
15         local checked = { }
16         for value in utl.imatch(value) do
17                 checked[value] = true
18         end
19 -%>
20
21 <ul style="margin:0; list-style-type:none; text-align:left">
22         <% for _, net in ipairs(networks) do
23                if net:name() ~= "loopback" and net:name() ~= self.exclude then %>
24         <li style="padding:0.25em 0">
25                 <input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=
26                         attr("type", self.widget or "radio") ..
27                         attr("id", cbid .. "." .. net:name()) ..
28                         attr("name", cbid) .. attr("value", net:name()) ..
29                         ifattr(checked[net:name()], "checked", "checked")
30                 %> /> &#160;
31                 <label<%=attr("for", cbid .. "." .. net:name())%>>
32                         &#160;<span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>:
33                                 <%
34                                         local empty = true
35                                         for _, iface in ipairs(net:get_interfaces()) do
36                                                 if not iface:is_bridge() then
37                                                         empty = false
38                                  %>
39                                         <img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
40                                 <% end end %>
41                                 <% if empty then %><em><%:(no interfaces attached)%></em><% end %>
42                         </span>
43                 </label>
44         </li>
45         <% end end %>
46
47         <% if self.widget ~= "checkbox" and not self.nocreate then %>
48         <li style="padding:0.25em 0">
49                 <input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%=attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value, "checked", "checked")%> /> &#160;
50                 <div style="padding:0.5em; display:inline">
51                         <label<%=attr("for", cbid .. "_new")%>><em><%:unspecified -or- create:%>&#160;</em></label>
52                         <input style="width:6em" type="text"<%=attr("name", cbid .. ".newnet")%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" />
53                 </div>
54         </li>
55         <% elseif self.widget ~= "checkbox" and self.unspecified then %>
56         <li style="padding:0.25em 0">
57                 <input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=
58                         attr("type", self.widget or "radio") ..
59                         attr("id", cbid .. "_uns") ..
60                         attr("name", cbid) ..
61                         attr("value", "") ..
62                         ifattr(not value or #value == 0, "checked", "checked")
63                 %> /> &#160;
64                 <div style="padding:0.5em; display:inline">
65                         <label<%=attr("for", cbid .. "_uns")%>><em><%:unspecified%></em></label>
66                 </div>
67         </li>
68         <% end %>
69 </ul>
70
71 <%+cbi/valuefooter%>