Commit ac3d804522b9da4e019e9ab94bfe17ec4be5d91f

Authored by unknown
1 parent 5e166421

Commit Changes

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -639,106 +639,97 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -639,106 +639,97 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
639 }) 639 })
640 // $rootScope.languageArray = []; 640 // $rootScope.languageArray = [];
641 $rootScope.loadSearchDataForBodyView = function () { 641 $rootScope.loadSearchDataForBodyView = function () {
642 - debugger; 642 +
643 var languageArray = []; 643 var languageArray = [];
644 - $scope.vocabTermTxtArray = []; 644 + $rootScope.vocabTermTxtArray = [];
645 var languageArray = $rootScope.lexiconLanguageArray; 645 var languageArray = $rootScope.lexiconLanguageArray;
  646 +
  647 + console.log(languageArray.length);
646 console.log('loadSearchDataForBodyView'); 648 console.log('loadSearchDataForBodyView');
647 649
648 var currentBodyViewId = localStorage.getItem("currentBodyViewId"); 650 var currentBodyViewId = localStorage.getItem("currentBodyViewId");
649 651
  652 + for (var i = 0; i <= languageArray.length - 1; i++) {
  653 + var searchWorker = new Worker('search-wp.js');
650 654
651 - var searchWorker = new Worker('search-wp.js');  
652 -  
653 - //push workers in array to further used the refernece to delete the workers  
654 - $scope.runningSearchWorkers.push({ 'workerName': searchWorker })  
655 -  
656 - //console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))  
657 -  
658 - searchWorker.postMessage({  
659 - 'currentBodyViewId': currentBodyViewId,  
660 - 'languageArray': languageArray  
661 - })  
662 -  
663 - searchWorker.onmessage = function (e) {  
664 - //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); 655 + //push workers in array to further used the refernece to delete the workers
  656 + $scope.runningSearchWorkers.push({ 'workerName': searchWorker })
665 657
  658 + //console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
666 659
667 660
668 - $rootScope.TermNumberData = e.data.TermNumberData,  
669 - $rootScope.VocabTermData = e.data.VocabTermData,//same  
670 - $scope.vocabTermTxt = e.data.vocabTermTxt,  
671 - $scope.vocabTermTxtArray = e.data.DataArray,  
672 - alert($rootScope.TermNumberData)  
673 - //$scope.vocabLang = e.data.a  
674 - alert($scope.vocabTermTxtArray[0].language);  
675 - alert($scope.vocabTermTxtArray[0].VocabTermData);  
676 - alert($scope.vocabTermTxtArray[0].vocabTermTxt);  
677 -  
678 - console.log("language" + $scope.vocabTermTxtArray[0].language);  
679 - console.log("VocabTermData" + $scope.vocabTermTxtArray[0].VocabTermData);  
680 - console.log("vocabTermTxt" + $scope.vocabTermTxtArray[0].vocabTermTxt);  
681 -  
682 -  
683 - for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) { 661 + searchWorker.postMessage({
684 662
  663 + 'currentBodyViewId': currentBodyViewId,
  664 + 'languageName': languageArray[i].language,
  665 + 'languageID': languageArray[i].id
  666 + })
685 667
686 - $scope.vocabTermTxtArray[i].vocabTermTxt = new jinqJs()  
687 - .from($scope.vocabTermTxtArray[i].vocabTermTxt)  
688 - .distinct('_TermText', '_ActualTermNumber')  
689 - .orderBy([{ field: '_TermText', sort: 'asc' }])  
690 - .select('_ActualTermNumber', '_TermText', '_cdId'); 668 + searchWorker.onmessage = function (e) {
  669 + //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
  670 + $rootScope.TermNumberData = e.data.TermNumberData;
  671 + $rootScope.VocabTermData = e.data.VocabTermData,//same
  672 + $scope.vocabTermTxt = e.data.vocabTermTxt,
  673 + $scope.vocabLanguage = e.data.language,
  674 + $rootScope.vocabTermTxtArray.push({ "language": $scope.vocabLanguage, "VocabTermData": $rootScope.VocabTermData, "vocabTermTxt": $scope.vocabTermTxt });
691 675
  676 + for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) {
  677 +
692 678
693 - }  
694 - alert("After" + $scope.vocabTermTxtArray.length);  
695 - //$scope.VocabTermTxt = new jinqJs()  
696 - // .from($scope.vocabTermTxt)  
697 - // .distinct('_TermText', '_ActualTermNumber')  
698 - // .orderBy([{ field: '_TermText', sort: 'asc' }])  
699 - // .select('_ActualTermNumber', '_TermText', '_cdId'); 679 + $rootScope.vocabTermTxtArray[i].vocabTermTxt = new jinqJs()
  680 + .from($rootScope.vocabTermTxtArray[i].vocabTermTxt)
  681 + .distinct('_TermText', '_ActualTermNumber')
  682 + .orderBy([{ field: '_TermText', sort: 'asc' }])
  683 + .select('_ActualTermNumber', '_TermText', '_cdId');
  684 + // alert("After" + $rootScope.vocabTermTxtArray.length);
  685 + console.log("Language= " + $rootScope.lexiconLanguageArray[i].language + ", vocabTermTxt= " + $rootScope.vocabTermTxtArray[i].vocabTermTxt[0]._TermText);
700 686
  687 + }
701 688
  689 + // alert("After" + $rootScope.vocabTermTxtArray[0].vocabTermTxt);
702 690
  691 + //$scope.VocabTermTxt = new jinqJs()
  692 + // .from($scope.vocabTermTxt)
  693 + // .distinct('_TermText', '_ActualTermNumber')
  694 + // .orderBy([{ field: '_TermText', sort: 'asc' }])
  695 + // .select('_ActualTermNumber', '_TermText', '_cdId');
703 696
704 - //$rootScope.languageArray.push({ language: $scope.vocabLang, Text: $scope.VocabTermTxt });  
705 - //alert($rootScope.languageArray.length);  
706 - console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); 697 + console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
707 698
708 - if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) { 699 + if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) {
709 700
710 - var workerCount = $scope.runningSearchWorkers.length;  
711 - if (workerCount > 0) {  
712 - for (var i = workerCount - 1; i >= 0; i--) { 701 + var workerCount = $scope.runningSearchWorkers.length;
  702 + if (workerCount > 0) {
  703 + for (var i = workerCount - 1; i >= 0; i--) {
713 704
714 - var runningWorker = $scope.runningSearchWorkers[i].workerName;  
715 - runningWorker.terminate();  
716 - $scope.runningSearchWorkers.splice(i, 1);  
717 - // workerCount--; 705 + var runningWorker = $scope.runningSearchWorkers[i].workerName;
  706 + runningWorker.terminate();
  707 + $scope.runningSearchWorkers.splice(i, 1);
  708 + // workerCount--;
  709 + }
718 } 710 }
719 } 711 }
720 } 712 }
721 - }  
722 -  
723 - //call watch on '$scope.VocabTermTxt and compile <li> and append to <ul> on first time load  
724 - $scope.$watch('$scope.VocabTermTxt', function (newValue, oldValue, scope) {  
725 713
726 - //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed  
727 - //Remove the list and then Repopulate  
728 - if ($('#searchListDiv').html() != "")  
729 - $('#searchListDiv').empty()  
730 - //Delay compile of ul li so that the remove of li is completed.  
731 - $timeout(function () {  
732 - 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 VocabTermTxt| filter:{ _TermText: searchFilter}">' +  
733 - '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +  
734 - ' </li></ul>').appendTo('#searchListDiv')  
735 - $compile($e2)($scope); 714 + //call watch on '$scope.VocabTermTxt and compile <li> and append to <ul> on first time load
  715 + $scope.$watch('$scope.VocabTermTxt', function (newValue, oldValue, scope) {
736 716
737 - }, 500); 717 + //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
  718 + //Remove the list and then Repopulate
  719 + if ($('#searchListDiv').html() != "")
  720 + $('#searchListDiv').empty()
  721 + //Delay compile of ul li so that the remove of li is completed.
  722 + $timeout(function () {
  723 + 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 VocabTermTxt| filter:{ _TermText: searchFilter}">' +
  724 + '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
  725 + ' </li></ul>').appendTo('#searchListDiv')
  726 + $compile($e2)($scope);
738 727
739 - }, true); 728 + }, 500);
740 729
  730 + }, true);
