Commit 184d8855a4d49df7ac60105c50a78e6e7dede22b

Authored by Amrita Vishnoi
2 parents ce248b25 69e170ee

Merge branch 'SearchListIssue' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -667,7 +667,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
667 667 })
668 668 // $rootScope.languageArray = [];
669 669 $rootScope.loadSearchData = function () {
670   -
  670 + var primaryLexiconIndex;
671 671 var languageArray = [];
672 672 $rootScope.vocabTermDataArray = [];
673 673 var languageArray = $rootScope.lexiconLanguageArray;
... ... @@ -719,14 +719,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
719 719  
720 720 if ($rootScope.vocabTermDataArray.length == $rootScope.lexiconLanguageArray.length) {
721 721 $("#setting-spinner").css("display", "none");
722   - // $rootScope.isLoading = false;
723   - // $("#spinner").css("visibility", "hidden");
724   - // // $("#spinner").css("display", "none");
725   -
726   - //} else {
727   - // $rootScope.isLoading = true;
728   - // $("#spinner").css("visibility", "visible");
729   - // // $("#spinner").css("visibility", "block");
  722 +
  723 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  724 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  725 + primaryLexiconIndex = i;
  726 + }
  727 + }
  728 + //alert(primaryLexiconIndex);
730 729 if ($rootScope.isListManagerMenuSelected) {
731 730 $scope.loadListManger();
732 731 }
... ... @@ -748,55 +747,16 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
748 747 }
749 748 }
750 749 }
751   -
752   -
753   -
754   -
755   -
756 750 }
757 751  
  752 +
  753 + //console.log("s" + $rootScope.vocabTermDataArray);
758 754 //call watch on '$scope.VocabTermTxt and compile <li> and append to <ul> on first time load
759   - $scope.$watch('$rootScope.vocabTermDataArray[0].vocabTermTxt', function (newValue, oldValue, scope) {
760   -
761   - //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
762   - //Remove the list and then Repopulate
763   - if ($('#searchListDiv').html() != "")
764   - $('#searchListDiv').empty()
765   - //Delay compile of ul li so that the remove of li is completed.
766   - $timeout(function () {
767   - var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:90px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[0].vocabTermTxt| filter:{ _TermText: searchFilter}">' +
768   - '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
769   - ' </li></ul>').appendTo('#searchListDiv')
770   - $compile($e2)($scope);
771   -
772   - $rootScope.isSearchInputClicked = true;
773   -
774   - console.log("INSIDE WATCH. LIST IS CREATED");
775   - $scope.isSearchDataLoaded = true;
776   -
777   - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
778   -
779   - if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
780   - $rootScope.isLoading = false;
781   - $('#spinner').css('visibility', 'hidden');
782   - }
783   - else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
784   - $rootScope.isLoading = false;
785   - $('#spinner').css('visibility', 'hidden');
786   - }
787   - else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
788   - $rootScope.isLoading = false;
789   - $('#spinner').css('visibility', 'hidden');
790   - }
791   - else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
792   - $rootScope.isLoading = false;
793   - $('#spinner').css('visibility', 'hidden');
794   - }
795   - }
796   -
797   - }, 500);
  755 + //$scope.$watch('$rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt', function (newValue, oldValue, scope) {
  756 +
  757 +
798 758  
799   - }, true);
  759 + //}, true);
800 760  
801 761 }
802 762  
... ... @@ -1387,7 +1347,6 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
1387 1347 }
1388 1348 }
1389 1349 else {
1390   - // debugger;
1391 1350 //below 4 bodyviews have only single body region
1392 1351 if (($rootScope.voId == '9') || ($rootScope.voId == '11') || ($rootScope.voId == '10') || ($rootScope.voId == '12')) {
1393 1352 var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId;
... ... @@ -1397,7 +1356,6 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
1397 1356 }
1398 1357 else // it is for other body view which have multiple body regions and layer no > 0
1399 1358 {
1400   - // debugger;
1401 1359 if (SelectedLayerData.BodyRegion.length > 0) {
1402 1360 for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) {
1403 1361 var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId;
... ... @@ -8423,32 +8381,72 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8423 8381  
8424 8382  
8425 8383 $scope.ShowSearch = function () {
  8384 + var primaryLexiconIndex;
  8385 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  8386 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  8387 + primaryLexiconIndex = i;
  8388 + }
  8389 + }
8426 8390 console.log('ShowSearch is called');
8427 8391 //this check is for log only because we are writing length so need to check if its not null or undefined
8428   - if ($rootScope.vocabTermDataArray[0].vocabTermTxt != null || $rootScope.vocabTermDataArray[0].vocabTermTxt != undefined)
8429   - console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[0].vocabTermTxt.length)
  8392 + if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined)
  8393 + console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length)
