From ca03882009bf80dca63a906e7350f6d5777e19cc Mon Sep 17 00:00:00 2001 From: birendra.kumar Date: Thu, 28 Nov 2019 16:16:52 +0530 Subject: [PATCH] update traversing and enable/disable editor --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js | 107 ++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------- 1 file changed, 42 insertions(+), 65 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index e677480..6c71535 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -601,10 +601,17 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ //var current_id = document.getElementById('cbSelect').value; traverseTreeSelectedSingleObj($rootScope.stru, nodeid); traverse($rootScope.stru, nodeid); + + $('#cbEditorRightSideBar').css('pointer-events', 'auto'); + $('#cbEditorRightSideBar').css('opacity', '1'); + if ($scope.selectedNodeSingleObj._isBranch == "true") { $("#cbSelect").empty(); - + + $('#cbEditorRightSideBar').css('pointer-events', 'none'); + $('#cbEditorRightSideBar').css('opacity', '0.7'); + localStorage.setItem("cbSelectId", nodeid); if ($scope.selectedNodeSingleObj._id == nodeid) { $scope.currentSlideNumber += 1; @@ -613,10 +620,15 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ else { $('#cbSelect').append(''); } - - if ($scope.selectedNodeSingleObj._isBranch == "true") { + + if ($scope.selectedNodeSingleObj._isRoot == "true") { + document.getElementById("slideNumber").innerHTML = "Slide " + 1 + " of " + 1; + } + else if ($scope.selectedNodeSingleObj._isBranch == "true") { document.getElementById("slideNumber").innerHTML = "Slide " + $scope.currentSlideNumber + " of " + Object.keys($scope.selectedNodeSingleObj).length; - } else { + } + else + { document.getElementById("slideNumber").innerHTML = "Slide " + $scope.currentSlideNumber + " of " + Object.keys($scope.selectedNodeSingleObj).length; } } @@ -640,90 +652,55 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ $rootScope.cbNext = function () { var cbCurrentId = document.getElementById('cbSelect').value; - traverse($rootScope.stru, cbCurrentId); - if ($scope.selectedNodeSiblingObjs.length == undefined) { - if ($scope.selectedNodeSiblingObjs["structure"]._isRoot == "true") { - $scope.nextCurrentId = $('#' + cbCurrentId).parent().next().find('span').attr('id'); - } - } - for (var k = 0; k < $scope.selectedNodeSiblingObjs.length; k++) { - if ($scope.selectedNodeSiblingObjs[k]._id == cbCurrentId) { - - if ($scope.selectedNodeSiblingObjs[k]._isBranch == "true") { - selectNextSpanId(cbCurrentId); - //$scope.nextCurrentId = $('#' + cbCurrentId).parent().next().find('span').attr('id'); // folder to child slide - } - else { - selectNextSpanId(cbCurrentId); - } - } - } - if ($scope.nextCurrentId != undefined) { - $('#jstree').jstree(true).deselect_all(); - $('#jstree').jstree('select_node', $scope.nextCurrentId); - } - } + var counter = 0; - function selectNextSpanId(cbCurrentId) { - var counter = "0"; - $('.jstree-container-ul li a span').each(function () { + $("#jstree").jstree("open_all"); + + $('.jstree-container-ul li a span').each(function () { var span_Id = $(this).attr("id"); if (span_Id == cbCurrentId) { counter++; } if (counter == 2) { $scope.nextCurrentId = span_Id; + + if ($scope.nextCurrentId != undefined) { + $('#jstree').jstree(true).deselect_all(); + $('#jstree').jstree('select_node', $scope.nextCurrentId); + } return false; } if (counter == 1) { counter += 1; } }); + } - function selectPrevoiusSpanId(cbCurrentId) { - $scope.spanIds = []; - var counter = "0"; - $('.jstree-container-ul li a span').each(function () { - - $scope.spanIds.push($(this).attr("id")); - }); + $rootScope.cbBack = function () { + var cbCurrentId = document.getElementById('cbSelect').value; + var counter = 0; + $("#jstree").jstree("open_all"); - for (var a = $scope.spanIds.length - 1; a > 0; a--) { - //console.log($scope.spanIds[a]); - if ($scope.spanIds[a] == cbCurrentId) { - if ($scope.spanIds[1] == cbCurrentId){ - $scope.backCurrentId = $scope.spanIds[1]; - } + $($(".jstree-container-ul li a span").get().reverse()).each(function () { + + var span_Id = $(this).attr("id"); + if (span_Id == cbCurrentId) { counter++; } if (counter == 2) { - $scope.backCurrentId = $scope.spanIds[a]; - break; + $scope.backCurrentId = span_Id; + + if ($scope.backCurrentId != undefined) { + $('#jstree').jstree(true).deselect_all(); + $('#jstree').jstree('select_node', $scope.backCurrentId); + } + return false; } if (counter == 1) { counter += 1; } - } - } - - $rootScope.cbBack = function () { - var cbCurrentId = document.getElementById('cbSelect').value; - traverse($rootScope.stru, cbCurrentId); - for (var k = 0; k < $scope.selectedNodeSiblingObjs.length; k++) { - if ($scope.selectedNodeSiblingObjs[k]._id == cbCurrentId) { - - if ($scope.selectedNodeSiblingObjs[k]._isBranch == "true") { - $scope.backCurrentId = $('#' + cbCurrentId).parent().parent().prev().find('span').attr('id'); // Privious child slide - selectPrevoiusSpanId(cbCurrentId); - } - else { - selectPrevoiusSpanId(cbCurrentId); - } - } - } - $('#jstree').jstree(true).deselect_all(); - $('#jstree').jstree('select_node', $scope.backCurrentId); + }); } //End Code by Sandeep for TicketNo: 49226(3) -- libgit2 0.21.4