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(); %>] QoS: View Graphs
</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>
20 <script type='text/javascript' src='debug.js'
></script>
22 <style type='text/css'
>
41 border-top: 1px dashed
#bbb;
46 <script type='text/javascript'
>
47 // <% nvram("qos_classnames,web_svg,qos_enable,qos_obw,qos_ibw"); %>
55 var Unclassified
= ['Unclassified'];
56 var Unused
= ['Unused'];
57 var classNames
= nvram
.qos_classnames
.split(' '); //Toastman Class Labels
58 var abc
= Unclassified
.concat(classNames
,Unused
);
61 // var abc = ['Unclassified', 'Highest', 'High', 'Medium', 'Low', 'Lowest', 'Class A', 'Class B', 'Class C', 'Class D', 'Class E'];
82 location
.href
= 'qos-detailed.asp?class=' + n
;
88 var totalConnections
, totalOutgoingBandwidth
, totalIncomingBandwidth
;
90 totalConnections
= totalOutgoingBandwidth
= totalIncomingBandwidth
= 0;
92 for (i
= 0; i
< 11; ++i
)
94 if (!nfmarks
[i
]) nfmarks
[i
] = 0;
95 totalConnections
+= nfmarks
[i
];
96 if (!qrates_out
[i
]) qrates_out
[i
] = 0;
97 totalOutgoingBandwidth
+= qrates_out
[i
];
98 if (!qrates_in
[i
]) qrates_in
[i
] = 0;
99 totalIncomingBandwidth
+= qrates_in
[i
];
102 for (i
= 0; i
< 11; ++i
) {
104 E('ccnt' + i
).innerHTML
= n
;
105 if (totalConnections
> 0) p
= (n
/ totalConnections
) * 100;
107 E('cpct' + i
).innerHTML
= p
.toFixed(2) + '%';
109 E('ccnt-total').innerHTML
= totalConnections
;
111 obwrate
= nvram
.qos_obw
* 1000;
112 ibwrate
= nvram
.qos_ibw
* 1000;
116 totalorate
= totalOutgoingBandwidth
;
117 totalirate
= totalIncomingBandwidth
;
118 totalrateout
= '100%';
119 totalratein
= '100%';
122 FreeOutgoing
= (obwrate
- totalOutgoingBandwidth
);
123 qrates_out
.push(FreeOutgoing
);
124 FreeIncoming
= (ibwrate
- totalIncomingBandwidth
);
125 qrates_in
.push(FreeIncoming
);
126 totalorate
= obwrate
;
127 totalirate
= ibwrate
;
128 totalrateout
= ((totalOutgoingBandwidth
/ totalorate
) * 100).toFixed(2) + '%';
129 totalratein
= ((totalIncomingBandwidth
/ totalirate
) * 100).toFixed(2) + '%';
132 for (i
= 1; i
< 11; ++i
) {
134 E('bocnt' + i
).innerHTML
= (n
/ 1000).toFixed(2)
135 E('bocntx' + i
).innerHTML
= (n
/ 8192).toFixed(2)
136 if (totalOutgoingBandwidth
> 0) p
= (n
/ totalorate
) * 100;
138 E('bopct' + i
).innerHTML
= p
.toFixed(2) + '%';
140 E('bocnt-total').innerHTML
= (totalOutgoingBandwidth
/ 1000).toFixed(2)
141 E('bocntx-total').innerHTML
= (totalOutgoingBandwidth
/ 8192).toFixed(2)
142 E('rateout').innerHTML
= totalrateout
;
144 for (i
= 1; i
< 11; ++i
) {
146 E('bicnt' + i
).innerHTML
= (n
/ 1000).toFixed(2)
147 E('bicntx' + i
).innerHTML
= (n
/ 8192).toFixed(2)
148 if (totalIncomingBandwidth
> 0) p
= (n
/ totalirate
) * 100;
150 E('bipct' + i
).innerHTML
= p
.toFixed(2) + '%';
152 E('bicnt-total').innerHTML
= (totalIncomingBandwidth
/ 1000).toFixed(2)
153 E('bicntx-total').innerHTML
= (totalIncomingBandwidth
/ 8192).toFixed(2)
154 E('ratein').innerHTML
= totalratein
;
157 var ref
= new TomatoRefresh('update.cgi', 'exec=qrate', 2, 'qos_graphs');
159 ref
.refresh = function(text
)
179 updateConnectionDistribution(nfmarks
, abc
);
180 updateBandwidthOutgoing(qrates_out
, abc
);
181 updateBandwidthIncoming(qrates_in
, abc
);
191 for (i
= 2; i
>= 0; --i
)
194 d
= e
.getSVGDocument();
211 updateConnectionDistribution
= w
.updateSVG
;
217 updateBandwidthOutgoing
= w
.updateSVG
;
223 updateBandwidthIncoming
= w
.updateSVG
;
236 updateConnectionDistribution(nfmarks
, abc
);
237 updateBandwidthOutgoing(qrates_out
, abc
);
238 updateBandwidthIncoming(qrates_in
, abc
);
240 else if (--svgReady
> -5)
242 setTimeout(checkSVG
, 500);
251 qrates_out
= qrates_out
.slice(0, -1);
252 qrates_in
= qrates_in
.slice(0, -1);
265 nbase
= fixInt(cookie
.get('qnbase'), 0, 1, 0);
269 ref
.initPage(2000, 3);
273 <body onload='init()'
>
274 <form id='_fom' action='javascript:{}'
>
275 <table id='container' cellspacing=
0>
276 <tr><td colspan=
3 id='header'
>
277 <div class='title'
>Tomato
</div>
278 <div class='version'
>Version <%
version(); %></div>
280 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
281 <td id='content'colspan=
2>
282 <div id='ident'
><%
ident(); %></div>
286 <div class=
"section-title">Connections Distribution
</div>
287 <div class=
"section">
288 <table border=
0 width=
"100%"><tr><td>
289 <table style=
"width:250px">
290 <script type='text/javascript'
>
291 for (i
= 0; i
< 11; ++i
) {
292 W('<tr style="cursor:pointer" onclick="mClick(' + i
+ ')">' +
293 '<td class="color" style="background:#' + colors
[i
] + '" onclick="mClick(' + i
+ ')"> </td>' +
294 '<td class="title" style="width:60px"><a href="qos-detailed.asp?class=' + i
+ '">' + abc
[i
] + '</a></td>' +
295 '<td id="ccnt' + i
+ '" class="count" style="width:90px"></td>' +
296 '<td id="cpct' + i
+ '" class="pct"></td></tr>');
299 <tr><td> </td><td class=
"total">Total
</a></td><td id=
"ccnt-total" class=
"total count"></td><td class=
"total pct">100%
</td></tr>
301 </td><td style=
"margin-right:150px">
302 <script type='text/javascript'
>
303 if (nvram
.web_svg
!= '0') {
304 W('<embed src="qos-graph.svg?n=0&v=<% version(); %>" style="width:310px;height:310px;margin:0;padding:0" id="svg0" type="image/svg+xml" pluginspage="http://www.adobe.com/svg/viewer/install/"></embed>');
311 <div class=
"section-title">Bandwidth Distribution (Outbound)
</div>
312 <div class=
"section">
313 <table border=
0 width=
"100%"><tr><td>
314 <table style=
"width:250px">
315 <tr><td class='color'
style=
"height:1em"></td><td class='title'
style=
"width:45px"> </td><td class='thead count'
>kbit/s
</td><td class='thead count'
>KB/s
</td><td class='thead pct'
>Rate
</td></tr>
316 <script type='text/javascript'
>
317 for (i
= 1; i
< 11; ++i
) {
318 W('<tr style="cursor:pointer" onclick="mClick(' + i
+ ')">' +
319 '<td class="color" style="background:#' + colors
[i
] + '" onclick="mClick(' + i
+ ')"> </td>' +
320 '<td class="title" style="width:45px"><a href="qos-detailed.asp?class=' + i
+ '">' + abc
[i
] + '</a></td>' +
321 '<td id="bocnt' + i
+ '" class="count" style="width:60px"></td>' +
322 '<td id="bocntx' + i
+ '" class="count" style="width:50px"></td>' +
323 '<td id="bopct' + i
+ '" class="pct"></td></tr>');
326 <tr><td> </td><td class=
"total">Total
</a></td><td id=
"bocnt-total" class=
"total count"></td><td id=
"bocntx-total" class=
"total count"></td><td id=
"rateout" class=
"total pct"></td></tr>
328 </td><td style=
"margin-right:150px">
329 <script type='text/javascript'
>
330 if (nvram
.web_svg
!= '0') {
331 W('<embed src="qos-graph.svg?n=1&v=<% version(); %>" style="width:310px;height:310px;margin:0;padding:0" id="svg1" type="image/svg+xml" pluginspage="http://www.adobe.com/svg/viewer/install/"></embed>');
338 <div class=
"section-title">Bandwidth Distribution (Inbound)
</div>
339 <div class=
"section">
340 <table border=
0 width=
"100%"><tr><td>
341 <table style=
"width:250px">
342 <tr><td class='color'
style=
"height:1em"></td><td class='title'
style=
"width:45px"> </td><td class='thead count'
>kbit/s
</td><td class='thead count'
>KB/s
</td><td class='thead pct'
>Rate
</td></tr>
343 <script type='text/javascript'
>
344 for (i
= 1; i
< 11; ++i
) {
345 W('<tr style="cursor:pointer" onclick="mClick(' + i
+ ')">' +
346 '<td class="color" style="background:#' + colors
[i
] + '" onclick="mClick(' + i
+ ')"> </td>' +
347 '<td class="title" style="width:45px"><a href="qos-detailed.asp?class=' + i
+ '">' + abc
[i
] + '</a></td>' +
348 '<td id="bicnt' + i
+ '" class="count" style="width:60px"></td>' +
349 '<td id="bicntx' + i
+ '" class="count" style="width:50px"></td>' +
350 '<td id="bipct' + i
+ '" class="pct"></td></tr>');
353 <tr><td> </td><td class=
"total">Total
</a></td><td id=
"bicnt-total" class=
"total count"></td><td id=
"bicntx-total" class=
"total count"></td><td id=
"ratein" class=
"total pct"></td></tr>
355 </td><td style=
"margin-right:150px">
356 <script type='text/javascript'
>
357 if (nvram
.web_svg
!= '0') {
358 W('<embed src="qos-graph.svg?n=2&v=<% version(); %>" style="width:310px;height:310px;margin:0;padding:0" id="svg2" type="image/svg+xml" pluginspage="http://www.adobe.com/svg/viewer/install/"></embed>');
365 <script type='text/javascript'
>
366 if (nvram
.qos_enable
!= '1') {
367 W('<div class="note-disabled"><b>QoS disabled.</b> <a href="qos-settings.asp">Enable »</a></div>');
374 <tr><td id='footer'
></td>
375 <td id='footer'
width=
"528"><input name=
"mybtn" style=
"width:100px" value=
"Zoom Graphs" type=
"button" onclick=
"showGraph()" ></td>
376 <td id='footer'
width=
"237"><script type='text/javascript'
>genStdRefresh(1,2,'ref.toggle()');</script></td>