741 731
  732 + }
742 733
743 } 734 }
744 735
@@ -1592,9 +1583,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1592,9 +1583,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1592 if ($rootScope.multiAnnotationIsON == true) { 1583 if ($rootScope.multiAnnotationIsON == true) {
1593 1584
1594 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top); 1585 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
1595 - alert(annotationText); 1586 +
1596 $scope.MultiLanguageAnnationArray = []; 1587 $scope.MultiLanguageAnnationArray = [];
1597 - $scope.MultiLanguageAnnationArray.push(annotationText); 1588 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  1589 +
  1590 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  1591 + }
1598 1592
1599 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true); 1593 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
1600 } 1594 }
@@ -1609,18 +1603,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1609,18 +1603,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1609 1603
1610 1604
1611 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top); 1605 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
1612 - alert(annotationText); 1606 + // alert(annotationText);
1613 $scope.MultiLanguageAnnationArray = []; 1607 $scope.MultiLanguageAnnationArray = [];
1614 - $scope.MultiLanguageAnnationArray.push(annotationText); 1608 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  1609 +
  1610 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  1611 + }
1615 1612
1616 1613
1617 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true); 1614 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
1618 } 1615 }
1619 else { 1616 else {
1620 - alert(annotationText); 1617 + // alert(annotationText);
1621 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top); 1618 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
1622 $scope.MultiLanguageAnnationArray = []; 1619 $scope.MultiLanguageAnnationArray = [];
1623 - $scope.MultiLanguageAnnationArray.push(annotationText); 1620 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  1621 +
  1622 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  1623 + }
