4 local utl = require "luci.util"
5 local nwm = require "luci.model.network".init()
8 local networks = nwm:get_networks()
9 local value = self:formvalue(section)
11 if not value or value == "-" then
12 value = self:cfgvalue(section) or self.default
16 for value in utl.imatch(value) do
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")
31 <label<%=attr("for", cbid .. "." .. net:name())%>>
32  <span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>:
35 for _, iface in ipairs(net:get_interfaces()) do
36 if not iface:is_bridge() then
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" />
41 <% if empty then %><em><%:(no interfaces attached)%></em><% end %>
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")%> />  
50 <div style="padding:0.5em; display:inline">
51 <label<%=attr("for", cbid .. "_new")%>><em><%:unspecified -or- create:%> </em></label>
52 <input style="width:6em" type="text"<%=attr("name", cbid .. ".newnet")%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" />
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") ..
62 ifattr(not value or #value == 0, "checked", "checked")
64 <div style="padding:0.5em; display:inline">
65 <label<%=attr("for", cbid .. "_uns")%>><em><%:unspecified%></em></label>