From 64c46c802f13862a4fd1cba39f59323ca571bfe0 Mon Sep 17 00:00:00 2001 From: Garrett K Date: Sun, 4 Apr 2021 05:14:32 +0000 Subject: [PATCH] 0.3.15 --- assets/pages/jquery.explore.js | 40 +++++++++++++++++++--------------- includes/App.class.php | 4 ++-- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/assets/pages/jquery.explore.js b/assets/pages/jquery.explore.js index cac3523..2fd8434 100755 --- a/assets/pages/jquery.explore.js +++ b/assets/pages/jquery.explore.js @@ -677,16 +677,18 @@ function postProcessCable(){ // Compile emptyGlobalIDArrayBase64 var emptyGlobalIDArrayBase64 = btoa(JSON.stringify([])); - // Clear previous remote port(s) - var prevRemotePortGlobalIDArray = JSON.parse(atob($('#'+localPortGlobalID).data('connectedGlobalId'))); - $.each(prevRemotePortGlobalIDArray, function(index, prevRemotePortGlobalID){ - if($('#'+prevRemotePortGlobalID).length) { - $('#'+prevRemotePortGlobalID).removeClass('populated').data('connectedGlobalId', emptyGlobalIDArrayBase64); - } - }); - - // Update local port - $('#'+localPortGlobalID).addClass('populated').data('connectedGlobalId', remotePortGlobalIDArrayBase64); + if($('#'+localPortGlobalID).length) { + // Clear previous remote port(s) + var prevRemotePortGlobalIDArray = JSON.parse(atob($('#'+localPortGlobalID).data('connectedGlobalId'))); + $.each(prevRemotePortGlobalIDArray, function(index, prevRemotePortGlobalID){ + if($('#'+prevRemotePortGlobalID).length) { + $('#'+prevRemotePortGlobalID).removeClass('populated').data('connectedGlobalId', emptyGlobalIDArrayBase64); + } + }); + + // Update local port + $('#'+localPortGlobalID).addClass('populated').data('connectedGlobalId', remotePortGlobalIDArrayBase64); + } // Update remote port(s) $.each(remotePortGlobalIDArray, function(index, remotePortGlobalID){ @@ -1019,14 +1021,16 @@ $( document ).ready(function() { // Compile localPortGlobalID var localPortGlobalID = 'port-4-'+objID+'-'+objFace+'-'+objDepth+'-'+objPort; - // Update remote port(s) - var remotePortGlobalIDArray = JSON.parse(atob($('#'+localPortGlobalID).data('connectedGlobalId'))); - $.each(remotePortGlobalIDArray, function(index, remotePortGlobalID){ - if($('#'+remotePortGlobalID).length) { - $('#'+remotePortGlobalID).removeClass('populated').data('connectedGlobalId', btoa(JSON.stringify([]))); - } - }); - $('#'+localPortGlobalID).removeClass('populated').data('connectedGlobalId', btoa(JSON.stringify([]))); + if($('#'+localPortGlobalID).length) { + // Update remote port(s) + var remotePortGlobalIDArray = JSON.parse(atob($('#'+localPortGlobalID).data('connectedGlobalId'))); + $.each(remotePortGlobalIDArray, function(index, remotePortGlobalID){ + if($('#'+remotePortGlobalID).length) { + $('#'+remotePortGlobalID).removeClass('populated').data('connectedGlobalId', btoa(JSON.stringify([]))); + } + }); + $('#'+localPortGlobalID).removeClass('populated').data('connectedGlobalId', btoa(JSON.stringify([]))); + } var interfaceSelectionElem = $('#selectPort').find(':selected'); $('#checkboxPopulated').prop("checked", false); diff --git a/includes/App.class.php b/includes/App.class.php index a62f671..9076191 100755 --- a/includes/App.class.php +++ b/includes/App.class.php @@ -1165,11 +1165,11 @@ var $qls; } } - $query = $this->qls->SQL->select('*', 'app_object', array('env_tree_id' => array('=', $cabinetID), 'AND', 'parent_id' => array('=', 0)), array($objSortAttr, $objSortDir)); + $query = $this->qls->SQL->select('*', 'app_object', array('env_tree_id' => array('=', $cabinetID)), array($objSortAttr, $objSortDir)); $counter = 1; while($objectNode = $this->qls->SQL->fetch_assoc($query)) { - if($objectNode['env_tree_id'] == $cabinetID and $objectNode['parent_id'] == 0) { + if($objectNode['parent_id'] == 0 or $objectNode['parent_id'] == Null) { $objectID = $objectNode['id']; $objectName = $objectNode['name']; $objectTemplateID = $objectNode['template_id'];