Commit 61d1f22c195aa2f9fda6e863622aed14d82b7667

Authored by Nikita Kulshreshtha
1 parent 76295384

changed few lines of code..

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