$Id$
]]--
m = Map("wireless", translate("wifi"), translate("a_w_devices1"))
+m:chain("network")
s = m:section(TypedSection, "wifi-device", translate("devices"))
end
mode = s:option(ListValue, "mode", translate("mode"))
-mode:value("ap", "Access Point")
-mode:value("adhoc", "Ad-Hoc")
-mode:value("sta", "Client")
+mode:value("ap", translate("m_w_ap"))
+mode:value("adhoc", translate("m_w_adhoc"))
+mode:value("sta", translate("m_w_client"))
function mode.write(self, section, value)
if value == "sta" then
- luci.model.uci.set("network", "wan", "type", "bridge")
- luci.model.uci.set("wireless", section, "network", "wan")
+ -- ToDo: Move this away
+ if not luci.model.uci.get("network", "wan") then
+ luci.model.uci.set("network", "wan", "proto", "none")
+ luci.model.uci.set("network", "wan", "ifname", " ")
+ end
+
+ local oldif = luci.model.uci.get("network", "wan", "ifname")
+ if oldif and oldif ~= " " then
+ luci.model.uci.set("network", "wan", "_ifname", oldif)
+ end
+ luci.model.uci.set("network", "wan", "ifname", " ")
+
+ self.map:set(section, "network", "wan")
else
- luci.model.uci.delete("network", "wan", "type")
- luci.model.uci.set("wireless", section, "network", "lan")
+ if luci.model.uci.get("network", "wan", "_ifname") then
+ luci.model.uci.set("network", "wan", "ifname", luci.model.uci.get("network", "wan", "_ifname"))
+ end
+ self.map:set(section, "network", "lan")
end
- luci.model.uci.save("network")
+
return ListValue.write(self, section, value)
end