Tomato 1.28
[tomato.git] / release / src / router / www / basic-wfilter.asp
blob7534eef713ab15ed14807b2b091262b96976188f
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'>
37 // <% nvram("wl_macmode,wl_maclist,macnames"); %>
39 var smg = new TomatoGrid();
41 smg.verifyFields = function(row, quiet) {
42 return v_mac(fields.getAll(row)[0], quiet);
45 smg.resetNewEditor = function() {
46 var f, c, n;
48 f = fields.getAll(this.newEditor);
49 ferror.clearAll(f);
51 if ((c = cookie.get('addmac')) != null) {
52 cookie.set('addmac', '', 0);
53 c = c.split(',');
54 if (c.length == 2) {
55 f[0].value = c[0];
56 f[1].value = c[1];
57 return;
61 f[0].value = '00:00:00:00:00:00';
62 f[1].value = '';
65 smg.setup = function() {
66 var i, i, m, s, t, n;
67 var macs, names;
69 this.init('sm-grid', 'sort', 200, [
70 { type: 'text', maxlen: 17 },
71 { type: 'text', maxlen: 48 }
72 ]);
73 this.headerSet(['MAC Address', 'Description']);
74 macs = nvram.wl_maclist.split(/\s+/);
75 names = nvram.macnames.split('>');
76 for (i = 0; i < macs.length; ++i) {
77 m = fixMAC(macs[i]);
78 if ((m) && (!isMAC0(m))) {
79 s = m.replace(/:/g, '');
80 t = '';
81 for (j = 0; j < names.length; ++j) {
82 n = names[j].split('<');
83 if ((n.length == 2) && (n[0] == s)) {
84 t = n[1];
85 break;
88 this.insertData(-1, [m, t]);
91 this.sort(0);
92 this.showNewEditor();
93 this.resetNewEditor();
96 function save()
98 var fom;
99 var d, i, macs, names, ma, na;
101 if (smg.isEditing()) return;
103 fom = E('_fom');
105 macs = [];
106 names = [];
107 d = smg.getAllData();
108 for (i = 0; i < d.length; ++i) {
109 ma = d[i][0];
110 na = d[i][1].replace(/[<>|]/g, '');
112 macs.push(ma);
113 if (na.length) {
114 names.push(ma.replace(/:/g, '') + '<' + na);
117 fom.wl_maclist.value = macs.join(' ');
118 fom.wl_macmode.value = E('_f_disable').checked ? 'disabled' : (E('_f_deny').checked ? 'deny' : 'allow');
119 fom.macnames.value = names.join('>');
120 form.submit(fom, 1);
123 function earlyInit()
125 smg.setup();
126 if (nvram.wl_macmode == 'allow') E('_f_allow').checked = 1;
127 else if (nvram.wl_macmode == 'deny') E('_f_deny').checked = 1;
128 else E('_f_disable').checked = 1;
131 function init()
133 smg.recolor();
135 </script>
136 </head>
137 <body onload='init()'>
138 <form id='_fom' method='post' action='tomato.cgi'>
139 <table id='container' cellspacing=0>
140 <tr><td colspan=2 id='header'>
141 <div class='title'>Tomato</div>
142 <div class='version'>Version <% version(); %></div>
143 </td></tr>
144 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
145 <td id='content'>
146 <div id='ident'><% ident(); %></div>
148 <!-- / / / -->
150 <input type='hidden' name='_nextpage' value='basic-wfilter.asp'>
151 <input type='hidden' name='_nextwait' value='10'>
152 <input type='hidden' name='_service' value='*'>
154 <input type='hidden' name='wl_macmode'>
155 <input type='hidden' name='wl_maclist'>
156 <input type='hidden' name='macnames'>
159 <div class='section-title'>Wireless Client Filter</div>
160 <div class='section'>
161 <input type='radio' name='f_type' id='_f_disable' value='disabled'> <label for='_f_disable'>Disable filter</label><br>
162 <input type='radio' name='f_type' id='_f_allow' value='allow'> <label for='_f_allow'>Permit only the following clients</label><br>
163 <input type='radio' name='f_type' id='_f_deny' value='deny'> <label for='_f_deny'>Block the following clients</label><br>
164 <br>
165 <table id='sm-grid' class='tomato-grid'></table>
166 </div>
169 <!-- / / / -->
171 </td></tr>
172 <tr><td id='footer' colspan=2>
173 <span id='footer-msg'></span>
174 <input type='button' value='Save' id='save-button' onclick='save()'>
175 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
176 </td></tr>
177 </table>
178 </form>
179 <script type='text/javascript'>earlyInit()</script>
180 </body>
181 </html>