From 00b22a54a59ca9e8bcc71bc6b914be4aed8b687e Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Thu, 15 Dec 2011 23:14:50 +0000 Subject: [PATCH] improved vlan display git-svn-id: http://www.observium.org/svn/observer/trunk@2787 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/print-vlan.inc.php | 17 ++++++++++++++++- html/pages/device/port/vlans.inc.php | 9 +++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/html/includes/print-vlan.inc.php b/html/includes/print-vlan.inc.php index 8ab7be263..53593c6fd 100644 --- a/html/includes/print-vlan.inc.php +++ b/html/includes/print-vlan.inc.php @@ -8,7 +8,20 @@ echo(" Vlan " . $vlan['vlan_vlan'] . ""); echo("" . $vlan['vlan_descr'] . ""); echo(""); -foreach (dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?", array($device['device_id'], $vlan['vlan_vlan'])) as $port) + $vlan_ports = array(); + $otherports = dbFetchRows("SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.interface_id = V.interface_id", array($device['device_id'], $vlan['vlan_vlan'])); + foreach($otherports as $otherport) + { + $vlan_ports[$otherport[ifIndex]] = $otherport; + } + $otherports = dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?", array($device['device_id'], $vlan['vlan_vlan'])); + foreach($otherports as $otherport) + { + $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); + } + ksort($vlan_ports); + +foreach ($vlan_ports as $port) { $port = ifLabel($port, $device); if ($vars['view'] == "graphs") @@ -29,6 +42,8 @@ foreach (dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ? { echo($vlan['port_sep'] . generate_port_link($port, makeshortif($port['label']))); $vlan['port_sep'] = ", "; + if($port['untagged']) { echo("(U)"); } + } } diff --git a/html/pages/device/port/vlans.inc.php b/html/pages/device/port/vlans.inc.php index e008a5888..f284c8119 100644 --- a/html/pages/device/port/vlans.inc.php +++ b/html/pages/device/port/vlans.inc.php @@ -4,7 +4,7 @@ $vlans = dbFetchRows("SELECT * FROM `ports_vlans` AS PV, vlans AS V WHERE PV.`in echo(''); -echo(""); +echo(""); $row=0; foreach($vlans as $vlan) @@ -19,19 +19,16 @@ foreach($vlans as $vlan) echo(""); $vlan_ports = array(); - $otherports = dbFetchRows("SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.interface_id = V.interface_id", array($device['device_id'], $vlan['vlan'])); foreach($otherports as $otherport) { $vlan_ports[$otherport[ifIndex]] = $otherport; } - $otherports = dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?", array($device['device_id'], $vlan['vlan'])); foreach($otherports as $otherport) { - $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('access' => '1')); + $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); } - ksort($vlan_ports); echo("");
VLANDescriptionCostPriorityStateOther Ports
VLANDescriptionCostPriorityStateOther Ports
".$vlan['cost']."".$vlan['priority']."".$vlan['state'].""); @@ -39,7 +36,7 @@ foreach($vlans as $vlan) foreach($vlan_ports as $otherport) { echo($vsep.generate_port_link($otherport, makeshortif($otherport['ifDescr']))); - if($otherport['access']) { echo("(A)"); } + if($otherport['untagged']) { echo("(U)"); } $vsep=", "; } echo("