1624 1624
1625 1625
1626 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true); 1626 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
@@ -1975,9 +1975,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1975,9 +1975,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1975 if ($rootScope.multiAnnotationIsON == true) { 1975 if ($rootScope.multiAnnotationIsON == true) {
1976 1976
1977 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top); 1977 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
1978 - alert(annotationText); 1978 + // alert(annotationText);
1979 $scope.MultiLanguageAnnationArray = []; 1979 $scope.MultiLanguageAnnationArray = [];
1980 - $scope.MultiLanguageAnnationArray.push(annotationText); 1980 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  1981 +
  1982 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  1983 + }
1981 1984
1982 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true); 1985 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
1983 } 1986 }
@@ -1999,7 +2002,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -1999,7 +2002,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1999 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top); 2002 // $scope.createDynamicSpeechBubble(evt, annotationText, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top);
2000 2003
2001 2004
2002 - $scope.MultiLanguageAnnationArray.push(annotationText); 2005 +
  2006 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  2007 +
  2008 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  2009 + }
2003 2010
2004 console.log('2. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length); 2011 console.log('2. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length);
2005 2012
@@ -2008,7 +2015,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2008,7 +2015,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2008 } 2015 }
2009 else { 2016 else {
2010 $scope.MultiLanguageAnnationArray = []; 2017 $scope.MultiLanguageAnnationArray = [];
2011 - $scope.MultiLanguageAnnationArray.push(annotationText); 2018 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  2019 +
  2020 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  2021 + }
2012 2022
2013 console.log('3. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length); 2023 console.log('3. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length);
2014 2024
@@ -2775,7 +2785,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2775,7 +2785,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2775 2785
2776 //get annotation from term number 2786 //get annotation from term number
2777 $scope.GetAnnotationText = function (termNumber) { 2787 $scope.GetAnnotationText = function (termNumber) {
2778 - debugger; 2788 + $rootScope.annotationText = [];
2779 var annotationText; 2789 var annotationText;
2780 var annotation = []; 2790 var annotation = [];
2781 //0 2791 //0
@@ -2784,7 +2794,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2784,7 +2794,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2784 if (parseInt(termNumber) != parseInt(figLeafTermNo)) { 2794 if (parseInt(termNumber) != parseInt(figLeafTermNo)) {
2785 $scope.TermNumber = termNumber; 2795 $scope.TermNumber = termNumber;
2786 for (var j = 0; j <= $rootScope.lexiconLanguageArray.length - 1; j++) { 2796 for (var j = 0; j <= $rootScope.lexiconLanguageArray.length - 1; j++) {
2787 - alert($rootScope.lexiconLanguageArray[j].language);  
2788 if ($rootScope.TermNumberData != null || $rootScope.TermNumberData != undefined) { 2797 if ($rootScope.TermNumberData != null || $rootScope.TermNumberData != undefined) {
2789 $scope.matchedTermNoData = new jinqJs() 2798 $scope.matchedTermNoData = new jinqJs()
2790 .from($rootScope.TermNumberData.TermData.Term) 2799 .from($rootScope.TermNumberData.TermData.Term)
@@ -2797,10 +2806,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2797,10 +2806,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2797 for (var z = 0; z < $scope.matchedTermNoData.length; z++) { 2806 for (var z = 0; z < $scope.matchedTermNoData.length; z++) {
2798 //send actual term no to get the term text. 2807 //send actual term no to get the term text.
2799 actualTermNo = $scope.matchedTermNoData[0]._ActualTermNumber; 2808 actualTermNo = $scope.matchedTermNoData[0]._ActualTermNumber;
2800 - annotationText = $scope.GetAnnotationBasedOnActualTermNo(actualTermNo);  
2801 - alert(annotationText); 2809 + annotationText = $scope.GetAnnotationBasedOnActualTermNo(actualTermNo, $rootScope.lexiconLanguageArray[j].language);
2802 annotation.push(annotationText); 2810 annotation.push(annotationText);
2803 - alert(annotation.length); 2811 + $rootScope.annotationText.push(annotationText);
2804 $rootScope.actualTermNumber = actualTermNo; 2812 $rootScope.actualTermNumber = actualTermNo;
2805 break; 2813 break;
2806 }; 2814 };
@@ -2814,33 +2822,42 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -2814,33 +2822,42 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2814 } 2822 }
2815 } 2823 }
2816 } 2824 }
2817 - alert(annotation.length); 2825 +
2818 return annotation; 2826 return annotation;
2819 } 2827 }
2820 2828
2821 - $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {  
2822 - 2829 + $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo, language) {
  2830 +
2823 var Annotation; 2831 var Annotation;
2824 $scope.ActualTermNo = actualTermNo; 2832 $scope.ActualTermNo = actualTermNo;
2825 - if ($rootScope.VocabTermData != null || $rootScope.VocabTermData != undefined) {  
2826 - $scope.matchedActualTermData = new jinqJs()  
2827 - .from($rootScope.VocabTermData.VocabTerms.Term)  
2828 - .where('_ActualTermNumber == ' + actualTermNo)  
2829 - .select(); 2833 + for (var j = 0; j <= $rootScope.vocabTermTxtArray.length - 1; j++) {
  2834 +
  2835 + if ($rootScope.vocabTermTxtArray[j].language == language) {
  2836 +
  2837 + if ($rootScope.vocabTermTxtArray[j].VocabTermData != null || $rootScope.vocabTermTxtArray[j].VocabTermData != undefined) {
  2838 + $scope.matchedActualTermData = new jinqJs()
  2839 + .from($rootScope.vocabTermTxtArray[j].VocabTermData.VocabTerms.Term)
  2840 + .where('_ActualTermNumber == ' + actualTermNo)
  2841 + .select();
  2842 +
  2843 + if ($scope.matchedActualTermData != null || $scope.matchedActualTermData != undefined) {
  2844 + for (var z = 0; z <= $scope.matchedActualTermData.length; z++) {
  2845 + //send actual term no to get the term text.
  2846 + Annotation = $scope.matchedActualTermData[0]._TermText;
  2847 + // alert("Annotation : " + Annotation);
  2848 + break;
  2849 + };
  2850 + }
  2851 + return Annotation;
  2852 + }
  2853 +
  2854 + else {
  2855 + return null;
  2856 + }
2830 2857
2831 - if ($scope.matchedActualTermData != null || $scope.matchedActualTermData != undefined) {  
2832 - for (var z = 0; z <= $scope.matchedActualTermData.length; z++) {  
2833 - //send actual term no to get the term text.  
2834 - Annotation = $scope.matchedActualTermData[0]._TermText;  
2835 - // alert("Annotation : " + Annotation);  
2836 - break;  
2837 - };  
2838 } 2858 }
2839 - return Annotation;  
2840 - }  
2841 - else {  
2842 - return null;  
2843 } 2859 }
  2860 +
2844 } 2861 }
2845 2862
2846 2863
@@ -4944,9 +4961,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4944,9 +4961,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4944 4961
4945 // var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_mci"; 4962 // var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_mci";
4946 4963
4947 - alert(annotationText); 4964 + // alert(annotationText);
4948 $scope.MultiLanguageAnnationArray = []; 4965 $scope.MultiLanguageAnnationArray = [];
4949 - $scope.MultiLanguageAnnationArray.push(annotationText); 4966 + for (var i = 0; i <= $rootScope.annotationText.length - 1; i++) {
  4967 +
  4968 + $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i]);
  4969 + }
