fix how we decide to show routing tab, and save some db queries

git-svn-id: http://www.observium.org/svn/observer/trunk@2296 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-13 08:57:54 +00:00
parent 6f461860f9
commit c156c75b0a
2 changed files with 26 additions and 42 deletions
+2 -17
View File
@@ -1,20 +1,5 @@
<?php
unset($datas);
$device_routing_count['bgp'] = mysql_result(mysql_query("select count(*) from bgpPeers WHERE device_id = '" . $device['device_id'] . "'"), 0);
if ($device_routing_count['bgp']) { $datas[] = 'bgp'; }
$device_routing_count['ospf'] = mysql_result(mysql_query("select count(*) from ospf_ports WHERE device_id = '" . $device['device_id'] . "'"), 0);
if ($device_routing_count['ospf']) { $datas[] = 'ospf'; }
$device_routing_count['cef'] = mysql_result(mysql_query("select count(*) from cef_switching WHERE device_id = '" . $device['device_id'] . "'"), 0);
if ($device_routing_count['cef']) { $datas[] = 'cef'; }
$device_routing_count['vrf'] = @mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0);
if($device_routing_count['vrf']) { $datas[] = 'vrf'; }
#$type_text['overview'] = "Overview";
$type_text['bgp'] = "BGP";
$type_text['cef'] = "CEF";
@@ -26,7 +11,7 @@ print_optionbar_start();
echo("<span style='font-weight: bold;'>Routing</span> &#187; ");
unset($sep);
foreach ($datas as $type)
foreach ($routing_tabs as $type)
{
if (!$_GET['opta']) { $_GET['opta'] = $type; }
@@ -49,7 +34,7 @@ if (is_file("pages/device/routing/".mres($_GET['opta']).".inc.php"))
{
include("pages/device/routing/".mres($_GET['opta']).".inc.php");
} else {
foreach ($datas as $type)
foreach ($routing_tabs as $type)
{
if ($type != "overview")
{