fix proto sort
[tomato/davidwu.git] / release / src / router / www / restrict.asp
blob84f31dc386d01d83c1bff92fe52c6c23e7d63d31
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(); %>] Access Restrictions</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 #res-over-grid .co1 {
23 width: 40%;
25 #res-over-grid .co2 {
26 width: 60%;
28 #res-over-grid .footer {
29 text-align: right;
31 #res-over-add {
32 width: 100px;
34 </style>
36 <script type='text/javascript' src='debug.js'></script>
38 <script type='text/javascript'>
39 // <% nvram(''); %> // http_id
40 // <% nvramseq("rrules", "rrule%d", 0, 99); %>
42 var dowNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
44 var og = new TomatoGrid();
45 og.setup = function() {
46 this.init('res-over-grid', 'sort');
47 this.headerSet(['Description', 'Schedule']);
48 var r = this.footerSet(['<input type="button" value="Add" onclick="TGO(this).addEntry()" id="res-over-add">']);
49 r.cells[0].colSpan = 2;
51 og.populate = function() {
52 this.removeAllData();
53 for (var i = 0; i < rrules.length; ++i) {
54 var v;
55 if ((v = rrules[i].match(/^(\d+)\|(-?\d+)\|(-?\d+)\|(\d+)\|(.*?)\|(.*?)\|([^|]*?)\|(\d+)\|(.*)$/m)) == null) {
56 rrules[i] = '';
57 continue;
59 v = v.slice(1);
60 if (isNaN(v[1] *= 1)) continue;
61 if (isNaN(v[2] *= 1)) continue;
62 if (isNaN(v[3] *= 1)) continue;
64 var s = '';
65 if (v[3] == 0x7F) {
66 s += 'Everyday';
68 else {
69 for (var j = 0; j < 7; ++j) {
70 if (v[3] & (1 << j)) {
71 if (s.length) s += ', ';
72 s += dowNames[j];
77 if ((v[1] >= 0) && (v[2] >= 0)) {
78 s += '<br>' + timeString(v[1]) + ' to ' + timeString(v[2]);
79 if (v[2] <= v[1]) s += ' <small>(the following day)</small>';
81 if (v[0] != '1') s += '<br><i><b>Disabled</b></i>';
82 this.insertData(-1, [i, v[8], s]);
84 og.sort(0);
86 og.dataToView = function(data) {
87 return [escapeHTML(data[1]), data[2]];
89 og.onClick = function(cell) {
90 E('_rruleN').value = PR(cell).getRowData()[0];
91 form.submit('_fom');
93 og.addEntry = function() {
94 for (var i = 0; i < 500; ++i) {
95 if ((rrules[i] == null) || (rrules[i] == '')) {
96 E('_rruleN').value = i;
97 form.submit('_fom');
98 return;
103 function init()
105 og.populate();
107 </script>
108 </head>
109 <body onload='init()'>
110 <form name='_fom' id='_fom' method='post' action='tomato.cgi'>
111 <table id='container' cellspacing=0>
112 <tr><td colspan=2 id='header'>
113 <div class='title'>Tomato</div>
114 <div class='version'>Version <% version(); %></div>
115 </td></tr>
116 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
117 <td id='content'>
118 <div id='ident'><% ident(); %></div>
120 <!-- / / / -->
122 <input type='hidden' name='_redirect' value='restrict-edit.asp'>
123 <input type='hidden' name='_commit' value='0'>
124 <input type='hidden' name='rruleN' id='_rruleN' value=''>
126 <div class='section-title'>Access Restriction Overview</div>
127 <div class='section'>
128 <table class='tomato-grid' cellspacing=1 id='res-over-grid'></table>
129 </div>
131 <br>
132 <script type='text/javascript'>show_notice1('<% notice("iptables"); %>');</script>
133 <br>
134 <script type='text/javascript'>show_notice1('<% notice("ip6tables"); %>');</script>
136 <!-- / / / -->
138 </td></tr>
139 <tr><td id='footer' colspan=2>&nbsp;</td></tr>
140 </table>
141 </form>
142 <script text='text/javascript'>og.setup();</script>
143 </body>
144 </html>