Ajax Speed Anzeige geändert

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@617 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
maniacikarus
2007-06-07 18:32:39 +00:00
parent 4cb74dce6f
commit 94ec137db5
5 changed files with 233 additions and 176 deletions

View File

@@ -365,7 +365,7 @@ END
<div align='center'>
<table width='100%' bgcolor='#ffffff'>
<tr><td align='center'>
<br /><br /><img src='/ipfire_big.gif' /><br /><br /><br />
<br /><br /><img src='/images/IPFire.png' /><br /><br /><br />
</td></tr>
</table>
<br />

View File

@@ -46,8 +46,8 @@ my $txb_diff = $txb_now - $txb_last;
if(( $rxb_diff == $rxb_now ) && ( $txb_diff == $txb_now ))
{
$rx_kbs = "0.00";
$tx_kbs = "0.00";
$rx_kbs = "0";
$tx_kbs = "0";
}
else
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -2,30 +2,30 @@
sub showmenu() {
print <<EOF
<div id="menu">
<ul>
<div id="menu">
<ul>
EOF
;
foreach my $k1 ( sort keys %$menu ) {
if (! $menu->{$k1}{'enabled'}) {
next;
}
my $link = getlink($menu->{$k1});
if ($link eq '') {
next;
}
if (! is_menu_visible($link)) {
next;
}
if ($menu->{$k1}->{'selected'}) {
print "<li><a href=\"$link\" class=\"active\">$menu->{$k1}{'caption'}</a></li>";
} else {
print "<li><a href=\"$link\">$menu->{$k1}{'caption'}</a></li>";
}
if (! $menu->{$k1}{'enabled'}) {
next;
}
my $link = getlink($menu->{$k1});
if ($link eq '') {
next;
}
if (! is_menu_visible($link)) {
next;
}
if ($menu->{$k1}->{'selected'}) {
print "<li><a href=\"$link\" class=\"active\">$menu->{$k1}{'caption'}</a></li>";
} else {
print "<li><a href=\"$link\">$menu->{$k1}{'caption'}</a></li>";
}
}
print <<EOF
</ul>
</div>
</ul>
</div>
EOF
;
}
@@ -33,13 +33,13 @@ EOF
sub getselected($) {
my $root = shift;
if (!$root) {
return 0;
return 0;
}
foreach my $item (%$root) {
if ($root->{$item}{'selected'}) {
return $root->{$item};
}
if ($root->{$item}{'selected'}) {
return $root->{$item};
}
}
}
@@ -47,45 +47,45 @@ sub showsubsection($$) {
my $root = shift;
if (! $root) {
return;
return;
}
my $selected = getselected($root);
if (! $selected) {
return;
return;
}
my $submenus = $selected->{'subMenu'};
if (! $submenus) {
return;
return;
}
print <<EOF
<h4><span>Side</span>menu</h4>
<ul class="links">
<h4><span>Side</span>menu</h4>
<ul class="links">
EOF
;
foreach my $item (sort keys %$submenus) {
my $hash = $submenus->{$item};
if (! $hash->{'enabled'}) {
next;
}
my $link = getlink($hash);
if ($link eq '') {
next;
}
if (! is_menu_visible($link)) {
next;
}
if ($hash->{'selected'}) {
print '<li class="selected">';
} else {
print '<li>';
}
my $hash = $submenus->{$item};
if (! $hash->{'enabled'}) {
next;
}
my $link = getlink($hash);
if ($link eq '') {
next;
}
if (! is_menu_visible($link)) {
next;
}
if ($hash->{'selected'}) {
print '<li class="selected">';
} else {
print '<li>';
}
print "<a href=\"$link\">$hash->{'caption'}</a></li>";
print "<a href=\"$link\">$hash->{'caption'}</a></li>";
}
print <<EOF
</ul>
</ul>
EOF
;
}
@@ -94,14 +94,14 @@ EOF
sub showsubsubsection($) {
my $root = shift;
if (!$root) {
return;
return;
}
my $selected = getselected($root);
if (! $selected) {
return
return
}
if (! $selected->{'subMenu'}) {
return
return
}
showsubsection($selected->{'subMenu'}, 'menu-subtop');
@@ -148,99 +148,99 @@ END
function swapVisibility(id) {
el = document.getElementById(id);
if(el.style.display != 'block') {
el.style.display = 'block'
}
else {
el.style.display = 'none'
}
if(el.style.display != 'block') {
el.style.display = 'block'
}
else {
el.style.display = 'none'
}
}
</script>
<script type="text/javascript" language="javascript">
var http_request = false;
function LoadInetInfo(url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
// zu dieser Zeile siehe weiter unten
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request.onreadystatechange = DisplayInetInfo;
http_request.open('GET', url, true);
http_request.send(null);
}
function DisplayInetInfo() {
if (http_request.readyState == 4) {
var xmldoc = http_request.responseXML;
var root1_node = xmldoc.getElementsByTagName('rx_kbs').item(0);
var root2_node = xmldoc.getElementsByTagName('tx_kbs').item(0);
var root3_node = xmldoc.getElementsByTagName('rxb').item(0);
var root4_node = xmldoc.getElementsByTagName('txb').item(0);
document.forms['speed'].txkb.value = root1_node.firstChild.data;
document.forms['speed'].rxkb.value = root2_node.firstChild.data;
// document.getElementsByTagName("input")[0].style.color = "#00FF00";
url = "/cgi-bin/speed.cgi?rxb_last=" + root3_node.firstChild.data + "&txb_last=" + root4_node.firstChild.data;
window.setTimeout("LoadInetInfo(url)", 3000);
}
}
</script>
<script type="text/javascript" language="javascript">
var http_request = false;
function LoadInetInfo(url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
// zu dieser Zeile siehe weiter unten
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request.onreadystatechange = DisplayInetInfo;
http_request.open('GET', url, true);
http_request.send(null);
}
function DisplayInetInfo() {
if (http_request.readyState == 4) {
var xmldoc = http_request.responseXML;
var root1_node = xmldoc.getElementsByTagName('rx_kbs').item(0);
var root2_node = xmldoc.getElementsByTagName('tx_kbs').item(0);
var root3_node = xmldoc.getElementsByTagName('rxb').item(0);
var root4_node = xmldoc.getElementsByTagName('txb').item(0);
document.forms['speed'].txkb.value = root1_node.firstChild.data;
document.forms['speed'].rxkb.value = root2_node.firstChild.data;
// document.getElementsByTagName("input")[0].style.color = "#00FF00";
url = "/cgi-bin/speed.cgi?rxb_last=" + root3_node.firstChild.data + "&txb_last=" + root4_node.firstChild.data;
window.setTimeout("LoadInetInfo(url)", 3000);
}
}
</script>
</head>
<body onLoad="LoadInetInfo('/cgi-bin/speed.cgi')">
<!-- IPFIRE HEADER -->
<div id="header">
<div id="header_inner" class="fixed">
<div id="header_inner" class="fixed">
<div id="logo">
<div id="logo">
END
;
if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') {
print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />";
} else {
print "<h1><span>IPFire</span></h1><br />";
}
print <<END
<h2>$h2</h2>
</div>
print "<h1><span>IPFire</span></h1><br />";
}
print <<END
<h2>$h2</h2>
</div>
END
;
&showmenu();
&showmenu();
print <<END
</div>
print <<END
</div>
</div>
<div id="main">
<div id="main_inner" class="fixed">
<div id="primaryContent_2columns">
<div id="columnA_2columns">
<div id="main_inner" class="fixed">
<div id="primaryContent_2columns">
<div id="columnA_2columns">
END
;
}
@@ -286,12 +286,12 @@ END
function swapVisibility(id) {
el = document.getElementById(id);
if(el.style.display != 'block') {
el.style.display = 'block'
}
else {
el.style.display = 'none'
}
if(el.style.display != 'block') {
el.style.display = 'block'
}
else {
el.style.display = 'none'
}
}
</script>
@@ -301,19 +301,19 @@ END
<div id="header">
<div id="header_inner" class="fixed">
<div id="header_inner" class="fixed">
<div id="logo">
<h1><span>IPFire</span></h1>
<h2>$h2</h2>
</div>
</div>
<div id="logo">
<h1><span>IPFire</span></h1>
<h2>$h2</h2>
</div>
</div>
</div>
<div id="main">
<div id="main_inner" class="fixed">
<div id="primaryContent_2columns">
<div id="columnA_2columns">
<div id="main_inner" class="fixed">
<div id="primaryContent_2columns">
<div id="columnA_2columns">
END
;
}
@@ -321,33 +321,33 @@ END
sub closepage () {
my $status = &connectionstatus();
$uptime = `/usr/bin/uptime`;
print <<END
</div>
</div>
</div>
</div>
<div id="secondaryContent_2columns">
<div id="columnC_2columns">
<div id="secondaryContent_2columns">
<div id="columnC_2columns">
END
;
&showsubsection($menu);
&showsubsubsection($menu);
print <<END
</div>
</div>
print <<END
</div>
</div>
<br class="clear" />
<div id="footer" class="fixed">
<b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD
<br />
<form name='speed'>
<b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}:<input type="text" name="rxkb" size="16" value="0,00 kb/s" style="border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF" />
$Lang::tr{'outgoing'}: <input type="text" name="txkb" size="16" value="0,00 kb/s" style="border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF" />
</form>
</div>
</div>
<br class="clear" />
<div id="footer" class="fixed">
<b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD
<br />
<form name='speed'>
<b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}:<input type="text" name="rxkb" size="5" value="0 kb/s" style="font-size: 12px; font-family: Arial, Helvetica;text-align: center;color:green; border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF; vertical-align: middle" />
$Lang::tr{'outgoing'}: <input type="text" name="txkb" size="5" value="0 kb/s" style="font-size: 12px; font-family: Arial, Helvetica;text-align: center;color:red; border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF; vertical-align: middle"/>
</form>
</div>
</div>
</div>
</body>
</html>
@@ -365,25 +365,25 @@ sub closebigbox
sub openbox
{
$width = $_[0];
$align = $_[1];
$caption = $_[2];
$width = $_[0];
$align = $_[1];
$caption = $_[2];
print <<END
print <<END
<!-- openbox -->
<div class="post" align="$align">
<div class="post" align="$align">
END
;
if ($caption) { print "<h3>$caption</h3>\n"; } else { print "&nbsp;"; }
if ($caption) { print "<h3>$caption</h3>\n"; } else { print "&nbsp;"; }
}
sub closebox
{
print <<END
</div>
<br class="clear" />
<!-- closebox -->
print <<END
</div>
<br class="clear" />
<!-- closebox -->
END
;
}

