luci2.wireless: support condensed output in formatEncryption()
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 13 Feb 2015 22:50:15 +0000 (23:50 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 13 Feb 2015 22:50:15 +0000 (23:50 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
luci2/htdocs/luci2/wireless.js

index c724f85b4c555ab3abf721d5784838f4f5f2058e..4d7892a4519c7a278a363a6cd555311e07a8f938 100644 (file)
@@ -129,7 +129,7 @@ Class.extend({
                });
        },
 
-       formatEncryption: function(enc)
+       formatEncryption: function(enc, condensed)
        {
                var format_list = function(l, s)
                {
@@ -144,7 +144,9 @@ Class.extend({
 
                if (enc.wep)
                {
-                       if (enc.wep.length == 2)
+                       if (condensed)
+                               return L.tr('WEP');
+                       else if (enc.wep.length == 2)
                                return L.tr('WEP Open/Shared') + ' (%s)'.format(format_list(enc.ciphers, ', '));
                        else if (enc.wep[0] == 'shared')
                                return L.tr('WEP Shared Auth') + ' (%s)'.format(format_list(enc.ciphers, ', '));
@@ -153,7 +155,11 @@ Class.extend({
                }
                else if (enc.wpa)
                {
-                       if (enc.wpa.length == 2)
+                       if (condensed && enc.wpa.length == 2)
+                               return L.tr('WPA mixed');
+                       else if (condensed)
+                               return (enc.wpa[0] == 2) ? L.tr('WPA2') : L.tr('WPA');
+                       else if (enc.wpa.length == 2)
                                return L.tr('mixed WPA/WPA2') + ' %s (%s)'.format(
                                        format_list(enc.authentication, '/'),
                                        format_list(enc.ciphers, ', ')