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
22 for value in utl.imatch(value) do
27 local n = self.network and net:get_network(self.network)
30 for _, i in ipairs(n:get_interfaces() or { n:get_interface() }) do
31 checked[i:name()] = true
37 <input type="hidden" name="<%=cbeid%>" value="1" />
39 <div class="cbi-dropdown" display-items="5" placeholder="<%:-- please select -- %>"<%=
41 ifattr(self.widget == "checkbox", "multiple", "multiple") ..
42 ifattr(self.widget == "checkbox", "optional", "optional")
44 <script type="item-template"><!--
45 <li value="{{value}}">
46 <img title="<%:Custom Interface%>: "{{value}}"" src="<%=resource%>/icons/ethernet_disabled.png" />
47 <span class="hide-open">{{value}}</span>
48 <span class="hide-close"><%:Custom Interface%>: "{{value}}"</span>
52 <% for _, iface in ipairs(ifaces) do
53 if (not self.nobridges or not iface:is_bridge()) and
54 (not self.noinactive or iface:is_up()) and
55 iface:name() ~= self.exclude
58 attr("value", iface:name()) ..
59 ifattr(checked[iface:name()], "selected", "selected")
61 <img<%=attr("title", iface:get_i18n())%> src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
62 <span class="hide-open"><%=pcdata(iface:name())%></span>
63 <span class="hide-close">
64 <%=pcdata(iface:get_i18n())%>
65 <% local ns = iface:get_networks(); if #ns > 0 then %>(
66 <%- local i, n; for i, n in ipairs(ns) do -%>
67 <%-= (i>1) and ', ' -%>
68 <a href="<%=n:adminlink()%>"><%=n:name()%></a>
74 <% if not self.nocreate then %>
76 <img title="<%:Custom Interface%>" src="<%=resource%>/icons/ethernet_disabled.png" />
77 <span><%:Custom Interface%>:</span>
78 <input type="password" style="display:none" />
79 <input class="create-item-input" type="text" />