Commit 4689418234e67cfa59f0720c4c5a61ef7a388892

Authored by Nikita Kulshreshtha
1 parent de8f52ae

made changes to fix this issue. need to test on qa and production

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -458,6 +458,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -458,6 +458,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
458 } 458 }
459 else { 459 else {
460 $rootScope.isVisibleLogin = false; 460 $rootScope.isVisibleLogin = false;
  461 +
461 $rootScope.loadSearchData(); 462 $rootScope.loadSearchData();
462 463
463 console.log('currentBodyViewId pickjed from localStorage: ' + currentBodyViewId); 464 console.log('currentBodyViewId pickjed from localStorage: ' + currentBodyViewId);
@@ -696,6 +697,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -696,6 +697,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
696 697
697 //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); 698 //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
698 $rootScope.TermNumberData = e.data.TermNumberData; 699 $rootScope.TermNumberData = e.data.TermNumberData;
  700 + console.log("$rootScope.TermNumberData = " + $rootScope.TermNumberData.length);
699 $rootScope.VocabTermData = e.data.VocabTermData,//same 701 $rootScope.VocabTermData = e.data.VocabTermData,//same
700 $scope.vocabTermTxt = e.data.vocabTermTxt, 702 $scope.vocabTermTxt = e.data.vocabTermTxt,
701 $scope.vocabLanguage = e.data.language, 703 $scope.vocabLanguage = e.data.language,
@@ -1635,7 +1637,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -1635,7 +1637,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
1635 $scope.enableExtract(false); 1637 $scope.enableExtract(false);
1636 } 1638 }
1637 1639
1638 - var annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); 1640 + var annotationText
  1641 + if ($rootScope.TermNumberData != null && $rootScope.TermNumberData != undefined) {
  1642 +
  1643 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  1644 + }
  1645 + else {
  1646 + $scope.loadSearchData();
  1647 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  1648 + }
1639 1649
1640 if ($('#speechBubbleTrns').length > 0) 1650 if ($('#speechBubbleTrns').length > 0)
1641 $('#speechBubbleTrns').remove(); 1651 $('#speechBubbleTrns').remove();
@@ -1800,7 +1810,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -1800,7 +1810,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
1800 } 1810 }
1801 1811
1802 if ($scope.isEligibleForHighlight == true) { 1812 if ($scope.isEligibleForHighlight == true) {
1803 - 1813 +
1804 if ($scope.isSearchDataLoaded) { 1814 if ($scope.isSearchDataLoaded) {
1805 $rootScope.isLoading = false; 1815 $rootScope.isLoading = false;
1806 $('#spinner').css('visibility', 'hidden'); 1816 $('#spinner').css('visibility', 'hidden');
@@ -1979,14 +1989,22 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -1979,14 +1989,22 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
1979 var maskCanvas = document.getElementById(maskCanvasId); 1989 var maskCanvas = document.getElementById(maskCanvasId);
1980 var maskCanvasContext = maskCanvas.getContext("2d"); 1990 var maskCanvasContext = maskCanvas.getContext("2d");
1981 RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); 1991 RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
1982 - annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); 1992 + // annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1983 } 1993 }
1984 else { 1994 else {
1985 RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); 1995 RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y);
  1996 + // annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  1997 +
  1998 + }
  1999 + if ($rootScope.TermNumberData != null && $rootScope.TermNumberData != undefined) {
1986 annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); 2000 annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1987 2001
1988 } 2002 }
  2003 + else {
  2004 + $scope.loadSearchData();
  2005 + annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
1989 2006
  2007 + }
1990 $rootScope.previousHighlightList.push(RGBColor); 2008 $rootScope.previousHighlightList.push(RGBColor);
1991 2009
1992 if ($rootScope.isHighLight == true) { 2010 if ($rootScope.isHighLight == true) {
@@ -3260,6 +3278,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -3260,6 +3278,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
3260 // send term no to vocab json data to get the text 3278 // send term no to vocab json data to get the text
3261 } 3279 }
3262 } 3280 }
  3281 + else {
  3282 + $rootScope.loadSearchData();
  3283 + $scope.GetAnnotationText(termNumber);
  3284 + }
3263 } 3285 }
3264 } 3286 }
3265 3287
@@ -3617,9 +3639,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -3617,9 +3639,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
3617 3639
3618 $scope.createDynamicSpeechBubble = function (event, x, y, isAnnotationNotForTBox) { 3640 $scope.createDynamicSpeechBubble = function (event, x, y, isAnnotationNotForTBox) {
3619 if (isAnnotationNotForTBox == true) { 3641 if (isAnnotationNotForTBox == true) {
3620 -  
3621 - $scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; }); 3642 + if ($scope.MultiLanguageAnnationArray > 1) {
  3643 + $scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; });
3622 3644
  3645 + }
  3646 + else {
  3647 + $scope.longestAnnotation = $scope.MultiLanguageAnnationArray[0].length;
  3648 + }
3623 //1. In transparency box we shows two annotation at a time, so we need to decide the max length of annotation in btween two annotation because based on that 3649 //1. In transparency box we shows two annotation at a time, so we need to decide the max length of annotation in btween two annotation because based on that
3624 // we decide the size of speech bubble 3650 // we decide the size of speech bubble
3625 //2. 3651 //2.
@@ -7821,6 +7847,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -7821,6 +7847,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
7821 $rootScope.isLoading = true; 7847 $rootScope.isLoading = true;
7822 $('#spinner').css('visibility', 'visible'); 7848 $('#spinner').css('visibility', 'visible');
7823 //1. 7849 //1.
  7850 + localStorage.setItem("currentBodyViewId", $rootScope.voId);
  7851 +
  7852 +
7824 $scope.loadSelectedBodyView($rootScope.voId); 7853 $scope.loadSelectedBodyView($rootScope.voId);
7825 7854
7826 //2. 7855 //2.
@@ -7841,7 +7870,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -7841,7 +7870,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
7841 } 7870 }
7842 $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title; 7871 $('#daImagePanel')[0].childNodes[0].childNodes[0].innerHTML = $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title;
7843 localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title); 7872 localStorage.setItem("currentViewTitle", $rootScope.getLocalStorageValue("genderId") + " " + event.currentTarget.title);
7844 - localStorage.setItem("currentBodyViewId", selectedViewId);  
7845 7873
7846 7874
7847 $rootScope.openViews.push( 7875 $rootScope.openViews.push(