From 9d8d4c2a390c845b9b40ecd1d87faefcfa6b8ee5 Mon Sep 17 00:00:00 2001 From: Garrett K Date: Mon, 1 Mar 2021 05:23:46 +0000 Subject: [PATCH] 0.3.14 --- includes/App.class.php | 53 +++++++++++++++++++++++++++++--------- includes/content-path2.php | 25 +++++++++++++++--- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/includes/App.class.php b/includes/App.class.php index 98e91a8..37cabb5 100755 --- a/includes/App.class.php +++ b/includes/App.class.php @@ -1983,6 +1983,7 @@ var $qls; // Generate port name(s) $objName = ''; $selected = false; + $populated = false; foreach($connectionSide as $port) { $objID = $port['objID']; @@ -1990,6 +1991,10 @@ var $qls; $objDepth = $port['objDepth']; $objPort = $port['objPort']; $selected = ($port['selected'] == true) ? true : $selected; + $cableLength = $port['length']; + $mediaTypeID = $port['mediaTypeID']; + $connectorTypeID = $port['connectorTypeID']; + $populated = (isset($this->populatedPortArray[$objID][$objFace][$objDepth][$objPort])) ? true : $populated; $objName .= $this->generateObjectPortName($objID, $objFace, $objDepth, $objPort).'
'; } @@ -1998,20 +2003,44 @@ var $qls; $htmlPort = $this->wrapObject($objID, $objName, $selected, $trunkPairID); // Gather connector data - $obj = $this->objectArray[$objID]; - $objTemplateID = $obj['template_id']; - $objCompatibility = $this->compatibilityArray[$objTemplateID][$objFace][$objDepth]; - $portTypeID = $objCompatibility['portType']; - $portTypeName = $this->portTypeValueArray[$portTypeID]['name']; + if($connectorTypeID) { + $portTypeName = $this->connectorTypeValueArray[$connectorTypeID]['name']; + } else { + $obj = $this->objectArray[$objID]; + $objTemplateID = $obj['template_id']; + $objCompatibility = $this->compatibilityArray[$objTemplateID][$objFace][$objDepth]; + $portTypeID = $objCompatibility['portType']; + $portTypeName = $this->portTypeValueArray[$portTypeID]['name']; + } - // Compile connector div - $htmlConnector = '
'; + // Determine if this port is connected to another + if($connectionIndex == 1) { + $connected = (count($connection[0])) ? true : false; + } else { + $connected = (count($connection[1])) ? true : false; + } - $mediaTypeID = $objCompatibility['mediaType']; - $mediaTypeName = $this->mediaTypeValueArray[$mediaTypeID]['name']; - $cableLength = 0; - - $htmlCable = '
'.$cableLength.'
'.$mediaTypeName.'
'; + if($connected or $populated) { + // Compile connector div + $htmlConnector = '
'; + + // Gather cable data + if($mediaTypeID) { + $mediaTypeName = $this->mediaTypeValueArray[$mediaTypeID]['name']; + } else { + $obj = $this->objectArray[$objID]; + $objTemplateID = $obj['template_id']; + $objCompatibility = $this->compatibilityArray[$objTemplateID][$objFace][$objDepth]; + $mediaTypeID = $objCompatibility['mediaType']; + $mediaTypeName = $this->mediaTypeValueArray[$mediaTypeID]['name']; + } + + // Compile cable div + $htmlCable = '
'.$cableLength.'
'.$mediaTypeName.'
'; + } else { + $htmlConnector = ''; + $htmlCable = ''; + } $htmlPathFull .= ''; $htmlPathFull .= ''.$htmlPort.''; diff --git a/includes/content-path2.php b/includes/content-path2.php index 14f968a..59e8d24 100755 --- a/includes/content-path2.php +++ b/includes/content-path2.php @@ -4,8 +4,8 @@ $pathArray = array(); if($connectorCode39) { - $connectorID2 = base_convert($connectorCode39, 36, 10); - $rootCable2 = $qls->App->inventoryByIDArray[$connectorID2]; + $managedCableID = base_convert($connectorCode39, 36, 10); + $rootCable2 = $qls->App->inventoryByIDArray[$managedCableID]; $objID2 = $rootCable2['local_object_id']; $objFace2 = $rootCable2['local_object_face']; @@ -135,13 +135,31 @@ function crawlTrunk(&$qls, $portSet) { function crawlConn(&$qls, $selected, $objID, $objFace, $objDepth, $objPort, &$connSet=array(array(),array()), $connSetID=0) { + $managedCableID = (isset($qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort])) ? $qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort][0]['localEndID'] : 0; + if($managedCableID != 0) { + $managedCable = $qls->App->inventoryByIDArray[$managedCableID]; + $managedCableMediaTypeID = $managedCable['mediaType']; + $managedCableLength = $managedCable['length']; + $includeUnit = true; + $length = $qls->App->calculateCableLength($managedCableMediaTypeID, $managedCableLength, $includeUnit); + $mediaTypeID = $managedCable['mediaType']; + $connectorTypeID = $managedCable['localConnector']; + } else { + $length = 'Unk. Length'; + $mediaTypeID = false; + $connectorTypeID = false; + } + // Store port details $workingArray = array( 'objID' => $objID, 'objFace' => $objFace, 'objDepth' => $objDepth, 'objPort' => $objPort, - 'selected' => $selected + 'selected' => $selected, + 'length' => $length, + 'mediaTypeID' => $mediaTypeID, + 'connectorTypeID' => $connectorTypeID ); // Add port info to connection set @@ -162,6 +180,7 @@ function crawlConn(&$qls, $selected, $objID, $objFace, $objDepth, $objPort, &$co $remoteObjFace = $connection['face']; $remoteObjDepth = $connection['depth']; $remoteObjPort = $connection['port']; + $managedCableID = $connection['localEndID']; // Verify this node has not been visited already $alreadySeen = false;