diff --git a/assets/pages/jquery.drawConnections.js b/assets/pages/jquery.drawConnections.js
index 18d9f41..5a7707a 100755
--- a/assets/pages/jquery.drawConnections.js
+++ b/assets/pages/jquery.drawConnections.js
@@ -289,17 +289,23 @@ function drawPath(){
function crawlPathConnections(){
- var pathConnections = {};
+ var pathConnections = [];
+ var workingPathConnections = {};
var connectorElementArray = $('#containerFullPath').find('.port');
- // Sort ports by connectionPairId
+ // Group connection peers
$.each(connectorElementArray, function(index, element){
- if($(element).data('connectionPairId') !== '') {
- var connectionPairID = $(element).data('connectionPairId');
- if(pathConnections[connectionPairID] === undefined) {
- pathConnections[connectionPairID] = [];
- }
- pathConnections[connectionPairID].push($(element));
+ var connectionPairID = $(element).data('connectionPairId');
+ if(workingPathConnections[connectionPairID] === undefined) {
+ workingPathConnections[connectionPairID] = [];
+ }
+ workingPathConnections[connectionPairID].push($(element));
+ });
+
+ // Filter out singles
+ $.each(workingPathConnections, function(index, element){
+ if(element.length == 2) {
+ pathConnections.push(element);
}
});
@@ -309,21 +315,27 @@ function crawlPathConnections(){
function crawlPathTrunks(){
- var pathTrunks = {};
+ var pathTrunks = [];
+ var workingPathTrunks = {};
var connectorElementArray = $('#containerFullPath').find('.objectBox');
+ // Group trunk peers
$.each(connectorElementArray, function(index, element){
-
- if($(element).data('trunkPairId') !== 0) {
-
- var trunkPairID = $(element).data('trunkPairId');
-
- if(pathTrunks[trunkPairID] === undefined) {
- pathTrunks[trunkPairID] = [];
- }
- pathTrunks[trunkPairID].push($(element));
+ var trunkPairID = $(element).data('trunkPairId');
+ if(workingPathTrunks[trunkPairID] === undefined) {
+ workingPathTrunks[trunkPairID] = [];
+ }
+ workingPathTrunks[trunkPairID].push($(element));
+ });
+
+ // Filter out singles
+ $.each(workingPathTrunks, function(index, element){
+ if(element.length == 2) {
+ pathTrunks.push(element);
}
});
+
+ // Store path trunk data
$(document).data('pathTrunks', pathTrunks);
}
diff --git a/backend/process_path_finder.php b/backend/process_path_finder.php
index e6ba983..ace66e9 100755
--- a/backend/process_path_finder.php
+++ b/backend/process_path_finder.php
@@ -321,7 +321,6 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
findPaths2($qls, $maxResults, $maxDepth, $reachable, $endpointAObj, $endpointBObj, $finalPathArray, $previousPathType);
}
- error_log('Debug (finalPathArray): '.json_encode($finalPathArray));
foreach($finalPathArray as $mediaType => &$pathData) {
foreach($pathData as &$path) {
$path['pathHTML'] = $qls->App->buildPathFull($path['pathArray'], null);
diff --git a/includes/App.class.php b/includes/App.class.php
index 139d21c..c1ed441 100755
--- a/includes/App.class.php
+++ b/includes/App.class.php
@@ -1959,6 +1959,9 @@ var $qls;
$pathOrientation = $this->qls->user_info['pathOrientation'];
+ $connectionPairID = 1;
+ $trunkPairID = 1;
+
// Cable Adjacent
if($pathOrientation == 0) {
foreach($path as $objectIndex => $object) {
@@ -1968,15 +1971,10 @@ var $qls;
case 'connector':
- $addConnector = false;
+ // Should connector be added?
if(isset($path[$objectIndex+1])) {
-
- if($path[$objectIndex+1]['type'] != 'object') {
-
- $addConnector = true;
- }
+ $addConnector = ($path[$objectIndex+1]['type'] != 'object') ? true : false;
} else {
-
$addConnector = true;
}
@@ -1986,8 +1984,8 @@ var $qls;
array_push($tableArray[count($tableArray)-1], '
'.$this->wrapObject(0, 'None').' | ');
}
+ // Generate and push connector HTML
$connectorTypeID = $object['data']['connectorType'];
- $connectionPairID = $object['data']['connectionPairID'];
$connectorTypeName = ($connectorTypeID != 0) ? $this->portTypeValueArray[$connectorTypeID]['name'] : 'Unk';
$htmlString = ' | ';
array_push($tableArray[count($tableArray)-1], $htmlString);
@@ -2001,6 +1999,8 @@ var $qls;
case 'cable':
+ $trunkPairID++;
+
$cableTypeID = $object['data']['mediaTypeID'];
if($cableTypeID != 0) {
$cableTypeName = $mediaTypeClass = $this->mediaTypeValueArray[$cableTypeID]['name'];
@@ -2025,7 +2025,6 @@ var $qls;
case 'object':
- $trunkPairID = $object['trunkPairID'];
$objName = '';
foreach($object['data'] as $item) {
$objID = $item['id'];
@@ -2045,7 +2044,6 @@ var $qls;
if($path[$objectIndex+1]['type'] == 'trunk' or !isset($path[$objectIndex+1])) {
if(isset($path[$objectIndex-1])) {
$connectorTypeID = $path[$objectIndex-1]['data']['connectorType'];
- $connectionPairID = $path[$objectIndex-1]['data']['connectionPairID'];
$connectorTypeName = ($connectorTypeID != 0) ? $this->portTypeValueArray[$connectorTypeID]['name'] : 'Unk';
$htmlString = ' | ';
array_push($tableArray[count($tableArray)-1], $htmlString);
@@ -2063,6 +2061,8 @@ var $qls;
break;
case 'trunk':
+
+ $connectionPairID++;
$htmlString = '';
@@ -2116,7 +2116,6 @@ var $qls;
case 'connector':
$htmlPathFull .= '
| ';
$connectorTypeID = $object['data']['connectorType'];
- $connectionPairID = $object['data']['connectionPairID'];
if($connectorTypeID != 0) {
$connectorTypeName = $this->connectorTypeValueArray[$connectorTypeID]['name'];
@@ -2152,6 +2151,9 @@ var $qls;
break;
case 'trunk':
+
+ $connectionPairID++;
+
$htmlPathFull .= ' | ';
$htmlPathFull .= ' ';
$htmlPathFull .= ' | ';
diff --git a/includes/content-path.php b/includes/content-path.php
index bb04cba..b57bd40 100755
--- a/includes/content-path.php
+++ b/includes/content-path.php
@@ -44,9 +44,6 @@ if($isTrunked) {
$reversePortID = 0;
}
-$connectionPairID = 1;
-$trunkPairID = 1;
-
// Discover path elements
// First look outward from the far end of the cable,
// then look outward from the near end of the cable.
@@ -56,10 +53,8 @@ for($x=0; $x<2; $x++){
// Object
$selected = ($objID == $selectedObjID and $objFace == $selectedObjFace and $objDepth == $selectedObjDepth and $objPort == $selectedObjPort) ? true : false;
- $trunkPairID = (isset($qls->App->peerArray[$objID][$objFace][$objDepth])) ? $qls->App->peerArray[$objID][$objFace][$objDepth]['id'] : 0;
$workingArray = array(
'type' => 'object',
- 'trunkPairID' => $trunkPairID,
'data' => array(
array(
'id' => $objID,
@@ -93,8 +88,7 @@ for($x=0; $x<2; $x++){
'type' => 'connector',
'data' => array(
'code39' => $connection[$localAttrPrefix.'_code39'],
- 'connectorType' => $connection[$localAttrPrefix.'_connector'],
- 'connectionPairID' => $connectionPairID
+ 'connectorType' => $connection[$localAttrPrefix.'_connector']
)
);
@@ -116,8 +110,7 @@ for($x=0; $x<2; $x++){
'type' => 'connector',
'data' => array(
'code39' => $connection[$remoteAttrPrefix.'_code39'],
- 'connectorType' => $connection[$remoteAttrPrefix.'_connector'],
- 'connectionPairID' => $connectionPairID
+ 'connectorType' => $connection[$remoteAttrPrefix.'_connector']
)
);
@@ -129,9 +122,6 @@ for($x=0; $x<2; $x++){
$objDepth = $connection[$remoteAttrPrefix.'_object_depth'];
$objPort = $connection[$remoteAttrPrefix.'_port_id'];
- $trunkPairID = (isset($qls->App->peerArray[$objID][$objFace][$objDepth])) ? $qls->App->peerArray[$objID][$objFace][$objDepth]['id'] : 0;
- $objectWorkingArray['trunkPairID'] = $trunkPairID;
-
// Remote Object
$workingArray = array(
'id' => $objID,
@@ -214,9 +204,6 @@ for($x=0; $x<2; $x++){
// No connected object
$objID = 0;
}
-
- $connectionPairID++;
- $trunkPairID++;
}
// Now that we've discovered the far side of the scanned cable,