View File

@@ -148,17 +148,69 @@ END
function swapVisibility(id) {
el = document.getElementById(id);
if(el.style.display != 'block') {
el.style.display = 'block'
}
else {
el.style.display = 'none'
}
if(el.style.display != 'block') {
el.style.display = 'block'
}
else {
el.style.display = 'none'
}
}
</script>
<script type="text/javascript" language="javascript">
var http_request = false;
function LoadInetInfo(url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
// zu dieser Zeile siehe weiter unten
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen');
return false;
}
http_request.onreadystatechange = DisplayInetInfo;
http_request.open('GET', url, true);
http_request.send(null);
}
function DisplayInetInfo() {
if (http_request.readyState == 4) {
var xmldoc = http_request.responseXML;
var root1_node = xmldoc.getElementsByTagName('rx_kbs').item(0);
var root2_node = xmldoc.getElementsByTagName('tx_kbs').item(0);
var root3_node = xmldoc.getElementsByTagName('rxb').item(0);
var root4_node = xmldoc.getElementsByTagName('txb').item(0);
document.forms['speed'].txkb.value = root1_node.firstChild.data;
document.forms['speed'].rxkb.value = root2_node.firstChild.data;
// document.getElementsByTagName("input")[0].style.color = "#00FF00";
url = "/cgi-bin/speed.cgi?rxb_last=" + root3_node.firstChild.data + "&txb_last=" + root4_node.firstChild.data;
window.setTimeout("LoadInetInfo(url)", 3000);
}
}
</script>
</head>
<body>
<body onLoad="LoadInetInfo('/cgi-bin/speed.cgi')">
<!-- IPFIRE HEADER -->
<div id="header">
@@ -289,6 +341,11 @@ END
<br class="clear" />
<div id="footer" class="fixed">
<b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD
<br />
<form name='speed'>
<b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}:<input type="text" name="rxkb" size="5" value="0 kb/s" style="font-size: 12px; font-family: Arial, Helvetica;text-align: center;color:green; border: 1px solid black; padding: 0; background-color:black; vertical-align: middle" />
$Lang::tr{'outgoing'}: <input type="text" name="txkb" size="5" value="0 kb/s" style="font-size: 12px; font-family: Arial, Helvetica;text-align: center;color:red; border: 1px solid black; padding: 0; background-color:black; vertical-align: middle" />
</form>
</div>
</div>
</div>