wireless filter limit increased to 250
[tomato.git] / release / src / router / www / basic-wfilter.asp
blob63539cd8a1002756e24d19648e9c2ccd93f48485
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Basic: Wireless Filter</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <style type='text/css'>
22 #sm-grid {
23 width: 80%;
25 #sm-grid .co1 {
26 width: 30%;
28 #sm-grid .co2 {
29 width: 70%;
31 </style>
33 <script type='text/javascript' src='debug.js'></script>
35 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
36 <script type='text/javascript'>
38 // <% nvram("wl_macmode,wl_maclist,macnames"); %>
40 var smg = new TomatoGrid();
42 smg.verifyFields = function(row, quiet) {
43 var f;
44 f = fields.getAll(row);
46 return v_mac(f[0], quiet) && v_nodelim(f[1], quiet, 'Description', 1);
49 smg.resetNewEditor = function() {
50 var f, c, n;
52 f = fields.getAll(this.newEditor);
53 ferror.clearAll(f);
55 if ((c = cookie.get('addmac')) != null) {
56 cookie.set('addmac', '', 0);
57 c = c.split(',');
58 if (c.length == 2) {
59 f[0].value = c[0];
60 f[1].value = c[1];
61 return;
65 f[0].value = '00:00:00:00:00:00';
66 f[1].value = '';
69 smg.setup = function() {
70 var i, i, m, s, t, n;
71 var macs, names;
73 this.init('sm-grid', 'sort', 250, [
74 { type: 'text', maxlen: 17 },
75 { type: 'text', maxlen: 48 }
76 ]);
77 this.headerSet(['MAC Address', 'Description']);
78 macs = nvram.wl_maclist.split(/\s+/);
79 names = nvram.macnames.split('>');
80 for (i = 0; i < macs.length; ++i) {
81 m = fixMAC(macs[i]);
82 if ((m) && (!isMAC0(m))) {
83 s = m.replace(/:/g, '');
84 t = '';
85 for (j = 0; j < names.length; ++j) {
86 n = names[j].split('<');
87 if ((n.length == 2) && (n[0] == s)) {
88 t = n[1];
89 break;
92 this.insertData(-1, [m, t]);
95 this.sort(0);
96 this.showNewEditor();
97 this.resetNewEditor();
100 function save()
102 var fom;
103 var d, i, macs, names, ma, na;
104 var u;
106 if (smg.isEditing()) return;
108 fom = E('_fom');
110 macs = [];
111 names = [];
112 d = smg.getAllData();
113 for (i = 0; i < d.length; ++i) {
114 ma = d[i][0];
115 na = d[i][1].replace(/[<>|]/g, '');
117 macs.push(ma);
118 if (na.length) {
119 names.push(ma.replace(/:/g, '') + '<' + na);
122 fom.wl_maclist.value = macs.join(' ');
123 fom.wl_macmode.value = E('_f_disable').checked ? 'disabled' : (E('_f_deny').checked ? 'deny' : 'allow');
124 fom.macnames.value = names.join('>');
126 for (i = 0; i < wl_ifaces.length; ++i) {
127 u = wl_unit(i);
128 E('_wl'+u+'_macmode').value = fom.wl_macmode.value;
129 E('_wl'+u+'_maclist').value = fom.wl_maclist.value;
132 form.submit(fom, 1);
135 function earlyInit()
137 smg.setup();
138 if (nvram.wl_macmode == 'allow') E('_f_allow').checked = 1;
139 else if (nvram.wl_macmode == 'deny') E('_f_deny').checked = 1;
140 else E('_f_disable').checked = 1;
143 function init()
145 smg.recolor();
147 </script>
148 </head>
149 <body onload='init()'>
150 <form id='_fom' method='post' action='tomato.cgi'>
151 <table id='container' cellspacing=0>
152 <tr><td colspan=2 id='header'>
153 <div class='title'>Tomato</div>
154 <div class='version'>Version <% version(); %></div>
155 </td></tr>
156 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
157 <td id='content'>
158 <div id='ident'><% ident(); %></div>
160 <!-- / / / -->
162 <input type='hidden' name='_nextpage' value='basic-wfilter.asp'>
163 <input type='hidden' name='_nextwait' value='10'>
164 <input type='hidden' name='_service' value='*'>
166 <input type='hidden' name='wl_macmode'>
167 <input type='hidden' name='wl_maclist'>
168 <input type='hidden' name='macnames'>
170 <script type='text/javascript'>
171 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
172 var u = wl_unit(uidx);
173 W('<input type=\'hidden\' id=\'_wl'+u+'_macmode\' name=\'wl'+u+'_macmode\'>');
174 W('<input type=\'hidden\' id=\'_wl'+u+'_maclist\' name=\'wl'+u+'_maclist\'>');
176 </script>
178 <div class='section-title'>Wireless Client Filter</div>
179 <div class='section'>
180 <input type='radio' name='f_type' id='_f_disable' value='disabled'> <label for='_f_disable'>Disable filter</label><br>
181 <input type='radio' name='f_type' id='_f_allow' value='allow'> <label for='_f_allow'>Permit only the following clients</label><br>
182 <input type='radio' name='f_type' id='_f_deny' value='deny'> <label for='_f_deny'>Block the following clients</label><br>
183 <br>
184 <table id='sm-grid' class='tomato-grid'></table>
185 </div>
188 <!-- / / / -->
190 </td></tr>
191 <tr><td id='footer' colspan=2>
192 <span id='footer-msg'></span>
193 <input type='button' value='Save' id='save-button' onclick='save()'>
194 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
195 </td></tr>
196 </table>
197 </form>
198 <script type='text/javascript'>earlyInit()</script>
199 </body>
200 </html>