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)
13 if not value or value ==
"-" then
14 value = self:cfgvalue(section) or self.default
18 for value in utl.imatch(value) do
23 <ul style=
"margin:0; list-style-type:none; text-align:left">
24 <% for _, net in ipairs(networks) do
25 if (net:name() ~=
"loopback") and
26 (net:name() ~= self.exclude) and
27 (not self.novirtual or not net:is_virtual())
29 <li style=
"padding:0.25em 0">
30 <input class=
"cbi-input-<%=self.widget or "radio
"%>" onclick=
"cbi_d_update(this.id)" onchange=
"cbi_d_update(this.id)"<%=
31 attr(
"type", self.widget or
"radio") ..
32 attr(
"id", cbid ..
"." .. net:name()) ..
33 attr(
"name", cbid) .. attr(
"value", net:name()) ..
34 ifattr(checked[net:name()],
"checked",
"checked")
36 <label<%=attr(
"for", cbid ..
"." .. net:name())%
>>
37 <span class=
"ifacebadge"><%=net:name()%
>:
40 for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do
41 if not iface:is_bridge() then
44 <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" />
46 <% if empty then %
><em><%:(no interfaces attached)%
></em><% end %
>
52 <% if not self.nocreate then %
>
53 <li style=
"padding:0.25em 0">
54 <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 and self.widget ~=
"checkbox",
"checked",
"checked")%
> />  
55 <div style=
"padding:0.5em; display:inline">
56 <label<%=attr(
"for", cbid ..
"_new")%
>><em>
57 <%- if self.widget ==
"checkbox" then -%
>
60 <%:unspecified -or- create:%
>
61 <%- end -%
> </em></label>
62 <input style=
"width:6em" type=
"text"<%=attr(
"name", cbid ..
".newnet")%
> onfocus=
"document.getElementById('<%=cbid%>_new').checked=true" />
65 <% elseif self.widget ~=
"checkbox" and self.unspecified then %
>
66 <li style=
"padding:0.25em 0">
67 <input class=
"cbi-input-<%=self.widget or "radio
"%>" onclick=
"cbi_d_update(this.id)" onchange=
"cbi_d_update(this.id)"<%=
68 attr(
"type", self.widget or
"radio") ..
69 attr(
"id", cbid ..
"_uns") ..
72 ifattr(not value or #value ==
0,
"checked",
"checked")
74 <div style=
"padding:0.5em; display:inline">
75 <label<%=attr(
"for", cbid ..
"_uns")%
>><em><%:unspecified%
></em></label>