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
24 (net:name() ~= self.exclude) and
25 (not self.novirtual or not net:is_virtual())
27 <li style=
"padding:0.25em 0">
28 <input class=
"cbi-input-<%=self.widget or "radio
"%>" onclick=
"cbi_d_update(this.id)" onchange=
"cbi_d_update(this.id)"<%=
29 attr(
"type", self.widget or
"radio") ..
30 attr(
"id", cbid ..
"." .. net:name()) ..
31 attr(
"name", cbid) .. attr(
"value", net:name()) ..
32 ifattr(checked[net:name()],
"checked",
"checked")
34 <label<%=attr(
"for", cbid ..
"." .. net:name())%
>>
35 <span class=
"ifacebadge"><%=net:name()%
>:
38 for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do
39 if not iface:is_bridge() then
42 <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" />
44 <% if empty then %
><em><%:(no interfaces attached)%
></em><% end %
>
50 <% if not self.nocreate then %
>
51 <li style=
"padding:0.25em 0">
52 <input class=
"cbi-input-<%=self.widget or "radio
"%>" onclick=
"cbi_d_update(this.id)" onchange=
"cbi_d_update(this.id)"<%=attr(
"type", self.widget or
"radio") .. attr(
"id", cbid ..
"_new") .. attr(
"name", cbid) .. attr(
"value",
"-") .. ifattr(not value,
"checked",
"checked")%
> />  
53 <div style=
"padding:0.5em; display:inline">
54 <label<%=attr(
"for", cbid ..
"_new")%
>><em><%:unspecified -or- create:%
> </em></label>
55 <input style=
"width:6em" type=
"text"<%=attr(
"name", cbid ..
".newnet")%
> onfocus=
"document.getElementById('<%=cbid%>_new').checked=true" />
58 <% elseif self.widget ~=
"checkbox" and self.unspecified then %
>
59 <li style=
"padding:0.25em 0">
60 <input class=
"cbi-input-<%=self.widget or "radio
"%>" onclick=
"cbi_d_update(this.id)" onchange=
"cbi_d_update(this.id)"<%=
61 attr(
"type", self.widget or
"radio") ..
62 attr(
"id", cbid ..
"_uns") ..
65 ifattr(not value or #value ==
0,
"checked",
"checked")
67 <div style=
"padding:0.5em; display:inline">
68 <label<%=attr(
"for", cbid ..
"_uns")%
>><em><%:unspecified%
></em></label>