Minor bugfixes

Added possibility to add networks from Wifi page
This commit is contained in:
Steven Barth 2008-08-19 17:02:40 +00:00
parent bfcefb717f
commit a35337e6a1
7 changed files with 50 additions and 10 deletions

View file

@ -112,6 +112,7 @@ a_w_connlimit = [[Connection Limit]]
a_w_networks1 = [[You can run several wifi networks with one device. Be aware that there are certain hardware and driverspecific restrictions. Normally you can operate 1 Ad-Hoc or up to 3 Master-Mode and 1 Client-Mode network simultaneously.]]
a_w_netid = [[Network Name (<abbr title="Extended Service Set Identifier">ESSID</abbr>)]]
a_w_network1 = [[Add the Wifi network to physical network]]
a_w_netmanual = [[ - Create new Network - ]]
a_w_txpwr = [[Transmit Power]]
a_w_brcmburst = [[Broadcom Frameburst]]
a_w_athburst = [[Atheros Frameburst]]
@ -124,7 +125,7 @@ a_w_ap = [[Access Point]]
a_w_adhoc = [[Ad-Hoc]]
a_w_ahdemo = [[Pseudo Ad-Hoc (ahdemo)]]
a_w_client = [[Client]]
a_w_wds = [[<abbr title="Wireless Distribution System">WDS</abbr>]]
a_w_wds = [[WDS]]
a_w_monitor = [[Monitor]]
dhcp_dnsmasq_desc = [[Dnsmasq is a combined <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-Server and <abbr title="Domain Name System">DNS</abbr>-Forwarder for <abbr title="Network Address Translation">NAT</abbr> firewalls]]
dhcp_dnsmasq_domainneeded = [[Domain required]]

View file

@ -132,6 +132,7 @@ a_w_diversity = [[Diversität]]
a_w_hideessid = [[ESSID verstecken]]
a_w_netid = [[Netzkennung (ESSID)]]
a_w_network1 = [[WLAN-Netz zu Netzwerk hinzufügen]]
a_w_netmanual = [[ - Neues Netzwerk erstellen - ]]
a_w_networks1 = [[Pro WLAN-Gerät können mehrere Netze bereitgestellt werden.
Es sollte beachtet werden, dass es hardware- / treiberspezifische Einschränkungen gibt.
So kann pro WLAN-Gerät in der Regel entweder 1 Ad-Hoc-Zugang ODER bis zu 3 Access-Point und 1 Client-Zugang

View file

@ -98,7 +98,11 @@ function cbi_bind(obj, type, callback, mode) {
function cbi_combobox(id, values, def, man) {
var obj = document.getElementById(id)
var sel = document.createElement("select");
obj.parentNode.appendChild(sel);
if (obj.nextSibling) {
obj.parentNode.insertBefore(sel, obj.nextSibling);
} else {
obj.parentNode.appendChild(sel);
}
if (!values[obj.value]) {
if (obj.value == "") {

View file

@ -26,7 +26,12 @@ $Id$
-%>
}, '<%- if not self.rmempty and not self.optional then -%>
<%-:cbi_select-%>
<%- end -%>', '<%:cbi_manual%>');
<%- end -%>', '
<%- if self.combobox_manual then -%>
<%-=self.combobox_manual-%>
<%- else -%>
<%-:cbi_manual-%>
<%- end -%>');
</script>
<% end -%>
<%+cbi/valuefooter%>

View file

@ -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, ", ")

View file

@ -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"))

View file

@ -16,13 +16,13 @@ require("luci.tools.webadmin")
require("luci.sys")
luci.model.uci.load_state("network")
local wireless = luci.model.uci.get_all("network")
local network = luci.model.uci.get_all("network")
luci.model.uci.unload("network")
local netstat = luci.sys.net.deviceinfo()
local ifaces = {}
for k, v in pairs(wireless) do
for k, v in pairs(network) do
if v[".type"] == "interface" and k ~= "loopback" then
table.insert(ifaces, v)
end