From 78fe096645bcbb759189d014d25a5293bf62aead Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Sun, 6 May 2012 19:03:03 +0000 Subject: [PATCH] improvements to (mysql) app system git-svn-id: http://www.observium.org/svn/observer/trunk@3135 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/print-menubar.php | 2 +- html/pages/apps.inc.php | 2 +- html/pages/apps/default.inc.php | 48 +++++++++++++++------------- html/pages/apps/overview.inc.php | 2 +- html/pages/device/apps/mysql.inc.php | 6 ++-- includes/functions.php | 15 +++++++-- 6 files changed, 44 insertions(+), 31 deletions(-) diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index f3bd8300c..c16d77b2d 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -411,7 +411,7 @@ if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0") $image = $config['html_dir']."/images/icons/".$row['app_type'].".png"; $icon = (file_exists($image) ? $row['app_type'] : "apps"); echo(' -
  • '.$app['app_type'].'
  • '); +
  • '.nicecase($app['app_type']).'
  • '); } ?> diff --git a/html/pages/apps.inc.php b/html/pages/apps.inc.php index 50f928b16..3d14da0b4 100644 --- a/html/pages/apps.inc.php +++ b/html/pages/apps.inc.php @@ -28,7 +28,7 @@ foreach ($app_list as $app) } else { #echo(''); } - echo(generate_link(ucfirst($app['app_type']),array('page'=>'apps','app'=>$app['app_type']))); + echo(generate_link(nicecase($app['app_type']),array('page'=>'apps','app'=>$app['app_type']))); if ($vars['app'] == $app['app_type']) { echo(""); } $sep = " | "; } diff --git a/html/pages/apps/default.inc.php b/html/pages/apps/default.inc.php index 8bf2fd8be..53f8d858b 100644 --- a/html/pages/apps/default.inc.php +++ b/html/pages/apps/default.inc.php @@ -9,36 +9,38 @@ $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; $graph_array['legend'] = "no"; -echo('

    '.$vars['app'].'

    '); +echo('

    '.nicecase($vars['app']).'

    '); echo(''); $app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($vars['app'])); + foreach ($app_devices as $app_device) { - echo(''); - echo(''); - echo(''); - echo(''); - echo(''); - echo(''); - echo(''); - echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); - echo(''); + echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); + } + + echo(''); + echo(''); } echo('
    '.generate_device_link($app_device, shorthost($app_device['hostname']), array('tab'=>'apps','app'=>$vars['app'])).''.$app_device['app_instance'].''.$app_device['app_status'].'
    '); + echo('
    '.generate_device_link($app_device, shorthost($app_device['hostname']), array('tab'=>'apps','app'=>$vars['app'])).''.$app_device['app_instance'].''.$app_device['app_status'].'
    '); - foreach ($graphs[$vars['app']] as $graph_type) - { - $graph_array['type'] = "application_".$vars['app']."_".$graph_type; - $graph_array['id'] = $app_device['app_id']; - $graph_array_zoom['type'] = "application_".$vars['app']."_".$graph_type; - $graph_array_zoom['id'] = $app_device['app_id']; + foreach ($graphs[$vars['app']] as $graph_type) + { + $graph_array['type'] = "application_".$vars['app']."_".$graph_type; + $graph_array['id'] = $app_device['app_id']; + $graph_array_zoom['type'] = "application_".$vars['app']."_".$graph_type; + $graph_array_zoom['id'] = $app_device['app_id']; - $link_array = $graph_array; - $link_array['page'] = "graphs"; - unset($link_array['height'], $link_array['width']); - $link = generate_url($link_array); + $link_array = $graph_array; + $link_array['page'] = "graphs"; + unset($link_array['height'], $link_array['width']); + $link = generate_url($link_array); - echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); - } - echo('
    '); diff --git a/html/pages/apps/overview.inc.php b/html/pages/apps/overview.inc.php index 0fbde3c5e..3d4cd63ed 100644 --- a/html/pages/apps/overview.inc.php +++ b/html/pages/apps/overview.inc.php @@ -12,7 +12,7 @@ $graph_array['legend'] = "no"; foreach ($app_list as $app) { echo('
    '); - echo('

    '.generate_link(ucfirst($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'

    '); + echo('

    '.generate_link(nicecase($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'

    '); $app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($app['app_type'])); foreach ($app_devices as $app_device) { diff --git a/html/pages/device/apps/mysql.inc.php b/html/pages/device/apps/mysql.inc.php index ddd8f7df0..25e1587b1 100644 --- a/html/pages/device/apps/mysql.inc.php +++ b/html/pages/device/apps/mysql.inc.php @@ -3,10 +3,10 @@ global $config; print_optionbar_start(); -echo("".$app['app_type']." » "); +echo("".nicecase($app['app_type'])." » "); $app_sections = array('system' => "System", - 'queries' => "Quieries", + 'queries' => "Queries", 'innodb' => "InnoDB"); unset($sep); @@ -20,7 +20,7 @@ foreach ($app_sections as $app_section => $app_section_text) { echo(""); } - echo(generate_link(ucfirst($app_section),$vars,array('app_section'=>$app_section))); + echo(generate_link(nicecase($app_section),$vars,array('app_section'=>$app_section))); if ($vars['app_section'] == $app_section) { echo(""); } $sep = " | "; } diff --git a/includes/functions.php b/includes/functions.php index eba85879f..4b5a007c2 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -26,8 +26,19 @@ if ($config['alerts']['email']['enable']) function nicecase($item) { - if ($item == "dbm") { return "dBm"; } - else return ucfirst($item); + switch ($item) + { + case "dbm": + return "dBm"; + case "mysql": + return" MySQL"; + case "powerdns": + return "PowerDNS"; + case "bind": + return "BIND"; + default: + return ucfirst($item); + } } function mac_clean_to_readable($mac)