diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index e2572df..768cb23 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -1,20 +1,26 @@ AIA.controller("CIController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "pages", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "MedicalSpecialties", "DataService", function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout, pages, BodyRegions, BodySystems, ViewOrientations, ImageTypes, MedicalSpecialties, DataService) { - // $rootScope.currentActiveModuleTitle = pages[3].name; - $scope.showTabButton = true; - $scope.IllustrationData; + + $scope.CIAllBodyRegion = []; $scope.CIAllBodySystem = []; $scope.CIAllOrientation = []; $scope.CIAllImageType = []; $scope.CIAllSpeciality = []; + $scope.selectedCIListViewData = []; + + //************************************ + + $scope.showTabButton = true; + // $scope.IllustrationData; + $scope.searchCIListViewData = []; $scope.SelectedCIthumbImage = []; $scope.SelectedCIImage = []; $scope.SelectedCISummary = []; $scope.SelectedCIId = []; $scope.SelectedCITitle = []; - $scope.selectedCIListViewData = []; + $scope.filterstring = false; $scope.idSelected; $scope.srollListView; @@ -30,8 +36,138 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.activeTab = tabToSet; localStorage.setItem("currentCITabView", $scope.activeTab); }; + + $scope.initializeCIWindowData = function (windowviewid, isOpenWithExistsModule, cbwindowid) { + if (isOpenWithExistsModule || cbwindowid == 0) { + if ($rootScope.CIWindowData != undefined) { + $rootScope.CIWindowData.length = 0; + } + else { + $rootScope.CIWindowData = []; + } + + $rootScope.CIWindowData.push( + { + 'multiwinid': windowviewid, + 'IllustrationData':[], + 'moduleName': '', + 'currentViewTitle': '', + 'parentSlugName': '', + 'sliderPercentValue': 1, + 'imageId': '', + 'imageName': '', + 'bodySystemName': '', + 'OpenItemImagePath': '', + 'isBodySystemSelected': false, + 'typeOfEvent': '', + 'selectedSystemName': null, + 'SelectedSystemID': 0 + + }); + + } + else { + var isNewWindow = true; + for (var k = 0; k < $rootScope.CIWindowData.length; k++) { + if ($rootScope.CIWindowData[k].multiwinid == windowviewid) { + isNewWindow = false; + break; + } + } + + if (isNewWindow) { + $rootScope.CIWindowData.push( + { + 'multiwinid': windowviewid, + 'IllustrationData': [], + 'moduleName': '', + 'currentViewTitle': '', + 'parentSlugName': '', + 'sliderPercentValue': 1, + 'imageId': '', + 'imageName': '', + 'bodySystemName': '', + 'OpenItemImagePath': '', + 'isBodySystemSelected': false, + 'typeOfEvent': '', + 'selectedSystemName': null, + 'SelectedSystemID': 0 + + }); + + } + } + } + + $scope.GetCIwindowStoreData = function (windowviewid, keyname) { + for (var x = 0 ; x < $rootScope.CIWindowData.length; x++) { + + if ($rootScope.CIWindowData[x].multiwinid == windowviewid) { + return $rootScope.CIWindowData[x][keyname]; + } + } + } + + $scope.SetCIwindowStoreData = function (windowviewid, keyname, value) { + for (var x = 0 ; x < $rootScope.CIWindowData.length; x++) { + + if ($rootScope.CIWindowData[x].multiwinid == windowviewid) { + $rootScope.CIWindowData[x][keyname] = value; + } + } + } + + $rootScope.GetCIWindowId = function () { + // handle for single window + if ($rootScope.CIWindowData.length > 0) { + for (var x = 0 ; x < $rootScope.CIWindowData.length; x++) { + + return $rootScope.CIWindowData[x].multiwinid; + } + } + else return 0; + } + + $scope.DisableUI = function () { + + var ciImagePanelConetent = document.getElementsByClassName("jsPanel-content"); + for (var i = 0; i < ciImagePanelConetent.length; i++) { + ciImagePanelConetent[i].style.pointerEvents = "none"; + ciImagePanelConetent[i].style.opacity = "0.7"; + + } + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + + // CB module disable all + $('#CBDetailPageDiv').css('pointer-events', 'none'); + $('#CBDetailPageDiv').css('opacity', '0.7'); + } + + $scope.EnableUI = function () { + + var ciImagePanelConetent = document.getElementsByClassName("jsPanel-content"); + for (var i = 0; i < ciImagePanelConetent.length; i++) { + ciImagePanelConetent[i].style.pointerEvents = "auto"; + ciImagePanelConetent[i].style.opacity = "1"; + } + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + // CB module enable all + $('#CBDetailPageDiv').css('pointer-events', 'auto'); + $('#CBDetailPageDiv').css('opacity', '1'); + } + $scope.loadAIModuleById = function (moduleId) { + $rootScope.isCallFromOtherModule = undefined; + + $rootScope.MULTI_VIEW_ID += 1 + + $scope.initializeCIWindowData($rootScope.MULTI_VIEW_ID, true, undefined); + + $scope.DisableUI(); if ($rootScope.refreshcheck == null) { $location.path('/'); @@ -50,7 +186,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.currentActiveModuleTitle = selectedModuleName; }) - $scope.LoadCIJsonData(); + $scope.SetCIwindowStoreData($rootScope.MULTI_VIEW_ID, 'moduleName', "Clinical Illustrations"); + + $scope.LoadCIJsonData($rootScope.MULTI_VIEW_ID); $scope.CIAllBodyRegion = BodyRegions; $scope.CIAllBodySystem = BodySystems; @@ -63,28 +201,31 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //set the local storage + setTimeout(function () { var curtab = $rootScope.getLocalStorageValue("currentCITabView"); if (curtab == 2) { $scope.setActiveTab(2); var curSelectedRowId = $rootScope.getLocalStorageValue("CISelectedRowId"); if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') { - $scope.reRunSearchOnLoad(); + $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID); $scope.idSelected = curSelectedRowId; $scope.ReloadListViewImageDiv($scope.idSelected); } else { - $scope.reRunSearchOnLoad() + $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID) $scope.idSelected = ''; } } else { $scope.setActiveTab(1); - $scope.reRunSearchOnLoad(); + $scope.reRunSearchOnLoad($rootScope.MULTI_VIEW_ID); } + + }, 200); } - $scope.reRunSearchOnLoad = function () { + $scope.reRunSearchOnLoad = function (windowviewid) { var curBodyRegion = $rootScope.getLocalStorageValue("CICurBodyRegion"); if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') { @@ -128,7 +269,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedorientation == "" && $scope.query.selectedimagetype == "" && $scope.query.selectedspecialty == "") { - $scope.loadAllCI(); + $scope.loadAllCI(windowviewid); } else { $scope.ApplySearch($scope.query); @@ -136,19 +277,24 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } - $scope.LoadCIJsonData = function () { + $scope.LoadCIJsonData = function (windowviewid) { var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') promise.then( function (result) { - $scope.IllustrationData = result; - $scope.selectedCIListViewData = new jinqJs() - .from($scope.IllustrationData.root.CIData) + + var IllustrationData = new jinqJs() + .from(result.root.CIData) .orderBy([{ field: '_Title', sort: 'asc' }]) .select(); + $scope.SetCIwindowStoreData(windowviewid, 'IllustrationData', IllustrationData); + + $scope.selectedCIListViewData = IllustrationData; + }, function (error) { + $scope.EnableUI(); // handle errors here console.log(' $scope.IllustrationData = ' + error.statusText); } @@ -157,63 +303,28 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout }; - $scope.loadAllCI = function () { - $('#ciSpinner').css('visibility', 'visible'); - $('#ciSpinner').css('zIndex', '20000'); - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') - promise.then( - function (result) { - $scope.IllustrationData = result; - - $scope.selectedCIListViewData = new jinqJs() - .from($scope.IllustrationData.root.CIData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); - - // console.log($scope.selectedCIListViewData); - - - - $('#grid-view').empty(); - var $e1 = $('').appendTo('#grid-view'); - $compile($e1)($scope); - //angular.forEach($scope.selectedCIListViewData, function (value, key) { - // $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage; - - // var $el = $('
' - // + '
' - // + '' - // + '

' + value._Title + '

').appendTo('#grid-view'); - + $scope.loadAllCI = function (windowviewid) { - // $compile($el)($scope); + $scope.selectedCIListViewData = $scope.GetCIwindowStoreData(windowviewid, 'IllustrationData'); - // $(".sidebar").mCustomScrollbar({ - // autoHideScrollbar: true, - // //theme:"rounded" - // }); - - //}); - $timeout(function () - { - $('#' + $rootScope.getLocalStorageValue("currentBodyViewId")).find('.thumbnail').addClass('HightLightThumbnail'); - if ($rootScope.getLocalStorageValue('CIGridViewScroll') !== null && $location.url() == "/clinical-illustrations") { - $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('CIGridViewScroll') }); - } - }, 100); + $('#grid-view').empty(); + var $e1 = $('').appendTo('#grid-view'); + $compile($e1)($scope); + + $timeout(function () + { + $('#' + $rootScope.getLocalStorageValue("currentBodyViewId")).find('.thumbnail').addClass('HightLightThumbnail'); + if ($rootScope.getLocalStorageValue('CIGridViewScroll') !== null && $location.url() == "/clinical-illustrations") { + $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('CIGridViewScroll') }); + } + }, 100); - $timeout(function () { $('#ciSpinner').css('visibility', 'hidden'); }, 300); - }, - function (error) { - // handle errors here - console.log(' $scope.IllustrationData = ' + error.statusText); - } - ); - + $timeout(function () { $scope.EnableUI(); }, 400); + } $scope.IsVisible = function () { @@ -262,7 +373,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } }; - $scope.Reset = function (query) { + $scope.Reset = function (query, windowviewid) { + + if (windowviewid == undefined) // call from also home controller list manager + windowviewid = $rootScope.MULTI_VIEW_ID; query.selectedbodyregion = ""; query.selectedbodysystem = ""; @@ -291,21 +405,21 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $scope.searchCIListViewData.pop(); } - $scope.loadAllCI(); + $scope.loadAllCI(windowviewid); } - $scope.ApplySearch = function (query) { + $scope.ApplySearch = function (query, windowviewid) { - - $scope.filterstring = true; - - while ($scope.searchCIListViewData.length) { - $scope.searchCIListViewData.pop(); + if (windowviewid == undefined) { + windowviewid = $rootScope.MULTI_VIEW_ID; } + + $scope.DisableUI(); - + $scope.filterstring = true; + filtercount = 0; if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { filtercount = filtercount + 1; @@ -357,139 +471,126 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } + $scope.selectedCIListViewData = $scope.GetCIwindowStoreData(windowviewid, 'IllustrationData'); - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') - promise.then( - function (result) { - $scope.IllustrationData = result; - - $scope.selectedCIListViewData = new jinqJs() - .from($scope.IllustrationData.root.CIData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); - - $('#grid-view').empty(); - - angular.forEach($scope.selectedCIListViewData, function (value, key) { - - var selectimg = true; - var count = 0; + $('#grid-view').empty(); + angular.forEach($scope.selectedCIListViewData, function (value, key) { - if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { - var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim())); - if (posbodyregion > -1) { - selectimg = true; - count = count + 1; + var selectimg = true; + var count = 0; - } - else { - selectimg = false; - count = count - 1; - } - } - - if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { - var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem); - if (posbodysystem > -1) { - count = count + 1; - selectimg = true; - } else { - selectimg = false; - count = count - 1; - } - } - - if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) { - var posorientation = value._ViewOrientation.indexOf(query.selectedorientation); - if (posorientation > -1) { - count = count + 1; - selectimg = true; - - } else { - selectimg = false; - count = count - 1; - } - - } - - if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) { - var posimagetype = value._ImageType.indexOf(query.selectedimagetype); - if (posimagetype > -1) { - count = count + 1; - selectimg = true; - - } else { - selectimg = false; - count = count - 1; - } - - } - - if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== "")) { - var posspeciality = value._MedicalSpecialty.indexOf(query.selectedspecialty); - if (posspeciality > -1) { - count = count + 1; - selectimg = true; - } else { - selectimg = false; - count = count - 1; - } - - } - - if (selectimg === true && count >= filtercount) { - - - $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage; - - var $el = $('
' - + '
' - + '' - + '

' + value._Title + '

').appendTo('#grid-view'); - - - $compile($el)($scope); - - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); - - - $scope.searchCIListViewData.push( - { - "_id": value._id, - "_ImageId": value._ImageId, - "_Title": value._Title, - "_contentImage": value._contentImage, - "_ThumbnailImage": value._ThumbnailImage, - "_BodySystem": value._BodySystem, - "_BodyRegion": value._BodyRegion, - "_ViewOrientation": value._ViewOrientation, - "_MedicalSpecialty": value._MedicalSpecialty, - "_ImageType": value._ImageType, - "_Summary": value._Summary - - }); - } - }); - $('table > #ListViewDiv > #searchItem').remove(); - //Show Error Message in case of gridview if no data is found - if ($scope.searchCIListViewData.length == 0) { - var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); - $compile($el)($scope); - $('table > #ListViewDiv > #searchItem').remove(); + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { + var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim())); + if (posbodyregion > -1) { + selectimg = true; + count = count + 1; + + } + else { + selectimg = false; + count = count - 1; + } + + } + + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { + var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem); + if (posbodysystem > -1) { + count = count + 1; + selectimg = true; + } else { + selectimg = false; + count = count - 1; + } + } + + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) { + var posorientation = value._ViewOrientation.indexOf(query.selectedorientation); + if (posorientation > -1) { + count = count + 1; + selectimg = true; + + } else { + selectimg = false; + count = count - 1; + } + + } + + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) { + var posimagetype = value._ImageType.indexOf(query.selectedimagetype); + if (posimagetype > -1) { + count = count + 1; + selectimg = true; + + } else { + selectimg = false; + count = count - 1; + } + + } + + if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== "")) { + var posspeciality = value._MedicalSpecialty.indexOf(query.selectedspecialty); + if (posspeciality > -1) { + count = count + 1; + selectimg = true; + } else { + selectimg = false; + count = count - 1; + } + + } + + if (selectimg === true && count >= filtercount) { + + + $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage; + + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); + + + $compile($el)($scope); + + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); + + + $scope.searchCIListViewData.push( + { + "_id": value._id, + "_ImageId": value._ImageId, + "_Title": value._Title, + "_contentImage": value._contentImage, + "_ThumbnailImage": value._ThumbnailImage, + "_BodySystem": value._BodySystem, + "_BodyRegion": value._BodyRegion, + "_ViewOrientation": value._ViewOrientation, + "_MedicalSpecialty": value._MedicalSpecialty, + "_ImageType": value._ImageType, + "_Summary": value._Summary + + }); + } + }); + $('table > #ListViewDiv > #searchItem').remove(); + //Show Error Message in case of gridview if no data is found + if ($scope.searchCIListViewData.length == 0) { + var $el = $('
No illustration found for the selected search criteria!
').appendTo('#grid-view'); + $compile($el)($scope); + $('table > #ListViewDiv > #searchItem').remove(); - $('#ListViewDiv').append('No illustration found for the selected search criteria!'); - } - }, - function (error) { - // handle errors here - console.log(' $scope.IllustrationData = ' + error.statusText); - } - ); + $('#ListViewDiv').append('No illustration found for the selected search criteria!'); + } + + $timeout(function () { $scope.EnableUI(); }, 400); } @@ -543,51 +644,11 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); $scope.voId = $rootScope.getLocalStorageValue("currentBodyViewId"); - - - //once you get id in scope push detail in jspanel content - - // var openViews; - // console.log($rootScope.openViews); - // if ($rootScope.openViews.length > 0 && $rootScope.openViews != null && $rootScope.openViews != undefined) { - // alert("entered"); - //for (var i=0; i <= $rootScope.openViews.length - 1; i++) { - // if ($rootScope.openViews[i].BodyViewId == $scope.voId) { - // alert("success"); - // openViews = $rootScope.openViews; - // } - //} - // openViews = $rootScope.openViews; - - - //alert($rootScope.openViews); - //openViews = new jinqJs() - // .from($rootScope.openViews) - // .where("BodyViewId==" + $scope.voId) - // .select(); - //} var counter = 1; var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); localStorage.setItem("currentViewTitle", tittle); - //if (openViews != null && openViews.length > 0 && openViews != undefined) { - // // alert("aaa"); - // console.log(openViews); - // angular.forEach(openViews, function (value, key) { - // if (value.body - views == tittle) { - // tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; - // $rootScope.currentActiveViewTitle = tittle; - // localStorage.setItem("currentViewTitle", tittle); - // } - - // }); - //} - //else { - // localStorage.setItem("currentViewTitle", tittle); - - //} - - //alert($rootScope.getLocalStorageValue("currentViewTitle")); + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json') promise.then( @@ -630,10 +691,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout '
' + '

' + $scope.clickedCISummary + '

' + '
' + - '', - //ajax: { - // url: 'app/views/ci/ci-view-detail.html' - //}, + '', title: $rootScope.getLocalStorageValue("currentViewTitle"), position: { top: 70,