diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index d05b7f2..14b2327 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -276,13 +276,15 @@ namespace AIAHTML5.API.Controllers { userInfo.userselectedModesty = modesty; userInfo.userSelectedSkintone = skintone; - } + userInfo.userLexicon = us.userLexicon; + } else { userInfo.userselectedModesty = null; userInfo.userSelectedSkintone = null; + userInfo.userLexicon = null; - } + } } private static void CheckLicenseStatus(User userInfo) @@ -427,6 +429,7 @@ namespace AIAHTML5.API.Controllers int Status = 0; dynamic responseData; User settings = new User(); + UserLexicon userLexicon = new UserLexicon(); try { @@ -434,18 +437,20 @@ namespace AIAHTML5.API.Controllers settings.userSelectedSkintone = jsonData["skintone"].Value(); settings.userSelectedFont = null; settings.Id= jsonData["userId"].Value(); + userLexicon.primaryid= jsonData["primaryid"].Value(); + userLexicon.secondryids = jsonData["secondryids"].Value(); + settings.userLexicon= userLexicon; - Status = AIAHTML5.API.Models.Users.SaveUserSelectedSettings(settings); - if (Status == 1) - + Status = AIAHTML5.API.Models.Users.SaveUserSelectedSettings(settings); + if (Status == 1) { responseData = "1"; - } else { responseData = AIAConstants.SETTINGS_SAVE_FAILURE; } + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(responseData) }; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 543f83e..d43fb98 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -387,10 +387,10 @@ namespace AIAHTML5.API.Models internal User GetSelectedSettings(int userId) { logger.Debug(" Inside GetSelectedSettings for userId = " + userId); - + UserLexicon objlexicon = null; User objUser = null; DBModel objModel = new DBModel(); - + SqlConnection conn = new SqlConnection(dbConnectionString); SqlCommand cmd = new SqlCommand(); SqlDataAdapter adapter; @@ -418,12 +418,17 @@ namespace AIAHTML5.API.Models { foreach (DataRow dr in dt.Rows) { + objlexicon = new UserLexicon(); objUser = new User(); objUser.Id = Convert.ToInt32(dr["UserId"]); objUser.userSelectedSkintone = dr["Skintone"].ToString(); objUser.userselectedModesty = dr["Modesty"].ToString(); - logger.Debug("objUser.Id= " + objUser.Id + ",objUser.userselectedModesty= " + objUser.userselectedModesty + ",objUser.userSelectedSkintone= " + objUser.userSelectedSkintone + ",objUser.Password= " + objUser.Password + ",objUser.SecurityQuestionId= " + objUser.SecurityQuestionId); + objlexicon.primaryid= dr["PrimaryLexicon"].ToString(); + objlexicon.secondryids = dr["SecondryLexicon"].ToString(); + objUser.userLexicon = objlexicon; + + // logger.Debug("objUser.Id= " + objUser.Id + ",objUser.userselectedModesty= " + objUser.userselectedModesty + ",objUser.userSelectedSkintone= " + objUser.userSelectedSkintone + ",objUser.Password= " + objUser.Password + ",objUser.SecurityQuestionId= " + objUser.SecurityQuestionId); } } } @@ -777,7 +782,9 @@ namespace AIAHTML5.API.Models cmd.Parameters.AddWithValue("@iModesty", settings.userselectedModesty); cmd.Parameters.AddWithValue("@iSkintone",settings. userSelectedSkintone); cmd.Parameters.AddWithValue("@ifont","" ); - + cmd.Parameters.AddWithValue("@pLexicon", settings.userLexicon.primaryid); + cmd.Parameters.AddWithValue("@sLexicon", settings.userLexicon.secondryids); + result = cmd.ExecuteNonQuery(); } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/User.cs b/400-SOURCECODE/AIAHTML5.API/Models/User.cs index a404612..24e3719 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/User.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/User.cs @@ -42,6 +42,7 @@ namespace AIAHTML5.API.Models public String userSelectedSkintone { get; set; } public string userselectedModesty { get; set; } public string userSelectedFont { get; set; } + public UserLexicon userLexicon { get; set; } public License LicenseInfo { get; set; } @@ -169,4 +170,11 @@ namespace AIAHTML5.API.Models } + public class UserLexicon + { + public string primaryid { get; set; } + public string secondryids { get; set; } + + } + } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index ca65a6b..a7c1a68 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -1286,17 +1286,23 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#canvasDivAI_' + windowviewid).css('height', canvasDIvHeight-5); - if (!$rootScope.isCallFromOtherModule) { + var canvas = document.getElementById("canvasAI_" + windowviewid); var canvasPaint = document.getElementById("canvasPaintAI_" + windowviewid); - canvas.height = canvasDIvHeight; - canvasPaint.height = canvasDIvHeight - canvas.width = screen.width; - canvasPaint.width = screen.width; + canvas.height = canvasDIvHeight-30; + canvasPaint.height = canvasDIvHeight-30; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + canvas.width = screen.width-20; + canvasPaint.width = screen.width-20; } - - + else + { + canvas.width = screen.width-40; + canvasPaint.width = screen.width-40; + } + $scope.SetAIwindowStoreData(windowviewid, 'currentSlug', 'adam-images-detail'); var openedImage = document.getElementById('aimage_' + windowviewid ); openedImage.src = selectedAIImage; diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index 9cbe59b..b712c45 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -974,7 +974,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout '
' + //'
' + '' + - '
' + + '
' + '

' + selectedImageCISummary + '

' + '
' + '
'+ @@ -1086,10 +1086,19 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var canvas = document.getElementById("canvasCI_" + windowviewid); var canvasPaint = document.getElementById("canvasPaintCI_" + windowviewid); - canvas.height = canvasDIvHeight; - canvasPaint.height = canvasDIvHeight; - canvas.width = screen.width-20; - canvasPaint.width = screen.width-20; + canvas.height = canvasDIvHeight-30; + canvasPaint.height = canvasDIvHeight-30; + + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + canvas.width = screen.width-20; + canvasPaint.width = screen.width-20; + } + else + { + canvas.width = screen.width-40; + canvasPaint.width = screen.width-40; + } if(screen.height<400) { $('#summary_' + windowviewid).css("bottom", "-220px"); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index 1aed23f..7ca2e04 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -3183,8 +3183,7 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ for (var i = 0; i < $rootScope.DaWindowData.length; i++) { $scope.updatedWindowListForSaveCB.push({ - // bodySystemTermList: $rootScope.DaWindowData[i].BodySystemData, - isTitleBarVisible: false, //BodySystemData.isTitleBarVisible,//N + isTitleBarVisible: false, highlightOptionsSelectedId: 0, selectedStructureID: 0,//N contentDescriptorId: 0, diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index c3da49f..51ce8ab 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -65,7 +65,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l 'fullTermlist':[], 'isHighlightBodyWithCBTermData':false, 'CurriculumTermData':[], - 'primaryLexiconInd':[], + 'TermAnnotationText':[], 'AllTerms':[], 'actualTermNumber':0, @@ -146,7 +146,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l 'transparencyX': 0, 'transparencyY': 0, 'isTransparent': false, - 'showHideAnnotations': 'showAnnotationStructure' + 'showHideAnnotations': 'showAnnotationStructure', + 'totalstructure': 0, + 'totalstructureLm': 0, + 'intervalObject': null, + 'isannotationReload': false }; return windata; @@ -843,16 +847,17 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.loadTermData = function (windowviewid) { - var bodyViewId=$scope.GetwindowStoreData(windowviewid,'voId'); + var bodyViewId=$scope.GetwindowStoreData(windowviewid,'voId'); // set gender $scope.setGenderNameById(bodyViewId,windowviewid); + $scope.LoadImageToExport(windowviewid); $rootScope.daloadSearchData(windowviewid); //call time interval function until load Illustration data var timeintval = null; timeintval = $interval(function () { var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray'); if (vocabTermDataArray!=null) { - $scope.stopVocab(); + $scope.stopVocab(timeintval); $scope.loadBodyView(windowviewid); } else @@ -861,7 +866,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } }, 100); - $scope.stopVocab = function () { + $scope.stopVocab = function (timeintval) { if (angular.isDefined(timeintval)) { $interval.cancel(timeintval); timeintval = undefined; @@ -1109,7 +1114,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var bodySystemListObj = document.getElementById("structureDropdownDA_" + windowviewid); var len = bodySystemListObj!=null?(bodySystemListObj.id).split("_").length:0; if (len>1) { - $scope.stopIntervalLoader(); + $scope.stopIntervalLoader(timeintval); //wait until DOM element load of DA $scope.daViewLoader(windowviewid); } @@ -1119,7 +1124,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l console.log("waiting for loading module"); } }, 200); - $scope.stopIntervalLoader = function () { + $scope.stopIntervalLoader = function (timeintval) { if (angular.isDefined(timeintval)) { $interval.cancel(timeintval); timeintval = undefined; @@ -1261,6 +1266,14 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); + //hide search data + $("#topMenuBar .dropdown-toggle").on('click', function (event) { + + $timeout(function () { + $scope.IsSearchVisible=false; + + }, 200); + }); $("#termlistfilter_"+windowviewid).scroll(function (event) { @@ -1301,6 +1314,35 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } }); + // set search for language input + $scope.langSearchLoad(windowviewid); + + } + + $scope.langSearchLoad= function(windowviewid) + { + $('#searchlangaugeDiv').empty(); + $('#searchlangaugeDiv').css("display","none"); + var languageArray = $rootScope.lexiconLanguageArray; + + if(languageArray.length>1) + { + $('#searchlangaugeDiv').css("display","block"); + var option=''; + for (var i = 0; i <= languageArray.length - 1; i++) { + option=option+''; + } + var $all = $('#searchlangaugeDiv').append( + '
'+ + ''+ + '
' + ) + $compile($all)($scope); + + } + } $scope.CanvasDivScroll = function (windowviewid) { @@ -1559,6 +1601,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // side bar toggle $("#sidebarId").attr("id", "sidebarId_" + windowviewid); + $("#closeTermList").attr("id", "closeTermList_" + windowviewid); + $("#selectLanguage").attr("id", "selectLanguage_" + windowviewid); + $("#totalTerms").attr("id", "totalTerms_" + windowviewid); + // bodyview id $("#Anterior").attr("id", "Anterior_" + windowviewid); @@ -1583,77 +1629,90 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $("#Skeletal").attr("id", "Skeletal_" + windowviewid); $("#Urinary").attr("id", "Urinary_" + windowviewid); - var $all = $("#da-input_" +windowviewid).prepend('') + var htm=''; + + var $all = $("#da-input_" +windowviewid).prepend(htm); $compile($all)($scope); + } $rootScope.daloadSearchData = function (windowviewid) { - $scope.SetwindowStoreData(windowviewid, 'primaryLexiconInd', []); - var languageInd = []; - var languageArray = []; + $scope.SetwindowStoreData(windowviewid, 'vocabTempTermArray', []); + $scope.SetwindowStoreData(windowviewid, 'daTermData', []); + $scope.SetwindowStoreData(windowviewid, 'vocabTermArray', []); + $scope.SetwindowStoreData(windowviewid, 'vocabTermDataArray', null); - var languageArray = $rootScope.lexiconLanguageArray; - console.log('loadSearchDataForBodyView'); - + var currentBodyViewId = $scope.GetwindowStoreData(windowviewid, 'voId'); - $scope.vocabTempTermArray = []; - - for (var i = 0; i <= languageArray.length - 1; i++) { + + for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) { + var searchWorker = new Worker('search-wp.js'); + var count= $scope.runningSearchWorkers.length==0?1:$scope.runningSearchWorkers.length+1; //push workers in array to further used the refernece to delete the workers - $scope.runningSearchWorkers.push({ 'workerName': searchWorker }) + $scope.runningSearchWorkers.push({ 'workerName': searchWorker,'windowId':windowviewid,'count':count }); + searchWorker.postMessage({ 'currentBodyViewId': currentBodyViewId, - 'languageName': languageArray[i].language, - 'languageID': languageArray[i].id + 'languageName': $rootScope.lexiconLanguageArray[i].language, + 'languageID': $rootScope.lexiconLanguageArray[i].id, + 'windowid': windowviewid }) searchWorker.onmessage = function (e) { console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + var vocabTempTermArray = []; + var daTermData =$scope.GetwindowStoreData(e.data.winId, 'daTermData'); + var vocabTermArray = $scope.GetwindowStoreData(e.data.winId, 'vocabTermArray'); - $scope.SetwindowStoreData(windowviewid,'TermNumberData',e.data.TermNumberData); - - // store image for export - $scope.LoadImageToExport(windowviewid); + daTermData.push({"WinId": e.data.winId, "language": e.data.language, "VocabTermData": e.data.TermNumberData}); + vocabTermArray.push({"WinId": e.data.winId, "language": e.data.language, "vocabTermTxt": e.data.vocabTermTxt }); - // console.log("$rootScope.TermNumberData = " + e.data.TermNumberData.TermData.Term.length); + $scope.SetwindowStoreData(e.data.winId, 'daTermData', daTermData); + $scope.SetwindowStoreData(e.data.winId, 'vocabTermArray', vocabTermArray); - // console.log("$scope.BodyViewIDs" + e.data.bodyViewID); - - $scope.vocabTempTermArray.push({ "language": e.data.language, "VocabTermData": e.data.VocabTermData, "vocabTermTxt": e.data.vocabTermTxt }); - - - - if ($scope.vocabTempTermArray.length == $rootScope.lexiconLanguageArray.length) { - $("#setting-spinner").css("display", "none"); + if (vocabTermArray.length == $rootScope.lexiconLanguageArray.length) { + for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) { + + if($rootScope.lexiconLanguageArray[0].language==daTermData[i].language) + { + //getting primary language term number - languageInd.push(i); + $scope.SetwindowStoreData(daTermData[i].WinId,'TermNumberData',daTermData[i].VocabTermData); + } - $scope.vocabTempTermArray[i].vocabTermTxt = new jinqJs() - .from($scope.vocabTempTermArray[i].vocabTermTxt) - .distinct('_TermText', '_ActualTermNumber') - .orderBy([{ field: '_TermText', sort: 'asc' }]) - .select('_ActualTermNumber', '_TermText', '_cdId'); + if($rootScope.lexiconLanguageArray[0].language==vocabTermArray[i].language) + { + //keep primary language at top + vocabTempTermArray.unshift(vocabTermArray[i]); + } + else + { + vocabTempTermArray.push(vocabTermArray[i]); + } + + } - $scope.SetwindowStoreData(windowviewid, 'primaryLexiconInd', languageInd); - // add data vocabTermDataArray - $scope.SetwindowStoreData(windowviewid, 'vocabTermDataArray', $scope.vocabTempTermArray); + for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) { - if ($rootScope.isListManagerMenuSelected) { - $scope.loadListManger(windowviewid); - } - if ($scope.GetwindowStoreData(windowviewid,'isSearchClicked')) { - $scope.FillSearchList(windowviewid); + vocabTempTermArray[i].vocabTermTxt = new jinqJs() + .from(vocabTempTermArray[i].vocabTermTxt) + .distinct('_ActualTermNumber','_TermText') + .orderBy([{ field: '_TermText', sort: 'asc' }]) + .select(); } + // add data vocabTermDataArray + $scope.SetwindowStoreData(e.data.winId, 'vocabTermDataArray', vocabTempTermArray); + // terminate search worker instances if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) { @@ -1661,17 +1720,21 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if (workerCount > 0) { for (var i = workerCount - 1; i >= 0; i--) { - var runningWorker = $scope.runningSearchWorkers[i].workerName; - runningWorker.terminate(); - $scope.runningSearchWorkers.splice(i, 1); + if($scope.runningSearchWorkers[i].windowId==e.data.winId) + { + var runningWorker = $scope.runningSearchWorkers[i].workerName; + runningWorker.terminate(); + $scope.runningSearchWorkers.splice(i, 1); + } + } } } - } - - console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + $scope.EnableUI(); + } + } } @@ -1852,7 +1915,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.LoadDefaultLayerImage = function (windowviewid) { - console.log('inside LoadDefaultLayerImage') $scope.SetwindowStoreData(windowviewid,'isNormalMode',true); //viewOrientationId is to pic coordinates of view and void is to pic image name from resopective json @@ -1998,18 +2060,30 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var serachTerm = $scope.daOpenInOtherModules.callOuts[i].termNumber.toString(); var isFound = jQuery.inArray(serachTerm, CurriculumTermData) if (isFound == -1) { - CurriculumTermData.push( - - { - "transparentTermNumber": $scope.daOpenInOtherModules.callOuts[i].transparentTermNumber, - "termNumber": $scope.daOpenInOtherModules.callOuts[i].termNumber, - "istpboxTerm":$scope.daOpenInOtherModules.callOuts[i].istpboxTerm==undefined?0:$scope.daOpenInOtherModules.callOuts[i].istpboxTerm, - "tips_x": $scope.daOpenInOtherModules.callOuts[i].tips_x, - "tips_y": $scope.daOpenInOtherModules.callOuts[i].tips_y, - "x": $scope.daOpenInOtherModules.callOuts[i].x, - "y": $scope.daOpenInOtherModules.callOuts[i].y - }); + if($scope.daOpenInOtherModules.callOuts[i].tips_x!=undefined) + { + CurriculumTermData.push( + { + "transparentTermNumber": $scope.daOpenInOtherModules.callOuts[i].transparentTermNumber.toString(), + "termNumber": $scope.daOpenInOtherModules.callOuts[i].termNumber.toString(), + "istpboxTerm":$scope.daOpenInOtherModules.callOuts[i].istpboxTerm==undefined?0:$scope.daOpenInOtherModules.callOuts[i].istpboxTerm, + "tips_x": $scope.daOpenInOtherModules.callOuts[i].tips_x, + "tips_y": $scope.daOpenInOtherModules.callOuts[i].tips_y, + "x": $scope.daOpenInOtherModules.callOuts[i].x, + "y": $scope.daOpenInOtherModules.callOuts[i].y + }); + + } + else + { + CurriculumTermData.push({ + "transparentTermNumber": $scope.daOpenInOtherModules.callOuts[i].transparentTermNumber.toString(), + "termNumber": $scope.daOpenInOtherModules.callOuts[i].termNumber.toString(), + "istpboxTerm":$scope.daOpenInOtherModules.callOuts[i].istpboxTerm==undefined?0:$scope.daOpenInOtherModules.callOuts[i].istpboxTerm, + 'relatedTerm':$scope.daOpenInOtherModules.callOuts[i].relatedTerm.toString() + }); + } } } @@ -2149,9 +2223,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var canvasID = "canvasDA_" + windowviewid; //register touch end and touchmove event for touch devices - var ATBarHtml = $("#canvasDivDA_" + windowviewid).append(''); + var ATBarHtml = $("#canvasDivDA_" + windowviewid).append(''); $compile(ATBarHtml)($scope); - + } var isCBAnnotationActive= $scope.GetwindowStoreData(windowviewid, 'isCBAnnotationActive'); @@ -2427,6 +2501,39 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#draggable_' + windowviewid).css("left", dragdivleft); $('#draggable_' + windowviewid).css("top", dragdivtop); + var canvas = document.getElementById("canvasDA_" + windowviewid); + var canvasPaint = document.getElementById("canvasPaintDA_" + windowviewid); + + if(viewOrientationId!=1 && viewOrientationId!=4) + { + if(viewOrientationId==5) + { + //lateral arm + canvas.height = 1500; + canvasPaint.height =1500; + + } + else if(viewOrientationId==6) + { + //medial arm + canvas.height = 1400; + canvasPaint.height = 1400; + + } + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + canvas.width = screen.width-145; + canvasPaint.width = screen.width-145; + } + else + { + canvas.width = screen.width-165; + canvasPaint.width = screen.width-165; + } + + } + + } @@ -2799,26 +2906,36 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // Scroll canvas based on CB data var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); if (isHighlightBodyWithCBTermData == true) { - var canvasHScrollX = $scope.daOpenInOtherModules.canvasHScrollX; - var canvasVScrollX = $scope.daOpenInOtherModules.canvasVScrollX; - $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); - $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); - - $scope.SetwindowStoreData(windowviewid, 'CanvasDivTopPosition', $("#canvasDivDA_" + windowviewid).scrollTop()); - $scope.SetwindowStoreData(windowviewid, 'CanvasDivLeftPosition', $("#canvasDivDA_" + windowviewid).scrollLeft()); - } + if($scope.daOpenInOtherModules!=null) + { + var canvasHScrollX = $scope.daOpenInOtherModules.canvasHScrollX; + var canvasVScrollX = $scope.daOpenInOtherModules.canvasVScrollX; + $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); + $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); + + $scope.SetwindowStoreData(windowviewid, 'CanvasDivTopPosition', $("#canvasDivDA_" + windowviewid).scrollTop()); + $scope.SetwindowStoreData(windowviewid, 'CanvasDivLeftPosition', $("#canvasDivDA_" + windowviewid).scrollLeft()); + } + else + { + var canvasHScrollX = $scope.GetwindowStoreData(windowviewid,'CanvasDivLeftPosition'); + var canvasVScrollX = $scope.GetwindowStoreData(windowviewid,'CanvasDivTopPosition'); + $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); + $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); + } + + } $scope.DisableUI(); - if ($scope.isSearchDataLoaded) { - $scope.EnableUI(); - } + var isHighLight=$scope.GetwindowStoreData(windowviewid,'isHighLight'); var isGenderChnage = $scope.GetwindowStoreData(windowviewid,'isGenderChnage'); var isViewChange = $scope.GetwindowStoreData(windowviewid,'isViewChange'); var isHighlightBodyByBodySystem=$scope.GetwindowStoreData(windowviewid,'isHighlightBodyByBodySystem'); var isListManagerSelected = $scope.GetwindowStoreData(windowviewid, 'isListManagerSelected'); // var isTBACtive = $scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated'); - if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated')) { + var isLexiconReload= $scope.GetwindowStoreData(windowviewid, 'isannotationReload'); + if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated') && isLexiconReload==false) { $scope.DrawTransparencyBox(windowviewid); @@ -2830,17 +2947,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l else if (isHighLight == true || (isListManagerSelected == true) || ((isGenderChnage == true) && (isHighLight == true)) || ((isViewChange == true) && (isHighLight == true)) || isHighlightBodyByBodySystem == true) { - console.log('1. $rootScope.isHighLight= ' + isHighLight) - $scope.SetwindowStoreData(windowviewid, 'isHighLight', true); $scope.DisableUI(); $scope.highLightBody(windowviewid); - if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true && isLexiconReload==false) { $scope.CalculateDimensionsAndDrawTBox(windowviewid); } } else { - if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true && isLexiconReload==false) { $scope.CalculateDimensionsAndDrawTBox(windowviewid); } var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); @@ -3004,76 +3119,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); previousHighlightList.push(RGBColor); - + //Save Term Number to Showing Annotaion Text for CB Module var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); AllTerms.push({ '_TermNumber': RGBColor }); var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); - fullTermlist.push(parseInt(RGBColor)); + fullTermlist.push(RGBColor); + + $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); - if ($scope.GetwindowStoreData(windowviewid,'isHighLight')) { - - if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) { - if ($scope.machedIcolorInBodyRegion.length > 0) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) { - var bodyRegionId = $scope.machedIcolorInBodyRegion[i]; - - var grayCanvasID = 'imageCanvas' + bodyRegionId + "_" + windowviewid; - var grayCanvas = document.getElementById(grayCanvasID); - - var grayCanvasContext = grayCanvas.getContext("2d"); - var grayImageDataList=$scope.GetwindowStoreData(windowviewid,'grayImageDataList'); - if (grayImageDataList[bodyRegionId - 1] != null || grayImageDataList[bodyRegionId - 1] != undefined) { - var grayImageData = grayImageDataList[bodyRegionId - 1]; - grayCanvasContext.putImageData(grayImageData, 0, 0); - } - - // for mirrored canvas - var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); - if (bodyVid == "1" || bodyVid == "4" || bodyVid == "5" || bodyVid == "8") { - if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) { - var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR' + "_" + windowviewid; - var grayCanvasMR = document.getElementById(grayCanvasID); - - var grayCanvasContextMR = grayCanvasMR.getContext("2d"); - var grayImageMRDataList=$scope.GetwindowStoreData(windowviewid,'grayImageMRDataList'); - if (grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) { - var grayImageDataMR = grayImageMRDataList[bodyRegionId]; - - grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); - } - } - } - } - } - } - } - - $scope.highLightBodyBasedOnIcolor(RGBColor,windowviewid); - } - - - //extarct clicked body part is extarct button is already enabled. - - if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); - } - $scope.enableExtract(false,windowviewid); - } - - var annotationText - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - if (TermNData != null && TermNData != undefined) { - - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); - } - else - { - $rootScope.daloadSearchData(windowviewid); - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); - } var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); var tips_x= parseInt( MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30; @@ -3081,39 +3135,78 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var posx= MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left; var posy= MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top; + var ismultiannotation=$scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON'); + + var newTerm=[] + + newTerm.push({ + "termNumber": RGBColor, + "istpboxTerm":0, + "tips_x": tips_x, + "tips_y": tips_y, + "posx": posx, + "posy": posy - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { + }) - $scope.MultiLanguageAnnationArray = []; - $scope.saveTermNumberForSaveCB(windowviewid,true,RGBColor,tips_x,tips_y,posx,posy); - - if (TermAnnotationText.length>0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { + if ($scope.GetwindowStoreData(windowviewid,'isHighLight') || $scope.GetwindowStoreData(windowviewid,'isExtract') == true) { + var ActualTermNo = $scope.getActualTermNumber(RGBColor, windowviewid); - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); + if (ActualTermNo != null) { + + //3. Find Term No List Based on ActualTermNo + var TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); + + if (TermList != null) { + for(var i=0;i 0) { - - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - - $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } + $scope.saveTermNumberForSaveCB(windowviewid,ismultiannotation,newTerm); } + $scope.MultiLanguageAnnationArray = []; + + if (TermAnnotationText.length > 0) { + + for (var i = 0; i <= TermAnnotationText.length - 1; i++) { + + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); + } + + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); + } } @@ -3138,19 +3231,19 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if (bodyRegionId == 3) { //set z index of hip canavs to fix the issue caused by overlapping of arm canavs on hip canavs. - imgCanvas.style.zIndex = "11000"; + imgCanvas.style.zIndex = "1000"; } if (bodyRegionId.match('modestyImg')) { //added class to further access this canavs to show and hide leaf as per modesty seting imgCanvas.className = 'modestyImg_'+windowviewid; imgCanvas.style.visibility = 'hidden' //set z index to make leaf canvas on top of hip canavs - imgCanvas.style.zIndex = "11000"; + imgCanvas.style.zIndex = "1000"; } var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); if ((bodyVid == 11 || bodyVid == 9) && bodyRegionId == 6) { - imgCanvas.style.zIndex = "11000"; + imgCanvas.style.zIndex = "1000"; } if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { @@ -3310,65 +3403,63 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // Scroll canvas based on CB data var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); if (isHighlightBodyWithCBTermData == true) { - var canvasHScrollX = $scope.daOpenInOtherModules.canvasHScrollX; - var canvasVScrollX = $scope.daOpenInOtherModules.canvasVScrollX; - $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); - $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); - - $scope.SetwindowStoreData(windowviewid, 'CanvasDivTopPosition', $("#canvasDivDA_" + windowviewid).scrollTop()); - $scope.SetwindowStoreData(windowviewid, 'CanvasDivLeftPosition', $("#canvasDivDA_" + windowviewid).scrollLeft()); + if($scope.daOpenInOtherModules!=null) + { + var canvasHScrollX = $scope.daOpenInOtherModules.canvasHScrollX; + var canvasVScrollX = $scope.daOpenInOtherModules.canvasVScrollX; + $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); + $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); + + $scope.SetwindowStoreData(windowviewid, 'CanvasDivTopPosition', $("#canvasDivDA_" + windowviewid).scrollTop()); + $scope.SetwindowStoreData(windowviewid, 'CanvasDivLeftPosition', $("#canvasDivDA_" + windowviewid).scrollLeft()); + } + else + { + var canvasHScrollX = $scope.GetwindowStoreData(windowviewid,'CanvasDivLeftPosition'); + var canvasVScrollX = $scope.GetwindowStoreData(windowviewid,'CanvasDivTopPosition'); + $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); + $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); + } + } $scope.DisableUI(); - if ($scope.isSearchDataLoaded) { - $scope.EnableUI(); - } + var isHighLight=$scope.GetwindowStoreData(windowviewid,'isHighLight'); var isGenderChnage = $scope.GetwindowStoreData(windowviewid,'isGenderChnage'); var isViewChange = $scope.GetwindowStoreData(windowviewid,'isViewChange'); var isHighlightBodyByBodySystem=$scope.GetwindowStoreData(windowviewid,'isHighlightBodyByBodySystem'); var isExtract= $scope.GetwindowStoreData(windowviewid,'isExtract') var isListManagerSelected = $scope.GetwindowStoreData(windowviewid, 'isListManagerSelected'); - if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated')) { + var isLexiconReload= $scope.GetwindowStoreData(windowviewid, 'isannotationReload'); + if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated') && isLexiconReload==false) { $scope.DrawTransparencyBox(windowviewid); } - else if (isExtract == true) { + else if (isExtract == true) { $scope.DisableUI(); $scope.highLightBody(windowviewid); - //Add code for Showing Annotation in Extract mode - var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); - if (isHighlightBodyWithCBTermData == true) { - $scope.ShowCBDataBodyView(windowviewid); - } - $scope.EnableUI(); - } else if (isHighLight == true || (isListManagerSelected == true) || ((isGenderChnage == true) && (isHighLight == true)) || ((isViewChange == true) && (isHighLight == true)) || isExtract == true || isHighlightBodyByBodySystem == true) { - console.log('2. $rootScope.isHighLight= ' + isHighLight) - - console.log('inside start of non flipped. ColoredImageSRC.length= ' + $scope.ColoredImageSRC.length) $scope.SetwindowStoreData(windowviewid,'isHighLight',true); - console.log('just before highLightBody call'); $scope.DisableUI(); $scope.highLightBody(windowviewid); - console.log('just after highLightBody call'); - if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true && isLexiconReload==false) { $scope.CalculateDimensionsAndDrawTBox(windowviewid); } } - else { - if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + else + { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true && isLexiconReload==false) { $scope.CalculateDimensionsAndDrawTBox(windowviewid); } - var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); if (isHighlightBodyWithCBTermData == true) { $scope.ShowCBDataBodyView(windowviewid); } @@ -3494,36 +3585,32 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //Modesty ON if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { - RGBColor = DA[0].figLeafTermId; - annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor, null, windowviewid); - } + // clear prev annotation + $scope.SetwindowStoreData(windowviewid,'TermAnnotationText',[]); + RGBColor = DA[0].figLeafTermId; + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor, null, windowviewid); + } //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er // else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') { - bodyRegionId = maskCanvasId.split("_")[0].slice(-1); + var bodyRegionId = maskCanvasId.split("_")[0].slice(-1); maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci' + "_" + windowviewid; var maskCanvas = document.getElementById(maskCanvasId); var maskCanvasContext = maskCanvas.getContext("2d"); RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, BodyRegoinX, BodyRegoinY); - } - else { + else + { RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, BodyRegoinX, BodyRegoinY); - } - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - if (TermNData != null && TermNData != undefined) { - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); - } - else { - $rootScope.daloadSearchData(windowviewid); - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + + var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); - } var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); previousHighlightList.push(RGBColor); @@ -3532,105 +3619,85 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); AllTerms.push({ '_TermNumber': RGBColor }); var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); - fullTermlist.push(parseInt(RGBColor)); + fullTermlist.push(RGBColor); + + var tips_x= parseInt( MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30; + var tips_y= parseInt( MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10; + var posx= MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left; + var posy= MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top; - if ($scope.GetwindowStoreData(windowviewid,'isHighLight') == true) { - if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) { - if ($scope.machedIcolorInBodyRegion.length > 0) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) { - var bodyRegionId = $scope.machedIcolorInBodyRegion[i]; + var ismultiannotation=$scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON'); - var grayCanvasID = 'imageCanvas' + bodyRegionId + "_" + windowviewid; - var grayCanvas = document.getElementById(grayCanvasID); - var grayImageDataList=$scope.GetwindowStoreData(windowviewid,'grayImageDataList'); - var grayCanvasContext = grayCanvas.getContext("2d"); - if (grayImageDataList[bodyRegionId - 1] != null || grayImageDataList[bodyRegionId - 1] != undefined) { - var grayImageData = grayImageDataList[bodyRegionId - 1]; - grayCanvasContext.putImageData(grayImageData, 0, 0); - } - var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); - // for unhighlight the mirrored body region - if (bodyVid == "1" || bodyVid == "4" || bodyVid == "5" || bodyVid == "8") { - if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) { - var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR' + "_" + windowviewid; - var grayCanvasMR = document.getElementById(grayCanvasID); - var grayImageMRDataList=$scope.GetwindowStoreData(windowviewid,'grayImageMRDataList'); - var grayCanvasContextMR = grayCanvasMR.getContext("2d"); + var newTerm=[] - if (grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) { + newTerm.push({ + "termNumber": RGBColor, + "istpboxTerm":0, + "tips_x": tips_x, + "tips_y": tips_y, + "posx": posx, + "posy": posy - var grayImageDataMR = grayImageMRDataList[bodyRegionId]; + }) - grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); + if (($scope.GetwindowStoreData(windowviewid,'isHighLight') && !(maskCanvasId.match('modestyImg') && RGBColor != '000000') )|| $scope.GetwindowStoreData(windowviewid,'isExtract') == true) { + var ActualTermNo = $scope.getActualTermNumber(RGBColor, windowviewid); - } - } - } + if (ActualTermNo != null) { + //3. Find Term No List Based on ActualTermNo + var TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); + + if (TermList != null) { + for(var i=0;i 0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { + } - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } + $scope.MultiLanguageAnnationArray = []; + if (TermAnnotationText.length > 0) { + for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); } + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); } - else - { - $scope.MultiLanguageAnnationArray = []; - $scope.saveTermNumberForSaveCB(windowviewid,false,RGBColor,tips_x,tips_y,posx,posy); - - if (TermAnnotationText.length > 0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - - console.log('2. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length); - - $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - - } - - - } + + } $scope.ShowCBDataBodyView = function(windowviewid) { @@ -3650,30 +3717,36 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var CurriculumTermData = $scope.GetwindowStoreData(windowviewid,'CurriculumTermData'); for (var i = 0; i < CurriculumTermData.length; i++) { $scope.MultiLanguageAnnationArray = []; $scope.annotationTextArrayT1 = []; $scope.annotationTextArrayT2 = []; - var annotationtext = $scope.GetAnnotationText(parseInt(CurriculumTermData[i].termNumber),windowviewid); - var TermAnnotationText = $scope.GetwindowStoreData(windowviewid, 'TermAnnotationText'); - - if(TermAnnotationText.length>0) + + if(CurriculumTermData[i].tips_x!=undefined) { - for (var j = 0; j <= TermAnnotationText.length - 1; j++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[j]); - $scope.annotationTextArrayT1.push(TermAnnotationText[j]); + $scope.GetAnnotationText(parseInt(CurriculumTermData[i].termNumber),windowviewid); + var TermAnnotationText = $scope.GetwindowStoreData(windowviewid, 'TermAnnotationText'); + + if(TermAnnotationText.length>0) + { + for (var j = 0; j <= TermAnnotationText.length - 1; j++) { + + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[j]); + $scope.annotationTextArrayT1.push(TermAnnotationText[j]); + } + if (CurriculumTermData[i].transparentTermNumber == '0' || CurriculumTermData[i].transparentTermNumber == undefined) { + + $scope.createDynamicSpeechBubble('CBAnnotation', CurriculumTermData[i].x, CurriculumTermData[i].y, true, CurriculumTermData[i].tips_x, CurriculumTermData[i].tips_y, windowviewid, CurriculumTermData[i].termNumber); + } } - if (CurriculumTermData[i].transparentTermNumber == 0 || CurriculumTermData[i].transparentTermNumber == undefined) { - - $scope.createDynamicSpeechBubble('CBAnnotation', CurriculumTermData[i].x, CurriculumTermData[i].y, true, CurriculumTermData[i].tips_x, CurriculumTermData[i].tips_y, windowviewid, CurriculumTermData[i].termNumber); - } + } + //Load Tbox AnnotationText for Save CB - var annotationtext2 = $scope.GetAnnotationText(parseInt(CurriculumTermData[i].transparentTermNumber), windowviewid); + $scope.GetAnnotationText(parseInt(CurriculumTermData[i].transparentTermNumber), windowviewid); var TermAnnotationText2 = $scope.GetwindowStoreData(windowviewid, 'TermAnnotationText'); if (TermAnnotationText2.length > 0) { for (var j = 0; j <= TermAnnotationText2.length - 1; j++) { $scope.annotationTextArrayT2.push(TermAnnotationText2[j]) } - if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') && CurriculumTermData[i].transparentTermNumber != 0) { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') && CurriculumTermData[i].transparentTermNumber != '0') { $scope.createDynamicSpeechBubble('CBAnnotation', CurriculumTermData[i].x, CurriculumTermData[i].y, false, CurriculumTermData[i].tips_x, CurriculumTermData[i].tips_y, windowviewid, CurriculumTermData[i].transparentTermNumber); } @@ -3682,6 +3755,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } + $scope.SetwindowStoreData(windowviewid, 'isannotationReload',false); $scope.SetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData', false); // finish CB window load @@ -3689,25 +3763,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } - $scope.highLightBodyBasedOnIcolor = function (RGBColor,windowviewid) { - //2. Find Actul Term No Based on Icolor. - var ActualTermNo = $scope.getActualTermNumber(RGBColor, windowviewid); - - if (ActualTermNo != null) { - - //3. Find Term No List Based on ActualTermNo - var TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); - if (TermList != null) { - $scope.HighlightBodyByTermList(TermList,windowviewid); - } - } - } - $scope.HighlightBodyOnExtract = function (windowviewid) { var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); var MaskCanvasData=$scope.GetwindowStoreData(windowviewid,'MaskCanvasData'); - console.log(' insode HighlightBodyOnExtract. MaskCanvasData length= ' + MaskCanvasData.length + ', previousHighlightList.length= ' + previousHighlightList.length) - + $("#btnExtract_" + windowviewid).removeClass("btn-black"); $("#btnExtract_" + windowviewid).addClass("btn-primary"); @@ -3726,10 +3785,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.SetwindowStoreData(windowviewid,'layerNumber',$("#txtLayerNumberDA_" + windowviewid).val()); var multiTermList = []; - var CallBackBodyRegion = []; var selectedAnnotation; var isListManagerSelected=$scope.GetwindowStoreData(windowviewid,'isListManagerSelected'); var multiAnnotationIsON=$scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON'); + if ((previousHighlightList != null || previousHighlightList != undefined) && (previousHighlightList.length > 0) && isListManagerSelected && multiAnnotationIsON == true) { @@ -3739,10 +3798,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var ActualTermNo = $scope.getActualTermNumber(value, windowviewid); selectedAnnotation = ActualTermNo; if (ActualTermNo != null) { - var TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); - if (TermList != null) { - for (var i = 0; i < TermList.length; i++) { - multiTermList.push(TermList[i]); + $scope.TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); + if ($scope.TermList != null) { + for (var i = 0; i < $scope.TermList.length; i++) { + multiTermList.push($scope.TermList[i]); } } } @@ -3750,14 +3809,17 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // to do }); } - else if (isListManagerSelected) { + else if (isListManagerSelected) + { multiTermList = $scope.GetwindowStoreData(windowviewid,'AllTerms'); selectedAnnotation = $scope.GetwindowStoreData(windowviewid,'actualTermNumber'); + $scope.TermList = $scope.getTermNumberList(selectedAnnotation,windowviewid); } else if ((previousHighlightList != null || previousHighlightList != undefined) && (previousHighlightList.length > 0) - && $rootScope.isCallFromOtherModule && multiAnnotationIsON == true) { + && $rootScope.isCallFromOtherModule && multiAnnotationIsON == true) + { multiTermList = $scope.GetwindowStoreData(windowviewid,'AllTerms'); angular.forEach(previousHighlightList, function (value, key) { @@ -3765,10 +3827,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var ActualTermNo = $scope.getActualTermNumber(value, windowviewid); selectedAnnotation = ActualTermNo; if (ActualTermNo != null) { - var TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); - if (TermList != null) { - for (var i = 0; i < TermList.length; i++) { - multiTermList.push(TermList[i]); + $scope.TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); + if ($scope.TermList != null) { + for (var i = 0; i < $scope.TermList.length; i++) { + multiTermList.push($scope.TermList[i]); } } } @@ -3782,10 +3844,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var ActualTermNo = $scope.getActualTermNumber(value, windowviewid); selectedAnnotation = ActualTermNo; if (ActualTermNo != null) { - var TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); - if (TermList != null) { - for (var i = 0; i < TermList.length; i++) { - multiTermList.push(TermList[i]); + $scope.TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); + if ($scope.TermList != null) { + for (var i = 0; i < $scope.TermList.length; i++) { + multiTermList.push($scope.TermList[i]); } } } @@ -3794,14 +3856,26 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); } else if ($rootScope.isCallFromOtherModule) - { + { + //load firt time from cb multiTermList = $scope.GetwindowStoreData(windowviewid,'AllTerms'); - // get actual term to highlight/extract body on selected region - selectedAnnotation= $scope.daOpenInOtherModules.selectedStructureId; + var term=0 + var CurriculumTermData = $scope.GetwindowStoreData(windowviewid,'CurriculumTermData'); + for (var i = 0; i < CurriculumTermData.length; i++) { + + if(CurriculumTermData[i].tips_x!=undefined) + { + term= CurriculumTermData[i].termNumber; + } + } + + var ActualTermNo = $scope.getActualTermNumber(term, windowviewid); + selectedAnnotation = ActualTermNo; + $scope.TermList = $scope.getTermNumberList(ActualTermNo,windowviewid); } //get term list to get term coordinates - $scope.TermList = $scope.getTermNumberList(selectedAnnotation,windowviewid); + $scope.termCoordinate = $scope.getTermCoordinate(selectedAnnotation); @@ -3822,6 +3896,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l loopLength = 1; } + var ExtractMasData=[]; + var ReturnMasData=[]; + if (loopLength !== 0) { for (var x = 0; x < loopLength; x++) { if (MaskCanvasData[x] != null || MaskCanvasData[x] != undefined) { @@ -3831,8 +3908,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l maskData = MaskCanvasData[x].maskData; var coloredImageDataVar = null; - var grayImageDataVar = null; - + var white = null; if (canvasId.match('_MR')) { var coloredImageMRCanvasList=$scope.GetwindowStoreData(windowviewid,'coloredImageMRCanvasList'); @@ -3859,40 +3935,54 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } } + ExtractMasData.push({ + 'maskCanvasData': maskData, + 'coloredImageData': coloredImageDataVar, + 'grayImageData': white, + 'bodyRegionId': bodyRegionId, + 'canvasId': canvasId - var worker = new Worker('extract-wp.js'); - - //push workers in array to further used the refernece to delete the workers - $scope.runningWorkers.push({ 'workerName': worker }) - - console.log('for BRID = ' + bodyRegionId + ', coloredImageDataVar: ' + coloredImageDataVar + ', maskData= ' + maskData + ', white= ' + white) + }); - if (coloredImageDataVar != null && maskData != null && white != null) { - worker.postMessage({ + } + } + } + for (var i = 0; i <= ExtractMasData.length - 1; i++) { + + var worker = new Worker('extract-wp.js'); - 'termList': multiTermList, - 'maskCanvasData': maskData, - 'coloredImageData': coloredImageDataVar, - 'grayImageData': white, - 'bodyRegionId': bodyRegionId, - 'canvasId': canvasId + //push workers in array to further used the refernece to delete the workers + $scope.runningWorkers.push({ 'workerName': worker }) + + worker.postMessage({ - }); - } - worker.onmessage = function (e) { - console.log('callback in extract for e.data.bodyRegionId: ' + e.data.bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); + 'termList': multiTermList, + 'maskCanvasData': ExtractMasData[i].maskCanvasData, + 'coloredImageData': ExtractMasData[i].coloredImageData, + 'grayImageData': ExtractMasData[i].grayImageData, + 'bodyRegionId': ExtractMasData[i].bodyRegionId, + 'canvasId': ExtractMasData[i].canvasId - var updatedData = e.data.value; + }); - var bodyRegionId = e.data.bodyRegionId; + worker.onmessage = function (e) { + var canvasId = (e.data.canvasId).replace('_mci', ''); + ReturnMasData.push({"updatedData": e.data.value, "bodyRegionId": e.data.bodyRegionId, "canvasId": canvasId}); - var canvasId = (e.data.canvasId).replace('_mci', ''); + if(ReturnMasData.length==ExtractMasData.length) + { + for (var k = 0; k <= ReturnMasData.length - 1; k++) { - var grayCanvasID = canvasId; + var updatedData = ReturnMasData[k].updatedData; + var bodyRegionId = ReturnMasData[k].bodyRegionId; + + var canvasId = ReturnMasData[k].canvasId; + var grayCanvasID =canvasId; + var grayCanvas = document.getElementById(grayCanvasID); var grayCanvasContext = grayCanvas.getContext("2d"); - + grayCanvasContext.putImageData(updatedData, 0, 0); //to resolve lateral arm black issue in highlight mode @@ -3902,8 +3992,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var canavsWidth = parseInt(grayCanvas.width); var canavsHeight = parseInt(grayCanvas.height); - console.log('canavsWidth= ' + canavsWidth + ', canavsHeight= ' + canavsHeight) - var imgData = grayCanvasContext.getImageData(0, 0, canavsWidth, canavsHeight); var data = imgData.data; var c = 0; @@ -3916,76 +4004,71 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l grayCanvasContext.putImageData(imgData, 0, 0); } - CallBackBodyRegion.push(bodyRegionId); - - $scope.doAligneCanvasWithTerm = false; - if (((viewOrientationId == '1') || (viewOrientationId == '4')) && (CallBackBodyRegion.length == 9)) { - $scope.doAligneCanvasWithTerm = true; - } - else if (((viewOrientationId == '2') || (viewOrientationId == '3')) && (CallBackBodyRegion.length == 5)) { - $scope.doAligneCanvasWithTerm = true; - } - else if (((viewOrientationId == '5')) && (CallBackBodyRegion.length == 1)) { - $scope.doAligneCanvasWithTerm = true; - } - else if (((viewOrientationId == '6')) && (CallBackBodyRegion.length == 1)) { - $scope.doAligneCanvasWithTerm = true; - } - - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { // commented ,no further use } - else { + else + { if (canvasId.match('_MR')) { var whiteImageMRDataList=$scope.GetwindowStoreData(windowviewid,'whiteImageMRDataList'); - whiteImageMRDataList[bodyRegionId] = e.data.value; + whiteImageMRDataList[bodyRegionId] = updatedData; } - + else { var whiteImageDataList=$scope.GetwindowStoreData(windowviewid,'whiteImageDataList'); - whiteImageDataList[bodyRegionId - 1] = e.data.value; + whiteImageDataList[bodyRegionId - 1] = updatedData; } } - - if ($scope.doAligneCanvasWithTerm == true) { + } + + var isHighlightBodyWithCBTermData=$scope.GetwindowStoreData(windowviewid,'isHighlightBodyWithCBTermData'); + if (isHighlightBodyWithCBTermData == false) { $scope.aligneCanvasWithTerm(windowviewid); + } + else if (isHighlightBodyWithCBTermData == true) { - $scope.EnableUI(); + $scope.ShowCBDataBodyView(windowviewid); + } - // terminate extract and term-number worker instances - if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { - var workerCount = $scope.runningWorkers.length; - if (workerCount > 0) { - for (var i = workerCount - 1; i >= 0; i--) { - var runningWorker = $scope.runningWorkers[i].workerName; - runningWorker.terminate(); - $scope.runningWorkers.splice(i, 1); - } - } + // terminate extract and term-number worker instances + if ($scope.runningWorkers != null || $scope.runningWorkers != undefined) { + var workerCount = $scope.runningWorkers.length; + if (workerCount > 0) { + for (var i = workerCount - 1; i >= 0; i--) { + var runningWorker = $scope.runningWorkers[i].workerName; + runningWorker.terminate(); + $scope.runningWorkers.splice(i, 1); } } - //Set Canvas Position which saved from CB module - if ($rootScope.isCallFromOtherModule) { - var canvasHScrollX = $scope.daOpenInOtherModules.canvasHScrollX; - var canvasVScrollX = $scope.daOpenInOtherModules.canvasVScrollX; - $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); - $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); - - $scope.SetwindowStoreData(windowviewid, 'CanvasDivTopPosition', $("#canvasDivDA_" + windowviewid).scrollTop()); - $scope.SetwindowStoreData(windowviewid, 'CanvasDivLeftPosition', $("#canvasDivDA_" + windowviewid).scrollLeft()); - } - - }; - worker.onerror = function (e) { - $rootScope.message = 'Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message; - $("#daMessageModal").modal('show'); - }; + } + + //Set Canvas Position which saved from CB module + if ($rootScope.isCallFromOtherModule) { + var canvasHScrollX = $scope.daOpenInOtherModules.canvasHScrollX; + var canvasVScrollX = $scope.daOpenInOtherModules.canvasVScrollX; + $('#canvasDivDA_' + windowviewid).scrollLeft(canvasHScrollX); + $('#canvasDivDA_' + windowviewid).scrollTop(canvasVScrollX); + + $scope.SetwindowStoreData(windowviewid, 'CanvasDivTopPosition', $("#canvasDivDA_" + windowviewid).scrollTop()); + $scope.SetwindowStoreData(windowviewid, 'CanvasDivLeftPosition', $("#canvasDivDA_" + windowviewid).scrollLeft()); + } + + $scope.EnableUI(); + ReturnMasData=[]; + ExtractMasData=[]; + } - } - } + + }; + worker.onerror = function (e) { + $rootScope.message = 'Error: Line ' + e.lineno + ' in ' + e.filename + ': ' + e.message; + $("#daMessageModal").modal('show'); + }; + + } + }, 500) } @@ -3996,9 +4079,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.SetwindowStoreData(windowviewid,'currentLayerNumber',nlayer); $scope.SetwindowStoreData(windowviewid,'layerNumber',$("#txtLayerNumberDA_" + windowviewid).val()); - //$scope.DisableUI(); - console.log('HighlightBodyByTermList is called'); - + $scope.highlightedBR = []; $scope.runningWorkers = []; ; @@ -4242,10 +4323,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.TermList = $scope.getTermNumberList(lastSelectedAnnotation,windowviewid); $scope.termCoordinate = $scope.getTermCoordinate(lastSelectedAnnotation); - console.log('last selected Annotation= ' + lastSelectedAnnotation); - console.log('termListCount= ' + $scope.TermList.length); - console.log('termCoordinate= ' + $scope.termCoordinate.x); - $scope.aligneCanvasWithTerm(windowviewid); } } @@ -4607,8 +4684,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); - console.log('createTermListByPreviousTermsAndHighlight is called'); - if ((multiTermList != undefined && multiTermList != null) && multiTermList.length > 0) { $timeout(function () { $scope.HighlightBodyByTermList(multiTermList,windowviewid); }, 50); @@ -4664,9 +4739,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var figLeafTermNo = 5868; // to do declare constant for this if (parseInt(termNumber) != parseInt(figLeafTermNo)) { - $scope.TermNumber = termNumber; - for (var j = 0; j <= $rootScope.lexiconLanguageArray.length - 1; j++) { - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); if (TermNData != null || TermNData != undefined) { @@ -4677,43 +4749,30 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l .select(); if ($scope.matchedTermNoData != null || $scope.matchedTermNoData != undefined) { + for (var j = 0; j <= $rootScope.lexiconLanguageArray.length - 1; j++) { //1. - var actualTermNo = 0; - for (var z = 0; z < $scope.matchedTermNoData.length; z++) { - //send actual term no to get the term text. - actualTermNo = $scope.matchedTermNoData[0]._ActualTermNumber; - annotationText = $scope.GetAnnotationBasedOnActualTermNo(actualTermNo, $rootScope.lexiconLanguageArray[j].language, windowviewid); - annotation.push(annotationText); - $scope.SetwindowStoreData(windowviewid,'TermAnnotationText',annotation); - $scope.SetwindowStoreData(windowviewid,'actualTermNumber',actualTermNo); - break; - }; - } - else { - // send term no to vocab json data to get the text + var actualTermNo = 0; + for (var z = 0; z < $scope.matchedTermNoData.length; z++) { + //send actual term no to get the term text. + actualTermNo = $scope.matchedTermNoData[0]._ActualTermNumber; + annotationText = $scope.GetAnnotationBasedOnActualTermNo(actualTermNo, $rootScope.lexiconLanguageArray[j].language, windowviewid); + annotation.push(annotationText); + $scope.SetwindowStoreData(windowviewid,'TermAnnotationText',annotation); + $scope.SetwindowStoreData(windowviewid,'actualTermNumber',actualTermNo); + break; + }; + } + } + } - else { - var currentBodyViewId = $scope.GetwindowStoreData(windowviewid,'voId'); - var termJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; - DataService.getAnotherJson(termJsonPath) - .then( - function (result) { - $scope.SetwindowStoreData(windowviewid,'TermNumberData',result); - $scope.GetAnnotationText(termNumber,windowviewid); - }) - } - } } - return annotation; } $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo, language, windowviewid) { - // clear prev annotation - $scope.SetwindowStoreData(windowviewid,'TermAnnotationText',[]); - + var Annotation; var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray'); @@ -4722,9 +4781,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if (vocabTermDataArray[j].language == language) { - if (vocabTermDataArray[j].VocabTermData != null || vocabTermDataArray[j].VocabTermData != undefined) { + if (vocabTermDataArray[j].vocabTermTxt != null || vocabTermDataArray[j].vocabTermTxt != undefined) { $scope.matchedActualTermData = new jinqJs() - .from(vocabTermDataArray[j].VocabTermData.VocabTerms.Term) + .from(vocabTermDataArray[j].vocabTermTxt) .where('_ActualTermNumber == ' + actualTermNo) .select(); @@ -5119,6 +5178,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } }); + $('.dynCross_'+windowviewid).unbind('click');//remove multiple event $('.dynCross_'+windowviewid).on('click', function (evt) { if ( $scope.speechbubbleList != null || $scope.speechbubbleList != undefined) { var removeid=$(this).parent().parent().attr('id'); @@ -5134,10 +5194,52 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var termNumber = removeid.split("-")[1]; var CurriculumTermData = []; CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + + //get related term of highted or extract body view + var matchList=[]; + var relatedTermList = new jinqJs() + .from(CurriculumTermData) + .where( function(row, index) { + return ( (row.relatedTerm == termNumber || row.termNumber == termNumber) && row.istpboxTerm==0 ); + }) + //.where('relatedTerm == ' + termNumber,"termNumber == " + termNumber) + .select('termNumber'); + + for(var tm=0;tm 0) { @@ -8251,6 +8393,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //Modesty ON if (canvasId.match('modestyImg') && RGBColor != '000000') { + // clear prev annotation + $scope.SetwindowStoreData(windowviewid,'TermAnnotationText',[]); + RGBColor = DA[0].figLeafTermId; annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor, null, windowviewid); $scope.annotationTextArrayT1 = []; @@ -8258,27 +8403,40 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.annotationTextArrayT1.push(annotationText); $scope.annotationTextArrayT2.push(annotationText); - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { - $scope.saveTBoxTermNumberForSaveCB(windowviewid,true,0,RGBColor,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB - } - else - { - $scope.saveTBoxTermNumberForSaveCB(windowviewid,false,0,RGBColor,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB - } + var isMultiAnnotation=$scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON'); + $scope.saveTBoxTermNumberForSaveCB(windowviewid,isMultiAnnotation,0,RGBColor,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB } else if (canvasId.match('modestyImg') && RGBColor == '000000') { //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er // - var bodyRegionId = canvasId.split("_")[1].slice(-1); + var clickedBodyRegion; + + var BodyRegionDictionary = $scope.GetwindowStoreData(windowviewid,'BodyRegionCordinatesData'); + var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); + if (viewOrientationId == 5) { + // use for female lateral arm + var clickedBodyRegionData = new jinqJs() + .from(BodyRegionDictionary) + .where('bodyRegionId == 6') + .select(); - var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci' + "_" + windowviewid; + clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId; + canavsX = clickedBodyRegionData[0].X; + canvasY = clickedBodyRegionData[0].Y; + } + else + { + clickedBodyRegion = canvasId.split("_")[1].slice(-1); + } + + var maskCanvasId = 'imageCanvas' + clickedBodyRegion + '_mci' + "_" + windowviewid; var maskCanvas = document.getElementById(maskCanvasId); var maskCanvasContext = maskCanvas.getContext("2d"); //transparecncy canvas - var maskCanvasTransId = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci' + "_" + windowviewid; + var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci' + "_" + windowviewid; var maskCanvastrans = document.getElementById(maskCanvasTransId); var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); @@ -8287,28 +8445,23 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope,windowviewid); + var TBoxTermNumber=annotations.TBoxTermNumber; + var NormalTermNumber=annotations.NormalTermNumber; + $scope.annotationTextArrayT1 = []; $scope.annotationTextArrayT2 = []; - for (var i = 0; i <= annotations.annotationT1.length - 1; i++) { - $scope.annotationTextArrayT1.push(annotations.annotationT1[i]); - - } - for (var i = 0; i <= annotations.annotationT2.length - 1; i++) { - $scope.annotationTextArrayT2.push(annotations.annotationT2[i]); + for (var i = 0; i <= $rootScope.annotationTextForTrans1.length - 1; i++) { + $scope.annotationTextArrayT1.push($rootScope.annotationTextForTrans1[i]); } + for (var i = 0; i <= $rootScope.annotationTextForTrans2.length - 1; i++) { + $scope.annotationTextArrayT2.push($rootScope.annotationTextForTrans2[i]); + + } - var TBoxTermNumber=annotations.TBoxTermNumber; - var NormalTermNumber=annotations.NormalTermNumber; - - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { - $scope.saveTBoxTermNumberForSaveCB(windowviewid,true,TBoxTermNumber,NormalTermNumber,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB - } - else - { - $scope.saveTBoxTermNumberForSaveCB(windowviewid,false,TBoxTermNumber,NormalTermNumber,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB - } - + var isMultiAnnotation=$scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON'); + $scope.saveTBoxTermNumberForSaveCB(windowviewid,isMultiAnnotation,TBoxTermNumber,NormalTermNumber,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB + } var tCanvasTopPos = $(".ui-wrapper").css("top"); @@ -8363,6 +8516,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1); var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope,windowviewid); + + var TBoxTermNumber=annotations.TBoxTermNumber; + var NormalTermNumber=annotations.NormalTermNumber; $scope.annotationTextArrayT1 = []; $scope.annotationTextArrayT2 = []; @@ -8373,21 +8529,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.annotationTextArrayT2.push($rootScope.annotationTextForTrans2[i]); } - var TBoxTermNumber=annotations.TBoxTermNumber; - var NormalTermNumber=annotations.NormalTermNumber; - var tips_x= parseInt( MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30; var tips_y= parseInt( MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10; var posx= MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left; var posy= MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top; - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { - $scope.saveTBoxTermNumberForSaveCB(windowviewid,true,TBoxTermNumber,NormalTermNumber,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB - } - else - { - $scope.saveTBoxTermNumberForSaveCB(windowviewid,false,TBoxTermNumber,NormalTermNumber,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB - } + var isMultiAnnotation=$scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON'); + $scope.saveTBoxTermNumberForSaveCB(windowviewid,isMultiAnnotation,TBoxTermNumber,NormalTermNumber,tips_x,tips_y,posx,posy);//Calling Method for Tbox termnumber SaveCB var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); if (TermAnnotationText.length > 0) { @@ -8417,8 +8565,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } CurriculumTermData.push({ - "transparentTermNumber": parseInt(TBoxTermNumber), - "termNumber": parseInt(NormalTermNumber), + "transparentTermNumber": TBoxTermNumber, + "termNumber": NormalTermNumber, "istpboxTerm":1, "tips_x": tips_x, "tips_y": tips_y, @@ -8473,8 +8621,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('.crossDiv_annotation_' + windowviewid).parent().parent().remove(); $('#bord_annotation_' + windowviewid).remove(); $('#dot_annotation_' + windowviewid).remove(); - - // remove all in multi annotation $('.com_' + windowviewid).remove(); @@ -8483,18 +8629,52 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#dot_' + windowviewid).remove(); $('#bord_' + windowviewid).remove(); $('#crossDiv_' + windowviewid).parent().parent().remove(); + } - //Added Method to Save TransparencyBox TermNumbers for SaveCB - $scope.saveTermNumberForSaveCB = function (windowviewid,isMultiAnnotation,NormalTermNumber,tips_x,tips_y,posx,posy) { + //Added method to remove All Previous Annotations and reload by lexicon + $scope.removeAllAnnotationText = function (windowviewid) { + + // remove all in multi annotation in TP + $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); + + // remove all in single annotation in TP + $('.crossDiv_annotation_' + windowviewid).parent().parent().remove(); + $('#bord_annotation_' + windowviewid).remove(); + $('#dot_annotation_' + windowviewid).remove(); + + // remove all in multi annotation + $('.com_' + windowviewid).remove(); - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + // remove all in single annotation + $('#dot_' + windowviewid).remove(); + $('#bord_' + windowviewid).remove(); + $('#crossDiv_' + windowviewid).parent().parent().remove(); - if(!isMultiAnnotation) - { - // remove all in multi annotation - $('.com_' + windowviewid).remove(); - + //--------------------------------------------------------------------------------- + // tp box + // remove all in multi annotation + $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); + + // remove all in single annotation + $('.crossDiv_annotation_' + windowviewid).parent().parent().remove(); + $('#bord_annotation_' + windowviewid).remove(); + $('#dot_annotation_' + windowviewid).remove(); + + $scope.SetwindowStoreData(windowviewid, 'isannotationReload',true); + + } + + //Added Method to Save TransparencyBox TermNumbers for SaveCB + $scope.saveTermNumberForSaveCB = function (windowviewid,isMultiAnnotation,TermData) { + + var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + + if(!isMultiAnnotation) + { + // remove all in multi annotation + $('.com_' + windowviewid).remove(); + // remove all in single annotation $('#dot_' + windowviewid).remove(); $('#bord_' + windowviewid).remove(); @@ -8504,16 +8684,40 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l .from(CurriculumTermData) .delete().at('istpboxTerm == ' + 0).select(); } + + if(TermData.length>0) + { + var relatedterm=''; + for(var i=0;i 0) && (isGenderChnage == true || isViewChange == true) || isListManagerAlreadySelected == true) { + else if (($rootScope.isCallFromOtherModule == true)||isLexiconReload==true || (isListManagerSelected == true) || (previousHighlightList != null && previousHighlightList.length > 0) && (isGenderChnage == true || isViewChange == true) || isListManagerAlreadySelected == true) { $timeout(function () { $scope.DisableUI(); @@ -9641,9 +9839,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); if (isHighlightBodyWithCBTermData == true) { $scope.SetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData', false); - - //$scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); - + + $scope.SetwindowStoreData(windowviewid, 'isannotationReload',false); // finish CB window load $rootScope.DAWindowLoadComplete = true; } @@ -9706,7 +9903,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }) } - else { + else + { // This code will execute when user will select normal Mode but this time isHighlight will be false console.log('highlightboy ELSE. $rootScope.isExtract= ' + $scope.GetwindowStoreData(windowviewid, 'isExtract') + ', previousHighlightList.length= ' + previousHighlightList.length) @@ -9965,16 +10163,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l return null; } } - else { - var currentBodyViewId = $scope.GetwindowStoreData(windowviewid,'voId'); - var termJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; - DataService.getAnotherJson(termJsonPath) - .then( - function (result) { - $scope.SetwindowStoreData(windowviewid,'TermNumberData',result); - $scope.getTermNumberList(actualTermNo,windowviewid); - }) - } } $scope.OnGenderChange = function (event) { var len= (event.target.parentElement.id).split("_").length; @@ -10133,32 +10321,63 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.loadBodyViewChangedBySetting = function (windowviewid, isLexiconChange) { + $scope.DisableUI(); + $scope.LoadImageToExport(windowviewid); var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); - + var timeintval=$scope.GetwindowStoreData(windowviewid,'intervalObject'); if(isLexiconChange) { + // remove first annotation text + $scope.SetwindowStoreData(windowviewid,'isHighlightBodyWithCBTermData',true); + $scope.removeAllAnnotationText(windowviewid); + + $scope.langSearchLoad(windowviewid); //load term data and also language data $rootScope.daloadSearchData(windowviewid); - //call time interval function until load Illustration data - var timeintval = null; - timeintval = $interval(function () { - var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray'); + timeintval = $interval(function(){loadBodyViewBySetting(windowviewid)},5); + $scope.SetwindowStoreData(windowviewid,'intervalObject',timeintval); + function loadBodyViewBySetting(panid) { + var vocabTermDataArray = $scope.GetwindowStoreData(panid, 'vocabTermDataArray'); if (vocabTermDataArray!=null) { - $scope.stopVocab(); - $scope.CalculateImageCordinates(viewOrientationId, windowviewid); + var intval=$scope.GetwindowStoreData(panid,'intervalObject'); + $scope.stopVocab(intval); + //loading da for selected panel + $scope.CalculateImageCordinates(viewOrientationId, panid); + + $timeout(function () { + if ($rootScope.isListManagerMenuSelected) { + var selectedPanel = $("#viewName option:selected").val(); + var winid = (selectedPanel).split("_")[1]; + if(winid==panid) + { + $scope.DisableUI(); + $rootScope.dalistManagerEvent(panid); + } + } + + if ($scope.GetwindowStoreData(panid,'isSearchClicked')) { + $scope.DisableUI(); + if ($('#searchTermListUl_' + panid).html() != "") { + $('#searchTermListUl_' + panid).empty(); + } + $scope.FillSearchList(panid); + } + }, 200); + } else { console.log("waiting for search term Data"); } - }, 100); - - $scope.stopVocab = function () { - if (angular.isDefined(timeintval)) { - $interval.cancel(timeintval); - timeintval = undefined; + } + + $scope.stopVocab = function (intvalobj) { + if (angular.isDefined(intvalobj)) { + $interval.cancel(intvalobj); + intvalobj = undefined; } - }; + }; + } else { @@ -10168,14 +10387,29 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.loadSelectedBodyViewChange = function (currentBodyViewId,windowviewid) { + $scope.LoadImageToExport(windowviewid); $rootScope.daloadSearchData(windowviewid); //call time interval function until load Illustration data var timeintval = null; timeintval = $interval(function () { var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray'); if (vocabTermDataArray!=null) { - $scope.stopVocab(); + $scope.stopVocab(timeintval); $scope.loadSelectedBodyView(currentBodyViewId,windowviewid); + $timeout(function () { + if ($rootScope.isListManagerMenuSelected) { + $scope.DisableUI(); + $rootScope.dalistManagerEvent(windowviewid) + } + + if ($scope.GetwindowStoreData(windowviewid,'isSearchClicked')) { + $scope.DisableUI(); + if ($('#searchTermListUl_' + windowviewid).html() != "") { + $('#searchTermListUl_' + windowviewid).empty(); + } + $scope.FillSearchList(windowviewid); + } + }, 200); } else { @@ -10183,7 +10417,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } }, 100); - $scope.stopVocab = function () { + $scope.stopVocab = function (timeintval) { if (angular.isDefined(timeintval)) { $interval.cancel(timeintval); timeintval = undefined; @@ -10250,111 +10484,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l ); } - // $scope.loadSelectedBodyView = function (currentBodyViewId, windowviewid) { - // var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); - // //remove transaprency scale - // if ($('#transparencyScale_' + windowviewid) != null) { - - // $('#transparencyScale_' + windowviewid).css('visibility', 'hidden'); - // } - - // $scope.SetwindowStoreData(windowviewid,'voId',currentBodyViewId); - - // var layerJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json'; - - // DataService.getJson(layerJsonPath) - // .then( - // function (result) { - - // $scope.SetwindowStoreData(windowviewid,'BodyLayerData',result); - - // //set max for LayerNumber input - // var totalLayer = result.Layers.DataLayer.length-1; - - // $scope.SetwindowStoreData(windowviewid,'totalLayers',totalLayer); - - // $('#txtLayerNumberDA_' + windowviewid).attr('max', totalLayer); - - // console.log('inside DataService.getJson. document.getElementById layerChangeSlider value : ' + document.getElementById('layerChangeSlider') + 'set value: ' + totalLayer); - - // $("#layerChangeSliderDA_" + windowviewid).slider("option", "max", totalLayer); - - // // CB part to load same layer while change gender/bodyview - - // if($rootScope.isCallFromOtherModule) - // { - // var cLayer= $scope.GetwindowStoreData(windowviewid,'layerNumber'); - - // if(cLayer>totalLayer) - // { - // $scope.SetwindowStoreData(windowviewid,'layerNumber',totalLayer); - // } - // } - // else - // { - // $scope.SetwindowStoreData(windowviewid,'layerNumber',0); - // } - - // //load json for annotations - - // var termJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; - // DataService.getAnotherJson(termJsonPath) - // .then( - // function (result) { - // var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); - // $scope.SetwindowStoreData(windowviewid,'TermNumberData',result); - // var isViewChange=$scope.GetwindowStoreData(windowviewid,'isViewChange'); - // var isGenderChnage=$scope.GetwindowStoreData(windowviewid,'isGenderChnage'); - // var isListManagerSelected=$scope.GetwindowStoreData(windowviewid,'isListManagerSelected'); - // var isListManagerAlreadySelected=$scope.GetwindowStoreData(windowviewid,'isListManagerAlreadySelected'); - // //if user seelcted any term and serached before gender cnage then itshould be highlighted in chnaged gender - - // if (((isListManagerSelected == true) || isListManagerAlreadySelected == true || - // ($scope.GetwindowStoreData(windowviewid,'isHighLight') == true && previousHighlightList != null - // && previousHighlightList.length > 0)) - // && ((isGenderChnage == true) || isViewChange == true)) { - // $scope.setLayerNumberAndHighlightByTermList(windowviewid); - // } - // else if (previousHighlightList != null && previousHighlightList.length > 0 && - // (isGenderChnage == true || isViewChange == true)) - // { - // $scope.SetwindowStoreData(windowviewid,'AllTerms',[]); - // $scope.SetwindowStoreData(windowviewid,'isHighLight',true); - // var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - // if (TermNData != undefined) { - // var actualTermNumber=$scope.GetwindowStoreData(windowviewid,'actualTermNumber'); - // $scope.TermList = $scope.getTermNumberList(actualTermNumber,windowviewid); - // if ($scope.TermList != null && $scope.TermList.length > 0) { - // $scope.setLayerNumberAndHighlightByTermList(windowviewid); - // } - // else { - // //actual term number is not found in thsi view menas previously selected body part does not exist in this view - // $scope.CalculateImageCordinates(viewOrientationId, windowviewid) - // } - // } - - // } - // else { - // $scope.CalculateImageCordinates(viewOrientationId, windowviewid); - // $('#txtLayerNumberDA_' + windowviewid).val( $scope.GetwindowStoreData(windowviewid,'layerNumber')) - - // } - - // }, - // function (error) { - // // handle errors here - // console.log(' $rootScope.TermNumberData= ' + error.statusText); - // } - // ) - // }, - - // function (error) { - // // handle errors here - // console.log(' $rootScope.BodyLayerData= ' + error.statusText); - // } - // ); - // } - $scope.OnViewChange = function (event) { var parentid=event.target.parentElement.id; var len= (parentid).split("_").length; @@ -10527,18 +10656,14 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } //removed the event and using function $rootScope.changeNavigatorModestyEvent = function (bodyViewId, windowviewid) { - $scope.loadNavigatorForSelectedBodyView(bodyViewId,windowviewid); - // store image for export - $scope.LoadImageToExport(windowviewid); - + $scope.loadNavigatorForSelectedBodyView(bodyViewId,windowviewid); } //Reload DA controller Body View after setting Change $rootScope.reloadDABodyViewEvent = function (bodyViewId,isLexiconChange, windowviewid) { //console.log('reloadDABodyViewEvent'); $scope.SetwindowStoreData(windowviewid,'isGlobalSettingChanged',true); - if ($rootScope.isSettingEventAlredayDispachted == true) { - $scope.DisableUI(); + if ($rootScope.isSettingEventAlredayDispachted == true) { $rootScope.isSettingEventAlredayDispachted = false; // define at home controller $scope.SetwindowStoreData(windowviewid,'layerNumber',parseInt($('#txtLayerNumberDA_' + windowviewid).val())); var currentLayerNumber=$scope.GetwindowStoreData(windowviewid,'currentLayerNumber'); @@ -10551,19 +10676,14 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.loadBodyViewChangedBySetting(windowviewid,isLexiconChange); } - $scope.loadNavigatorForSelectedBodyView(bodyViewId, windowviewid); + $scope.loadNavigatorForSelectedBodyView(bodyViewId, windowviewid); - // store image for export - $scope.LoadImageToExport(windowviewid); - - if ($scope.GetwindowStoreData(windowviewid,'layerNumber')!= 0) { - $scope.EnableUI(); - } } } $scope.loadNavigatorForSelectedBodyView = function (currentBodyViewId, windowviewid) { - + // store image for export + $scope.LoadImageToExport(windowviewid); var NavigatorData=$scope.GetwindowStoreData(windowviewid,'NavigatorData'); if (!$rootScope.isCallFromOtherModule) { @@ -10646,7 +10766,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l DataService.getJson(bodySystemDataPath) .then( function (result) { - $scope.SetwindowStoreData(windowviewid,'BodySystemData',result); + $scope.SetwindowStoreData(windowviewid,'BodySystemData',result.BodySystem.BodySystemTerm); }, function (error) { @@ -10695,8 +10815,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.SetwindowStoreData(windowviewid,'isHighlightBodyByBodySystem',true); if ($scope.GetwindowStoreData(windowviewid,'isHighLight') == false) { //color the body gray - console.log('highLightBody from HighlightBodyByBodySystem'); - + $scope.SetwindowStoreData(windowviewid,'isHighLight',true); if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { @@ -10870,85 +10989,70 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.ShowSearch = function (windowviewid, isbuttionclick) { - console.log('ShowSearch is called'); - // clear time stamp on text box click - $scope.SetwindowStoreData(windowviewid, 'SearchTimeStampValue', 0); + if ($('#searchListDiv_' + windowviewid).html() != "") + $('#termlistfilter_'+windowviewid).empty(); - // get first language term text - var primaryLexiconIndx = $scope.GetwindowStoreData(windowviewid, 'primaryLexiconInd')[0]; + $scope.IsSearchVisible = true; - var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray'); - //this check is for log only because we are writing length so need to check if its not null or undefined - if (vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != null || vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != undefined) - console.log('$scope.VocabTermTxt.length= ' + vocabTermDataArray[primaryLexiconIndx].vocabTermTxt.length) - $scope.IsSearchVisible = true; + // clear time stamp on text box click + $scope.SetwindowStoreData(windowviewid, 'SearchTimeStampValue', 0); - var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); - if ((vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != null || vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != undefined) && (vocabTermDataArray[0].vocabTermTxt.length > 0)) { - //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed - //Remove the list and then Repopulate - if ($('#searchListDiv_' + windowviewid).html() != "") - $('#termlistfilter_'+windowviewid).empty(); - //Delay compile of ul li so that the remove of li is completed. - $timeout(function () { + var langId = $("#searchLanguageLm_"+windowviewid+" option:selected").val(); + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; - $scope.isSearchDataLoaded = true; - var ColoredImageSRC=$scope.GetwindowStoreData(windowviewid,'ColoredImageSRC'); - if ((ColoredImageSRC != null || ColoredImageSRC != undefined)) { + var lanName=selectedLanguage.language; + } + else + { + // get default language + var lanName=$rootScope.lexiconLanguageArray[0].language + } + + var allVocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); - if (((viewOrientationId == '1') || (viewOrientationId == '4')) && (ColoredImageSRC.length == 9)) { - $scope.EnableUI(); - } - else if (((viewOrientationId == '2') || (viewOrientationId == '3')) && (ColoredImageSRC.length == 5)) { - $scope.EnableUI(); - } - else if ((viewOrientationId == '5') && (ColoredImageSRC.length == 1)) { - $scope.EnableUI(); - } - else if ((viewOrientationId == '6') && (ColoredImageSRC.length == 1)) { - $scope.EnableUI(); - } - } - }, 500); + var languageVocabTermDataArray = new jinqJs() + .from( allVocabTermDataArray) + .where('language == ' + lanName) + .select('vocabTermTxt')[0]; - var vocabTermDataArray =vocabTermDataArray[primaryLexiconIndx].vocabTermTxt; + var languageVocabData= languageVocabTermDataArray.vocabTermTxt; - var searchvalue = $("#typedTermName_" + windowviewid).val(); - - var searchfilterdata = $filter('filter')(vocabTermDataArray, searchvalue); - if(searchvalue.trim()!="") - { - $scope.AllSearchData = $filter('orderBy')(searchfilterdata, '_TermText.length'); - } - else - { - $scope.AllSearchData = $filter('orderBy')(searchfilterdata, '_TermText'); - } + var searchvalue = $("#typedTermName_" + windowviewid).val(); + + var searchfilterdata = $filter('filter')(languageVocabData, searchvalue); + if(searchvalue.trim()!="") + { + $scope.AllSearchData = $filter('orderBy')(searchfilterdata, '_TermText.length'); + } + else + { + $scope.AllSearchData = $filter('orderBy')(searchfilterdata, '_TermText'); + } - $scope.limitTofilterdata = $filter('limitTo')(searchfilterdata, 500); + $scope.limitTofilterdata = $filter('limitTo')(searchfilterdata, 500); - $('#termlistfilter_'+windowviewid).css("display", "block"); + $('#termlistfilter_'+windowviewid).css("display", "block"); - angular.forEach($scope.limitTofilterdata, function (value2, key2) { - var $el = $('').appendTo('#termlistfilter_' + windowviewid); - $compile($el)($scope); - }) - - var $all = $('#termlistfilter_'+windowviewid).appendTo('#searchListDiv_' + windowviewid); - $compile($all)($scope); - - if(isbuttionclick) - { - $timeout(function () { - $('#termlistfilter_'+windowviewid).focus(); - }, 200); - } + angular.forEach($scope.limitTofilterdata, function (value2, key2) { + var $el = $('').appendTo('#termlistfilter_' + windowviewid); + $compile($el)($scope); + }) + + var $all = $('#termlistfilter_'+windowviewid).appendTo('#searchListDiv_' + windowviewid); + $compile($all)($scope); + + if(isbuttionclick) + { + $timeout(function () { + $('#termlistfilter_'+windowviewid).focus(); + }, 200); + } - } - else { - $rootScope.daloadSearchData(windowviewid); - } - } $scope.HideSearch = function () { @@ -10988,102 +11092,319 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //event remove it fire multiple time $rootScope.dalistManagerEvent = function (windowviewid) { - if ($rootScope.islistManagerEventAlredayDispachted == true) { - $scope.DisableUI(); - - $('#bodySystems').empty(); - $("#bodySystems").css("display", "block"); - $("#AABodySystems").css("display", "none"); + $scope.DisableUI(); + $('#bodySystems').empty(); + $("#bodySystems").css("display", "block"); + $("#AABodySystems").css("display", "none"); + + $("#langaugeDivLm").css("display", "none"); + $('#termList').empty(); + + var totalstructure=0; + $rootScope.isListManagerMenuSelected = true; - var $all = $('').appendTo('#bodySystems'); - $compile($all)($scope); + $scope.SetwindowStoreData(windowviewid,'totalstructureLm',0); + var languageArray = $rootScope.lexiconLanguageArray; + + if(languageArray.length>1) + { + $("#langaugeDivLm").css("display", "block"); + $("#selectLanguageLm").empty(); + for (var i = 0; i <= languageArray.length - 1; i++) { + $('#selectLanguageLm').append(''); + } + } + + var $all = $('').appendTo('#bodySystems'); + $compile($all)($scope); - $("#structureDropdownDA_" + windowviewid + " li a").each(function (key, value) { + $("#structureDropdownDA_" + windowviewid + " li a").each(function (key, value) { + if($(this).attr('id')!="0") + { var sysid= $(this).attr('id') + '_' +windowviewid; - - if ($(this).parent().hasClass("disabledSelectedSystem")) { - var $systemOptions = $('').appendTo("#bodySystems") - $compile($systemOptions)($scope); + if ($(this).parent().hasClass("disabledSelectedSystem")) { + var $systemOptions = $('').appendTo("#bodySystems") + $compile($systemOptions)($scope); + } + else{ + var $systemOptions = $('').appendTo("#bodySystems") + $compile($systemOptions)($scope); + } + } - else{ - var $systemOptions = $('').appendTo("#bodySystems") - $compile($systemOptions)($scope); - } - - }); + + }); + + // primar language + var lanName=languageArray[0].language; + $scope.loadListManger(windowviewid,lanName,totalstructure); + + $rootScope.islistManagerEventAlredayDispachted = false; + $scope.EnableUI(); + + } + + $rootScope.changeLanguageLmEvent = function (windowviewid) { + $scope.DisableUI(); + $('#termList').empty(); + var totalstructure=0; + $scope.SetwindowStoreData(windowviewid,'totalstructure',0); + + var langId = $("#selectLanguageLm option:selected").val(); + + setTimeout(function () { + + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; + + var lanName=selectedLanguage.language; - $scope.loadListManger(windowviewid); - $rootScope.islistManagerEventAlredayDispachted = false; } else { - $scope.EnableUI(); + var lanName=$rootScope.lexiconLanguageArray[0].language; + } + + var sysid = $("#bodySystems option:selected").attr("id"); + var bodysystemId = (sysid).split("_")[0]; + if(bodysystemId=="0") + { + $scope.loadListManger(windowviewid,lanName,totalstructure); } + else + { + $scope.systemMatchTermLoad(bodysystemId,windowviewid,lanName,totalstructure); + } + + },100) + } - $scope.loadListManger = function (windowviewid) { - var primaryLexiconIndex = $scope.GetwindowStoreData(windowviewid, 'primaryLexiconInd')[0]; + $rootScope.LoadMoreLmEvent = function (windowviewid) { + $scope.DisableUI(); + var langId = $("#selectLanguageLm option:selected").val(); + var totalstructure = $scope.GetwindowStoreData(windowviewid, 'totalstructureLm'); + + setTimeout(function () { + + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; - var vocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); + var lanName=selectedLanguage.language; - if (vocabTermDataArray != null && vocabTermDataArray != undefined && vocabTermDataArray.length > 0) { - $('#termList').empty(); - $rootScope.isListManagerMenuSelected = true; + } + else + { + var lanName=$rootScope.lexiconLanguageArray[0].language; + } - var vocabTermTxt = []; - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - if (TermNData != null || TermNData != undefined && TermNData.TermData.Term.length > 0) { - angular.forEach(TermNData.TermData.Term, function (value1, key1) { + var sysid = $("#bodySystems option:selected").attr("id"); + var bodysystemId = (sysid).split("_")[0]; + if(bodysystemId=="0") + { + $scope.loadListManger(windowviewid,lanName,totalstructure); + } + else + { + $scope.systemMatchTermLoad(bodysystemId,windowviewid,lanName,totalstructure); + } + + }, 100); + + } - angular.forEach(vocabTermDataArray[primaryLexiconIndex].VocabTermData.VocabTerms.Term, function (value2, key2) { + $scope.loadListManger = function (windowviewid,lanName,totalstructure) { + + var allVocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); + var languageVocabTermDataArray = new jinqJs() + .from( allVocabTermDataArray) + .where('language == ' + lanName) + .select('vocabTermTxt')[0]; - if (value1._ActualTermNumber === value2._ActualTermNumber) { - vocabTermTxt.push( - { + var languageVocabData= languageVocabTermDataArray.vocabTermTxt; - "_ActualTermNumber": value2._ActualTermNumber, - "_TermText": value2._TermText, - "_cdId": value2._cdId + var afterskipdata = new jinqJs() + .from(languageVocabData) + .skip(totalstructure) + .select(); - }); + var limitTofilterdata = $filter('limitTo')(afterskipdata, 500); - } + var option=''; - }) - }) - var VocabTermTxtfilter = new jinqJs() - .from(vocabTermTxt) - .distinct('_TermText', '_ActualTermNumber') - .orderBy([{ field: '_TermText', sort: 'asc' }]) - .select('_ActualTermNumber', '_TermText', '_cdId'); - - if (VocabTermTxtfilter != null || VocabTermTxtfilter != undefined) { - for (var j = 0; j < VocabTermTxtfilter.length; j++) { - var $el = $('').appendTo('#termList') - $compile($el)($scope); - - } - $scope.EnableUI(); + angular.forEach(limitTofilterdata, function (value2, key2) { + totalstructure=totalstructure+1; + option=option+''; + + }) + var $el = $(option).appendTo('#termList') + $compile($el)($scope); - var termsTotal = '' + VocabTermTxtfilter.length + ' Structures'; - $("#totalTerms").empty(); - $('#totalTerms').append(termsTotal); + $scope.SetwindowStoreData(windowviewid,'totalstructureLm',totalstructure); + var termsTotal = '' + totalstructure + ' Structures'; - } - } - else { - console.log("$rootScope.TermNumberData NOT FOUND"); - $rootScope.daloadSearchData(windowviewid); + $("#totalTermsLm").empty(); + $("#totalTermsLm").append(termsTotal); + + if(totalstructure < languageVocabData.length) + { + $("#totalTermsLm").append(''); + } + else + { + $("#totalTermsLm").append(''); + $('#btlLoadMoreLm').attr('disabled', 'disabled'); + } + + $scope.EnableUI(); + + + } + + $rootScope.refreshTermListOnSystemSelection = function (selectedBodysystemId) { + var windowviewid = (selectedBodysystemId).split("_")[1]; + var bodysystemId = (selectedBodysystemId).split("_")[0]; + $scope.DisableUI(); + $("#bodySystems").find("option:not(:disabled)").css({ "background-color": "#ffffff", "color": "#000000" }); + $("#bodySystems").find("option[id=" + selectedBodysystemId + "]").css({ "background-color": "#3399FF", "color": "#ffffff" }); + + $("#bodySystems").find("option[id=" + selectedBodysystemId + "]").css({ "background-color": "#3399FF", "color": "#ffffff" }); + + $('#termList').empty(); + + $scope.SetwindowStoreData(windowviewid, 'totalstructureLm',0); + var totalstructure = 0; + var langId = $("#selectLanguageLm option:selected").val(); + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; + + var lanName=selectedLanguage.language; - } } - else { - $rootScope.daloadSearchData(windowviewid); + else + { + var lanName=$rootScope.lexiconLanguageArray[0].language; + } + if(bodysystemId=="0") + { + setTimeout(function () { + $scope.loadListManger(windowviewid,lanName,totalstructure); + + }, 100); + } + else + { + $scope.systemMatchTermLoad(bodysystemId,windowviewid,lanName,totalstructure); } } + + $scope.systemMatchTermLoad=function(bodysystemId,windowviewid,lanName,totalstructure) + { + var BodySystemData = $scope.GetwindowStoreData(windowviewid,'BodySystemData'); + var systemMatchedTermList = new jinqJs() + .from(BodySystemData) + .where('_SystemNumber == ' + bodysystemId) + .select(); + if (systemMatchedTermList != null || systemMatchedTermList != undefined) { + $scope.refreshTerms(systemMatchedTermList,windowviewid,lanName,totalstructure); + } + } + + $scope.refreshTerms = function (termList,windowviewid,lanName,totalstructure) { + var vocabTermTxt = []; + var actulaTermNumber = []; + var allVocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); + + var languageVocabTermDataArray = new jinqJs() + .from( allVocabTermDataArray) + .where('language == ' + lanName) + .select('vocabTermTxt')[0]; + + var VocabTermDataText= languageVocabTermDataArray.vocabTermTxt; + + var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); + for (var i = 0; i < termList.length; i++) { + + var actulaTerm = new jinqJs() + .from(TermNData.TermData.Term) + .where('_TermNumber == ' + termList[i]._TermNumber) + .select('_ActualTermNumber'); + + if (actulaTerm != null || actulaTerm != undefined) { + actulaTermNumber.push(actulaTerm[0]); + } + + } + + angular.forEach(VocabTermDataText, function (value2, key2) { + for (var i = 0; i < termList.length; i++) { + if (actulaTermNumber[i]._ActualTermNumber == value2._ActualTermNumber) { + vocabTermTxt.push( + { + "_ActualTermNumber": value2._ActualTermNumber, + "_TermText": value2._TermText + + }); + break; + + } + } + + }) + + var VocabTermTxtfilter = new jinqJs() + .from(vocabTermTxt) + .distinct('_TermText', '_ActualTermNumber') + .orderBy([{ field: '_TermText', sort: 'asc' }]) + .select('_ActualTermNumber', '_TermText'); + + var option=''; + if (VocabTermTxtfilter != null || VocabTermTxtfilter != undefined) { + + angular.forEach(VocabTermTxtfilter, function (value2, key2) { + totalstructure=totalstructure+1; + option=option+''; + + }) + var $el = $(option).appendTo('#termList') + $compile($el)($scope); + + $scope.SetwindowStoreData(windowviewid,'totalstructureLm',totalstructure); + var termsTotal = '' + totalstructure + ' Structures'; + + $("#totalTermsLm").empty(); + $("#totalTermsLm").append(termsTotal); + + if(totalstructure < VocabTermTxtfilter.length) + { + $("#totalTermsLm").append(''); + } + else + { + $("#totalTermsLm").append(''); + $('#btlLoadMoreLm').attr('disabled', 'disabled'); + } + + } + $scope.EnableUI(); + + } + $scope.HighlightBodyOnListManagerSelection = function (selectedtermid, isTermListOptionClicked, windowviewid) { $rootScope.UnsaveCurriculum = true; var currenttermidTxt=$("#" + selectedtermid).text(); @@ -11235,21 +11556,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } } } - else { - var currentBodyViewId = $scope.GetwindowStoreData(windowviewid,'voId') ; - var termJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; - DataService.getAnotherJson(termJsonPath) - .then( - function (result) { - $scope.SetwindowStoreData(windowviewid,'TermNumberData',result); - $scope.TermList = $scope.getTermNumberList(actualTermNumber,windowviewid); - - if (($scope.TermList != null || $scope.TermList != undefined) && $scope.TermList.length > 0) { - - $scope.setLayerNumberAndHighlightByTermList(windowviewid); - } - }) - } + var totalayer=$scope.GetwindowStoreData(windowviewid,'totalLayers'); var nlayer=$scope.GetwindowStoreData(windowviewid,'layerNumber'); $('#txtLayerNumberDA_' + windowviewid).val((parseInt(nlayer))); @@ -11314,8 +11621,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var isFound = jQuery.inArray(serachTerm, fullTermlist) if (isFound == -1) { fullTermlist.push(serachTerm); - console.log("psudhed in getChildTermList") - AllTerms.push({ '_TermNumber': serachTerm }) + $scope.SetwindowStoreData(windowviewid,'fullTermlist',fullTermlist); + AllTerms.push({ '_TermNumber': serachTerm }); + $scope.SetwindowStoreData(windowviewid,'AllTerms',AllTerms); $scope.getChildTermList(serachTerm,windowviewid); } } @@ -11343,9 +11651,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var AllTerms=$scope.GetwindowStoreData(windowviewid,'AllTerms'); for (var i = 0; i < data2.length; i++) { fullTermlist.push(data2[i]._TermNumber); + $scope.SetwindowStoreData(windowviewid,'fullTermlist',fullTermlist); console.log("psudhed in getSiblings") - AllTerms.push({ '_TermNumber': data2[i]._TermNumber }) + AllTerms.push({ '_TermNumber': data2[i]._TermNumber }); + $scope.SetwindowStoreData(windowviewid,'AllTerms',AllTerms); $scope.getChildTermList(data2[i]._TermNumber,windowviewid); } } @@ -11422,119 +11732,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l return Math.round(iReturnValue / nExistingZoom); } - $rootScope.refreshTermListOnSystemSelection = function (selectedBodysystemId) { - - var windowviewid = (selectedBodysystemId).split("_")[1]; - var bodysystemId = (selectedBodysystemId).split("_")[0]; - $scope.DisableUI(); - $("#bodySystems").find("option:not(:disabled)").css({ "background-color": "#ffffff", "color": "#000000" }); - $("#bodySystems").find("option[id=" + selectedBodysystemId + "]").css({ "background-color": "#3399FF", "color": "#ffffff" }); - - $("#bodySystems").find("option[id=" + selectedBodysystemId + "]").css({ "background-color": "#3399FF", "color": "#ffffff" }); - - $('#termList').empty(); - - if (bodysystemId == 0) { - $scope.loadListManger(windowviewid); - } - else { - var currentBodyViewId = $scope.GetwindowStoreData(windowviewid,'voId'); - var bodySystemDataPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_body_system_term_' + currentBodyViewId + '.json'; - DataService.getJson(bodySystemDataPath) - .then( - function (result) { - $scope.SetwindowStoreData(windowviewid,'BodySystemData',result); - var systemMatchedTermList = new jinqJs() - .from(result.BodySystem.BodySystemTerm) - .where('_SystemNumber == ' + bodysystemId) - .select(); - if (systemMatchedTermList != null || systemMatchedTermList != undefined) { - $scope.EnableUI(); - $scope.refreshTerms(systemMatchedTermList,windowviewid); - } - }, - function (error) { - console.log(error.statusText) - } - ) - - } - } - - $scope.refreshTerms = function (termList,windowviewid) { - - var path = '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json' - - $http({ method: 'GET', url: '~/../content/data/json/da/vocab/english/cm_dat_vocabterm_1.json' }).success(function (data) { - - var VocabTermData = data; - - var vocabTermTxt = []; - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - - for (var i = 0; i < termList.length; i++) { - - var actulaTermNumber = new jinqJs() - .from(TermNData.TermData.Term) - .where('_TermNumber == ' + termList[i]._TermNumber) - .select('_ActualTermNumber'); - - if (actulaTermNumber != null || actulaTermNumber != undefined) { - - - angular.forEach(VocabTermData.VocabTerms.Term, function (value2, key2) { - - - if (actulaTermNumber[0]._ActualTermNumber == value2._ActualTermNumber) { - vocabTermTxt.push( - - { - - "_ActualTermNumber": value2._ActualTermNumber, - - "_TermText": value2._TermText, - - "_cdId": value2._cdId - - } - - ); - - } - - }) - - } - } - - var VocabTermTxtfilter = new jinqJs() - .from(vocabTermTxt) - .distinct('_TermText', '_ActualTermNumber') - .orderBy([{ field: '_TermText', sort: 'asc' }]) - .select('_ActualTermNumber', '_TermText', '_cdId'); - - if (VocabTermTxtfilter != null || VocabTermTxtfilter != undefined) { - - - for (var j = 0; j < VocabTermTxtfilter.length; j++) { - var $el = $('').appendTo('#termList') - $compile($el)($scope); - } - - var termsTotal = '' + VocabTermTxtfilter.length + ' Structures'; - $("#totalTerms").empty(); - $('#totalTerms').append(termsTotal); - $scope.EnableUI(); - } - }) - - .error(function (data, status, headers, config) { - console.log(data); - - }); - - } - $scope.LayerChangeBasedOnKeyPressed = function (event) { var len= (event.currentTarget.id).split("_").length; @@ -11651,14 +11848,34 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.showFilteredTerms = function (windowviewid) { - // get first language term text - var lexiconInd = $scope.GetwindowStoreData(windowviewid, 'primaryLexiconInd')[0]; + var langId = $("#searchLanguageLm_"+windowviewid+" option:selected").val(); + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; - var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray')[lexiconInd].vocabTermTxt; + var lanName=selectedLanguage.language; + } + else + { + // get default language + var lanName=$rootScope.lexiconLanguageArray[0].language + } + + var allVocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); + + var languageVocabTermDataArray = new jinqJs() + .from( allVocabTermDataArray) + .where('language == ' + lanName) + .select('vocabTermTxt')[0]; + + var languageVocabData= languageVocabTermDataArray.vocabTermTxt; var searchvalue = $("#typedTermName_" + windowviewid).val(); - var searchfilterdata = $filter('filter')(vocabTermDataArray, searchvalue); + var searchfilterdata = $filter('filter')(languageVocabData, searchvalue); if(searchvalue.trim()!="") { @@ -11696,7 +11913,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l '-webkit-box-shadow': '0px 0px 2px 1px rgba(173,173,173,1)', '-moz-box-shadow': '0px 0px 2px 1px rgba(173,173,173,1)', 'box-shadow': '0px 0px 2px 1px rgba(173,173,173,1)', - 'width': '350px', + 'width': '400px', 'position': 'absolute', 'top': '170px', 'left': '40%', @@ -11736,35 +11953,147 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#searchedTermListPopUp_' + windowviewid).draggable({containment:'#daViewDA_' + windowviewid}); setTimeout(function () { + if ($('#searchTermListUl_' + windowviewid).html() != "") { + $('#searchTermListUl_' + windowviewid).empty(); + } + + $('#searchTermListUl_' + windowviewid).css('height','250px'); + $scope.FillSearchList(windowviewid); }, 100); } - $scope.FillSearchList = function (windowviewid) { + + $scope.FillSearchList = function (windowviewid) { + $scope.SetwindowStoreData(windowviewid,'totalstructure',0); + $scope.SetwindowStoreData(windowviewid,'isSearchClicked',true); + var totalstructure=0; + + $("#languageDiv").css("display","none"); + + var languageArray = $rootScope.lexiconLanguageArray; + + if(languageArray.length>1) + { + $("#languageDiv").css("display","block"); + $("#selectLanguage_"+windowviewid).empty(); + for (var i = 0; i <= languageArray.length - 1; i++) { + $('#selectLanguage_'+windowviewid).append(''); + } + } + + // primar language + var lanName=languageArray[0].language; + $scope.loadSearchList(windowviewid,lanName,totalstructure); + + } + $scope.changeLanguageList = function (event) { + $scope.DisableUI(); + var len= (event.currentTarget.id).split("_").length; + var windowviewid = (event.currentTarget.id).split("_")[len-1]; if ($('#searchTermListUl_' + windowviewid).html() != "") { $('#searchTermListUl_' + windowviewid).empty(); + } + $('#searchTermListUl_' + windowviewid).css('height','250px'); + + $scope.SetwindowStoreData(windowviewid,'totalstructure',0); + var totalstructure=0; + + setTimeout(function () { + var langId = $("#selectLanguage_"+windowviewid+" option:selected").val(); + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; + + var lanName=selectedLanguage.language; + } - $scope.SetwindowStoreData(windowviewid,'isSearchClicked',true); + else + { + var lanName=$rootScope.lexiconLanguageArray[0].language; + } + + $scope.loadSearchList(windowviewid,lanName,totalstructure); - var primaryLexiconIndex = $scope.GetwindowStoreData(windowviewid, 'primaryLexiconInd')[0]; - var vocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); + },100) + + } - var searchvalue = $("#typedTermName_" + windowviewid).val(); - var searchfilterdata = $filter('filter')(vocabTermDataArray, searchvalue); + $scope.LoadMore = function (event) { + $scope.DisableUI(); + var len= (event.currentTarget.id).split("_").length; + var windowviewid = (event.currentTarget.id).split("_")[len-1]; + var totalstructure = $scope.GetwindowStoreData(windowviewid, 'totalstructure'); + + setTimeout(function () { + var langId = $("#selectLanguage_"+windowviewid+" option:selected").val(); + if(langId!=undefined) + { + var selectedLanguage = new jinqJs() + .from( $rootScope.lexiconLanguageArray) + .where('id == ' + langId) + .select()[0]; + + var lanName=selectedLanguage.language; + + } + else + { + var lanName=$rootScope.lexiconLanguageArray[0].language; + } + $scope.loadSearchList(windowviewid,lanName,totalstructure); + + }, 100); + + } + + $scope.loadSearchList = function (windowviewid,lanName,totalstructure) { + + var allVocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); - var totalstructures=0; - angular.forEach(searchfilterdata[primaryLexiconIndex].VocabTermData.VocabTerms.Term, function (value2, key2) { - totalstructures=totalstructures+1; - var $el = $('').appendTo('#searchTermListUl_' + windowviewid); - $compile($el)($scope); + var languageVocabTermDataArray = new jinqJs() + .from( allVocabTermDataArray) + .where('language == ' + lanName) + .select('vocabTermTxt')[0]; + + var languageVocabData= languageVocabTermDataArray.vocabTermTxt; + + var afterskipdata = new jinqJs() + .from(languageVocabData) + .skip(totalstructure) + .select(); + + var limitTofilterdata = $filter('limitTo')(afterskipdata, 500); + + var option=''; + + angular.forEach(limitTofilterdata, function (value2, key2) { + totalstructure=totalstructure+1; + option=option+''; + }) - var termsTotal = '' + totalstructures + ' Structures'; - $("#totalTerms").empty(); - $('#totalTerms').append(termsTotal); + var $el = $(option).appendTo('#searchTermListUl_' + windowviewid); + $compile($el)($scope); + $scope.SetwindowStoreData(windowviewid,'totalstructure',totalstructure); + var termsTotal = '' + totalstructure + ' Structures'; + $("#totalTerms_"+windowviewid).empty(); + $("#totalTerms_"+windowviewid).css('padding-bottom','10px'); + $("#totalTerms_"+windowviewid).append(termsTotal); + + if(totalstructure < languageVocabData.length) + { + $("#totalTerms_"+windowviewid).append(''); + } + else + { + $("#totalTerms_"+windowviewid).append(''); + $('#btlLoadMore_' + windowviewid).attr('disabled', 'disabled'); + } - $scope.EnableUI(); - if (navigator.userAgent.match(/(iPod|iPhone|iPad|android)/i)) { $(document).on("mouseover", "#searchTermListUl_" + windowviewid+ " option", function (e) { @@ -11777,11 +12106,14 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); } + $scope.EnableUI(); + } - $scope.closeSerachTermListPopUp = function () { + + $scope.closeSerachTermListPopUp = function (event) { - var len= (event.target.parentElement.parentElement.parentElement.id).split("_").length; - var windowviewid = (event.target.parentElement.parentElement.parentElement.id).split("_")[len-1]; + var len= (event.currentTarget.id).split("_").length; + var windowviewid = (event.currentTarget.id).split("_")[len-1]; $('#searchedTermListPopUp_' + windowviewid).css('display', 'none'); $('#searchedTermListPopUp_' + windowviewid).css("visibility", "hidden"); @@ -12009,6 +12341,37 @@ function genderChange(event) { $(".custom-tooltip1").toggle(); } } +function ApplySearch(event) { + event.stopPropagation(); + var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); + scope.$apply(function () { + scope.ApplySearch(event); + }); +} + +function closeSerachTermListPopUp(event) { + event.stopPropagation(); + var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); + scope.$apply(function () { + scope.closeSerachTermListPopUp(event); + }); +} +function changeLanguageList(event) { + event.stopPropagation(); + var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); + scope.$apply(function () { + scope.changeLanguageList(event); + }); +} + +function LoadMore(event) { + event.stopPropagation(); + var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); + scope.$apply(function () { + scope.LoadMore(event); + }); +} + function viewChange(event) { event.stopPropagation(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 12ef705..b6cdbc2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -39,7 +39,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data ethnicity: null, modesty: null }; - + $rootScope.lexicons = { + primaryid:1, + secondryids:[] + }; + + // on refersh this variable will also get null that is why we are only checking this variable on initialize that if it is null that means page gets refershed. $rootScope.refreshcheck = null; var isCommingSoonModel = true; @@ -325,7 +330,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data draggable: "disabled", size: { - width: screen.width-10, + width: screen.width-30, height: screen.height-150 }, @@ -649,6 +654,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data sessionStorage.removeItem('isModuleOpenByOpenResource'); sessionStorage.removeItem('ExitsCBFileDetail'); $('#login').css('visibility', 'visible'); + $rootScope.lexiconData(); $rootScope.checkRefreshButtonClick = 1; var date = new Date(); @@ -684,8 +690,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $scope.ValidateClientSiteUrl(); } - - else { + else + { if (navigator.cookieEnabled) { $rootScope.isLoading = false; @@ -792,6 +798,156 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }, 2000); } + + $rootScope.lexiconData = function () { + + $rootScope.lexiconAllLanguage = []; + $rootScope.lexiconLanguageArray = []; + $.ajax({ + url: '~/../content/data/json/da/uc_dat_default.json', + dataType: "json", + success: function (result) { + var plId=result.root.uc.pl.lx._id; + var plText=result.root.uc.pl.lx._tl; + + $rootScope.lexiconAllLanguage.push({ _id: plId, _tl: plText }); + $(result.root.uc.al.lx).each(function (key, value) { + $rootScope.lexiconAllLanguage.push({ _id: this._id, _tl: this._tl }); + + }); + + } + + }); + + $('#lexiconLangDropdown').change(function () { + $rootScope.isLexiconLanguageClicked = true; + $('#laxiconLangAdd').removeAttr('disabled'); + $('#laxicanlanguageChagne').removeAttr('disabled'); + $rootScope.selectedId = $("#lexiconLangDropdown option:selected").attr('val'); + $rootScope.selectedText = $("#lexiconLangDropdown option:selected").text(); + }); + + $('#laxiconLangAdd').click(function () { + if ($rootScope.isLexiconLanguageClicked == true) { + $rootScope.isLexiconLanguageClicked = false; + $("#lexiconLangDropdown :selected").remove(); + $('#secondLax').append(''); + $rootScope.lexiconLanguageArray.push({ id: $rootScope.selectedId, language: $rootScope.selectedText }); + $rootScope.islaxicanlanguageChange=true; + $('#laxiconLangAdd').attr('disabled', 'disabled'); + $('#laxicanlanguageChagne').attr('disabled', 'disabled'); + + $timeout(function () { + $('#lexiconLangDropdown').html($('#lexiconLangDropdown').find('option').sort(function (x, y) { + return $(x).text() > $(y).text() ? 1 : -1 + })); + }, 100); + } + }); + + $('#secondLax').change(function () { + $rootScope.isActiveLexiconLanguageClicked = true; + $rootScope.secondlaxdid = $("#secondLax option:selected").attr('val'); + $rootScope.secondlaxtext = $("#secondLax option:selected").text(); + $('#laxiconLangRemove').removeAttr('disabled'); + + }); + + $("#laxiconLangRemove").click(function () { + if ($rootScope.isActiveLexiconLanguageClicked == true) { + $rootScope.isActiveLexiconLanguageClicked = false; + $("#secondLax :selected").remove(); + $('#lexiconLangDropdown').append(''); + // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); + $rootScope.lexiconLanguageArray = []; + $("#secondLax > option").each(function () { + $rootScope.lexiconLanguageArray.push({ id: $(this).attr("val"), language: this.value }); + }); + $rootScope.lexiconLanguageArray.unshift({ id: $("#primarylaxican").attr("name"), language: $("#primarylaxican").val() }); + $rootScope.islaxicanlanguageChange=true; + + $timeout(function () { + $('#lexiconLangDropdown').html($('#lexiconLangDropdown').find('option').sort(function (x, y) { + return $(x).text() > $(y).text() ? 1 : -1 + })); + + $('#laxiconLangRemove').attr('disabled', 'disabled'); + $("#secondLax > option").each(function () { + $('#laxiconLangRemove').removeAttr('disabled'); + }); + }, 100); + } + }); + + $("#laxicanlanguageChagne").click(function () { + if ($rootScope.isLexiconLanguageClicked == true) { + $rootScope.isLexiconLanguageClicked = false; + var primarylaxiid = $("#lexiconLangDropdown option:selected").attr('val'); + var primarylaxicantext = $("#lexiconLangDropdown option:selected").text(); + $("#lexiconLangDropdown :selected").remove(); + $('#lexiconLangDropdown').append(''); + $('#primarylaxican').val(primarylaxicantext); + $('#primarylaxican').attr("name", primarylaxiid); + $rootScope.lexiconLanguageArray[0].id = primarylaxiid; + $rootScope.lexiconLanguageArray[0].language = primarylaxicantext; + $('#laxicanlanguageChagne').attr('disabled', 'disabled'); + $('#laxiconLangAdd').attr('disabled', 'disabled'); + + $rootScope.islaxicanlanguageChange=true; + + $timeout(function () { + $('#lexiconLangDropdown').html($('#lexiconLangDropdown').find('option').sort(function (x, y) { + return $(x).text() > $(y).text() ? 1 : -1 + })); + }, 100); + + } + }); + } + + $rootScope.InitiateLexicon = function (primaryId,secondryIds) { + + var secondLng=[]; + secondLng=secondryIds.split(','); + var primaryLang = new jinqJs() + .from( $rootScope.lexiconAllLanguage) + .where('_id == ' + primaryId) + .select()[0]; + + var secondLang = new jinqJs() + .from( $rootScope.lexiconAllLanguage) + .in(secondLng, '_id') + .orderBy([{ field: '_tl', sort: 'asc' }]) + .select(); + $rootScope.lexiconLanguageArray.push({ id: primaryLang._id, language: primaryLang._tl }); + + $("#primarylaxican").val(primaryLang._tl); + $('#primarylaxican').attr("name", primaryLang._id); + + + secondLng.push(primaryId); + + var restLanguage = new jinqJs() + .from( $rootScope.lexiconAllLanguage) + .not() + .in(secondLng, '_id') + .orderBy([{ field: '_tl', sort: 'asc' }]) + .select(); + + + angular.forEach(restLanguage, function (value, key) { + $('#lexiconLangDropdown').append(''); + }); + + angular.forEach(secondLang, function (value, key) { + $('#secondLax').append(''); + $rootScope.lexiconLanguageArray.push({ id: value._id, language: value._tl }); + }); + + + } + $rootScope.getConfigurationValues = function () { ConfigurationService.getCofigValue() .then( @@ -877,23 +1033,26 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.isModestyOff = false; localStorage.setItem("globalModesty", "Y"); $rootScope.formsetting = { - ethnicity: null, + ethnicity: "W", modesty: "Y" } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + + $rootScope.UpdateSetting($rootScope.formsetting) } else { $rootScope.isModestyOn = false; $rootScope.isModestyOff = true; localStorage.setItem("globalModesty", "N"); $rootScope.formsetting = { - ethnicity: null, + ethnicity: "W", modesty: "N" } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + + $rootScope.UpdateSetting($rootScope.formsetting) } } - else { + else + { localStorage.setItem("globalModesty", result.userselectedModesty); localStorage.setItem("globalEthnicity", result.userSelectedSkintone); @@ -901,9 +1060,18 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data ethnicity: result.userSelectedSkintone, modesty: result.userselectedModesty } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + + $rootScope.UpdateSetting($rootScope.formsetting); } + + $rootScope.lexicons = { + primaryid:result.userLexicon!=null && result.userLexicon.primaryid!=""?result.userLexicon.primaryid:"1", + secondryids:result.userLexicon!=null && result.userLexicon.secondryids!="" ?result.userLexicon.secondryids:"" + }; + + $rootScope.InitiateLexicon( $rootScope.lexicons.primaryid, $rootScope.lexicons.secondryids) + } else { if (result.userselectedModesty == undefined || result.userselectedModesty == null || @@ -913,12 +1081,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.isModestyOff = false; localStorage.setItem("globalModesty", "Y"); $rootScope.formsetting = { - ethnicity: null, + ethnicity: "W", modesty: "Y" } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting); + $rootScope.UpdateSetting($rootScope.formsetting); } - else { + else + { localStorage.setItem("globalModesty", result.userselectedModesty); localStorage.setItem("globalEthnicity", result.userSelectedSkintone); @@ -926,9 +1095,17 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data ethnicity: result.userSelectedSkintone, modesty: result.userselectedModesty } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + $rootScope.UpdateSetting($rootScope.formsetting) } + + $rootScope.lexicons = { + primaryid:result.userLexicon!=null && result.userLexicon.primaryid!=""?result.userLexicon.primaryid:"1", + secondryids:result.userLexicon!=null && result.userLexicon.secondryids!="" ?result.userLexicon.secondryids:"" + }; + + $rootScope.InitiateLexicon( $rootScope.lexicons.primaryid, $rootScope.lexicons.secondryids) + } //code for modesty setting $rootScope.aiaModesty = $rootScope.formsetting.modesty; @@ -1452,20 +1629,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.isModestyOff = false; localStorage.setItem("globalModesty", "Y"); $rootScope.formsetting = { - ethnicity: null, + ethnicity: "W", modesty: "Y" } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + $rootScope.UpdateSetting($rootScope.formsetting) } else { $rootScope.isModestyOn = false; $rootScope.isModestyOff = true; localStorage.setItem("globalModesty", "N"); $rootScope.formsetting = { - ethnicity: null, + ethnicity: "W", modesty: "N" } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + $rootScope.UpdateSetting($rootScope.formsetting) } } else { @@ -1473,11 +1650,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.isModestyOff = false; localStorage.setItem("globalModesty", "Y"); $rootScope.formsetting = { - ethnicity: null, + ethnicity: "W", modesty: "Y" } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + $rootScope.UpdateSetting($rootScope.formsetting) } + + //for site user set default lexicon + $rootScope.lexicons = { + primaryid:"1", + secondryids:"" + }; + + $rootScope.InitiateLexicon( $rootScope.lexicons.primaryid, $rootScope.lexicons.secondryids) //code for modesty setting $rootScope.aiaModesty = $rootScope.formsetting.modesty; @@ -1516,7 +1701,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $location.path('/'); } - else { + else + { if (result.LicenseInfo != null ) { //only site instructor allowed to change modesty @@ -1527,11 +1713,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#modestyDiv").find("*").prop('disabled', true); } - // set license id - $scope.UpdateUserExportImageData(result.Id, 'LicenseId', result.LicenseId) + // set license id + $scope.UpdateUserExportImageData(result.Id, 'LicenseId', result.LicenseId) - // set license type :note 5 for demo/test license - $scope.UpdateUserExportImageData(result.Id, 'LicenseTypeId', result.LicenseInfo.LicenseTypeId); + // set license type :note 5 for demo/test license + $scope.UpdateUserExportImageData(result.Id, 'LicenseTypeId', result.LicenseInfo.LicenseTypeId); if(result.UserExportImageDetail!=null) { @@ -2041,90 +2227,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data ); } - $rootScope.lexiconLanguageArray = []; - $rootScope.lexiconLanguageArray.push({ id: "1", language: "English" }); $(document).ready(function () { - $rootScope.isLexiconTabClicked = true; - $rootScope.lexiconData = function () { - if ($rootScope.isLexiconTabClicked == true) { - $rootScope.isLexiconTabClicked = false; - $.ajax({ - url: '~/../content/data/json/da/uc_dat_default.json', - dataType: "json", - success: function (result) { - $(result.root.uc.al.lx).each(function (key, value) { - - $('#lexiconLangDropdown').append(''); - - - }); - $('#lexiconLangDropdown').html($('#lexiconLangDropdown').find('option').sort(function (x, y) { - - return $(x).text() > $(y).text() ? 1 : -1 - - })); - } - - }); - } - $('#lexiconLangDropdown').change(function () { - $rootScope.isLexiconLanguageClicked = true; - $('#laxiconLangAdd').removeAttr('disabled'); - $('#laxicanlanguageChagne').removeAttr('disabled'); - $rootScope.selectedId = $("#lexiconLangDropdown option:selected").attr('val'); - $rootScope.selectedText = $("#lexiconLangDropdown option:selected").text(); - }); - - $('#laxiconLangAdd').click(function () { - if ($rootScope.isLexiconLanguageClicked == true) { - $rootScope.isLexiconLanguageClicked = false; - $("#lexiconLangDropdown :selected").remove(); - $('#secondLax').append(''); - $rootScope.lexiconLanguageArray.push({ id: $rootScope.selectedId, language: $rootScope.selectedText }); - $rootScope.islaxicanlanguageChange=true; - } - }); - - $('#secondLax').change(function () { - $rootScope.isActiveLexiconLanguageClicked = true; - $rootScope.secondlaxdid = $("#secondLax option:selected").attr('val'); - $rootScope.secondlaxtext = $("#secondLax option:selected").text(); - - }); - - $("#laxiconLangRemove").click(function () { - if ($rootScope.isActiveLexiconLanguageClicked == true) { - $rootScope.isActiveLexiconLanguageClicked = false; - $("#secondLax :selected").remove(); - $('#lexiconLangDropdown').append(''); - // $rootScope.lexiconLanguageArray.splice($rootScope.secondlaxtext, 1); - $rootScope.lexiconLanguageArray = []; - $("#secondLax > option").each(function () { - $rootScope.lexiconLanguageArray.push({ id: $(this).attr("val"), language: this.value }); - }); - $rootScope.lexiconLanguageArray.unshift({ id: $("#primarylaxican").attr("name"), language: $("#primarylaxican").val() }); - $rootScope.islaxicanlanguageChange=true; - } - }); - - $("#laxicanlanguageChagne").click(function () { - if ($rootScope.isLexiconLanguageClicked == true) { - $rootScope.isLexiconLanguageClicked = false; - var primarylaxiid = $("#lexiconLangDropdown option:selected").attr('val'); - var primarylaxicantext = $("#lexiconLangDropdown option:selected").text(); - $("#lexiconLangDropdown :selected").remove(); - $('#lexiconLangDropdown').append(''); - $('#primarylaxican').val(primarylaxicantext); - $('#primarylaxican').attr("name", primarylaxiid); - $rootScope.lexiconLanguageArray[0].id = primarylaxiid; - $rootScope.lexiconLanguageArray[0].language = primarylaxicantext; - - $rootScope.islaxicanlanguageChange=true; - } - }); - } - $(function () { var colpick = $('.demo').each(function () { @@ -3243,8 +3347,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); } - else { - + else + { + $('#modelsettingsbackground').css('z-index', '12000000'); $('#modal-settings').css("display", "block"); $("#modelsettingsbackground").css("display", "block"); } @@ -7752,7 +7857,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#AABodySystems').empty(); $('#bodySystems').empty(); $('#termList').empty(); - $('#viewName').empty(); + $('#viewName').empty(); + $("#langaugeDivLm").css("display", "none"); var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='ciImagePanel']").not("div[id*='aiImagePanel']").not("div[id*='picImagePanel']").not("div[id*='vidImagePanel']"); if (modulePanel != undefined && modulePanel.length>0) { for (var i = 0 ; i < modulePanel.length; i++) { @@ -7779,6 +7885,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#bodySystems').empty(); $('#termList').empty(); $('#viewName').empty(); + $("#langaugeDivLm").css("display", "none"); var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']").not("div[id*='caImagePanel']").not("div[id*='ThreeDImagePanel']").not("div[id*='ciImagePanel']").not("div[id*='aiImagePanel']").not("div[id*='labImagePanel']").not("div[id*='picImagePanel']").not("div[id*='vidImagePanel']"); if (modulePanel != undefined && modulePanel.length>0) { for (var index = 0 ; index < modulePanel.length; index++) { @@ -7867,16 +7974,16 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#annotationpaintbrushsize").css('pointer-events', 'none'); $("#annotationpainteraser").css('pointer-events', 'none'); - $rootScope.islistManagerEventAlredayDispachted = true; - if(selectedPanel.match("daImagePanel")) { + $("#langaugeDivLm").css("display", "block"); $rootScope.dalistManagerEvent(windowviewid); $("#termList").attr("onclick", "if (typeof(this.selectedIndex) != 'undefined') onListManagerTermSelection(this.options[this.selectedIndex].id, true)"); } else if(selectedPanel.match("AAImagePanel")) { + $("#langaugeDivLm").css("display", "none"); $rootScope.aalistManagerEvent(windowviewid); $("#termList").attr("onclick", "if (typeof(this.selectedIndex) != 'undefined') onSearchItemSelection(this.options[this.selectedIndex].id)"); @@ -7941,6 +8048,27 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $rootScope.changeLanguageLmList = function () { + var selectedPanel = $("#viewName option:selected").val(); + + if(selectedPanel.match("daImagePanel")) + { + var windowviewid=selectedPanel.split('_')[1]; + $rootScope.changeLanguageLmEvent(windowviewid); + } + } + + $rootScope.LoadMoreLm = function () { + var selectedPanel = $("#viewName option:selected").val(); + + if(selectedPanel.match("daImagePanel")) + { + var windowviewid=selectedPanel.split('_')[1]; + $rootScope.LoadMoreLmEvent(windowviewid); + } + } + + function fillListManagerTerms() { var len = $rootScope.openModules.length; @@ -8061,85 +8189,94 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.aiaModesty = $rootScope.formsetting.modesty; } - $rootScope.isApplyBtnClicked = false; + $rootScope.CancelSetting = function () { $rootScope.isCloseSettingClicked = true; + $rootScope.islaxicanlanguageChange=false; $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity); $rootScope.setModestySettings($rootScope.globalSetting.modesty); - $rootScope.islaxicanlanguageChange=false; - if ($rootScope.isApplyBtnClicked == false) { - - $rootScope.deSelectLanguageOptions(); - } - else { - - $rootScope.isApplyBtnClicked = false; - } + $rootScope.deSelectLanguageOptions(); + $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); } - $rootScope.CloseSetting = function () { - if($rootScope.isApplyBtnClicked) - { - $("#saveSettingsMessageModal").modal('show'); - $("#saveSettingsMessageModal").css('zIndex', 80000000000); - } - else - { - $rootScope.CancelSetting (); - } - } - - $rootScope.saveSettings = function () { - var currentSkintone = $rootScope.globalSetting.ethnicity; - var currentModesty = $rootScope.globalSetting.modesty; + $rootScope.UpdateAndCloseSetting = function (Formatsetting) { + + $timeout(function () { + $('#setting-spinner').css('visibility', 'visible'); + $('#modelsettingsbackground').css('z-index', '12000005'); + + }, 100); + + $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; var setting={}; - setting.modesty =currentModesty ; - setting.skintone = currentSkintone; + setting.modesty =Formatsetting.modesty ; + setting.skintone = Formatsetting.ethnicity; setting.userId = $rootScope.userData.Id; - AuthenticationService.saveSetings(setting) - .then( + + var secondLan=[] + + $("#secondLax > option").each(function () { + secondLan.push($(this).attr("val")); + + }); + setting.primaryid = $('#primarylaxican').attr("name"); + setting.secondryids = secondLan.join(","); + + if($rootScope.userData.Id!=0) + { + AuthenticationService.saveSetings(setting) + .then( function (result) { - var k= result; - if(result==1){ - $('#modal-settings').css("display", "none"); - $("#modelsettingsbackground").css("display", "none"); - //hide saveSettingsMessageModal - $("#saveSettingsMessageModal").modal('hide'); - $rootScope.sucessMessage = AIAConstants.SETTINGS_SAVED - $("#successMessageModal").modal('show'); - + if(result==1) + { + $timeout(function () { + $('#setting-spinner').css('visibility', 'hidden'); + $('#modal-settings').css("display", "none"); + $('#modelsettingsbackground').css('z-index', '12000000'); + $("#modelsettingsbackground").css("display", "none"); + $rootScope.UpdateSetting(Formatsetting); + + }, 500); + } else { $rootScope.errorMessage =AIAConstants.SETTING_SAVE_ERROR; $("#messageModal").modal('show'); - } - }), - function (error) { - console.log(' Error in Saving settings = ' + error.statusText); - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = error; - $("#messageModal").modal('show'); + function (error) { + console.log(' Error in Saving settings = ' + error.statusText); + $rootScope.isVisibleLogin = true; + $('#setting-spinner').css('visibility', 'hidden'); + $('#modal-settings').css("display", "none"); + $('#modelsettingsbackground').css('zIndex', '12000000'); + $("#modelsettingsbackground").css("display", "none"); + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); + } + + } + else + { + // for site user. no user id for site license + $('#setting-spinner').css('visibility', 'hidden'); + $('#modal-settings').css("display", "none"); + $('#modelsettingsbackground').css('zIndex', '12000000'); + $("#modelsettingsbackground").css("display", "none"); + $rootScope.UpdateSetting(setting); + } - } - $rootScope.UpdateAndCloseSetting = function (setting) { - $rootScope.UpdateSetting(setting); - $rootScope.isApplyBtnClicked = false; - $('#modal-settings').css("display", "none"); - $("#modelsettingsbackground").css("display", "none"); - $rootScope.lexiconLanguageArrayLength = $rootScope.lexiconLanguageArray.length; + }; - $rootScope.deSelectLanguageOptions = function () { var languageDifference = ($rootScope.lexiconLanguageArrayLength) - ($rootScope.lexiconLanguageArray.length); @@ -8169,9 +8306,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }); } - //$("#primarylaxican").val($rootScope.lexiconPrimaryLanguage); - //$('#primarylaxican').attr("name", $rootScope.primaryLangID); - } } else if (languageDifference < 0) { @@ -8228,11 +8362,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data })); } - $rootScope.UpdateSetting = function (setting) { $rootScope.isCallFromOtherModule = undefined; - $rootScope.isApplyBtnClicked = true; var isReloadingViewRequired = false; //1. if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js index 5e3f48d..7b86c67 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/MyPictureController.js @@ -385,12 +385,20 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#canvasDivPIC_' + windowviewid).css('height', canvasDIvHeight-5); var canvas = document.getElementById("canvasPIC_" + windowviewid); var canvasPaint = document.getElementById("canvasPaintPIC_" + windowviewid); - + canvas.height = canvasDIvHeight; canvasPaint.height = canvasDIvHeight - canvas.width = screen.width; - canvasPaint.width = screen.width; - + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + canvas.width = screen.width-20; + canvasPaint.width = screen.width-20; + } + else + { + canvas.width = screen.width-40; + canvasPaint.width = screen.width-40; + } + var openedImage = document.getElementById('mypic_' + windowviewid ); openedImage.src = selectedpicture; openedImage.onload = function () { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index 6505579..04324fb 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -2720,6 +2720,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $("#AABodySystems").empty(); $("#bodySystems").css("display", "none"); + $("#langaugeDivLm").css("display", "none"); $("#AABodySystems").css("display", "block"); $("#bodySystemList_" + windowviewid + " li a").each(function (key, value) { var sysid= $(this).attr('id') + '_' +windowviewid; @@ -2769,8 +2770,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $rootScope.aaloadSearchData(windowviewid); $timeout(function () { - $("#totalTerms").empty(); - $("#totalTerms").html("" + $("#termList option").length + " Structures"); + $("#totalTermsLm").empty(); + $("#totalTermsLm").html("" + $("#termList option").length + " Structures"); $scope.EnableUI(); }, 1000); @@ -2790,8 +2791,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $compile($selectedOptions)($scope); } - $("#totalTerms").empty(); - $("#totalTerms").html("" + $("#termList option").length + " Structures"); + $("#totalTermsLm").empty(); + $("#totalTermsLm").html("" + $("#termList option").length + " Structures"); } else { var imageId = $scope.GetAAwindowStoreData(windowviewid,'imageId'); @@ -2861,8 +2862,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou } } }); - $("#totalTerms").empty(); - $("#totalTerms").html("" + $("#termList option").length + " Structures"); + $("#totalTermsLm").empty(); + $("#totalTermsLm").html("" + $("#termList option").length + " Structures"); } } $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo,windowviewid) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index 699876d..ea36cbc 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -101,6 +101,10 @@ }).error(function (data, status, headers, config) { console.log('error') deferred.reject(data); + $('#setting-spinner').css('visibility', 'hidden'); + $('#modal-settings').css("display", "none"); + $('#modelsettingsbackground').css('zIndex', '12000000'); + $("#modelsettingsbackground").css("display", "none"); $rootScope.errorMessage = data; $("#messageModal").modal('show'); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html index a0b522e..fce65b9 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html @@ -234,7 +234,7 @@