diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-20 23:26:49 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-20 23:26:49 +0000 |
commit | 5d426cf4acd3c2fb70cd9939d3171d560e588c61 (patch) | |
tree | 4818db93c02f53b5dc42d83a99dd9cddf509aee2 /modules/admin-full | |
parent | b8c1487f6d109f589324c2c40d2b26c6058adffa (diff) |
modules/admin-full: rework wifi CBI maps
Diffstat (limited to 'modules/admin-full')
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua | 28 | ||||
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua | 4 |
2 files changed, 15 insertions, 17 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index 0cfc021764..fdeea99e9a 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -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")) @@ -633,7 +633,7 @@ wepslot.cfgvalue = function(self, section) if not slot or slot < 1 or slot > 4 then return 1 end - return slot + return slot end wepslot.write = function(self, section, value) @@ -648,7 +648,7 @@ for slot=1,4 do wepkey.datatype = "wepkey" wepkey.rmempty = true wepkey.password = true - + function wepkey.write(self, section, value) if value and (#value == 5 or #value == 13) then value = "s:" .. value diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua index 3d0d7550eb..5dd6393dc5 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi_add.lua @@ -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 |