summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/model
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-09-22 02:43:38 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-09-22 02:43:38 +0000
commit659a8bdf014a617cd8f254e90d73bed07b4d1e15 (patch)
tree05d96ef88b231f907c7aef61d6fe81912f4113c9 /modules/admin-full/luasrc/model
parent0252fb9da783b8e831108dd7248ed747d8b33229 (diff)
modules/admin-full: implement per-wifi-iface disable option
Diffstat (limited to 'modules/admin-full/luasrc/model')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua31
1 files changed, 25 insertions, 6 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 cc534f5c93..d0ebba2155 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -47,6 +47,22 @@ if not wnet or not wdev then
return
end
+-- wireless toggle was requested, commit and reload page
+if m:formvalue("cbid.wireless.%s.__toggle" % wdev:name()) then
+ if wdev:get("disabled") == "1" or wnet:get("disabled") == "1" then
+ wnet:set("disabled", nil)
+ else
+ wnet:set("disabled", "1")
+ end
+ wdev:set("disabled", nil)
+
+ nw:commit("wireless")
+ luci.sys.call("(env -i /sbin/wifi down; env -i /sbin/wifi up) >/dev/null 2>/dev/null")
+
+ luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", arg[1]))
+ return
+end
+
m.title = luci.util.pcdata(wnet:get_i18n())
@@ -75,13 +91,16 @@ st = s:taboption("general", DummyValue, "__status", translate("Status"))
st.template = "admin_network/wifi_status"
st.ifname = arg[1]
-en = s:taboption("general", Flag, "disabled", translate("Enable device"))
-en.enabled = "0"
-en.disabled = "1"
-en.rmempty = false
+en = s:taboption("general", Button, "__toggle")
-function en.cfgvalue(self, section)
- return Flag.cfgvalue(self, section) or "0"
+if wdev:get("disabled") == "1" or wnet:get("disabled") == "1" then
+ en.title = translate("Wireless network is disabled")
+ en.inputtitle = translate("Enable")
+ en.inputstyle = "apply"
+else
+ en.title = translate("Wireless network is enabled")
+ en.inputtitle = translate("Disable")
+ en.inputstyle = "reset"
end