From 1ad3650475af2b94d5817aa8bfc9605679c76841 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 8 Feb 2010 18:56:26 +0000 Subject: [PATCH] start cleanup of overlib into functions. create defaults.inc.php for new settings (why not before? because i suck. duh.) git-svn-id: http://www.observium.org/svn/observer/trunk@796 61d68cd4-352d-0410-923a-c4978735b2b8 --- config.php.default | 12 +++--------- includes/defaults.inc.php | 7 +++++++ includes/functions.php | 34 ++++++++++++++++++++++------------ 3 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 includes/defaults.inc.php diff --git a/config.php.default b/config.php.default index 76581ebfb0..c773cbc681 100755 --- a/config.php.default +++ b/config.php.default @@ -1,5 +1,8 @@ diff --git a/includes/functions.php b/includes/functions.php index 661114ddc3..51665344e4 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -311,27 +311,33 @@ function geteventicon ($message) if ($icon) { return $icon; } else { return false; } } -function generateiflink($interface, $text=0, $type = '') +function generateiflink($interface, $text=0, $type = NULL) { global $twoday; global $now; global $config; global $day; global $month; $interface = ifNameDescr($interface); if (!$text) { $text = fixIfName($interface['label']); } - if (isset($type)) { $interface['graph_type'] = $type; } - if (!$interface['graph_type']) { $interface['graph_type'] = 'port_bits'; } + if (isset($type)) { $interface['graph_type'] = $type; } else { $interface['graph_type'] = 'port_bits'; } $class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']); $graph_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=100&type=" . $interface['graph_type']; $graph_url_month = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$month&to=$now&width=400&height=100&type=" . $interface['graph_type']; $device_id = getifhost($interface['interface_id']); - $link = ""; - if ($interface['ifAlias']) { $link .= "
" . htmlentities($interface['ifAlias']); } - $link .= "' "; - $link .= $config['overlib_defaults'].");\" onmouseout=\"return nd();\" >$text
"; + $url = $config['base_url']."/device/$device_id/interface/" . $interface['interface_id'] . "/"; + $contents = "
" . $interface['hostname'] . " - " . fixifName($interface['label']) . "
"; + if ($interface['ifAlias']) { $contents .= htmlentities($interface['ifAlias'] ."
" ); } + $contents .= "
"; + $link = overlib_link($url, $text, $contents, $class); return $link; } +function overlib_link($url, $text, $contents, $class) { + global $config; + $output = ""; + $output .= $text.""; + return $output; +} + function generatedevicelink($device, $text=0, $start=0, $end=0) { global $twoday; global $day; global $now; global $config; @@ -341,9 +347,13 @@ function generatedevicelink($device, $text=0, $start=0, $end=0) if (!$text) { $text = $device['hostname']; } $graph_url = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=device_cpu"; $graph_url_b = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&from=$start&to=$end&width=400&height=120&type=device_memory"; - $link = "".$device['hostname']." - CPU & Memory Usage"; - $link .= "
'".$config['overlib_defaults'].", LEFT);\" onmouseout=\"return nd();\">" . htmlentities($text) . "
"; + + $url = $config['base_url']."/device/" . $device['device_id'] . "/"; + $contents = "
".$device['hostname']." - CPU & Memory Usage
"; + if ($device['location']) { $contents .= "" . htmlentities($device['location']."
"); } + $contents .= "