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)
29 local a = n:is_alias()
31 checked['@' .. a] = true
34 for _, i in ipairs(n:get_interfaces() or { n:get_interface() }) do
35 checked[i:name()] = true
42 <input type=
"hidden" name=
"<%=cbeid%>" value=
"1" />
44 <div class=
"cbi-dropdown" display-items=
"10" placeholder=
"<%:-- please select -- %>"<%=
46 ifattr(self.widget ==
"checkbox",
"multiple",
"multiple") ..
47 ifattr(self.widget ==
"checkbox",
"optional",
"optional")
49 <script type=
"item-template"><!--
50 <li data-value="{{value}}">
51 <img title="<%:Custom Interface%>: "{{value}}"" src="<%=resource%>/icons/ethernet_disabled.png" />
52 <span class="hide-open">{{value}}</span>
53 <span class="hide-close"><%:Custom Interface%>: "{{value}}"</span>
57 <% for _, iface in ipairs(ifaces) do
58 if (not self.noaliases or iface:type() ~=
"alias") and
59 (not self.nobridges or not iface:is_bridge()) and
60 (not self.noinactive or iface:is_up()) and
61 iface:name() ~= self.exclude
64 attr(
"data-value", iface:name()) ..
65 ifattr(checked[iface:name()],
"selected",
"selected")
67 <img<%=attr(
"title", iface:get_i18n())%
> src=
"<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled
"%>.png" />
68 <span class=
"hide-open"><%=pcdata(iface:name())%
></span>
69 <span class=
"hide-close">
70 <%=pcdata(iface:get_i18n())%
>
71 <% local ns = iface:get_networks(); if #ns
> 0 then %
>(
72 <%- local i, n; for i, n in ipairs(ns) do -%
>
73 <%-= (i
>1) and ', ' -%
>
74 <a href=
"<%=n:adminlink()%>"><%=n:name()%
></a>
80 <% if not self.nocreate then %
>
82 <img title=
"<%:Custom Interface%>" src=
"<%=resource%>/icons/ethernet_disabled.png" />
83 <span><%:Custom Interface%
>:
</span>
84 <input type=
"password" style=
"display:none" />
85 <input class=
"create-item-input" type=
"text" />