diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index 768cb23..ec4ce0b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -9,14 +9,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.CIAllSpeciality = []; $scope.selectedCIListViewData = []; - //************************************ - - $scope.showTabButton = true; - // $scope.IllustrationData; - - $scope.searchCIListViewData = []; + //$scope.searchCIListViewData = []; $scope.SelectedCIthumbImage = []; - $scope.SelectedCIImage = []; $scope.SelectedCISummary = []; $scope.SelectedCIId = []; $scope.SelectedCITitle = []; @@ -24,6 +18,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.filterstring = false; $scope.idSelected; $scope.srollListView; + + $scope.showTabButton = true; + $scope.query = { selectedbodyregion: '', selectedbodysystem: '', @@ -32,6 +29,15 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout selectedspecialty: '', }; + //************************************ + + + + + + + + $scope.setActiveTab = function (tabToSet) { $scope.activeTab = tabToSet; localStorage.setItem("currentCITabView", $scope.activeTab); @@ -49,15 +55,18 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.CIWindowData.push( { 'multiwinid': windowviewid, - 'IllustrationData':[], + 'IllustrationData': [], + 'searchCIListViewData': [], + 'CIImagePath': '', + 'ImageSummary': '', 'moduleName': '', 'currentViewTitle': '', 'parentSlugName': '', + 'currentSlug': '', 'sliderPercentValue': 1, 'imageId': '', 'imageName': '', 'bodySystemName': '', - 'OpenItemImagePath': '', 'isBodySystemSelected': false, 'typeOfEvent': '', 'selectedSystemName': null, @@ -80,14 +89,18 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout { 'multiwinid': windowviewid, 'IllustrationData': [], + 'searchCIListViewData': [], + 'CIImagePath': '', + 'ImageSummary': '', 'moduleName': '', 'currentViewTitle': '', 'parentSlugName': '', + 'currentSlug':'', 'sliderPercentValue': 1, 'imageId': '', 'imageName': '', 'bodySystemName': '', - 'OpenItemImagePath': '', + 'isBodySystemSelected': false, 'typeOfEvent': '', 'selectedSystemName': null, @@ -209,7 +222,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID); $scope.idSelected = curSelectedRowId; - $scope.ReloadListViewImageDiv($scope.idSelected); + $scope.ReloadListViewImageDiv($scope.idSelected, $rootScope.MULTI_VIEW_ID); } else { $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID) @@ -316,7 +329,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $timeout(function () { - $('#' + $rootScope.getLocalStorageValue("currentBodyViewId")).find('.thumbnail').addClass('HightLightThumbnail'); + $('#' + $rootScope.getLocalStorageValue("currentImageId")).find('.thumbnail').addClass('HightLightThumbnail'); if ($rootScope.getLocalStorageValue('CIGridViewScroll') !== null && $location.url() == "/clinical-illustrations") { $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('CIGridViewScroll') }); } @@ -332,7 +345,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } - $scope.showItem = function (id) { + $scope.showItem = function (id, windowviewid) { + + if (windowviewid == undefined) + windowviewid = $rootScope.MULTI_VIEW_ID; + $scope.idSelected = id; localStorage.setItem("CISelectedRowId", id); @@ -355,12 +372,15 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title; } - else { - if ($scope.searchCIListViewData.length > 0) { + else + { + var searchCIListViewData = $scope.GetCIwindowStoreData(windowviewid, 'searchCIListViewData'); + + if (searchCIListViewData.length > 0) { var SelectedCIthumbImage = []; SelectedCIthumbImage = new jinqJs() - .from($scope.searchCIListViewData) + .from(searchCIListViewData) .where('_id = ' + id) .select('_ThumbnailImage', '_Summary', '_id', '_Title'); @@ -401,10 +421,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.hideListViewDiv(); $scope.filterstring = false; - while ($scope.searchCIListViewData.length) { - $scope.searchCIListViewData.pop(); - } + $scope.SetCIwindowStoreData(windowviewid, 'searchCIListViewData', []); + $scope.loadAllCI(windowviewid); } @@ -419,6 +438,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.filterstring = true; + $scope.SetCIwindowStoreData(windowviewid, 'searchCIListViewData', []); filtercount = 0; if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { @@ -562,8 +582,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //theme:"rounded" }); - - $scope.searchCIListViewData.push( + var cilistviewdata = []; + cilistviewdata.push( { "_id": value._id, "_ImageId": value._ImageId, @@ -578,11 +598,15 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout "_Summary": value._Summary }); + $scope.SetCIwindowStoreData(windowviewid, 'searchCIListViewData', cilistviewdata); + } }); $('table > #ListViewDiv > #searchItem').remove(); + + var searchCIListViewData = $scope.GetCIwindowStoreData(windowviewid, 'searchCIListViewData'); //Show Error Message in case of gridview if no data is found - if ($scope.searchCIListViewData.length == 0) { + if (searchCIListViewData.length == 0) { var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); $compile($el)($scope); $('table > #ListViewDiv > #searchItem').remove(); @@ -601,29 +625,47 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.openView = function ($event) { + var windowviewid = $rootScope.MULTI_VIEW_ID; $rootScope.MenuModuleName = "CI"; $rootScope.disableAnnotationTB = false; $rootScope.CIAnotationIdentifyModeOff = true; - $rootScope.currentBodyViewId = $event.currentTarget.id; if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") { - var CITitle = []; - CITitle = new jinqJs() + var selectedTileData = []; + selectedTileData = new jinqJs() .from($scope.selectedCIListViewData) .where('_id = ' + $event.currentTarget.id) - .select('_Title'); - - // console.log(CITitle); - // console.log($scope.selectedCIListViewData); + .select(); - $rootScope.ViewTitle = CITitle[0]._Title; + $rootScope.ViewTitle = selectedTileData[0]._Title; } else { $rootScope.ViewTitle = $event.currentTarget.textContent; } + + localStorage.setItem("currentViewTitle", $rootScope.ViewTitle); + localStorage.setItem("currentImageId", $event.currentTarget.id); + + $scope.SetCIwindowStoreData(windowviewid, 'currentViewTitle', $rootScope.ViewTitle); + $scope.SetCIwindowStoreData(windowviewid, 'imageId', $event.currentTarget.id); + + var imageName = selectedTileData[0]._contentImage; + + $scope.SetCIwindowStoreData(windowviewid, 'imageName', imageName); + + var imagePath = "~/../content/images/ci/images/" + imageName; + + $scope.SetCIwindowStoreData(windowviewid, 'CIImagePath', imagePath); + + var selectedImageCISummary = selectedTileData[0]._Summary + + $scope.SetCIwindowStoreData(windowviewid, 'ImageSummary', selectedImageCISummary); + + // store image for export + var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); + $rootScope.StoreTitleName(tittle); + $rootScope.StoreOrgImageName(imageName); - localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); - localStorage.setItem("currentBodyViewId", $event.currentTarget.id); //Set the vertical scroll value of the Grid-View. var y = $($window).scrollTop(); @@ -631,115 +673,195 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var u = $location.url(); $location.url('/clinical-illustrations-detail'); - // console.log($location.url('/clinical-illustrations-detail')); + + } + + $scope.openBodyViewMain = function () { + + if ($rootScope.isCallFromOtherModule) { + $scope.CIModuleData = ModuleService.getModuleData("ATLAS_ANATOMY"); + $scope.readyToLoad = true; + $rootScope.CIWindowLoadComplete = false; + $scope.wincount = 1; + var winlen = $scope.CIModuleData.length; + var timeint = null; + var slideId = ""; + timeint = $interval(function () { + + if ($scope.readyToLoad == true) { + var windata = $scope.CIModuleData[$scope.wincount - 1]; + slideId = windata.slideId; + $scope.openBodyView(windata); + + } + $scope.readyToLoad = false; + if ($scope.wincount < winlen && $rootScope.CIWindowLoadComplete == true) { + $scope.wincount = $scope.wincount + 1; + $rootScope.CIWindowLoadComplete = false; + $scope.readyToLoad = true; + } + + if ($scope.wincount == winlen && $rootScope.CIWindowLoadComplete == true) { + $scope.stopInterval(); + $scope.$emit("LoadModuleComplete", "ATLAS_ANATOMY", slideId); + } + + + }, 100); + + $scope.stopInterval = function () { + if (angular.isDefined(timeint)) { + $interval.cancel(timeint); + timeint = undefined; + } + + }; + } + else { + $scope.openBodyView(null); + } } - $scope.openBodyView = function () { + $scope.openBodyView = function (ciModuleData) { + + if ($rootScope.isCallFromOtherModule == true) { + $scope.ciOpenInOtherModules = ciModuleData; + $rootScope.MULTI_VIEW_ID += 1; + var windowviewid = $rootScope.MULTI_VIEW_ID; + + $scope.initializeCIWindowData(windowviewid, false, $scope.ciOpenInOtherModules.currentWindowId); + + var moduleName = $scope.ciOpenInOtherModules.mType; + $scope.SetCIwindowStoreData(windowviewid, 'moduleName', moduleName); + + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') + promise.then( + function (result) { + var IllustrationData = new jinqJs() + .from(result.root.CIData) + .orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); + + // serial no of imageid + var imageId = $scope.ciOpenInOtherModules.id; + + $scope.SetCIwindowStoreData(windowviewid, 'imageId', imageId); + + var selectedTileData = []; + selectedTileData = new jinqJs() + .from(IllustrationData) + .where('_id == ' + imageId) + .select(); + + + var imageName = selectedTileData[0]._contentImage; + + $scope.SetCIwindowStoreData(windowviewid, 'imageName', imageName); + + var imagePath = "~/../content/images/ci/images/" + imageName; + + $scope.SetCIwindowStoreData(windowviewid, 'CIImagePath', imagePath); + + var selectedImageCISummary = selectedTileData[0]._Summary + + $scope.SetCIwindowStoreData(windowviewid, 'ImageSummary', selectedImageCISummary); + + var ciTitle = $scope.ciOpenInOtherModules.anatomyTitle; + $scope.SetCIwindowStoreData(windowviewid, 'currentViewTitle', ciTitle); + localStorage.setItem("currentViewTitle", ciTitle); + + // store image for export + $rootScope.StoreTitleName(ciTitle); + $rootScope.StoreOrgImageName(selectedTileData[0]._contentImage); + + $scope.SetCIwindowStoreData(windowviewid, 'parentSlugName', ($location.url()).replace('/', '')); + + $scope.loadCIllustration(windowviewid); + + }, + function (error) { + // handle errors here + console.log(' $scope.CIllustrationData = ' + error.statusText); + } + + ); + + + } + else { + $scope.SetCIwindowStoreData($rootScope.MULTI_VIEW_ID, 'parentSlugName', 'clinical-illustrations'); + $scope.loadCIllustration($rootScope.MULTI_VIEW_ID); + } + + + + } + + $scope.loadCIllustration = function (windowviewid) { if ($rootScope.refreshcheck == null) { $location.path('/'); } + + $scope.jsPanelID = 'ciImagePanel' + '_' + windowviewid; + var selectedCIImage = $scope.GetCIwindowStoreData(windowviewid, 'CIImagePath'); + + var selectedImageCISummary = $scope.GetCIwindowStoreData(windowviewid, 'ImageSummary'); + var tittle = $scope.GetCIwindowStoreData(windowviewid, 'currentViewTitle'); + var imageId = $scope.GetCIwindowStoreData(windowviewid, 'imageId'); + + + $.jsPanel({ + id: $scope.jsPanelID, + selector: '.ciView', + theme: 'success', + currentController: 'CIController', + parentSlug: $scope.GetCIwindowStoreData(windowviewid, 'parentSlugName'), + content: '
' + + '
' + + '
' + + '

