summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-19 17:02:40 +0000
committerSteven Barth <steven@midlink.org>2008-08-19 17:02:40 +0000
commita35337e6a150412a5a7be8b4fe06eaba04dc4fa5 (patch)
treeb65276921c9cbeecad49f85bc513f2c9cf2db933 /modules/admin-full
parentbfcefb717f6f23d8382bd7b2a3b877c3e54cc29a (diff)
Minor bugfixes
Added possibility to add networks from Wifi page
Diffstat (limited to 'modules/admin-full')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/network.lua23
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua16
2 files changed, 34 insertions, 5 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
index c0f66e965..1f10ac829 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
@@ -15,9 +15,12 @@ $Id$
require("luci.sys")
require("luci.tools.webadmin")
+luci.model.uci.load_state("network")
+local netstate = luci.model.uci.get_all("network")
+luci.model.uci.unload("network")
+
m = Map("network", translate("interfaces"))
-m.stateful = true
local created
local netstat = luci.sys.net.deviceinfo()
@@ -45,12 +48,25 @@ function s.parse(self, ...)
end
up = s:option(Flag, "up")
+function up.cfgvalue(self, section)
+ return netstate[section] and netstate[section].up or "0"
+end
+
function up.write(self, section, value)
- local call = value == "1" and "ifup" or "ifdown"
- os.execute(call .. " " .. section)
+ local call
+ if value == "1" then
+ call = "ifup"
+ elseif value == "0" then
+ call = "ifdown"
+ end
+ os.execute(call .. " " .. section .. " >/dev/null 2>&1")
end
ifname = s:option(DummyValue, "ifname", translate("device"))
+function ifname.cfgvalue(self, section)
+ return netstate[section] and netstate[section].ifname
+end
+
ifname.titleref = luci.dispatcher.build_url("admin", "network", "vlan")
if luci.model.uci.load("firewall") then
@@ -74,7 +90,6 @@ end
ipaddr = s:option(DummyValue, "ipaddr", translate("addresses"))
-
function ipaddr.cfgvalue(self, section)
local addr = luci.tools.webadmin.network_get_addresses(section)
return table.concat(addr, ", ")
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 64a492879..3717c5b5b 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -66,10 +66,24 @@ s.defaults.device = arg[1]
s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
-network = s:option(ListValue, "network", translate("network"), translate("a_w_network1"))
+network = s:option(Value, "network", translate("network"), translate("a_w_network1"))
+network.rmempty = true
network:value("")
+network.combobox_manual = translate("a_w_netmanual")
luci.tools.webadmin.cbi_add_networks(network)
+function network.write(self, section, value)
+ if not luci.model.uci.get("network", value) then
+ m:chain("network")
+ luci.model.uci.set("network", value, "interface")
+ Value.write(self, section, value)
+ else
+ if luci.model.uci.get("network", value) == "interface" then
+ Value.write(self, section, value)
+ end
+ end
+end
+
mode = s:option(ListValue, "mode", translate("mode"))
mode:value("ap", translate("a_w_ap"))
mode:value("adhoc", translate("a_w_adhoc"))