8430 8394  
8431 8395 $timeout(function () {
8432   - if (($rootScope.vocabTermDataArray[0].vocabTermTxt != null || $rootScope.vocabTermDataArray[0].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
  8396 +
  8397 + if (($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
  8398 + //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
  8399 + //Remove the list and then Repopulate
  8400 + if ($('#searchListDiv').html() != "")
  8401 + $('#searchListDiv').empty()
  8402 + //Delay compile of ul li so that the remove of li is completed.
  8403 + $timeout(function () {
  8404 + console.log("INSIDE WATCH. LIST IS CREATED");
  8405 + $scope.isSearchDataLoaded = true;
  8406 +
  8407 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  8408 +
  8409 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  8410 + $rootScope.isLoading = false;
  8411 + $('#spinner').css('visibility', 'hidden');
  8412 + }
  8413 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  8414 + $rootScope.isLoading = false;
  8415 + $('#spinner').css('visibility', 'hidden');
  8416 + }
  8417 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  8418 + $rootScope.isLoading = false;
  8419 + $('#spinner').css('visibility', 'hidden');
  8420 + }
  8421 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  8422 + $rootScope.isLoading = false;
  8423 + $('#spinner').css('visibility', 'hidden');
  8424 + }
  8425 + }
8433 8426  
  8427 + }, 500);
8434 8428 $scope.IsSearchVisible = true;
  8429 + console.log("s" + $rootScope.vocabTermDataArray[primaryLexiconIndex].language);
  8430 + $rootScope.a = primaryLexiconIndex;
  8431 + var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:90px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[a].vocabTermTxt| filter:{ _TermText: searchFilter}">' +
  8432 + '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
  8433 + ' </li></ul>').appendTo('#searchListDiv')
  8434 + $compile($e2)($scope);
8435 8435 document.getElementById("termlistfilter").style.display = "block";
  8436 + $timeout(function () {
  8437 + $rootScope.searchListArray = [];
  8438 + $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) {
  8439 + $rootScope.searchListArray.push({ "name": $(this).find("a").html(), "id": $(this).find("a").attr("id") });
  8440 + });
  8441 + }, 100);
8436 8442 }
8437 8443 else {
8438 8444 $rootScope.loadSearchData();
8439   - if ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0) {
  8445 + if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length > 0) {
8440 8446 $scope.ShowSearch();
8441 8447 }
8442 8448 }
8443   -
8444   - if ($rootScope.isSearchInputClicked == true) {
8445   - $rootScope.isSearchInputClicked = false;
8446   - $rootScope.searchListArray = [];
8447   - $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) {
8448   - $rootScope.searchListArray.push({ "name": $(this).find("a").html(), "id": $(this).find("a").attr("id") });
8449   - });
8450   -
8451   - }
  8449 +
8452 8450  
8453 8451 }, 500);
8454 8452  
... ... @@ -8589,14 +8587,20 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8589 8587 });
8590 8588  
8591 8589 $scope.loadListManger = function () {
8592   -
  8590 + var primaryLexiconIndex;
  8591 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  8592 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  8593 + primaryLexiconIndex = i;
  8594 + }
  8595 + }
  8596 + console.log($rootScope.vocabTermDataArray[primaryLexiconIndex].language);
8593 8597 $rootScope.isListManagerMenuSelected = true;
8594 8598  
8595 8599 var vocabTermTxt = [];
8596 8600 if ($rootScope.TermNumberData != null || $rootScope.TermNumberData != undefined && $rootScope.TermNumberData.length > 0) {
8597 8601 angular.forEach($rootScope.TermNumberData.TermData.Term, function (value1, key1) {
8598 8602  
8599   - angular.forEach($rootScope.vocabTermDataArray[0].VocabTermData.VocabTerms.Term, function (value2, key2) {
  8603 + angular.forEach($rootScope.vocabTermDataArray[primaryLexiconIndex].VocabTermData.VocabTerms.Term, function (value2, key2) {
8600 8604  
8601 8605  
8602 8606 if (value1._ActualTermNumber === value2._ActualTermNumber) {
... ...