' + selectedImageCISummary + '

' + + '
' + + '
', + title: $rootScope.getLocalStorageValue("currentViewTitle"), + position: { + top: 70, + left: 15, + }, + + size: { width: $(window).outerWidth() - 30, height: $(window).outerHeight() - 125 }, - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - $scope.voId = $rootScope.getLocalStorageValue("currentBodyViewId"); - - var counter = 1; - var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); - localStorage.setItem("currentViewTitle", tittle); - + }); - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') - promise.then( - function (result) { - $scope.CIllustrationData = result; - $scope.CIlistViewData = $scope.CIllustrationData.root.CIData; - - var clickedCIImage = []; - clickedCIImage = new jinqJs() - .from($scope.CIlistViewData) - .where('_id == ' + $scope.voId) - .select('_contentImage'); - - // store image for export - var tittle = $rootScope.getLocalStorageValue("currentViewTitle"); - $rootScope.StoreTitleName(tittle); - $rootScope.StoreOrgImageName(clickedCIImage[0]._contentImage); - - - $scope.clickedCIImage = "~/../content/images/ci/images/" + clickedCIImage[0]._contentImage; - - var clickedCISummary = []; - clickedCISummary = new jinqJs() - .from($scope.CIlistViewData) - .where('_id == ' + $scope.voId) - .select('_Summary'); - - $scope.clickedCISummary = clickedCISummary[0]._Summary - - if (clickedCIImage.length > 0 && clickedCISummary.length > 0) { - - $.jsPanel({ - id: 'ciImagePanel', - selector: '.ciView', - theme: 'success', - currentController: 'CIController', - parentSlug: 'clinical-illustrations', - content: '
' + - '
' + - '
' + - '

' + $scope.clickedCISummary + '

' + - '
' + - '
', - title: $rootScope.getLocalStorageValue("currentViewTitle"), - position: { - top: 70, - left: 15, - }, - - size: { width: $(window).outerWidth() - 30, height: $(window).outerHeight() - 125 }, - - }); - - - $('#canvasDiv img').load(function () { - - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); - }); - - $rootScope.currentSlug = 'clinical-illustrations-detail'; - - $rootScope.openViews.push( - { - "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, - "slug": $rootScope.currentSlug - }); - - - $("#ciImagePanel .img-thumbnail").css("height", $("#ciImagePanel .jsPanel-content").height()); - var jspContentHeight = $('.jsPanel-content').height(); - - // console.log($rootScope.OpenAdamImages); - $('#CIView').css("height", $(window).outerHeight() - 65); - $('#CIView').css("width", $(window).outerWidth() - 15); + $('#canvasDivCI_' + windowviewid + ' img').load(function () { - var canvasDIvHeight = parseInt($('#aiImagePanel').outerHeight()) - 90; + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + }); - $('#canvasDiv').css('height', canvasDIvHeight); - } + $scope.SetCIwindowStoreData(windowviewid, 'currentSlug', 'clinical-illustrations-detail'); + $rootScope.openViews.push( + { + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": imageId, + "slug": $scope.GetCIwindowStoreData(windowviewid, 'currentSlug') + }); - }, - function (error) { - // handle errors here - console.log(' $scope.CIllustrationData = ' + error.statusText); - } - ); + $("#" + $scope.jsPanelID + " .img-thumbnail").css("height", $("#" + $scope.jsPanelID + " .jsPanel-content").height()); + var jspContentHeight = $('.jsPanel-content').height(); + // console.log($rootScope.OpenAdamImages); + $('#CIView').css("height", $(window).outerHeight() - 65); + + $('#CIView').css("width", $(window).outerWidth() - 15); + + var canvasDIvHeight = parseInt($("#" + $scope.jsPanelID).outerHeight()) - 90; + + $('#canvasDivCI_' + windowviewid).css('height', canvasDIvHeight); + } $scope.$on('annotationToolEvent', function (event, data) { @@ -756,53 +878,42 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.FreeStylePaint(); }); - $scope.ReloadListViewImageDiv = function (id) { + $scope.ReloadListViewImageDiv = function (id, windowviewid) { //console.log(id); $scope.idSelected = id; $scope.hiderow = true; - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') - promise.then( - function (result) { - $scope.IllustrationData = result; + + var IllustrationData = $scope.GetCIwindowStoreData(windowviewid, 'IllustrationData'); - var SelectedCIthumbImage = []; - SelectedCIthumbImage = new jinqJs() - .from($scope.IllustrationData.root.CIData) - .where('_id = ' + id) - .select('_ThumbnailImage', '_Summary', '_id', '_Title'); + var SelectedCIthumbImage = []; + SelectedCIthumbImage = new jinqJs() + .from(IllustrationData) + .where('_id = ' + id) + .select('_ThumbnailImage', '_Summary', '_id', '_Title'); - $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage; - $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary; - $scope.SelectedCIId = SelectedCIthumbImage[0]._id; - $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title; + $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage; + $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary; + $scope.SelectedCIId = SelectedCIthumbImage[0]._id; + $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title; - //Set the scroll position of the tablebody to show selected row. + //Set the scroll position of the tablebody to show selected row. - var curCIListViewScroll = $rootScope.getLocalStorageValue("CIListViewScroll"); - if (typeof (curCIListViewScroll) !== "undefined" && curCIListViewScroll !== null && curCIListViewScroll !== '') { - if (typeof InstallTrigger !== 'undefined') - { + var curCIListViewScroll = $rootScope.getLocalStorageValue("CIListViewScroll"); + if (typeof (curCIListViewScroll) !== "undefined" && curCIListViewScroll !== null && curCIListViewScroll !== '') { + if (typeof InstallTrigger !== 'undefined') + { - $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("CIListViewScroll") }); - } - else - { + $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("CIListViewScroll") }); + } + else + { - $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("CIListViewScroll")); - } + $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("CIListViewScroll")); + } - } - //else { - // $('#ListViewDiv').scrollTop(0); - //} - - }, - function (error) { - // handle errors here - console.log(' $scope.AnimationData = ' + error.statusText); - } - ); + } + }; $scope.hideListViewDiv = function () { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/ci/clinical-illustrations-detail.html b/400-SOURCECODE/AIAHTML5.Web/app/views/ci/clinical-illustrations-detail.html index b5b3df6..a599678 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/ci/clinical-illustrations-detail.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/ci/clinical-illustrations-detail.html @@ -1,6 +1,6 @@ 
-
+