Commit ca03882009bf80dca63a906e7350f6d5777e19cc

Authored by Birendra Kumar
1 parent 3868b7e9

update traversing and enable/disable editor

400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
... ... @@ -601,10 +601,17 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
601 601 //var current_id = document.getElementById('cbSelect').value;
602 602 traverseTreeSelectedSingleObj($rootScope.stru, nodeid);
603 603 traverse($rootScope.stru, nodeid);
  604 +
  605 + $('#cbEditorRightSideBar').css('pointer-events', 'auto');
  606 + $('#cbEditorRightSideBar').css('opacity', '1');
  607 +
604 608 if ($scope.selectedNodeSingleObj._isBranch == "true") {
605 609  
606 610 $("#cbSelect").empty();
607   -
  611 +
  612 + $('#cbEditorRightSideBar').css('pointer-events', 'none');
  613 + $('#cbEditorRightSideBar').css('opacity', '0.7');
  614 +
608 615 localStorage.setItem("cbSelectId", nodeid);
609 616 if ($scope.selectedNodeSingleObj._id == nodeid) {
610 617 $scope.currentSlideNumber += 1;
... ... @@ -613,10 +620,15 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
613 620 else {
614 621 $('#cbSelect').append('<option value="' + $scope.selectedNodeSingleObj._id + '">' + $scope.selectedNodeSingleObj._label + '</option>');
615 622 }
616   -
617   - if ($scope.selectedNodeSingleObj._isBranch == "true") {
  623 +
  624 + if ($scope.selectedNodeSingleObj._isRoot == "true") {
  625 + document.getElementById("slideNumber").innerHTML = "Slide " + 1 + " of " + 1;
  626 + }
  627 + else if ($scope.selectedNodeSingleObj._isBranch == "true") {
618 628 document.getElementById("slideNumber").innerHTML = "Slide " + $scope.currentSlideNumber + " of " + Object.keys($scope.selectedNodeSingleObj).length;
619   - } else {
  629 + }
  630 + else
  631 + {
620 632 document.getElementById("slideNumber").innerHTML = "Slide " + $scope.currentSlideNumber + " of " + Object.keys($scope.selectedNodeSingleObj).length;
621 633 }
622 634 }
... ... @@ -640,90 +652,55 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $
640 652 $rootScope.cbNext = function () {
641 653  
642 654 var cbCurrentId = document.getElementById('cbSelect').value;
643   - traverse($rootScope.stru, cbCurrentId);
644   - if ($scope.selectedNodeSiblingObjs.length == undefined) {
645   - if ($scope.selectedNodeSiblingObjs["structure"]._isRoot == "true") {
646   - $scope.nextCurrentId = $('#' + cbCurrentId).parent().next().find('span').attr('id');
647   - }
648   - }
649   - for (var k = 0; k < $scope.selectedNodeSiblingObjs.length; k++) {
650   - if ($scope.selectedNodeSiblingObjs[k]._id == cbCurrentId) {
651   -
652   - if ($scope.selectedNodeSiblingObjs[k]._isBranch == "true") {
653   - selectNextSpanId(cbCurrentId);
654   - //$scope.nextCurrentId = $('#' + cbCurrentId).parent().next().find('span').attr('id'); // folder to child slide
655   - }
656   - else {
657   - selectNextSpanId(cbCurrentId);
658   - }
659   - }
660   - }
661   - if ($scope.nextCurrentId != undefined) {
662   - $('#jstree').jstree(true).deselect_all();
663   - $('#jstree').jstree('select_node', $scope.nextCurrentId);
664   - }
665   - }
  655 + var counter = 0;
666 656  
667   - function selectNextSpanId(cbCurrentId) {
668   - var counter = "0";
669   - $('.jstree-container-ul li a span').each(function () {
  657 + $("#jstree").jstree("open_all");
  658 +
  659 + $('.jstree-container-ul li a span').each(function () {
670 660 var span_Id = $(this).attr("id");
671 661 if (span_Id == cbCurrentId) {
672 662 counter++;
673 663 }
674 664 if (counter == 2) {
675 665 $scope.nextCurrentId = span_Id;
  666 +
  667 + if ($scope.nextCurrentId != undefined) {
  668 + $('#jstree').jstree(true).deselect_all();
  669 + $('#jstree').jstree('select_node', $scope.nextCurrentId);
  670 + }
676 671 return false;
677 672 }
678 673 if (counter == 1) {
679 674 counter += 1;
680 675 }
681 676 });
  677 +
682 678 }
683 679  
684   - function selectPrevoiusSpanId(cbCurrentId) {
685   - $scope.spanIds = [];
686   - var counter = "0";
687   - $('.jstree-container-ul li a span').each(function () {
688   -
689   - $scope.spanIds.push($(this).attr("id"));
690   - });
  680 + $rootScope.cbBack = function () {
  681 + var cbCurrentId = document.getElementById('cbSelect').value;
  682 + var counter = 0;
  683 + $("#jstree").jstree("open_all");
691 684  
692   - for (var a = $scope.spanIds.length - 1; a > 0; a--) {
693   - //console.log($scope.spanIds[a]);
694   - if ($scope.spanIds[a] == cbCurrentId) {
695   - if ($scope.spanIds[1] == cbCurrentId){
696   - $scope.backCurrentId = $scope.spanIds[1];
697   - }
  685 + $($(".jstree-container-ul li a span").get().reverse()).each(function () {
  686 +
  687 + var span_Id = $(this).attr("id");
  688 + if (span_Id == cbCurrentId) {
698 689 counter++;
699 690 }
700 691 if (counter == 2) {
701   - $scope.backCurrentId = $scope.spanIds[a];
702   - break;
  692 + $scope.backCurrentId = span_Id;
  693 +
  694 + if ($scope.backCurrentId != undefined) {
  695 + $('#jstree').jstree(true).deselect_all();
  696 + $('#jstree').jstree('select_node', $scope.backCurrentId);
  697 + }
  698 + return false;
703 699 }
704 700 if (counter == 1) {
705 701 counter += 1;
706 702 }
707   - }
708   - }
709   -
710   - $rootScope.cbBack = function () {
711   - var cbCurrentId = document.getElementById('cbSelect').value;
712   - traverse($rootScope.stru, cbCurrentId);
713   - for (var k = 0; k < $scope.selectedNodeSiblingObjs.length; k++) {
714   - if ($scope.selectedNodeSiblingObjs[k]._id == cbCurrentId) {
715   -
716   - if ($scope.selectedNodeSiblingObjs[k]._isBranch == "true") {
717   - $scope.backCurrentId = $('#' + cbCurrentId).parent().parent().prev().find('span').attr('id'); // Privious child slide
718   - selectPrevoiusSpanId(cbCurrentId);
719   - }
720   - else {
721   - selectPrevoiusSpanId(cbCurrentId);
722   - }
723   - }
724   - }
725   - $('#jstree').jstree(true).deselect_all();
726   - $('#jstree').jstree('select_node', $scope.backCurrentId);
  703 + });
727 704 }
728 705 //End Code by Sandeep for TicketNo: 49226(3)
729 706  
... ...