summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/admin-full/luasrc/controller/admin/status.lua1
-rw-r--r--modules/admin-full/luasrc/view/admin_status/iwscan.htm52
-rw-r--r--modules/admin-mini/luasrc/controller/mini/network.lua1
-rw-r--r--modules/admin-mini/luasrc/controller/mini/wifi.lua24
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/index.lua5
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/wifi.lua106
-rw-r--r--modules/admin-mini/luasrc/view/mini/index2.htm54
-rw-r--r--modules/admin-mini/luasrc/view/mini/iwscan.htm52
8 files changed, 108 insertions, 187 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/status.lua b/modules/admin-full/luasrc/controller/admin/status.lua
index 81686d906d..0eb3c19646 100644
--- a/modules/admin-full/luasrc/controller/admin/status.lua
+++ b/modules/admin-full/luasrc/controller/admin/status.lua
@@ -19,7 +19,6 @@ function index()
entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20)
entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll"))
- entry({"admin", "status", "iwscan"}, template("admin_status/iwscan"), i18n("wlanscan"), 20)
end
function action_syslog()
diff --git a/modules/admin-full/luasrc/view/admin_status/iwscan.htm b/modules/admin-full/luasrc/view/admin_status/iwscan.htm
deleted file mode 100644
index c0290d086b..0000000000
--- a/modules/admin-full/luasrc/view/admin_status/iwscan.htm
+++ /dev/null
@@ -1,52 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-<%+header%>
-<h1><%:iwscan%></h1>
-<p><%:iwscan1%></p>
-
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:interface%></th>
-<th>ESSID</th>
-<th>BSSID</th>
-<th><%:mode%></th>
-<th><%:channel%></th>
-<th><%:iwscan_encr%></th>
-<th><%:iwscan_link%></th>
-<th><%:iwscan_signal%></th>
-<th><%:iwscan_noise%></th>
-</tr>
-<%for iface, cells in pairs(luci.sys.wifi.iwscan()) do
- for i, cell in ipairs(cells) do
-%>
-<tr>
-<td><%=iface%></td>
-<td><%=luci.util.pcdata(cell.ESSID)%></td>
-<td><%=cell.Address%></td>
-<td><%=cell.Mode%></td>
-<td><%=(cell.Channel or cell.Frequency or "")%></td>
-<td><%=cell["Encryption key"]%></td>
-<td><%=cell.Quality%></td>
-<td><%=cell["Signal level"]%></td>
-<td><%=cell["Noise level"]%></td>
-</tr>
-<%
- end
-end
-%>
-</table>
-<br />
-<%+footer%> \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/controller/mini/network.lua b/modules/admin-mini/luasrc/controller/mini/network.lua
index 5bd587daf7..1ea6dc52cb 100644
--- a/modules/admin-mini/luasrc/controller/mini/network.lua
+++ b/modules/admin-mini/luasrc/controller/mini/network.lua
@@ -21,5 +21,6 @@ function index()
entry({"mini", "network"}, alias("mini", "network", "index"), i18n("network"), 20)
entry({"mini", "network", "index"}, cbi("mini/network"), i18n("general"), 1)
+ entry({"mini", "network", "wifi"}, cbi("mini/wifi"), i18n("wifi"), 10)
entry({"mini", "network", "dhcp"}, cbi("mini/dhcp"), "DHCP", 20)
end \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/controller/mini/wifi.lua b/modules/admin-mini/luasrc/controller/mini/wifi.lua
deleted file mode 100644
index e879a2c7e6..0000000000
--- a/modules/admin-mini/luasrc/controller/mini/wifi.lua
+++ /dev/null
@@ -1,24 +0,0 @@
---[[
-LuCI - Lua Configuration Interface
-
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-]]--
-module("luci.controller.mini.wifi", package.seeall)
-
-function index()
- luci.i18n.loadc("admin-core")
- local i18n = luci.i18n.translate
-
- entry({"mini", "wifi"}, alias("mini", "wifi", "index"), i18n("wifi"), 30)
- entry({"mini", "wifi", "index"}, cbi("mini/wifi"), i18n("general"), 1)
- entry({"mini", "wifi", "scan"}, template("mini/iwscan"), i18n("wlanscan"), 10)
-end \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/index.lua b/modules/admin-mini/luasrc/model/cbi/mini/index.lua
index 5ce9dfcd99..950a9319a7 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/index.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/index.lua
@@ -99,7 +99,4 @@ function errors.cfgvalue(self, section)
return string.format("%s / %s", tx, rx)
end
-
-
-w2 = Template("mini/index2")
-return w, f, m, w2 \ No newline at end of file
+return w, f, m \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
index 2890a78a3c..3abceba59a 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
@@ -12,15 +12,121 @@ You may obtain a copy of the License at
$Id$
]]--
+
+-- Data init --
+
+luci.model.uci.load_state("wireless")
+local wireless = luci.model.uci.get_all("wireless")
+luci.model.uci.unload("wireless")
+
+local wifidata = luci.sys.wifi.getiwconfig()
+local ifaces = {}
+
+for k, v in pairs(wireless) do
+ if v[".type"] == "wifi-iface" then
+ table.insert(ifaces, v)
+ end
+end
+
+
+-- Main Map --
+
m = Map("wireless", translate("wifi"), translate("a_w_devices1"))
m:chain("network")
+
+-- Status Table --
+s = m:section(Table, ifaces, translate("networks"))
+
+link = s:option(DummyValue, "_link", translate("link"))
+function link.cfgvalue(self, section)
+ local ifname = self.map:get(section, "ifname")
+ return wifidata[ifname] and wifidata[ifname]["Link Quality"] or "-"
+end
+
+essid = s:option(DummyValue, "ssid", "ESSID")
+
+bssid = s:option(DummyValue, "_bsiid", "BSSID")
+function bssid.cfgvalue(self, section)
+ local ifname = self.map:get(section, "ifname")
+ return (wifidata[ifname] and (wifidata[ifname].Cell
+ or wifidata[ifname]["Access Point"])) or "-"
+end
+
+channel = s:option(DummyValue, "channel", translate("channel"))
+function channel.cfgvalue(self, section)
+ return wireless[self.map:get(section, "device")].channel
+end
+
+protocol = s:option(DummyValue, "_mode", translate("protocol"))
+function protocol.cfgvalue(self, section)
+ return "802." .. wireless[self.map:get(section, "device")].mode
+end
+
+mode = s:option(DummyValue, "mode", translate("mode"))
+encryption = s:option(DummyValue, "encryption", translate("iwscan_encr"))
+
+power = s:option(DummyValue, "_power", translate("power"))
+function power.cfgvalue(self, section)
+ local ifname = self.map:get(section, "ifname")
+ return wifidata[ifname] and wifidata[ifname]["Tx-Power"] or "-"
+end
+
+scan = s:option(Button, "_scan", translate("scan"))
+scan.inputstyle = "find"
+
+function scan.cfgvalue(self, section)
+ return self.map:get(section, "ifname") or false
+end
+
+-- WLAN-Scan-Table --
+
+t2 = m:section(Table, {}, translate("iwscan"), translate("iwscan1"))
+
+function scan.write(self, section)
+ t2.render = t2._render
+ local ifname = self.map:get(section, "ifname")
+ luci.util.update(t2.data, luci.sys.wifi.iwscan(ifname))
+end
+
+t2._render = t2.render
+t2.render = function() end
+
+t2:option(DummyValue, "Quality", translate("iwscan_link"))
+essid = t2:option(DummyValue, "ESSID", "ESSID")
+function essid.cfgvalue(self, section)
+ return luci.util.pcdata(self.map:get(section, "ESSID"))
+end
+
+t2:option(DummyValue, "Address", "BSSID")
+t2:option(DummyValue, "Mode", translate("mode"))
+chan = t2:option(DummyValue, "channel", translate("channel"))
+function chan.cfgvalue(self, section)
+ return self.map:get(section, "Channel")
+ or self.map:get(section, "Frequency")
+ or "-"
+end
+
+t2:option(DummyValue, "Encryption key", translate("iwscan_encr"))
+
+t2:option(DummyValue, "Signal level", translate("iwscan_signal"))
+
+t2:option(DummyValue, "Noise level", translate("iwscan_noise"))
+
+
+-- Config Section --
+
s = m:section(TypedSection, "wifi-device", translate("devices"))
en = s:option(Flag, "disabled", translate("enable"))
en.enabled = "0"
en.disabled = "1"
+function en.cfgvalue(self, section)
+ return Flag.cfgvalue(self, section) or "0"
+end
+
+
mode = s:option(ListValue, "mode", translate("mode"))
mode:value("", "standard")
mode:value("11b", "802.11b")
diff --git a/modules/admin-mini/luasrc/view/mini/index2.htm b/modules/admin-mini/luasrc/view/mini/index2.htm
deleted file mode 100644
index 741ef7c466..0000000000
--- a/modules/admin-mini/luasrc/view/mini/index2.htm
+++ /dev/null
@@ -1,54 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-<%
-local iwconfig = luci.sys.wifi.getiwconfig()
-if next(iwconfig) then
-%>
-<h2><%:wifi%></h2>
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:name%></th>
-<th><%:protocol%></th>
-<th><%:frequency%></th>
-<th><%:power%></th>
-<th><%:bitrate%></th>
-<th><%:rts%></th>
-<th><%:frag%></th>
-<th><%:link%></th>
-<th><%:signal%></th>
-<th><%:noise%></th>
-</tr>
-<%for k, v in pairs(iwconfig) do
-%>
-<tr>
-<td rowspan="2"><%=k%></td>
-<td><%=v[1]%></td>
-<td><%=v.Frequency%></td>
-<td><%=v["Tx-Power"]%></td>
-<td><%=v["Bit Rate"]%></td>
-<td><%=v["RTS thr"]%></td>
-<td><%=v["Fragment thr"]%></td>
-<td><%=v["Link Quality"]%></td>
-<td><%=v["Signal level"]%></td>
-<td><%=v["Noise level"]%></td>
-</tr>
-<tr>
-<td colspan="4"><strong>ESSID: </strong><%=v.ESSID%></td>
-<td colspan="5"><strong>BSSID: </strong><%=(v.Cell or v["Access Point"])%></td>
-</tr>
-<%end%>
-</table>
-<%-end%> \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/view/mini/iwscan.htm b/modules/admin-mini/luasrc/view/mini/iwscan.htm
deleted file mode 100644
index c0290d086b..0000000000
--- a/modules/admin-mini/luasrc/view/mini/iwscan.htm
+++ /dev/null
@@ -1,52 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-<%+header%>
-<h1><%:iwscan%></h1>
-<p><%:iwscan1%></p>
-
-<br />
-<table cellspacing="0" cellpadding="6" class="smalltext">
-<tr>
-<th><%:interface%></th>
-<th>ESSID</th>
-<th>BSSID</th>
-<th><%:mode%></th>
-<th><%:channel%></th>
-<th><%:iwscan_encr%></th>
-<th><%:iwscan_link%></th>
-<th><%:iwscan_signal%></th>
-<th><%:iwscan_noise%></th>
-</tr>
-<%for iface, cells in pairs(luci.sys.wifi.iwscan()) do
- for i, cell in ipairs(cells) do
-%>
-<tr>
-<td><%=iface%></td>
-<td><%=luci.util.pcdata(cell.ESSID)%></td>
-<td><%=cell.Address%></td>
-<td><%=cell.Mode%></td>
-<td><%=(cell.Channel or cell.Frequency or "")%></td>
-<td><%=cell["Encryption key"]%></td>
-<td><%=cell.Quality%></td>
-<td><%=cell["Signal level"]%></td>
-<td><%=cell["Noise level"]%></td>
-</tr>
-<%
- end
-end
-%>
-</table>
-<br />
-<%+footer%> \ No newline at end of file