summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/controller
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-10-29 02:23:58 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-10-29 02:23:58 +0000
commit91856a9242125388336d88140c840938704e9053 (patch)
tree99b0a75d8643e2dd9ad93f3fc582cb932b3e47b8 /modules/admin-full/luasrc/controller
parent2a1f1a1d7beacb1cc69c3259139c2ca2ca750c92 (diff)
modules/admin-full: support deleting wireless networks and fix wireless join
Diffstat (limited to 'modules/admin-full/luasrc/controller')
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua23
1 files changed, 20 insertions, 3 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua
index 28ee82e65..bb880685a 100644
--- a/modules/admin-full/luasrc/controller/admin/network.lua
+++ b/modules/admin-full/luasrc/controller/admin/network.lua
@@ -47,6 +47,10 @@ function index()
page.i18n = "wifi"
page.leaf = true
+ local page = entry({"admin", "network", "wireless_delete"}, call("wifi_delete"), nil, 16)
+ page.i18n = "wifi"
+ page.leaf = true
+
local page = entry({"admin", "network", "network"}, arcombine(cbi("admin_network/network"), cbi("admin_network/ifaces")), i18n("interfaces", "Schnittstellen"), 10)
page.leaf = true
page.subindex = true
@@ -130,12 +134,14 @@ function wifi_join()
ssid = ssid
}
- if attach_intf and uci:get("network", attach_intf, "ifname") then
+ if attach_intf and uci:get("network", attach_intf) == "interface" then
-- target network already has a interface, make it a bridge
uci:set("network", attach_intf, "type", "bridge")
uci:save("network")
uci:commit("network")
+ wificonf.network = attach_intf
+
if autoconnect then
require "luci.sys".call("/sbin/ifup " .. attach_intf)
end
@@ -153,7 +159,7 @@ function wifi_join()
wificonf.key = param("key")
end
- uci:section("wireless", "wifi-iface", nil, wificonf)
+ local s = uci:section("wireless", "wifi-iface", nil, wificonf)
uci:delete("wireless", dev, "disabled")
uci:set("wireless", dev, "channel", channel)
@@ -164,7 +170,7 @@ function wifi_join()
require "luci.sys".call("/sbin/wifi")
end
- luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", dev))
+ luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
elseif cancel then
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless_join?device=" .. dev))
else
@@ -174,3 +180,14 @@ function wifi_join()
luci.template.render("admin_network/wifi_join")
end
end
+
+function wifi_delete(network)
+ local uci = require "luci.model.uci".cursor()
+ local wlm = require "luci.model.wireless"
+
+ wlm.init(uci)
+ wlm:del_network(network)
+
+ uci:save("wireless")
+ luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
+end