1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
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.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Bandwidth: Daily
</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>
21 <script type='text/javascript' src='debug.js'
></script>
22 <script type='text/javascript' src='bwm-hist.js'
></script>
24 <script type='text/javascript'
>
26 // <% nvram("wan_ifname,lan_ifname,rstats_enable"); %>
28 // <% bandwidth("daily"); %>
34 if (typeof(daily_history
) == 'undefined') {
41 cookie
.set('daily', scale
, 31);
48 w
= window
.open('', 'tomato_data_d');
49 w
.document
.writeln('<pre>');
50 for (i
= 0; i
< daily_history
.length
; ++i
) {
53 w
.document
.writeln([t
[0], t
[1] + 1, t
[2], h
[1], h
[2]].join(','));
55 w
.document
.writeln('</pre>');
62 return [(((n
>> 16) & 0xFF) + 1900), ((n
>>> 8) & 0xFF), (n
& 0xFF)];
75 if (daily_history
.length
> 0) {
76 ymd
= getYMD(daily_history
[0][0]);
77 d
= new Date((new Date(ymd
[0], ymd
[1], ymd
[2], 12, 0, 0, 0)).getTime() - ((30 - 1) * 86400000));
78 E('last-dates').innerHTML
= '(' + ymdText(ymd
[0], ymd
[1], ymd
[2]) + ' to ' + ymdText(d
.getFullYear(), d
.getMonth(), d
.getDate()) + ')';
80 lastt
= ((d
.getFullYear() - 1900) << 16) | (d
.getMonth() << 8) | d
.getDate();
89 grid
= '<table class="bwmg" cellspacing="1">';
90 grid
+= makeRow('header', 'Date', 'Download', 'Upload', 'Total');
92 for (i
= 0; i
< daily_history
.length
; ++i
) {
95 grid
+= makeRow(((rows
& 1) ? 'odd' : 'even'), ymdText(ymd
[0], ymd
[1], ymd
[2]), rescale(h
[1]), rescale(h
[2]), rescale(h
[1] + h
[2]));
104 E('bwm-daily-grid').innerHTML
= grid
+ '</table>';
106 E('last-dn').innerHTML
= rescale(lastd
);
107 E('last-up').innerHTML
= rescale(lastu
);
108 E('last-total').innerHTML
= rescale(lastu
+ lastd
);
115 if (nvram
.rstats_enable
!= '1') return;
117 if ((s
= cookie
.get('daily')) != null) {
118 if (s
.match(/^([0-2])$/)) {
119 E('scale').value
= scale
= RegExp
.$1 * 1;
124 daily_history
.sort(cmpHist
);
130 <body onload='init()'
>
132 <table id='container' cellspacing=
0>
133 <tr><td colspan=
2 id='header'
>
134 <div class='title'
>Tomato
</div>
135 <div class='version'
>Version <%
version(); %></div>
137 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
139 <div id='ident'
><%
ident(); %></div>
143 <div class='section-title'
>WAN Bandwidth - Daily
</div>
144 <div id='bwm-daily-grid' style='float:left'
></div>
145 <div style=
"float:right;text-align:right">
148 <table class='tomato-grid' style='width:
150px'
>
149 <tr class='header'
><td colspan=
2 style='text-align:center'
>Last
30 Days
<br><span style='font-weight:normal' id='last-dates'
></span></td></tr>
150 <tr class='even'
><td>Down
</td><td id='last-dn'
>-
</td></tr>
151 <tr class='odd'
><td>Up
</td><td id='last-up'
>-
</td></tr>
152 <tr class='footer'
><td>Total
</td><td id='last-total'
>-
</td></tr>
159 <b>Date
</b> <select onchange='changeDate(this,
"ymd")' id='dafm'
><option value=
0>yyyy-mm-dd
</option><option value=
1>mm-dd-yyyy
</option><option value=
2>mmm dd, yyyy
</option><option value=
3>dd.mm.yyyy
</option></select><br>
160 <b>Scale
</b> <select onchange='changeScale(this)' id='scale'
><option value=
0>KB
</option><option value=
1>MB
</option><option value=
2 selected
>GB
</option></select><br>
162 » <a href=
"javascript:genData()">Data
</a>
164 » <a href=
"admin-bwm.asp">Configure
</a>
174 <tr><td id='footer' colspan=
2>
175 <input type='button' value='Refresh' onclick='reloadPage()'
>