From ef48c52384587df3668c72cc4c66ab772cdf32e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 25 Jun 2014 21:50:30 +0200 Subject: [PATCH] luci2: early wireless configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- .../luci2/template/network.wireless.htm | 1 + luci2/htdocs/luci2/view/network.wireless.js | 89 +++++++++++++++++++ luci2/share/menu.d/network.json | 6 ++ 3 files changed, 96 insertions(+) create mode 100644 luci2/htdocs/luci2/template/network.wireless.htm create mode 100644 luci2/htdocs/luci2/view/network.wireless.js diff --git a/luci2/htdocs/luci2/template/network.wireless.htm b/luci2/htdocs/luci2/template/network.wireless.htm new file mode 100644 index 0000000..a16cde4 --- /dev/null +++ b/luci2/htdocs/luci2/template/network.wireless.htm @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/luci2/htdocs/luci2/view/network.wireless.js b/luci2/htdocs/luci2/view/network.wireless.js new file mode 100644 index 0000000..ab006a0 --- /dev/null +++ b/luci2/htdocs/luci2/view/network.wireless.js @@ -0,0 +1,89 @@ +L.ui.view.extend({ + execute: function() { + var self = this; + + var m = new L.cbi.Map('wireless', { + caption: L.tr('Wireless configuration') + }); + + var s = m.section(L.cbi.TypedSection, 'wifi-device', { + caption: L.tr('WiFi devices'), + collabsible: true + }); + + (s.option(L.cbi.DummyValue, '__name', { + caption: L.tr('Device') + })).ucivalue = function(sid) + { + return sid; + }; + + s.option(L.cbi.CheckboxValue, 'disabled', { + caption: L.tr('Disabled') + }); + + s.option(L.cbi.InputValue, 'channel', { + caption: L.tr('Channel') + }); + + var s_1 = s.subsection(L.cbi.TypedSection, 'wifi-iface', { + caption: L.tr('Device interfaces'), + addremove: true, + add_caption: L.tr('Add interface …') + }); + + s_1.filter = function(section, parent_sid) { + return section.device == parent_sid; + }; + + s_1.add = function(name, sid) { + var iface = this.ownerMap.add('wireless', 'wifi-iface'); + this.ownerMap.set('wireless', iface, 'device', sid); + }; + + s_1.tab({ + id: 'general', + caption: L.tr('General Settings') + }); + + s_1.taboption('general', L.cbi.CheckboxValue, 'disabled', { + caption: L.tr('Disabled') + }); + + s_1.taboption('general', L.cbi.ListValue, 'mode', { + caption: L.tr('Mode'), + initial: 'ap' + }) + .value('ap', L.tr('Access Point')) + .value('sta', L.tr('Client')) + .value('adhoc', L.tr('Ad-Hoc')) + .value('wds', L.tr('WDS (Wireless Distribution System)')) + .value('monitor', L.tr('Monitor')) + .value('mesh', L.tr('Mesh')); + + s_1.taboption('general', L.cbi.InputValue, 'ssid', { + caption: 'SSID' + }); + + s_1.tab({ + id: 'security', + caption: L.tr('Security') + }); + + s_1.taboption('security', L.cbi.ListValue, 'encryption', { + caption: L.tr('Encryption'), + initial: 'none' + }) + .value('none', L.tr('No encryption')) + .value('psk', L.tr('WPA Personal (PSK)')) + .value('psk2', L.tr('WPA2 Personal (PSK)')) + .value('mixed-psk', L.tr('WPA/WPA2 Personal (PSK) mixed')); + + s_1.taboption('security', L.cbi.PasswordValue, 'key', { + caption: L.tr('Passphrase'), + optional: true + }); + + return m.insertInto('#map'); + } +}); diff --git a/luci2/share/menu.d/network.json b/luci2/share/menu.d/network.json index 25ffeee..99b826b 100644 --- a/luci2/share/menu.d/network.json +++ b/luci2/share/menu.d/network.json @@ -9,6 +9,12 @@ "view": "network/interfaces", "index": 10 }, + "network/wireless": { + "title": "Wireless", + "acls": [ "network" ], + "view": "network/wireless", + "index": 20 + }, "network/switch": { "title": "Switch", "acls": [ "network" ], -- 2.30.2