4 local utl = require "luci.util"
5 local net = require "luci.model.network".init()
6 local cbeid = luci.cbi.FEXIST_PREFIX .. self.config .. "." .. section .. "." .. self.option
9 local ifaces = net:get_interfaces()
12 if self.map:formvalue(cbeid) == "1" then
13 value = self:formvalue(section) or self.default or ""
15 value = self:cfgvalue(section) or self.default
21 for value in utl.imatch(value) do
25 local n = self.network and net:get_network(self.network)
28 for _, i in ipairs(n:get_interfaces()) do
29 checked[i:name()] = true
35 <input type="hidden" name="<%=cbeid%>" value="1" />
36 <ul style="margin:0; list-style-type:none">
37 <% for _, iface in ipairs(ifaces) do
38 local link = iface:adminlink()
39 if (not self.nobridges or not iface:is_bridge()) and iface:name() ~= self.exclude then %>
41 <input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=
42 attr("type", self.widget or "radio") ..
43 attr("id", cbid .. "." .. iface:name()) ..
44 attr("name", cbid) .. attr("value", iface:name()) ..
45 ifattr(checked[iface:name()], "checked", "checked") ..
46 ifattr(iface:type() == "wifi" and not iface:is_up(), "disabled", "disabled")
48 <label<%=attr("for", cbid .. "." .. iface:name())%>>
49 <% if link then -%><a href="<%=link%>"><% end -%>
50 <img title="<%=iface:get_type_i18n()%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
51 <% if link then -%></a><% end -%>
52 <%=pcdata(iface:get_i18n())%><% local n = iface:get_network(); if n then %> (<a href="<%=n:adminlink()%>"><%=n:name()%></a>)<% end %>
56 <% if not self.nocreate then %>
58 <input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=
59 attr("type", self.widget or "radio") ..
60 attr("id", cbid .. "_custom") ..
63 <label<%=attr("for", cbid .. "_custom")%>>
64 <img title="<%:Custom Interface%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/ethernet_disabled.png" />
65 <%:Custom Interface%>:
67 <input type="text" style="width:50px" onfocus="document.getElementById('<%=cbid%>_custom').checked=true" onblur="var x=document.getElementById('<%=cbid%>_custom'); x.value=this.value; x.checked=true" />