c07511644d28bf73c028660870923da663260e5d
[bcm963xx.git] / userapps / broadcom / cfm / html / wlcfgkey.html
1 <html>
2    <head>
3       <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
4       <link rel='stylesheet' href='stylemain.css' type='text/css'>
5          <link rel='stylesheet' href='colors.css' type='text/css'>
6             <script language='javascript' src='util.js'></script>
7             <script language='javascript'>
8 <!-- hide
9 var enbl = '<%ejGetWl(wlEnbl)%>';
10 var bit = '<%ejGetWl(wlKeyBit)%>';
11 var keyIdx = '<%ejGetWl(wlKeyIndex)%>';
12 var keys = new Array( "<%ejGetWl(wlKey1)%>", "<%ejGetWl(wlKey2)%>",
13                       "<%ejGetWl(wlKey3)%>", "<%ejGetWl(wlKey4)%>" );
14 var mode = '<%ejGetWl(wlAuthMode)%>';
15 var wep = '<%ejGetWl(wlWep)%>';
16 var auth = '<%ejGetWl(wlAuth)%>';
17
18 function frmLoad() {
19    with ( document.forms[0] ) {
20       for ( i = 0; i < 4; i++ ) {
21          wlKeys[i].value = keys[i];
22       }
23       if (mode != "open" && mode != "shared") {
24          wlKeys[0].disabled = 1;
25          wlKeys[3].disabled = 1;
26          wlKeyIndex[0] = new Option("2", "2");
27          wlKeyIndex[1] = new Option("3", "3");
28          if (keyIdx != "2" && keyIdx != "3") {
29             wlKeyIndex.selectedIndex = 0;
30          }
31          else {
32             wlKeyIndex.selectedIndex = parseInt(keyIdx) - 2;
33          }
34       }
35       else {
36          wlKeyIndex[0] = new Option("1", "1");
37          wlKeyIndex[1] = new Option("2", "2");
38          wlKeyIndex[2] = new Option("3", "3");
39          wlKeyIndex[3] = new Option("4", "4");
40          wlKeyIndex.selectedIndex = parseInt(keyIdx) - 1;
41       }
42    }
43 }
44
45 function btnApply() {
46    if ( enbl == '0' ) {
47       alert('Cannot apply the change since wireless is currently disabled.');
48       return;
49    }
50    
51    with ( document.forms[0] ) {
52       var idx = wlKeyIndex.selectedIndex;
53       var keyIndex = wlKeyIndex.options[idx].value;
54       var num = parseInt(keyIndex-1);
55       if ( wlKeys[num].value == '' ) {
56          if (!((wep == 'enabled') && (mode == 'radius'))) {
57             alert('Cannot choose key that has empty value.');
58             return;
59          }
60       }
61       
62       var i, val;
63       for ( i = 0; i < 4; i++ ) {
64          val = wlKeys[i].value;
65          if ( val != '' ) {
66             if ( bit == '0' ) {
67                if ( isValidKey(val, 13) == false ) {
68                   alert('Key "' + val + '" is not a valid 128-bit encryption key.');
69                   return;
70                }
71             } else {
72                if ( isValidKey(val, 5) == false ) {
73                   alert('Key "' + val + '" is not a valid 64-bit encryption key.');
74                   return;
75                }
76             }
77          }
78       }
79
80       var loc = 'wlsecurity.wl?';
81       loc += 'wlKeyIndex=' + keyIndex;
82       loc += '&wlKey1=' + encodeUrl(wlKeys[0].value);
83       loc += '&wlKey2=' + encodeUrl(wlKeys[1].value);
84       loc += '&wlKey3=' + encodeUrl(wlKeys[2].value);
85       loc += '&wlKey4=' + encodeUrl(wlKeys[3].value);
86
87       var code = 'location="' + loc + '"';
88       eval(code);
89    }
90 }
91
92 // done hiding -->
93       </script>
94    </head>
95    <body onLoad='frmLoad()'>
96       <blockquote>
97          <form onSubmit='return false'>
98             <b>Wireless Settings -- Encryption Keys</b><br>
99             <br>
100             <script language='javascript'>
101 <!-- hide
102 if ( bit == '0' )
103    document.writeln("Enter 13 ASCII characters or 26 hexadecimal digits for 128-bit encryption keys.");
104 else
105    document.writeln("Enter 5 ASCII characters or 10 hexadecimal digits for 64-bit encryption keys.");
106 // done hiding -->
107             </script>
108             <br>
109             <br>
110             <table border='0' cellpadding='4' cellspacing='0'>
111                <script language='javascript'>
112 <!-- hide
113 if ( bit == '0' ) {
114    document.writeln("  <tr>");
115    document.writeln("    <td width='120'>Network Key 1:</td>");
116    document.writeln("    <td><input type='text' name='wlKeys' size='30' maxlength=26></td>");
117    document.writeln("  </tr>");
118    document.writeln("  <tr>");
119    document.writeln("    <td>Network Key 2:</td>");
120    document.writeln("    <td><input type='text' name='wlKeys' size='30' maxlength=26></td>");
121    document.writeln("  </tr>");
122    document.writeln("  <tr>");
123    document.writeln("    <td>Network Key 3:</td>");
124    document.writeln("    <td><input type='text' name='wlKeys' size='30' maxlength=26></td>");
125    document.writeln("  </tr>");
126    document.writeln("  <tr>");
127    document.writeln("    <td>Network Key 4:</td>");
128    document.writeln("    <td><input type='text' name='wlKeys' size='30' maxlength=26></td>");
129    document.writeln("  </tr>");
130 } else {
131    document.writeln("  <tr>");
132    document.writeln("    <td width='120'>Network Key 1:</td>");
133    document.writeln("    <td><input type='text' name='wlKeys' maxlength=10></td>");
134    document.writeln("  </tr>");
135    document.writeln("  <tr>");
136    document.writeln("    <td>Network Key 2:</td>");
137    document.writeln("    <td><input type='text' name='wlKeys' maxlength=10></td>");
138    document.writeln("  </tr>");
139    document.writeln("  <tr>");
140    document.writeln("    <td>Network Key 3:</td>");
141    document.writeln("    <td><input type='text' name='wlKeys' maxlength=10></td>");
142    document.writeln("  </tr>");
143    document.writeln("  <tr>");
144    document.writeln("    <td>Network Key 4:</td>");
145    document.writeln("    <td><input type='text' name='wlKeys' maxlength=10></td>");
146    document.writeln("  </tr>");
147 }
148 // done hiding -->
149                </script>
150                <tr>
151                   <td>Current Network Key:</td>
152                   <td><select name='wlKeyIndex' size='1'>
153                      </select></td>
154                </tr>
155             </table>
156             <br>
157             <center>
158                <input type='button' onClick='btnApply()' value='Save/Apply'>
159             </center>
160          </form>
161       </blockquote>
162    </body>
163 </html>