Commit 14c93874cf37509d88708f496e5cfc81144ded2f

Authored by Amrita Vishnoi
1 parent 9044b961

against Merge Request #774

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -8685,77 +8685,83 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
8685 8685  
8686 8686  
8687 8687 $scope.ShowSearch = function () {
8688   -
8689   - var primaryLexiconIndex;
8690   - for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
8691   - if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
8692   - primaryLexiconIndex = i;
  8688 + if (($rootScope.vocabTermDataArray != null || $rootScope.vocabTermDataArray != undefined) && ($rootScope.vocabTermDataArray.length > 0)) {
  8689 + var primaryLexiconIndex;
  8690 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  8691 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  8692 + primaryLexiconIndex = i;
  8693 + }
8693 8694 }
8694   - }
8695   - console.log('ShowSearch is called');
8696   - //this check is for log only because we are writing length so need to check if its not null or undefined
8697   - if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined)
8698   - console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length)
  8695 + console.log('ShowSearch is called');
  8696 + //this check is for log only because we are writing length so need to check if its not null or undefined
  8697 + if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined)
  8698 + console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length)
8699 8699  
8700   - $timeout(function () {
8701   -
8702   - if (($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
8703   - //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
8704   - //Remove the list and then Repopulate
8705   - if ($('#searchListDiv').html() != "")
8706   - $('#searchListDiv').empty()
8707   - //Delay compile of ul li so that the remove of li is completed.
8708   - $timeout(function () {
8709   - console.log("INSIDE WATCH. LIST IS CREATED");
8710   - $scope.isSearchDataLoaded = true;
  8700 + $timeout(function () {
8711 8701  
8712   - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  8702 + if (($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
  8703 + //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
  8704 + //Remove the list and then Repopulate
  8705 + if ($('#searchListDiv').html() != "")
  8706 + $('#searchListDiv').empty()
  8707 + //Delay compile of ul li so that the remove of li is completed.
  8708 + $timeout(function () {
  8709 + console.log("INSIDE WATCH. LIST IS CREATED");
  8710 + $scope.isSearchDataLoaded = true;
8713 8711  
8714   - if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
8715   - $rootScope.isLoading = false;
8716   - $('#spinner').css('visibility', 'hidden');
8717   - }
8718   - else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
8719   - $rootScope.isLoading = false;
8720   - $('#spinner').css('visibility', 'hidden');
8721   - }
8722   - else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
8723   - $rootScope.isLoading = false;
8724   - $('#spinner').css('visibility', 'hidden');
8725   - }
8726   - else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
8727   - $rootScope.isLoading = false;
8728   - $('#spinner').css('visibility', 'hidden');
  8712 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  8713 +
  8714 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  8715 + $rootScope.isLoading = false;
  8716 + $('#spinner').css('visibility', 'hidden');
  8717 + }
  8718 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  8719 + $rootScope.isLoading = false;
  8720 + $('#spinner').css('visibility', 'hidden');
  8721 + }
  8722 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  8723 + $rootScope.isLoading = false;
  8724 + $('#spinner').css('visibility', 'hidden');
  8725 + }
  8726 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  8727 + $rootScope.isLoading = false;
  8728 + $('#spinner').css('visibility', 'hidden');
  8729 + }
8729 8730 }
8730   - }
8731 8731  
8732   - }, 500);
8733   - $scope.IsSearchVisible = true;
8734   - console.log("s" + $rootScope.vocabTermDataArray[primaryLexiconIndex].language);
8735   - $rootScope.a = primaryLexiconIndex;
8736   - 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}">' +
8737   - '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
8738   - ' </li></ul>').appendTo('#searchListDiv')
8739   - $compile($e2)($scope);
8740   - document.getElementById("termlistfilter").style.display = "block";
8741   - $timeout(function () {
8742   - $rootScope.searchListArray = [];
8743   - $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) {
8744   - $rootScope.searchListArray.push({ "name": $(this).find("a").html(), "id": $(this).find("a").attr("id") });
8745   - });
8746   - }, 100);
8747   -
8748   - }
8749   - else {
8750   - $rootScope.loadSearchData();
8751   - if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length > 0) {
8752   - $scope.ShowSearch();
8753   - }
8754   - }
8755   - }, 500);
  8732 + }, 500);
  8733 + $scope.IsSearchVisible = true;
  8734 + console.log("s" + $rootScope.vocabTermDataArray[primaryLexiconIndex].language);
  8735 + $rootScope.a = primaryLexiconIndex;
  8736 + 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}">' +
  8737 + '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
  8738 + ' </li></ul>').appendTo('#searchListDiv')
  8739 + $compile($e2)($scope);
  8740 + document.getElementById("termlistfilter").style.display = "block";
  8741 + $timeout(function () {
  8742 + $rootScope.searchListArray = [];
  8743 + $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) {
  8744 + $rootScope.searchListArray.push({ "name": $(this).find("a").html(), "id": $(this).find("a").attr("id") });
  8745 + });
  8746 + }, 100);
8756 8747  
8757   -
  8748 + }
  8749 + else {
  8750 + $rootScope.loadSearchData();
  8751 + if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length > 0) {
  8752 + $scope.ShowSearch();
  8753 + }
  8754 + }
  8755 + }, 500);
8758 8756  
  8757 + }
  8758 + else
  8759 + {
  8760 + $rootScope.loadSearchData();
  8761 + $scope.ShowSearch();
  8762 +
  8763 +
  8764 + }
8759 8765 }
8760 8766  
8761 8767  
... ...