Tomato 1.28
[tomato/tomato-null.git] / release / src / router / www / bwm-24.asp
blob8d56dfaf8a53a0cc0b02cbb61bd03f8405dee3ea
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(); %>] Bandwidth: Last 24 Hours</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 #txt {
23 width: 550px;
24 white-space: nowrap;
26 #bwm-controls {
27 text-align: right;
28 margin-right: 5px;
29 margin-top: 5px;
30 float: right;
31 visibility: hidden;
33 </style>
35 <script type='text/javascript' src='debug.js'></script>
36 <script type='text/javascript' src='bwm-common.js'></script>
38 <script type='text/javascript'>
40 // <% nvram("wan_ifname,lan_ifname,wl_ifname,wan_proto,web_svg,rstats_enable,rstats_colors"); %>
42 var cprefix = 'bw_24';
43 var updateInt = 120;
44 var updateDiv = updateInt;
45 var updateMaxL = 720;
46 var updateReTotal = 1;
47 var hours = 24;
48 var lastHours = 0;
49 var debugTime = 0;
51 function showHours()
53 if (hours == lastHours) return;
54 showSelectedOption('hr', lastHours, hours);
55 lastHours = hours;
58 function switchHours(h)
60 if ((!svgReady) || (updating)) return;
62 hours = h;
63 updateMaxL = (720 / 24) * hours;
64 showHours();
65 loadData();
66 cookie.set(cprefix + 'hrs', hours);
69 var ref = new TomatoRefresh('update.cgi', 'exec=bandwidth&arg0=speed');
71 ref.refresh = function(text)
73 ++updating;
74 try {
75 this.refreshTime = 1500;
76 speed_history = {};
77 try {
78 eval(text);
79 if (rstats_busy) {
80 E('rbusy').style.display = 'none';
81 rstats_busy = 0;
83 this.refreshTime = (fixInt(speed_history._next, 1, 120, 60) + 2) * 1000;
85 catch (ex) {
86 speed_history = {};
88 if (debugTime) E('dtime').innerHTML = (new Date()) + ' ' + (this.refreshTime / 1000);
89 loadData();
91 catch (ex) {
92 // alert('ex=' + ex);
94 --updating;
97 ref.showState = function()
99 E('refresh-button').value = this.running ? 'Stop' : 'Start';
102 ref.toggleX = function()
104 this.toggle();
105 this.showState();
106 cookie.set(cprefix + 'refresh', this.running ? 1 : 0);
109 ref.initX = function()
111 var a;
113 a = fixInt(cookie.get(cprefix + 'refresh'), 0, 1, 1);
114 if (a) {
115 ref.refreshTime = 100;
116 ref.toggleX();
120 function init()
122 if (nvram.rstats_enable != '1') return;
124 try {
125 // <% bandwidth("speed"); %>
127 catch (ex) {
128 speed_history = {};
130 rstats_busy = 0;
131 if (typeof(speed_history) == 'undefined') {
132 speed_history = {};
133 rstats_busy = 1;
134 E('rbusy').style.display = '';
137 hours = fixInt(cookie.get(cprefix + 'hrs'), 1, 24, 24);
138 updateMaxL = (720 / 24) * hours;
139 showHours();
141 initCommon(1, 0, 0);
142 ref.initX();
144 </script>
146 </head>
147 <body onload='init()'>
148 <form>
149 <table id='container' cellspacing=0>
150 <tr><td colspan=2 id='header'>
151 <div class='title'>Tomato</div>
152 <div class='version'>Version <% version(); %></div>
153 </td></tr>
154 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
155 <td id='content'>
156 <div id='ident'><% ident(); %></div>
158 <!-- / / / -->
160 <div id='rstats'>
161 <div id='tab-area'></div>
163 <script type='text/javascript'>
164 if ((nvram.web_svg != '0') && (nvram.rstats_enable == '1')) {
165 // without a div, Opera 9 moves svgdoc several pixels outside of <embed> (?)
166 W("<div style='border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0;visibility:hidden;padding:0;margin:0' id='graph'><embed src='bwm-graph.svg?<% version(); %>' style='width:760px;height:300px;margin:0;padding:0' type='image/svg+xml' pluginspage='http://www.adobe.com/svg/viewer/install/'></embed></div>");
168 </script>
170 <div id='bwm-controls'>
171 <small>(2 minute interval)</small><br>
172 <br>
173 Hours:&nbsp;
174 <a href='javascript:switchHours(4);' id='hr4'>4</a>,
175 <a href='javascript:switchHours(6);' id='hr6'>6</a>,
176 <a href='javascript:switchHours(12);' id='hr12'>12</a>,
177 <a href='javascript:switchHours(18);' id='hr18'>18</a>,
178 <a href='javascript:switchHours(24);' id='hr24'>24</a><br>
179 Avg:&nbsp;
180 <a href='javascript:switchAvg(1)' id='avg1'>Off</a>,
181 <a href='javascript:switchAvg(2)' id='avg2'>2x</a>,
182 <a href='javascript:switchAvg(4)' id='avg4'>4x</a>,
183 <a href='javascript:switchAvg(6)' id='avg6'>6x</a>,
184 <a href='javascript:switchAvg(8)' id='avg8'>8x</a><br>
185 Max:&nbsp;
186 <a href='javascript:switchScale(0)' id='scale0'>Uniform</a>,
187 <a href='javascript:switchScale(1)' id='scale1'>Per IF</a><br>
188 Display:&nbsp;
189 <a href='javascript:switchDraw(0)' id='draw0'>Solid</a>,
190 <a href='javascript:switchDraw(1)' id='draw1'>Line</a><br>
191 Color:&nbsp; <a href='javascript:switchColor()' id='drawcolor'>-</a><br>
192 <small><a href='javascript:switchColor(1)' id='drawrev'>[reverse]</a></small><br>
193 <br><br>
194 &nbsp; &raquo; <a href="admin-bwm.asp">Configure</a>
195 </div>
197 <br><br>
198 <table border=0 cellspacing=2 id='txt'>
199 <tr>
200 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='rx-name'>RX</b></td>
201 <td width='15%' align='right' valign='top'><span id='rx-current'></span></td>
202 <td width='8%' align='right' valign='top'><b>Avg</b></td>
203 <td width='15%' align='right' valign='top' id='rx-avg'></td>
204 <td width='8%' align='right' valign='top'><b>Peak</b></td>
205 <td width='15%' align='right' valign='top' id='rx-max'></td>
206 <td width='8%' align='right' valign='top'><b>Total</b></td>
207 <td width='14%' align='right' valign='top' id='rx-total'></td>
208 <td>&nbsp;</td>
209 </tr>
210 <tr>
211 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='tx-name'>TX</b></td>
212 <td width='15%' align='right' valign='top'><span id='tx-current'></span></td>
213 <td width='8%' align='right' valign='top'><b>Avg</b></td>
214 <td width='15%' align='right' valign='top' id='tx-avg'></td>
215 <td width='8%' align='right' valign='top'><b>Peak</b></td>
216 <td width='15%' align='right' valign='top' id='tx-max'></td>
217 <td width='8%' align='right' valign='top'><b>Total</b></td>
218 <td width='14%' align='right' valign='top' id='tx-total'></td>
219 <td>&nbsp;</td>
220 </tr>
221 </table>
222 </div>
223 <br>
225 <script type='text/javascript'>
226 if (nvram.rstats_enable != '1') {
227 W('<div class="note-disabled">Bandwidth monitoring disabled.</b><br><br><a href="admin-bwm.asp">Enable &raquo;</a><div>');
228 E('rstats').style.display = 'none';
230 else {
231 W('<div class="note-warning" style="display:none" id="rbusy">The rstats program is not responding or is busy. Try reloading after a few seconds.</div>');
233 </script>
235 <!-- / / / -->
237 </td></tr>
238 <tr><td id='footer' colspan=2>
239 <span id='dtime'></span>
240 <img src='spin.gif' id='refresh-spinner' onclick='debugTime=1'>
241 <input type='button' value='Refresh' id='refresh-button' onclick='ref.toggleX()'>
242 </td></tr>
243 </table>
244 </form>
245 </body>
246 </html>