From 08c740c64ff9c9e60f43cd360585b113b4210f42 Mon Sep 17 00:00:00 2001 From: Garrett K Date: Sun, 21 Feb 2021 06:50:09 +0000 Subject: [PATCH] 0.3.14 --- assets/pages/jquery.diagram.js | 5 +- assets/pages/jquery.drawConnections.js | 21 +++++---- includes/content-path2.php | 64 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 12 deletions(-) create mode 100755 includes/content-path2.php diff --git a/assets/pages/jquery.diagram.js b/assets/pages/jquery.diagram.js index 39ea2bc..28f3a6d 100755 --- a/assets/pages/jquery.diagram.js +++ b/assets/pages/jquery.diagram.js @@ -61,11 +61,10 @@ function addCab(elementID, elementFace, elementType){ }); if(elementType == 'object') { - refreshPathData(); - redraw(); + drawCabinet(); } - makePortsHoverable(); + makePortsHoverable(false); makeCabArrowsClickable(); makeCabCloseClickable(); $('#objectTreeModal').modal('hide'); diff --git a/assets/pages/jquery.drawConnections.js b/assets/pages/jquery.drawConnections.js index c8f0516..9873035 100755 --- a/assets/pages/jquery.drawConnections.js +++ b/assets/pages/jquery.drawConnections.js @@ -1,6 +1,5 @@ // ### Cabinet Functions ### function drawCabinet(){ - resizeCabinetCanvas(); clearCabinetConnections(); crawlCabinet(); @@ -23,13 +22,13 @@ function crawlCabinet(){ $.each(pathSourceArray, function(pathSourceType, pathSource){ if(pathSource !== undefined && pathSource !== false) { - - // -=# TESTING #=- var testConnectionArray = crawlCabinetConnections($(pathSource)); var testTrunkArray = crawlCabinetTrunks($(pathSource)); + } else { + var testConnectionArray = []; + var testTrunkArray = []; } - //$(document).data(sourceTypeMap[pathSourceType][0], connectionArray); $(document).data(sourceTypeMap[pathSourceType][0], testConnectionArray); $(document).data(sourceTypeMap[pathSourceType][1], testTrunkArray); }); @@ -171,6 +170,8 @@ function crawlCabinetTrunks(localPort, trunkArray = [], visitedPartitionArray = } }); } + } else if(localRemotePartitionID.toLowerCase() != 'none') { + trunkArray.push([localPartition, localRemotePartitionID]); } // Gather local peer ports @@ -598,11 +599,13 @@ function highlightElement(elem, color){ cabinetCtx.lineWidth = origLineWidth; } -function makePortsHoverable(){ +function makePortsHoverable(clearPaths=true){ - resetConnectionData(); - clearPathConnections(); - clearCabinetConnections(); + if(clearPaths) { + resetConnectionData(); + clearPathConnections(); + clearCabinetConnections(); + } $('#buildSpaceContent').find('.port').each(function(){ $(this).unbind('mouseenter mouseleave click.drawConnections'); @@ -650,7 +653,7 @@ function makeCabArrowsClickable(){ var direction = $(this).data('cabMoveDirection'); var cabinet = $(this).closest('.diagramCabinetContainer'); if(direction == 'left') { - $(cabinet).insertBefore($(cabinet).prev()).animate(); + $(cabinet).insertBefore($(cabinet).prev()); } else { $(cabinet).insertAfter($(cabinet).next()); } diff --git a/includes/content-path2.php b/includes/content-path2.php new file mode 100755 index 0000000..cbcf360 --- /dev/null +++ b/includes/content-path2.php @@ -0,0 +1,64 @@ +App->inventoryByIDArray[$connectorID]; + + $objID = $rootCable['local_object_id']; + $objFace = $rootCable['local_object_face']; + $objDepth = $rootCable['local_object_depth']; + $objPort = $rootCable['local_object_port']; +} + +$selectedObjID = $objID; +$selectedObjFace = $objFace; +$selectedObjDepth = $objDepth; +$selectedObjPort = $objPort; + +function crawlConnSet($objID, $objFace, $objDepth, $objPort, $connSetID=0, $connSet=array(array(),array())) { + + // Store port details + $workingArray = array( + 'objID' => $objID, + 'objFace' => $objFace, + 'objDepth' => $objDepth, + 'objPort' => $objPort, + ); + + // Verify this node has not been visited already + $alreadySeen = false; + foreach($connSet as $conn) { + foreach($conn as $port) { + if($port['objID'] == $objID and $port['objFace'] == $objFace and $port['objDepth'] == $objDepth and $port['objPort'] == $objPort) { + $alreadySeen = true; + } + } + } + + // Is local port connected? + if(isset($qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort]) and !$alreadySeen) { + + // Add port info to connection set + array_push($connSet[$connSetID], $workingArray); + + // Loop over each local port connection + $inventoryEntry = $qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort]; + foreach($inventoryEntry as $connection) { + + // Collect remote object data + $remoteObjID = $connection['id']; + $remoteObjFace = $connection['face']; + $remoteObjDepth = $connection['depth']; + $remoteObjPort = $connection['port']; + + // Flip the connection set ID + $connSetID = ($connSetID == 0) ? 1 : 0; + crawlConnSet($remoteObjID, $remoteObjFace, $remoteObjDepth, $remoteObjPort, $connSetID, $connSet); + + } + } +} + +?>