improvements to (mysql) app system

git-svn-id: http://www.observium.org/svn/observer/trunk@3135 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans 2012-05-06 19:03:03 +00:00
parent 8df2b9b3f5
commit 78fe096645
6 changed files with 44 additions and 31 deletions

View File

@ -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('
<li><a href="apps/app='.$app['app_type'].'/"><img src="images/icons/'.$icon.'.png" border="0" align="absmiddle" /> '.$app['app_type'].' </a></li>');
<li><a href="apps/app='.$app['app_type'].'/"><img src="images/icons/'.$icon.'.png" border="0" align="absmiddle" /> '.nicecase($app['app_type']).' </a></li>');
}
?>

View File

@ -28,7 +28,7 @@ foreach ($app_list as $app)
} else {
#echo('<img src="images/icons/greyscale/'.$app['app_type'].'.png" class="optionicon" />');
}
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("</span>"); }
$sep = " | ";
}

View File

@ -9,36 +9,38 @@ $graph_array_zoom['height'] = "150";
$graph_array_zoom['width'] = "400";
$graph_array['legend'] = "no";
echo('<h2>'.$vars['app'].'</h2>');
echo('<h2>'.nicecase($vars['app']).'</h2>');
echo('<table cellpadding=5 cellspacing=0 class=devicetable width=100%>');
$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('<tr class="list-device">');
echo('<td class="device-head" width=300px>'.generate_device_link($app_device, shorthost($app_device['hostname']), array('tab'=>'apps','app'=>$vars['app'])).'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_instance'].'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_status'].'</td>');
echo('<td></td>');
echo('</tr>');
echo('<tr class="list-device">');
echo('<td colspan=4>');
echo('<tr class="list-device">');
echo('<td class="device-head" width=300px>'.generate_device_link($app_device, shorthost($app_device['hostname']), array('tab'=>'apps','app'=>$vars['app'])).'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_instance'].'</td>');
echo('<td class="device-head" width=100px>'.$app_device['app_status'].'</td>');
echo('<td></td>');
echo('</tr>');
echo('<tr class="list-device">');
echo('<td colspan=4>');
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('</td>');
echo('</tr>');
echo(overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
}
echo('</td>');
echo('</tr>');
}
echo('</table>');

View File

@ -12,7 +12,7 @@ $graph_array['legend'] = "no";
foreach ($app_list as $app)
{
echo('<div style="clear: both;">');
echo('<h2>'.generate_link(ucfirst($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'</h2>');
echo('<h2>'.generate_link(nicecase($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'</h2>');
$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)
{

View File

@ -3,10 +3,10 @@ global $config;
print_optionbar_start();
echo("<span style='font-weight: bold;'>".$app['app_type']."</span> &#187; ");
echo("<span style='font-weight: bold;'>".nicecase($app['app_type'])."</span> &#187; ");
$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("<span class='pagemenu-selected'>");
}
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("</span>"); }
$sep = " | ";
}

View File

@ -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)