From 233cc0a77302d2658b1265c63fb775667589d14f Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 2 Oct 2009 13:20:24 +0000 Subject: [PATCH] adding new web-only includes for functions and add thumbnail graphs to pseudowires git-svn-id: http://www.observium.org/svn/observer/trunk@478 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/functions.inc.php | 55 +++++++++++++++++++++++++++++++++ html/index.php | 3 +- html/pages/device/ports.inc.php | 28 ++++------------- html/pages/pseudowires.php | 55 ++++++++++++++++++++++++++++++--- 4 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 html/includes/functions.inc.php diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php new file mode 100644 index 0000000000..3840ea4477 --- /dev/null +++ b/html/includes/functions.inc.php @@ -0,0 +1,55 @@ +
', CAPTION, '" . $args['hostname'] . " - " . fixifName($args['label']) . ""; + if($args['ifAlias']) { $link .= "
" . $args['ifAlias']; } + $link .= "' "; + $link .= $config['overlib_defaults'].");\" onmouseout=\"return nd();\" >".$args['content'].""; + return $link; +} + +function generate_port_thumbnail($args) { + if(!$args['bg']) { $args['bg'] = "FFFFF"; } + $args['content'] = ""; + $output = generate_if_link($args); + echo $output; +} + +function print_optionbar_start () { + echo(" +
+ + + + + + +
+
"); +} + + +function print_optionbar_end () { + echo("
+
+ + + + + + +
"); +} + +?> diff --git a/html/index.php b/html/index.php index bb96f9c15a..65339ddc88 100755 --- a/html/index.php +++ b/html/index.php @@ -3,7 +3,7 @@ ini_set('display_errors', 0); -if($_GET[debug]) { +if($debug) { ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ini_set('log_errors', 1); @@ -12,6 +12,7 @@ if($_GET[debug]) { include("../config.php"); include("../includes/functions.php"); + include("includes/functions.inc.php"); include("includes/authenticate.inc"); $start = utime(); diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index 2b53d4c535..0cabd0b458 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -1,16 +1,8 @@ - - - - - - -
-
-Basic | +print_optionbar_start(); + +echo("Basic | Details | ARP Table | Graphs: Bits @@ -20,17 +12,9 @@ echo(" NU Packets (Mini) | Errors -(Mini) -
-
- - - - - - - -"); +(Mini)"); + +print_optionbar_end(); if($_GET['opta'] == graphs ) { if($_GET['optb']) { $graph_type = $_GET['optb']; } else { $graph_type = "bits"; } diff --git a/html/pages/pseudowires.php b/html/pages/pseudowires.php index ab9cf4b407..f3930ea1cf 100644 --- a/html/pages/pseudowires.php +++ b/html/pages/pseudowires.php @@ -1,6 +1,16 @@ "); +print_optionbar_start(); + +echo("Details | Graphs : +Mini +"); + +print_optionbar_end(); + + list($opta, $optb, $optc, $optd, $opte) = explode("/", $_GET['opta']); + +echo(""); $sql = "SELECT * FROM pseudowires AS P, interfaces AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr"; $query = mysql_query($sql); @@ -25,14 +35,49 @@ while($pw_a = mysql_fetch_array($query)) { if($skip) { unset($skip); } else { - if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } - echo(" - + if($bg == "ffffff") { $bg = "e5e5e5"; } else { $bg="ffffff"; } + echo(" + "); - echo(""); + echo(""); + if($opta == "graphs") { + echo(""); + + } + $linkdone[] = $pw_b['device_id'] . $pw_b['interface_id']; } + } echo("
".$pw_a['cpwVcID']."".generatedevicelink($pw_a)."".generateiflink($pw_a)." =>
".$pw_a['cpwVcID']."".generatedevicelink($pw_a)."".generateiflink($pw_a)." ".generatedevicelink($pw_b)."".generateiflink($pw_b)."
".$pw_a['ifAlias']."".$pw_b['ifAlias']."
".$pw_a['ifAlias']."".$pw_b['ifAlias']."
"); + if(!$optb) { $optb = "mini"; } + if($pw_a) { + $pw_a['width'] = "150"; + $pw_a['height'] = "30"; + $pw_a['from'] = $day; + $pw_a['to'] = $now; + $pw_a['bg'] = $bg; + $types = array('bits','pkts','errors'); + foreach($types as $graph_type) { + $pw_a['graph_type'] = $graph_type; + generate_port_thumbnail($pw_a); + } + } + echo(""); + + if($pw_b) { + $pw_b['width'] = "150"; + $pw_b['height'] = "30"; + $pw_b['from'] = $day; + $pw_b['to'] = $now; + $pw_b['bg'] = $bg; + $types = array('bits','pkts','errors'); + foreach($types as $graph_type) { + $pw_b['graph_type'] = $graph_type; + generate_port_thumbnail($pw_b); + } + } + + echo("
");