modules/admin-full: rework wifi CBI maps
This commit is contained in:
parent
b8c1487f6d
commit
5d426cf4ac
2 changed files with 15 additions and 17 deletions
|
@ -17,7 +17,6 @@ local nw = require "luci.model.network"
|
|||
local fs = require "nixio.fs"
|
||||
|
||||
arg[1] = arg[1] or ""
|
||||
arg[2] = arg[2] or ""
|
||||
|
||||
m = Map("wireless", "",
|
||||
translate("The <em>Device Configuration</em> section covers physical settings of the radio " ..
|
||||
|
@ -30,24 +29,25 @@ m:chain("network")
|
|||
local ifsection
|
||||
|
||||
function m.on_commit(map)
|
||||
local wnet = nw:get_wifinet(arg[2])
|
||||
local wnet = nw:get_wifinet(arg[1])
|
||||
if ifsection and wnet then
|
||||
ifsection.section = wnet.sid
|
||||
m.title = wnet:get_i18n()
|
||||
m.title = luci.util.pcdata(wnet:get_i18n())
|
||||
end
|
||||
end
|
||||
|
||||
nw.init(m.uci)
|
||||
|
||||
local wnet = nw:get_wifinet(arg[2])
|
||||
local wnet = nw:get_wifinet(arg[1])
|
||||
local wdev = wnet and wnet:get_device()
|
||||
|
||||
-- redirect to overview page if network does not exist anymore (e.g. after a revert)
|
||||
if not wnet then
|
||||
if not wnet or not wdev then
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
|
||||
return
|
||||
end
|
||||
|
||||
m.title = wnet:get_i18n()
|
||||
m.title = luci.util.pcdata(wnet:get_i18n())
|
||||
|
||||
|
||||
local iw = luci.sys.wifi.getiwinfo(arg[1])
|
||||
|
@ -55,7 +55,7 @@ local tx_powers = iw.txpwrlist or { }
|
|||
local hw_modes = iw.hwmodelist or { }
|
||||
|
||||
|
||||
s = m:section(NamedSection, arg[1], "wifi-device", translate("Device Configuration"))
|
||||
s = m:section(NamedSection, wdev:name(), "wifi-device", translate("Device Configuration"))
|
||||
s.addremove = false
|
||||
|
||||
s:tab("general", translate("General Setup"))
|
||||
|
@ -70,7 +70,7 @@ back.titleref = luci.dispatcher.build_url("admin", "network", "wireless")
|
|||
|
||||
st = s:taboption("general", DummyValue, "__status", translate("Status"))
|
||||
st.template = "admin_network/wifi_status"
|
||||
st.ifname = arg[2]
|
||||
st.ifname = arg[1]
|
||||
|
||||
en = s:taboption("general", Flag, "disabled", translate("Enable device"))
|
||||
en.enabled = "0"
|
||||
|
@ -82,11 +82,11 @@ function en.cfgvalue(self, section)
|
|||
end
|
||||
|
||||
|
||||
local hwtype = m:get(arg[1], "type")
|
||||
local htcaps = m:get(arg[1], "ht_capab") and true or false
|
||||
local hwtype = wdev:get("type")
|
||||
local htcaps = wdev:get("ht_capab") and true or false
|
||||
|
||||
-- NanoFoo
|
||||
local nsantenna = m:get(arg[1], "antenna")
|
||||
local nsantenna = wdev:get("antenna")
|
||||
|
||||
ch = s:taboption("general", Value, "channel", translate("Channel"))
|
||||
ch:value("auto", translate("auto"))
|
||||
|
@ -276,7 +276,7 @@ s = m:section(NamedSection, wnet.sid, "wifi-iface", translate("Interface Configu
|
|||
ifsection = s
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
s.defaults.device = arg[1]
|
||||
s.defaults.device = wdev:name()
|
||||
|
||||
s:tab("general", translate("General Setup"))
|
||||
s:tab("encryption", translate("Wireless Security"))
|
||||
|
|
|
@ -166,9 +166,7 @@ function newnet.parse(self, section)
|
|||
uci:save("network")
|
||||
uci:save("firewall")
|
||||
|
||||
luci.http.redirect(luci.dispatcher.build_url(
|
||||
"admin/network/wireless", wdev:name(), wnet:ifname()
|
||||
))
|
||||
luci.http.redirect(wnet:adminlink())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue