0.3.14
This commit is contained in:
parent
1ba1d850d8
commit
fa0703870a
@ -26,7 +26,8 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
// Create $path
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/includes/content-path2.php';
|
||||
include_once $_SERVER['DOCUMENT_ROOT'].'/includes/content-path.php';
|
||||
$validate->returnData['success'] = $qls->App->buildPathFull($path, $connectorCode39);
|
||||
$validate->returnData['success'] = $qls->App->buildPathFull2($pathArray);
|
||||
//$validate->returnData['success'] = $qls->App->buildPathFull($path, $connectorCode39);
|
||||
}
|
||||
echo json_encode($validate->returnData);
|
||||
}
|
||||
|
||||
@ -1955,6 +1955,84 @@ var $qls;
|
||||
$this->qls->SQL->insert('app_history', $columns, $values);
|
||||
}
|
||||
|
||||
function buildPathFull2($pathArray){
|
||||
|
||||
$pathOrientation = $this->qls->user_info['pathOrientation'];
|
||||
$trunkPairID = 0;
|
||||
|
||||
$htmlPathFull = '';
|
||||
$htmlPathFull .= '<table>';
|
||||
|
||||
// Cable Adjacent
|
||||
if($pathOrientation == 0) {
|
||||
|
||||
foreach($pathArray as $pathArrayIndex => $connection) {
|
||||
|
||||
// Set connectionPairID so connection can be drawn
|
||||
$connectionPairID = $pathArrayIndex;
|
||||
|
||||
foreach($connection as $connectionIndex => $connectionSide) {
|
||||
|
||||
if(count($connectionSide)) {
|
||||
|
||||
// Set trunkPairID so trunk can be drawn
|
||||
if($connectionIndex == 1) {
|
||||
$trunkPairID++;
|
||||
}
|
||||
|
||||
// Generate port name(s)
|
||||
$objName = '';
|
||||
$selected = false;
|
||||
foreach($connectionSide as $port) {
|
||||
|
||||
$objID = $port['objID'];
|
||||
$objFace = $port['objFace'];
|
||||
$objDepth = $port['objDepth'];
|
||||
$objPort = $port['objPort'];
|
||||
$selected = ($port['selected'] == true) ? true : $selected;
|
||||
|
||||
$objName .= $this->generateObjectPortName($objID, $objFace, $objDepth, $objPort).'<br>';
|
||||
}
|
||||
|
||||
// Compile port name(s) in an object box
|
||||
$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'];
|
||||
|
||||
// Compile connector div
|
||||
$htmlConnector = '<div title="'.$portTypeName.'" class="port '.$portTypeName.'" data-connection-pair-id='.$connectionPairID.'></div>';
|
||||
|
||||
$mediaTypeID = $objCompatibility['mediaType'];
|
||||
$mediaTypeName = $this->mediaTypeValueArray[$mediaTypeID]['name'];
|
||||
$cableLength = 0;
|
||||
|
||||
$htmlCable = '<div style="width:100%;text-align:left;" title="'.$mediaTypeName.'" class="cable '.$mediaTypeName.' adjacent">'.$cableLength.'<br>'.$mediaTypeName.'</div>';
|
||||
|
||||
$htmlPathFull .= '<tr>';
|
||||
$htmlPathFull .= '<td>'.$htmlPort.'</td>';
|
||||
$htmlPathFull .= '<td>'.$htmlConnector.'</td>';
|
||||
if($connectionIndex == 0) {
|
||||
$htmlPathFull .= '<td rowspan="2">'.$htmlCable.'</td>';
|
||||
}
|
||||
$htmlPathFull .= '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cable inline
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
$htmlPathFull .= '<table>';
|
||||
return $htmlPathFull;
|
||||
}
|
||||
|
||||
function buildPathFull($path, $connectorCode39){
|
||||
|
||||
$htmlPathFull = '';
|
||||
|
||||
@ -19,20 +19,26 @@ $selectedObjDepth2 = $objDepth;
|
||||
$selectedObjPort2 = $objPort;
|
||||
|
||||
// Retrieve initial connection set
|
||||
$connSet = crawlConn($qls, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
||||
$selected = true;
|
||||
$connSet = crawlConn($qls, $selected, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
||||
detectDivergence($connSet[0]);
|
||||
detectDivergence($connSet[1]);
|
||||
//$connSet[0]['selected'] = true;
|
||||
array_push($pathArray, $connSet);
|
||||
|
||||
for($direction=0; $direction<2; $direction++) {
|
||||
|
||||
$trunkFound = true;
|
||||
while($trunkFound){
|
||||
do {
|
||||
|
||||
// Set path array pointer
|
||||
// 0 for up, -1 for down
|
||||
$pathArrayPointer = ($direction == 0) ? 0 : count($pathArray)-1;
|
||||
|
||||
error_log('Debug (pathArray): '.json_encode($pathArray));
|
||||
error_log('Debug (pathArrayPointer): '.$pathArrayPointer);
|
||||
error_log('Debug (direction): '.$direction);
|
||||
error_log('Debug (crawlTrunk data): '.json_encode($pathArray[$pathArrayPointer][$direction]));
|
||||
|
||||
// Get port trunk peer
|
||||
$trunkSet = crawlTrunk($qls, $pathArray[$pathArrayPointer][$direction]);
|
||||
detectDivergence($trunkSet);
|
||||
@ -49,16 +55,27 @@ for($direction=0; $direction<2; $direction++) {
|
||||
$selectedObjPort2 = $port['objPort'];
|
||||
|
||||
// Find connections
|
||||
$connSet = crawlConn($qls, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
||||
$selected = false;
|
||||
$connSet = crawlConn($qls, $selected, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
||||
detectDivergence($connSet[0]);
|
||||
detectDivergence($connSet[1]);
|
||||
|
||||
// Add ports to workingConnSet
|
||||
foreach($connSet[0] as $port) {
|
||||
array_push($workingConnSet[0], $port);
|
||||
}
|
||||
foreach($connSet[1] as $port) {
|
||||
array_push($workingConnSet[1], $port);
|
||||
if($direction == 0) {
|
||||
foreach($connSet[0] as $port) {
|
||||
array_push($workingConnSet[1], $port);
|
||||
}
|
||||
foreach($connSet[1] as $port) {
|
||||
array_push($workingConnSet[0], $port);
|
||||
}
|
||||
} else {
|
||||
foreach($connSet[0] as $port) {
|
||||
array_push($workingConnSet[0], $port);
|
||||
}
|
||||
foreach($connSet[1] as $port) {
|
||||
array_push($workingConnSet[1], $port);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,9 +87,11 @@ for($direction=0; $direction<2; $direction++) {
|
||||
array_push($pathArray, $workingConnSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while($trunkFound);
|
||||
}
|
||||
|
||||
error_log('Debug (FINAL pathArray): '.json_encode($pathArray));
|
||||
|
||||
function crawlTrunk(&$qls, $portSet) {
|
||||
|
||||
$trunkSet = array();
|
||||
@ -114,14 +133,15 @@ function crawlTrunk(&$qls, $portSet) {
|
||||
return $trunkSet;
|
||||
}
|
||||
|
||||
function crawlConn(&$qls, $objID, $objFace, $objDepth, $objPort, &$connSet=array(array(),array()), $connSetID=0) {
|
||||
function crawlConn(&$qls, $selected, $objID, $objFace, $objDepth, $objPort, &$connSet=array(array(),array()), $connSetID=0) {
|
||||
|
||||
// Store port details
|
||||
$workingArray = array(
|
||||
'objID' => $objID,
|
||||
'objFace' => $objFace,
|
||||
'objDepth' => $objDepth,
|
||||
'objPort' => $objPort
|
||||
'objPort' => $objPort,
|
||||
'selected' => $selected
|
||||
);
|
||||
|
||||
// Add port info to connection set
|
||||
@ -154,7 +174,8 @@ function crawlConn(&$qls, $objID, $objFace, $objDepth, $objPort, &$connSet=array
|
||||
}
|
||||
|
||||
if(!$alreadySeen) {
|
||||
crawlConn($qls, $remoteObjID, $remoteObjFace, $remoteObjDepth, $remoteObjPort, $connSet, $connSetID);
|
||||
$selected = false;
|
||||
crawlConn($qls, $selected, $remoteObjID, $remoteObjFace, $remoteObjDepth, $remoteObjPort, $connSet, $connSetID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user