Commit b449e7508588aaf09cd03292cf36a697b0773b57

Authored by Nikita Kulshreshtha
2 parents fad8a339 61d1f22c

manually merged Bug#22404_1 into develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -56,6 +56,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
56 56 $scope.isEligibleForHighlight = false;
57 57 $scope.doHighlightOrExtract = false;
58 58 $scope.isClickedOnBodyForHighlight;
  59 + $scope.isSearchClicked = false;
59 60 $scope.isEligibleForHighlightBodyByTermList = false;
60 61  
61 62 // $scope.AnteriorView = "active";
... ... @@ -816,7 +817,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
816 817 })
817 818 // $rootScope.languageArray = [];
818 819 $rootScope.loadSearchData = function () {
819   - var primaryLexiconIndex;
  820 +
  821 + $scope.primaryLexiconInd;
820 822 var languageArray = [];
821 823 $rootScope.vocabTermDataArray = [];
822 824 var languageArray = $rootScope.lexiconLanguageArray;
... ... @@ -871,13 +873,16 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
871 873  
872 874 for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
873 875 if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
874   - primaryLexiconIndex = i;
  876 + $scope.primaryLexiconInd = i;
875 877 }
876 878 }
877 879 //alert(primaryLexiconIndex);
878   - if ($rootScope.isListManagerMenuSelected) {
  880 + if ($rootScope.isListManagerMenuSelected ) {
879 881 $scope.loadListManger();
880 882 }
  883 + else if ($scope.isSearchClicked) {
  884 + $scope.ShowSearch();
  885 + }
881 886 }
882 887  
883 888  
... ... @@ -8898,28 +8903,25 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8898 8903  
8899 8904  
8900 8905 $scope.ShowSearch = function () {
8901   - if (($rootScope.vocabTermDataArray != null || $rootScope.vocabTermDataArray != undefined) && ($rootScope.vocabTermDataArray.length > 0)) {
8902   - var primaryLexiconIndex;
8903   - for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
8904   - if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
8905   - primaryLexiconIndex = i;
8906   - }
8907   - }
8908   - console.log('ShowSearch is called');
  8906 +
  8907 + $scope.isSearchClicked = true;
  8908 + console.log('ShowSearch is called');
  8909 + var primaryLexiconIndx = $scope.primaryLexiconInd;
  8910 +
8909 8911 //this check is for log only because we are writing length so need to check if its not null or undefined
8910   - if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined)
8911   - console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length)
  8912 + if ($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != undefined)
  8913 + console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt.length)
8912 8914  
8913 8915 $timeout(function () {
8914 8916  
8915   - if (($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
  8917 + if (($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
8916 8918 //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
8917 8919 //Remove the list and then Repopulate
8918 8920 if ($('#searchListDiv').html() != "")
8919   - $('#searchListDiv').empty()
  8921 + $('#searchListDiv').empty();
8920 8922 //Delay compile of ul li so that the remove of li is completed.
8921 8923 $timeout(function () {
8922   - console.log("INSIDE WATCH. LIST IS CREATED");
  8924 +
8923 8925 $scope.isSearchDataLoaded = true;
8924 8926  
8925 8927 if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
... ... @@ -8944,12 +8946,17 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8944 8946  
8945 8947 }, 500);
8946 8948 $scope.IsSearchVisible = true;
8947   - console.log("s" + $rootScope.vocabTermDataArray[primaryLexiconIndex].language);
8948   - $rootScope.a = primaryLexiconIndex;
  8949 + console.log("primary language: " + $rootScope.vocabTermDataArray[primaryLexiconIndx].language);
  8950 +
  8951 +
  8952 + $rootScope.a = primaryLexiconIndx;
8949 8953 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}">' +
8950 8954 '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
8951 8955 ' </li></ul>').appendTo('#searchListDiv')
8952 8956 $compile($e2)($scope);
  8957 +
  8958 + console.log('termlistfilter is created and complied');
  8959 +
8953 8960 document.getElementById("termlistfilter").style.display = "block";
8954 8961 $timeout(function () {
8955 8962 $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) {
... ... @@ -8969,19 +8976,15 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8969 8976 }
8970 8977 else {
8971 8978 $rootScope.loadSearchData();
8972   - if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length > 0) {
8973   - $scope.ShowSearch();
8974   - }
  8979 + //if ($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt.length > 0) {
  8980 + // $scope.ShowSearch();
  8981 + //}
8975 8982 }
8976 8983 }, 500);
8977 8984  
8978   - }
8979   - else {
8980   - $rootScope.loadSearchData();
8981   - $scope.ShowSearch();
8982   -
8983   -
8984   - }
  8985 +
  8986 +
  8987 +
8985 8988 }
8986 8989  
8987 8990  
... ... @@ -9119,7 +9122,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
9119 9122 });
9120 9123  
9121 9124 $scope.loadListManger = function () {
9122   - var primaryLexiconIndex;
  9125 + var primaryLexiconIndex = $scope.primaryLexiconInd;;
9123 9126 if ($rootScope.vocabTermDataArray != null && $rootScope.vocabTermDataArray != undefined && $rootScope.vocabTermDataArray.length > 0) {
9124 9127  
9125 9128 for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
... ...