Changeset 5427
- Timestamp:
- 10/27/09 22:40:12 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
r5399 r5427 14 14 15 15 local wa = require "luci.tools.webadmin" 16 local nw = require "luci.model.network" 16 17 local fs = require "nixio.fs" 17 18 18 19 arg[1] = arg[1] or "" 20 arg[2] = arg[2] or "" 19 21 20 22 m = Map("wireless", translate("networks"), translate("a_w_networks1")) 21 23 m:chain("network") 24 nw.init(m.uci) 22 25 23 26 local iw = nil … … 199 202 ----------------------- Interface ----------------------- 200 203 201 s = m:section( TypedSection, "wifi-iface", translate("interfaces"))202 s.addremove = (iw and iw.mbssid_support) and true orfalse204 s = m:section(NamedSection, arg[2], "wifi-iface", translate("interfaces")) 205 s.addremove = false 203 206 s.anonymous = true 204 s:depends("device", arg[1])205 207 s.defaults.device = arg[1] 206 208 … … 222 224 network = s:taboption("general", Value, "network", translate("network"), translate("a_w_network1")) 223 225 network.rmempty = true 224 network:value("") 225 network.combobox_manual = translate("a_w_netmanual") 226 wa.cbi_add_networks(network) 226 network.template = "cbi/network_netlist" 227 network.widget = "radio" 227 228 228 229 function network.write(self, section, value) 229 if not m.uci:get("network", value) then 230 -- avoid "value not defined in enum" because network is not known yet 231 s.override_scheme = true 232 233 m:chain("network") 234 m.uci:set("network", value, "interface") 235 Value.write(self, section, value) 236 else 237 if m.uci:get("network", value) == "interface" then 238 Value.write(self, section, value) 230 local i = nw:get_interface(section) 231 if i then 232 if value == '-' then 233 value = m:formvalue(self:cbid(section) .. ".newnet") 234 if value and #value > 0 then 235 local n = nw:add_network(value, {type="bridge", proto="none"}) 236 if n then n:add_interface(i) end 237 else 238 local n = i:get_network() 239 if n then n:del_interface(i) end 240 end 241 else 242 local n = nw:get_network(value) 243 if n then 244 n:type("bridge") 245 n:add_interface(i) 246 end 239 247 end 240 248 end 241 249 end 242 243 250 244 251 -------------------- MAC80211 Interface ----------------------
