diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index feee5ee41..dc80cdc4a 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -9,6 +9,44 @@ function generateiflink($interface, $text=0, $type = NULL) return generate_if_link($interface, $text); } +function generatedevicelink($device, $text=0, $start=0, $end=0) +{ + global $twoday; global $day; global $now; global $config; global $popgraph; global $popdescr; + if (!$start) { $start = $day; } + if (!$end) { $end = $now; } + $class = devclass($device); + if (!$text) { $text = $device['hostname']; } + + if (isset($popgraph[$device['os']])) + { + $graphs = $popgraph[$device['os']]; + $descr = $popdescr[$device['os']]; + } + else + { + $graphs = $popgraph['default']; + $descr = $popdescr['default']; + } + + $url = $config['base_url']."/device/" . $device['device_id'] . "/"; + $contents = "
".$device['hostname'] . " - $descr
"; + if (isset($device['location'])) { $contents .= "" . htmlentities($device['location'])."
"; } + foreach ($graphs as $graph) + { + $contents .= '
'; + } + $text = htmlentities($text); + $link = overlib_link($url, $text, $contents, $class); + if(devicepermitted($device['device_id'])) { + return $link; + } else { + return $device['hostname']; + } + + + return $link; +} + function overlib_link($url, $text, $contents, $class) { global $config; $contents = str_replace("\"", "\'", $contents); diff --git a/includes/functions.php b/includes/functions.php index ead2ed4fc..c90d2ce21 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -217,33 +217,6 @@ function geteventicon ($message) if (isset($icon)) { return $icon; } else { return false; } } -function generatedevicelink($device, $text=0, $start=0, $end=0) -{ - global $twoday; global $day; global $now; global $config; - if (!$start) { $start = $day; } - if (!$end) { $end = $now; } - $class = devclass($device); - 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"; - - $url = $config['base_url']."/device/" . $device['device_id'] . "/"; - $contents = "
".$device['hostname']." - CPU & Memory Usage
"; - if (isset($device['location'])) { $contents .= "" . htmlentities($device['location']."
"); } - $contents .= "
"; diff --git a/includes/static-config.php b/includes/static-config.php index e0be161a1..305decb43 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -97,11 +97,42 @@ if(!$config['graph_colours']['mixed']) { $device_types = array('server','network','firewall','workstation','printer','power', 'environment'); +## Popup graphs + +# Default +$popgraph['default'][] = 'device_cpu'; +$popgraph['default'][] = 'device_memory'; +$popdescr['default'] = "CPU & Memory Usage"; + +$popgraph['apc'][] = 'device_current'; +$popdescr['apc'] = "Current"; + +$popgraph['mgeups'][] = 'device_current'; +$popdescr['mgeups'] = "Current"; + +$popgraph['dell-laser'][] = 'device_toner'; +$popdescr['dell-laser'] = "Toner"; + +#$popgraph['areca'][] = 'device_'; +#$popdescr['areca'] = ""; + +$popgraph['netmanplus'][] = 'device_current'; +$popdescr['netmanplus'] = "Current"; + +$popgraph['akcp'][] = 'device_temperatures'; +$popdescr['akcp'] = "Temperature"; + +$popgraph['minkelsrms'] = $popgraph['akcp']; +$popdescr['minkelsrms'] = $popdescr['akcp']; + +$popgraph['papouch-tme'][] = 'device_temperatures'; +$popdescr['papouch-tme'] = "Temperature"; + ############################## # No changes below this line # ############################## -$config['version'] = "0.10.6"; +$config['version'] = "0.10"; $config['rrd_opts_array'] = explode(" ", trim($config['rrdgraph_def_text']));