modules/admin-full: extend wifi model to allow assigning multiple networks

This commit is contained in:
Jo-Philipp Wich 2012-06-26 21:49:18 +00:00
parent fe7424b68e
commit 2e924f7aa5

View file

@ -14,6 +14,7 @@ $Id$
local wa = require "luci.tools.webadmin" local wa = require "luci.tools.webadmin"
local nw = require "luci.model.network" local nw = require "luci.model.network"
local ut = require "luci.util"
local fs = require "nixio.fs" local fs = require "nixio.fs"
arg[1] = arg[1] or "" arg[1] = arg[1] or ""
@ -415,7 +416,8 @@ network = s:taboption("general", Value, "network", translate("Network"),
network.rmempty = true network.rmempty = true
network.template = "cbi/network_netlist" network.template = "cbi/network_netlist"
network.widget = "radio" network.widget = "checkbox"
network.novirtual = true
function network.write(self, section, value) function network.write(self, section, value)
local i = nw:get_interface(section) local i = nw:get_interface(section)
@ -430,13 +432,21 @@ function network.write(self, section, value)
if n then n:del_interface(i) end if n then n:del_interface(i) end
end end
else else
local n = nw:get_network(value) local v
for _, v in ipairs(i:get_networks()) do
v:del_interface(i)
end
for v in ut.imatch(value) do
local n = nw:get_network(v)
if n then if n then
if not n:is_empty() then
n:set("type", "bridge") n:set("type", "bridge")
end
n:add_interface(i) n:add_interface(i)
end end
end end
end end
end
end end
-------------------- MAC80211 Interface ---------------------- -------------------- MAC80211 Interface ----------------------