4950 if (annotationText == "undefined") { 4970 if (annotationText == "undefined") {
4951 } 4971 }
4952 else { 4972 else {
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -370,7 +370,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -370,7 +370,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
370 $("#lexiconLangDropdown :selected").remove(); 370 $("#lexiconLangDropdown :selected").remove();
371 $('#secondLax').append('<option val="' + $rootScope.selectedId + '">' + $rootScope.selectedText + '</option>'); 371 $('#secondLax').append('<option val="' + $rootScope.selectedId + '">' + $rootScope.selectedText + '</option>');
372 $rootScope.lexiconLanguageArray.push({ id: $rootScope.selectedId, language: $rootScope.selectedText }); 372 $rootScope.lexiconLanguageArray.push({ id: $rootScope.selectedId, language: $rootScope.selectedText });
373 - alert($rootScope.lexiconLanguageArray.length); 373 + // alert($rootScope.lexiconLanguageArray.length);
374 } 374 }
375 }); 375 });
376 376
@@ -387,7 +387,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -387,7 +387,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
387 $("#secondLax :selected").remove(); 387 $("#secondLax :selected").remove();
388 $('#lexiconLangDropdown').append('<option val="' + $rootScope.secondlaxdid + '">' + $rootScope.secondlaxtext + '</option>'); 388 $('#lexiconLangDropdown').append('<option val="' + $rootScope.secondlaxdid + '">' + $rootScope.secondlaxtext + '</option>');
389 $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); 389 $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1);
390 - alert($rootScope.lexiconLanguageArray.length); 390 + // alert($rootScope.lexiconLanguageArray.length);
391 } 391 }
392 }); 392 });
393 393
400-SOURCECODE/AIAHTML5.Web/search-wp.js
1 ๏ปฟ 1 ๏ปฟ
2 2
3 -loadTermData = function (currentBodyViewId, languageArray) { 3 +loadTermData = function (currentBodyViewId, languageName, languageID) {
4 4
5 console.log('search-wp, loadTermData, time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); 5 console.log('search-wp, loadTermData, time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
6 - console.log('languageArray: ' + languageArray.length);  
7 -  
8 var termNoJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; 6 var termNoJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json';
9 7
10 var TermNumberData; 8 var TermNumberData;
@@ -17,8 +15,8 @@ loadTermData = function (currentBodyViewId, languageArray) { @@ -17,8 +15,8 @@ loadTermData = function (currentBodyViewId, languageArray) {
17 TermNumberData = JSON.parse(AJAX_req.responseText); 15 TermNumberData = JSON.parse(AJAX_req.responseText);
18 console.log("data returned: " + TermNumberData); 16 console.log("data returned: " + TermNumberData);
19 17
20 - loadTermTextData(TermNumberData, languageArray);  
21 - // loadTermTextData(languageArray); 18 + loadTermTextData(TermNumberData, languageName, languageID);
  19 +
22 } 20 }
23 } 21 }
24 AJAX_req.send(); 22 AJAX_req.send();
@@ -27,34 +25,19 @@ loadTermData = function (currentBodyViewId, languageArray) { @@ -27,34 +25,19 @@ loadTermData = function (currentBodyViewId, languageArray) {
27 } 25 }
28 26
29 27
30 -loadTermTextData = function (TermNumberData, arr) {  
31 - console.log(arr.length);  
32 - var DataArray = [];  
33 - var a;  
34 - for (var j = 0; j <= arr.length - 1; j++) {  
35 -  
36 - //1.  
37 - var a = arr[j].language;  
38 - var termTextJsonPath = '~/../content/data/json/da/vocab/' + arr[j].language + '/cm_dat_vocabterm_' + arr[j].id + '.json';  
39 - console.log(termTextJsonPath);  
40 - 28 +loadTermTextData = function (TermNumberData, languageName, languageID) {
  29 + var termTextJsonPath = '~/../content/data/json/da/vocab/' + languageName + '/cm_dat_vocabterm_' + languageID + '.json';
41 var VocabTermData; 30 var VocabTermData;
42 var AJAX_req = new XMLHttpRequest(); 31 var AJAX_req = new XMLHttpRequest();
43 AJAX_req.open("GET", termTextJsonPath, true); 32 AJAX_req.open("GET", termTextJsonPath, true);
44 AJAX_req.setRequestHeader("Content-type", "application/json"); 33 AJAX_req.setRequestHeader("Content-type", "application/json");
45 -  
46 AJAX_req.onreadystatechange = function () { 34 AJAX_req.onreadystatechange = function () {
47 if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { 35 if (AJAX_req.readyState == 4 && AJAX_req.status == 200) {
  36 + console.log('AJAX_req.readyState= ' + AJAX_req.readyState + ' and AJAX_req.status =' + AJAX_req.status);
48 VocabTermData = JSON.parse(AJAX_req.responseText); 37 VocabTermData = JSON.parse(AJAX_req.responseText);
49 - console.log("data returned FOR VocabTermData: " + VocabTermData);  
50 -  
51 var vocabTermTxt = []; 38 var vocabTermTxt = [];
52 -  
53 TermNumberData.TermData.Term.forEach(function (value1, key1) { 39 TermNumberData.TermData.Term.forEach(function (value1, key1) {
54 -  
55 - console.log("data returned FOR VocabTermData1: " + VocabTermData.VocabTerms);  
56 VocabTermData.VocabTerms.Term.forEach(function (value2, key2) { 40 VocabTermData.VocabTerms.Term.forEach(function (value2, key2) {
57 -  
58 if (value1._ActualTermNumber === value2._ActualTermNumber) { 41 if (value1._ActualTermNumber === value2._ActualTermNumber) {
59 vocabTermTxt.push( 42 vocabTermTxt.push(
60 { 43 {
@@ -65,40 +48,25 @@ loadTermTextData = function (TermNumberData, arr) { @@ -65,40 +48,25 @@ loadTermTextData = function (TermNumberData, arr) {
65 ); 48 );
66 } 49 }
67 }) 50 })
68 -  
69 }) 51 })
70 - DataArray.push({ "language": a, "VocabTermData": VocabTermData, "vocabTermTxt": vocabTermTxt });  
71 - self.postMessage({  
72 - 'vocabTermTxt': vocabTermTxt,  
73 - 'TermNumberData': TermNumberData,  
74 - 'VocabTermData': VocabTermData,  
75 - 'DataArray': DataArray  
76 -  
77 - }); 52 + self.postMessage({
  53 + 'vocabTermTxt': vocabTermTxt,
  54 + 'TermNumberData': TermNumberData,
  55 + 'VocabTermData': VocabTermData,
  56 + 'language': languageName
78 57
  58 + });
79 } 59 }
80 } 60 }
81 -  
82 -  
83 -  
84 - }  
85 AJAX_req.send(); 61 AJAX_req.send();
86 -  
87 - // var termTextJsonPath = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json';  
88 -  
89 - // readTextFile(termTextJsonPath, function (text) {  
90 -  
91 -  
92 -  
93 -  
94 } 62 }
95 63
96 64
97 self.onmessage = function (e) { 65 self.onmessage = function (e) {
98 console.log("search"); 66 console.log("search");
99 //console.log('search-wp onmessage time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); 67 //console.log('search-wp onmessage time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
100 - loadTermData(e.data.currentBodyViewId, e.data.languageArray);  
101 - // loadTermData(e.data.languageArray); 68 + loadTermData(e.data.currentBodyViewId, e.data.languageName, e.data.languageID);
  69 +
102 70
103 } 71 }
104 72