usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / www / bwm-monthly.asp
blobc51555b57039ae789f48b965266dd443cc96a3bb
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: Monthly</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 <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"); %>
27 try {
28 // <% bandwidth("monthly"); %>
30 catch (ex) {
31 monthly_history = [];
33 rstats_busy = 0;
34 if (typeof(monthly_history) == 'undefined') {
35 monthly_history = [];
36 rstats_busy = 1;
39 function genData()
41 var w, i, h;
43 w = window.open('', 'tomato_data_m');
44 w.document.writeln('<pre>');
45 for (i = 0; i < monthly_history.length; ++i) {
46 h = monthly_history[i];
47 w.document.writeln([(((h[0] >> 16) & 0xFF) + 1900), (((h[0] >>> 8) & 0xFF) + 1), h[1], h[2]].join(','));
49 w.document.writeln('</pre>');
50 w.document.close();
53 function save()
55 cookie.set('monthly', scale, 31);
58 function redraw()
60 var h;
61 var grid;
62 var rows;
63 var yr, mo, da;
65 rows = 0;
66 block = '';
67 gn = 0;
69 grid = '<table class="bwmg" cellspacing="1">';
70 grid += makeRow('header', 'Date', 'Download', 'Upload', 'Total');
72 for (i = 0; i < monthly_history.length; ++i) {
73 h = monthly_history[i];
74 yr = (((h[0] >> 16) & 0xFF) + 1900);
75 mo = ((h[0] >>> 8) & 0xFF);
77 grid += makeRow(((rows & 1) ? 'odd' : 'even'), ymText(yr, mo), rescale(h[1]), rescale(h[2]), rescale(h[1] + h[2]));
78 ++rows;
81 E('bwm-monthly-grid').innerHTML = grid + '</table>';
84 function init()
86 var s;
88 if (nvram.rstats_enable != '1') return;
90 if ((s = cookie.get('monthly')) != null) {
91 if (s.match(/^([0-2])$/)) {
92 E('scale').value = scale = RegExp.$1 * 1;
96 initDate('ym');
97 monthly_history.sort(cmpHist);
98 redraw();
100 </script>
102 </head>
103 <body onload='init()'>
104 <form>
105 <table id='container' cellspacing=0>
106 <tr><td colspan=2 id='header'>
107 <div class='title'>Tomato</div>
108 <div class='version'>Version <% version(); %></div>
109 </td></tr>
110 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
111 <td id='content'>
112 <div id='ident'><% ident(); %></div>
114 <!-- / / / -->
116 <div class='section-title'>WAN Bandwidth - Monthly</div>
117 <div id='bwm-monthly-grid' style='float:left'></div>
118 <div style="float:right;text-align:right">
119 <b>Date</b> <select onchange='changeDate(this, "ym")' id='dafm'><option value=0>yyyy-mm</option><option value=1>mm-yyyy</option><option value=2>mmm yyyy</option><option value=3>mm.yyyy</option></select><br>
120 <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>
121 <br>
122 &raquo; <a href="javascript:genData()">Data</a>
123 <br>
124 &raquo; <a href="admin-bwm.asp">Configure</a>
125 <br><br><br>
126 </div>
127 <br>
129 <script type='text/javascript'>checkRstats();</script>
131 <!-- / / / -->
133 </td></tr>
134 <tr><td id='footer' colspan=2>
135 <input type='button' value='Refresh' onclick='reloadPage()'>
136 </td></tr>
137 </table>
138 </form>
139 </body>
140 </html>