summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/view/admin_network
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-19 04:08:15 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-19 04:08:15 +0000
commit7ae988f34299f882f5e4c7bb55fdbba3d09dd162 (patch)
tree799585a24edfca662a972bad22712d1351f69600 /modules/admin-full/luasrc/view/admin_network
parent1a3533cb8693ef81e9ce9e638e4fb24fa67b67fd (diff)
modules/admin-full: rework wifi configuration
Diffstat (limited to 'modules/admin-full/luasrc/view/admin_network')
-rw-r--r--modules/admin-full/luasrc/view/admin_network/wifi_status.htm77
1 files changed, 77 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/admin-full/luasrc/view/admin_network/wifi_status.htm
new file mode 100644
index 0000000000..044549d529
--- /dev/null
+++ b/modules/admin-full/luasrc/view/admin_network/wifi_status.htm
@@ -0,0 +1,77 @@
+<%+cbi/valueheader%>
+
+<script type="text/javascript"><![CDATA[
+ var iwxhr = new XHR();
+ window.setInterval(function() {
+ iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "wireless_status", self.ifname)%>', null,
+ function(x)
+ {
+ var iw = x.responseText ? eval('(' + x.responseText + ')') : null;
+ if (iw)
+ {
+ var is_assoc = (iw.bssid && iw.channel);
+ var p = (100 / iw.quality_max * iw.quality);
+ var q = is_assoc ? p : -1;
+
+ var icon;
+ if (q < 0)
+ icon = "<%=resource%>/icons/signal-none.png";
+ else if (q == 0)
+ icon = "<%=resource%>/icons/signal-0.png";
+ else if (q < 25)
+ icon = "<%=resource%>/icons/signal-0-25.png";
+ else if (q < 50)
+ icon = "<%=resource%>/icons/signal-25-50.png";
+ else if (q < 75)
+ icon = "<%=resource%>/icons/signal-50-75.png";
+ else
+ icon = "<%=resource%>/icons/signal-75-100.png";
+
+ var s = document.getElementById('<%=self.option%>-iw-signal');
+ if (s)
+ s.innerHTML = String.format(
+ '<img src="%s" title="Signal: %d dBm / Noise: %d dBm" /><br />' +
+ '<small>%d%%</small>', icon, iw.signal, iw.noise, p
+ );
+
+ var d = document.getElementById('<%=self.option%>-iw-description');
+ if (d && is_assoc)
+ d.innerHTML = String.format(
+ '<strong><%:Mode%>:</strong> %s |' +
+ '<strong><%:SSID%>:</strong> %s<br />' +
+ '<strong><%:BSSID%>:</strong> %s |' +
+ '<strong><%:Encryption%>:</strong> %s<br />' +
+ '<strong><%:Channel%>:</strong> %d (%.3f GHz) |' +
+ '<strong><%:Tx-Power%>:</strong> %d dBm<br />' +
+ '<strong><%:Signal%>:</strong> %d dBm |' +
+ '<strong><%:Noise%>:</strong> %d dBm<br />' +
+ '<strong><%:Bit Rate%>:</strong> %.1f MBit/s |' +
+ '<strong><%:Country%>:</strong> %s',
+ iw.mode, iw.ssid, iw.bssid,
+ iw.encryption ? iw.encryption.description : '<%:None%>',
+ iw.channel, iw.frequency ? (iw.frequency / 1000) : 0,
+ iw.txpower, iw.signal, iw.noise,
+ iw.bitrate ? (iw.bitrate / 1000) : 0, iw.country
+ );
+ else if (d)
+ d.innerHTML = '<%:Wireless is disabled or not associated%>';
+ }
+ }
+ )
+ }, 5000);
+]]></script>
+
+<table>
+ <tr class="cbi-section-table">
+ <td></td>
+ <td class="cbi-value-field" style="width:16px; padding:3px" id="<%=self.option%>-iw-signal">
+ <img src="<%=resource%>/icons/signal-none.png" title="<%:Not associated%>" /><br />
+ <small>0%</small>
+ </td>
+ <td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-iw-description">
+ <em><%:Collecting data...%></em>
+ </td>
+ </tr>
+</table>
+
+<%+cbi/valuefooter%>