modules/admin-full: change workflow of wifi config page; display only one network (choosen in wifi overview) and add a hook for section remapping

on uci commit
This commit is contained in:
Jo-Philipp Wich 2009-10-29 02:23:18 +00:00
parent 66fe827403
commit 2a1f1a1d7b

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 ww = require "luci.model.wireless"
local fs = require "nixio.fs" local fs = require "nixio.fs"
arg[1] = arg[1] or "" arg[1] = arg[1] or ""
@ -21,7 +22,22 @@ arg[2] = arg[2] or ""
m = Map("wireless", translate("networks"), translate("a_w_networks1")) m = Map("wireless", translate("networks"), translate("a_w_networks1"))
m:chain("network") m:chain("network")
local ifsection
function m.on_commit(map)
nw.init(map.uci)
ww.init(map.uci)
local wnet = ww:get_network(arg[2])
if ifsection and wnet then
ifsection.section = wnet.sid
end
end
nw.init(m.uci) nw.init(m.uci)
ww.init(m.uci)
local iw = nil local iw = nil
local tx_powers = nil local tx_powers = nil
@ -201,7 +217,11 @@ end
----------------------- Interface ----------------------- ----------------------- Interface -----------------------
s = m:section(NamedSection, arg[2], "wifi-iface", translate("interfaces")) local wnet = ww:get_network(arg[2])
if wnet then
s = m:section(NamedSection, wnet.sid, "wifi-iface", ww:get_i18n(wnet))
ifsection = s
s.addremove = false s.addremove = false
s.anonymous = true s.anonymous = true
s.defaults.device = arg[1] s.defaults.device = arg[1]
@ -527,6 +547,6 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
password:depends({mode="sta", eap_type="TTLS", encryption="wpa2"}) password:depends({mode="sta", eap_type="TTLS", encryption="wpa2"})
password:depends({mode="sta", eap_type="TTLS", encryption="wpa"}) password:depends({mode="sta", eap_type="TTLS", encryption="wpa"})
end end
end
return m return m