diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index 2bc7fbe..226c53b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -1,766 +1,766 @@ -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.searchCIListViewData = []; - $scope.SelectedCIthumbImage = []; - $scope.SelectedCIImage = []; - $scope.SelectedCISummary = []; - $scope.SelectedCIId = []; - $scope.SelectedCITitle = []; - $scope.selectedCIListViewData = []; - $scope.filterstring = false; - $scope.idSelected; - $scope.srollListView; - $scope.query = { - selectedbodyregion: '', - selectedbodysystem: '', - selectedorientation: '', - selectedimagetype: '', - selectedspecialty: '', - }; - - $scope.setActiveTab = function (tabToSet) { - $scope.activeTab = tabToSet; - localStorage.setItem("currentCITabView", $scope.activeTab); - }; - - $scope.$on('$viewContentLoaded', function (event) { - - if ($rootScope.refreshcheck == null) { - $location.path('/'); - } - // code that will be executed ... - // every time this view is loaded - - //get current path - var currentURL = $location.path(); - var selectedModuleName = ''; - //set module title - angular.forEach($rootScope.userModules, function (value, key) { - if (value.slug === currentURL.replace('/', '')) { - selectedModuleName = value.name; - } - $rootScope.currentActiveModuleTitle = selectedModuleName; - }) - - $scope.LoadCIJsonData(); - - $scope.CIAllBodyRegion = BodyRegions; - $scope.CIAllBodySystem = BodySystems; - $scope.CIAllOrientation = ViewOrientations; - $scope.CIAllImageType = ImageTypes; - $scope.CIAllSpeciality = MedicalSpecialties; - $scope.scroll(); - //push the details of open module in array $rootScope.openModules - $rootScope.openModules.push({ "ModuleId": 4 }); - - //set the local storage - - 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.idSelected = curSelectedRowId; - $scope.ReloadListViewImageDiv($scope.idSelected); - } - else { - $scope.reRunSearchOnLoad() - $scope.idSelected = ''; - } - } - else { - $scope.setActiveTab(1); - $scope.reRunSearchOnLoad(); - - } - - - }); - - $scope.reRunSearchOnLoad = function () { - - var curBodyRegion = $rootScope.getLocalStorageValue("CICurBodyRegion"); - if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') { - $scope.query.selectedbodyregion = curBodyRegion; - } - else { - $scope.query.selectedbodyregion = ""; - } - - var curBodySystem = $rootScope.getLocalStorageValue("CICurBodySystem"); - if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null && curBodySystem !== '') { - $scope.query.selectedbodysystem = curBodySystem; - } - else { - $scope.query.selectedbodysystem = ""; - } - - var curOrientation = $rootScope.getLocalStorageValue("CICurOrientation"); - if (typeof (curOrientation) !== "undefined" && curOrientation !== null && curOrientation !== '') { - $scope.query.selectedorientation = curOrientation; - } - else { - $scope.query.selectedorientation = ""; - } - - var curImageType = $rootScope.getLocalStorageValue("CICurImageType"); - if (typeof (curImageType) !== "undefined" && curImageType !== null && curImageType !== '') { - $scope.query.selectedimagetype = curImageType; - } - else { - $scope.query.selectedimagetype = ""; - } - - var curSpeciality = $rootScope.getLocalStorageValue("CICurSpeciality"); - if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null && curSpeciality !== '') { - $scope.query.selectedspecialty = curSpeciality; - } - else { - $scope.query.selectedspecialty = ""; - } - - - if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedorientation == "" && $scope.query.selectedimagetype == "" && $scope.query.selectedspecialty == "") { - $scope.loadAllCI(); - } - else { - $scope.ApplySearch($scope.query); - } - - } - - $scope.LoadCIJsonData = function () { - - 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(); - - }, - function (error) { - // handle errors here - console.log(' $scope.IllustrationData = ' + error.statusText); - } - ); - - - }; - - $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'); - - - // $compile($el)($scope); - - // $(".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); - - - $timeout(function () { $('#ciSpinner').css('visibility', 'hidden'); }, 300); - }, - function (error) { - // handle errors here - console.log(' $scope.IllustrationData = ' + error.statusText); - } - ); - - } - - $scope.IsVisible = function () { - $scope.scroll(); - - } - - $scope.showItem = function (id) { - $scope.idSelected = id; - localStorage.setItem("CISelectedRowId", id); - - //Set the vertical scroll value of the table. - var y = $('#ListViewDiv').scrollTop(); - localStorage.setItem("CIListViewScroll", y); - - $scope.hiderow = true; - if ($scope.filterstring == false) { - - var SelectedCIthumbImage = []; - SelectedCIthumbImage = new jinqJs() - .from($scope.selectedCIListViewData) - .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; - - } - else { - if ($scope.searchCIListViewData.length > 0) { - - var SelectedCIthumbImage = []; - SelectedCIthumbImage = new jinqJs() - .from($scope.searchCIListViewData) - .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.Reset = function (query) { - - query.selectedbodyregion = ""; - query.selectedbodysystem = ""; - query.selectedorientation = ""; - query.selectedimagetype = ""; - query.selectedspecialty = ""; - - - //set localstorage values - localStorage.setItem("CICurBodyRegion", ''); - localStorage.setItem("CICurBodySystem", ''); - localStorage.setItem("CICurOrientation", ''); - localStorage.setItem("CICurImageType", ''); - localStorage.setItem("CICurSpeciality", ''); - localStorage.setItem("CISelectedRowId", ""); - localStorage.setItem("CIListViewScroll", ''); - - if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } - - $('#ListViewDiv').scrollTop(0); - - $scope.hideListViewDiv(); - - $scope.filterstring = false; - while ($scope.searchCIListViewData.length) { - $scope.searchCIListViewData.pop(); - } - - $scope.loadAllCI(); - - } - - $scope.ApplySearch = function (query) { - - - $scope.filterstring = true; - - while ($scope.searchCIListViewData.length) { - $scope.searchCIListViewData.pop(); - } - - - - filtercount = 0; - if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { - filtercount = filtercount + 1; - - localStorage.setItem("CICurBodyRegion", query.selectedbodyregion); - - } - else { - localStorage.setItem("CICurBodyRegion", ''); - - } - - if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { - filtercount = filtercount + 1; - localStorage.setItem("CICurBodySystem", query.selectedbodysystem); - - } - else { - localStorage.setItem("CICurBodySystem", ''); - - } - - if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) { - filtercount = filtercount + 1; - localStorage.setItem("CICurOrientation", query.selectedorientation); - - } - else { - localStorage.setItem("CICurOrientation", ''); - } - - if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) { - filtercount = filtercount + 1; - localStorage.setItem("CICurImageType", query.selectedimagetype); - - } - else { - localStorage.setItem("CICurImageType", ''); - - } - - if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== '')) { - filtercount = filtercount + 1; - localStorage.setItem("CICurSpeciality", query.selectedspecialty); - - } - else { - localStorage.setItem("CICurSpeciality", ''); - - } - - - 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; - - - 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); - } - ); - } - - - $scope.scroll = function () { - $("html,body").scrollTop(0); - } - - - $scope.openView = function ($event) { - - $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() - .from($scope.selectedCIListViewData) - .where('_id = ' + $event.currentTarget.id) - .select('_Title'); - - // console.log(CITitle); - // console.log($scope.selectedCIListViewData); - - $rootScope.ViewTitle = CITitle[0]._Title; - } - else { - $rootScope.ViewTitle = $event.currentTarget.textContent; - - } - - localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); - localStorage.setItem("currentBodyViewId", $event.currentTarget.id); - - //Set the vertical scroll value of the Grid-View. - var y = $($window).scrollTop(); - localStorage.setItem("CIGridViewScroll", y); - var u = $location.url(); - $location.url('/clinical-illustrations-detail'); - - // console.log($location.url('/clinical-illustrations-detail')); - - } - - $scope.openBodyView = function () { - - if ($rootScope.refreshcheck == null) { - $location.path('/'); - } - - $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( - 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'); - - $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 + '

' + - '
' + - '
', - //ajax: { - // url: 'app/views/ci/ci-view-detail.html' - //}, - title: $rootScope.getLocalStorageValue("currentViewTitle"), - position: { - top: 70, - left: 20, - }, - - size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 110 }, - - }); - - - $('#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(); - //var imgHeight = $('.img-thumbnail').find('img').height(); - //if (imgHeight <= 0) - // imgHeight = 320; - //var textH = $('.img-subtitle').height(); - //textH = textH + 40; - //var blackBorderHeight = jspContentHeight - (imgHeight + textH); - //if ($('.jsPanel-content').length > 0) { - // $('.img-subtitle').css('margin-bottom', blackBorderHeight); - //} - } - - - }, - function (error) { - // handle errors here - console.log(' $scope.CIllustrationData = ' + error.statusText); - } - - ); - - // console.log($rootScope.openViews); - $('#CIView').css("height", $(window).outerHeight()); - - $('#CIView').css("width", $(window).outerWidth()); - - } - - $scope.$on('annotationToolEvent', function (event, data) { - - $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)") - $('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" }); - $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)") - $('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" }); - - $("#canvas").css("display", "block"); - $("#canvasPaint").css("display", "block"); - - $rootScope.onDrawingCanvasClick(); - $rootScope.FreeStylePaint(); - }); - - $scope.ReloadListViewImageDiv = function (id) { - //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 SelectedCIthumbImage = []; - SelectedCIthumbImage = new jinqJs() - .from($scope.IllustrationData.root.CIData) - .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; - - //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') - { - - $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("CIListViewScroll") }); - } - else - { - - $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("CIListViewScroll")); - } - - } - //else { - // $('#ListViewDiv').scrollTop(0); - //} - - }, - function (error) { - // handle errors here - console.log(' $scope.AnimationData = ' + error.statusText); - } - ); - }; - - $scope.hideListViewDiv = function () { - if ($rootScope.getLocalStorageValue("currentCITabView") == 2) { - localStorage.setItem("CISelectedRowId", ""); - if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } - $scope.hiderow = false; - } - } - - - -}] -); - - - - +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.searchCIListViewData = []; + $scope.SelectedCIthumbImage = []; + $scope.SelectedCIImage = []; + $scope.SelectedCISummary = []; + $scope.SelectedCIId = []; + $scope.SelectedCITitle = []; + $scope.selectedCIListViewData = []; + $scope.filterstring = false; + $scope.idSelected; + $scope.srollListView; + $scope.query = { + selectedbodyregion: '', + selectedbodysystem: '', + selectedorientation: '', + selectedimagetype: '', + selectedspecialty: '', + }; + + $scope.setActiveTab = function (tabToSet) { + $scope.activeTab = tabToSet; + localStorage.setItem("currentCITabView", $scope.activeTab); + }; + + $scope.$on('$viewContentLoaded', function (event) { + + if ($rootScope.refreshcheck == null) { + $location.path('/'); + } + // code that will be executed ... + // every time this view is loaded + + //get current path + var currentURL = $location.path(); + var selectedModuleName = ''; + //set module title + angular.forEach($rootScope.userModules, function (value, key) { + if (value.slug === currentURL.replace('/', '')) { + selectedModuleName = value.name; + } + $rootScope.currentActiveModuleTitle = selectedModuleName; + }) + + $scope.LoadCIJsonData(); + + $scope.CIAllBodyRegion = BodyRegions; + $scope.CIAllBodySystem = BodySystems; + $scope.CIAllOrientation = ViewOrientations; + $scope.CIAllImageType = ImageTypes; + $scope.CIAllSpeciality = MedicalSpecialties; + $scope.scroll(); + //push the details of open module in array $rootScope.openModules + $rootScope.openModules.push({ "ModuleId": 4 }); + + //set the local storage + + 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.idSelected = curSelectedRowId; + $scope.ReloadListViewImageDiv($scope.idSelected); + } + else { + $scope.reRunSearchOnLoad() + $scope.idSelected = ''; + } + } + else { + $scope.setActiveTab(1); + $scope.reRunSearchOnLoad(); + + } + + + }); + + $scope.reRunSearchOnLoad = function () { + + var curBodyRegion = $rootScope.getLocalStorageValue("CICurBodyRegion"); + if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') { + $scope.query.selectedbodyregion = curBodyRegion; + } + else { + $scope.query.selectedbodyregion = ""; + } + + var curBodySystem = $rootScope.getLocalStorageValue("CICurBodySystem"); + if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null && curBodySystem !== '') { + $scope.query.selectedbodysystem = curBodySystem; + } + else { + $scope.query.selectedbodysystem = ""; + } + + var curOrientation = $rootScope.getLocalStorageValue("CICurOrientation"); + if (typeof (curOrientation) !== "undefined" && curOrientation !== null && curOrientation !== '') { + $scope.query.selectedorientation = curOrientation; + } + else { + $scope.query.selectedorientation = ""; + } + + var curImageType = $rootScope.getLocalStorageValue("CICurImageType"); + if (typeof (curImageType) !== "undefined" && curImageType !== null && curImageType !== '') { + $scope.query.selectedimagetype = curImageType; + } + else { + $scope.query.selectedimagetype = ""; + } + + var curSpeciality = $rootScope.getLocalStorageValue("CICurSpeciality"); + if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null && curSpeciality !== '') { + $scope.query.selectedspecialty = curSpeciality; + } + else { + $scope.query.selectedspecialty = ""; + } + + + if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedorientation == "" && $scope.query.selectedimagetype == "" && $scope.query.selectedspecialty == "") { + $scope.loadAllCI(); + } + else { + $scope.ApplySearch($scope.query); + } + + } + + $scope.LoadCIJsonData = function () { + + 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(); + + }, + function (error) { + // handle errors here + console.log(' $scope.IllustrationData = ' + error.statusText); + } + ); + + + }; + + $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'); + + + // $compile($el)($scope); + + // $(".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); + + + $timeout(function () { $('#ciSpinner').css('visibility', 'hidden'); }, 300); + }, + function (error) { + // handle errors here + console.log(' $scope.IllustrationData = ' + error.statusText); + } + ); + + } + + $scope.IsVisible = function () { + $scope.scroll(); + + } + + $scope.showItem = function (id) { + $scope.idSelected = id; + localStorage.setItem("CISelectedRowId", id); + + //Set the vertical scroll value of the table. + var y = $('#ListViewDiv').scrollTop(); + localStorage.setItem("CIListViewScroll", y); + + $scope.hiderow = true; + if ($scope.filterstring == false) { + + var SelectedCIthumbImage = []; + SelectedCIthumbImage = new jinqJs() + .from($scope.selectedCIListViewData) + .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; + + } + else { + if ($scope.searchCIListViewData.length > 0) { + + var SelectedCIthumbImage = []; + SelectedCIthumbImage = new jinqJs() + .from($scope.searchCIListViewData) + .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.Reset = function (query) { + + query.selectedbodyregion = ""; + query.selectedbodysystem = ""; + query.selectedorientation = ""; + query.selectedimagetype = ""; + query.selectedspecialty = ""; + + + //set localstorage values + localStorage.setItem("CICurBodyRegion", ''); + localStorage.setItem("CICurBodySystem", ''); + localStorage.setItem("CICurOrientation", ''); + localStorage.setItem("CICurImageType", ''); + localStorage.setItem("CICurSpeciality", ''); + localStorage.setItem("CISelectedRowId", ""); + localStorage.setItem("CIListViewScroll", ''); + + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } + + $('#ListViewDiv').scrollTop(0); + + $scope.hideListViewDiv(); + + $scope.filterstring = false; + while ($scope.searchCIListViewData.length) { + $scope.searchCIListViewData.pop(); + } + + $scope.loadAllCI(); + + } + + $scope.ApplySearch = function (query) { + + + $scope.filterstring = true; + + while ($scope.searchCIListViewData.length) { + $scope.searchCIListViewData.pop(); + } + + + + filtercount = 0; + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) { + filtercount = filtercount + 1; + + localStorage.setItem("CICurBodyRegion", query.selectedbodyregion); + + } + else { + localStorage.setItem("CICurBodyRegion", ''); + + } + + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) { + filtercount = filtercount + 1; + localStorage.setItem("CICurBodySystem", query.selectedbodysystem); + + } + else { + localStorage.setItem("CICurBodySystem", ''); + + } + + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) { + filtercount = filtercount + 1; + localStorage.setItem("CICurOrientation", query.selectedorientation); + + } + else { + localStorage.setItem("CICurOrientation", ''); + } + + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) { + filtercount = filtercount + 1; + localStorage.setItem("CICurImageType", query.selectedimagetype); + + } + else { + localStorage.setItem("CICurImageType", ''); + + } + + if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== '')) { + filtercount = filtercount + 1; + localStorage.setItem("CICurSpeciality", query.selectedspecialty); + + } + else { + localStorage.setItem("CICurSpeciality", ''); + + } + + + 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; + + + 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); + } + ); + } + + + $scope.scroll = function () { + $("html,body").scrollTop(0); + } + + + $scope.openView = function ($event) { + + $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() + .from($scope.selectedCIListViewData) + .where('_id = ' + $event.currentTarget.id) + .select('_Title'); + + // console.log(CITitle); + // console.log($scope.selectedCIListViewData); + + $rootScope.ViewTitle = CITitle[0]._Title; + } + else { + $rootScope.ViewTitle = $event.currentTarget.textContent; + + } + + localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); + localStorage.setItem("currentBodyViewId", $event.currentTarget.id); + + //Set the vertical scroll value of the Grid-View. + var y = $($window).scrollTop(); + localStorage.setItem("CIGridViewScroll", y); + var u = $location.url(); + $location.url('/clinical-illustrations-detail'); + + // console.log($location.url('/clinical-illustrations-detail')); + + } + + $scope.openBodyView = function () { + + if ($rootScope.refreshcheck == null) { + $location.path('/'); + } + + $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( + 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'); + + $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 + '

' + + '
' + + '
', + //ajax: { + // url: 'app/views/ci/ci-view-detail.html' + //}, + title: $rootScope.getLocalStorageValue("currentViewTitle"), + position: { + top: 70, + left: 20, + }, + + size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 110 }, + + }); + + + $('#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(); + //var imgHeight = $('.img-thumbnail').find('img').height(); + //if (imgHeight <= 0) + // imgHeight = 320; + //var textH = $('.img-subtitle').height(); + //textH = textH + 40; + //var blackBorderHeight = jspContentHeight - (imgHeight + textH); + //if ($('.jsPanel-content').length > 0) { + // $('.img-subtitle').css('margin-bottom', blackBorderHeight); + //} + } + + + }, + function (error) { + // handle errors here + console.log(' $scope.CIllustrationData = ' + error.statusText); + } + + ); + + // console.log($rootScope.openViews); + $('#CIView').css("height", $(window).outerHeight()); + + $('#CIView').css("width", $(window).outerWidth()); + + } + + $scope.$on('annotationToolEvent', function (event, data) { + + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)") + $('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" }); + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)") + $('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" }); + + $("#canvas").css("display", "block"); + $("#canvasPaint").css("display", "block"); + + $rootScope.onDrawingCanvasClick(); + $rootScope.FreeStylePaint(); + }); + + $scope.ReloadListViewImageDiv = function (id) { + //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 SelectedCIthumbImage = []; + SelectedCIthumbImage = new jinqJs() + .from($scope.IllustrationData.root.CIData) + .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; + + //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') + { + + $('#ListViewDiv').animate({ scrollTop: $rootScope.getLocalStorageValue("CIListViewScroll") }); + } + else + { + + $('#ListViewDiv').scrollTop($rootScope.getLocalStorageValue("CIListViewScroll")); + } + + } + //else { + // $('#ListViewDiv').scrollTop(0); + //} + + }, + function (error) { + // handle errors here + console.log(' $scope.AnimationData = ' + error.statusText); + } + ); + }; + + $scope.hideListViewDiv = function () { + if ($rootScope.getLocalStorageValue("currentCITabView") == 2) { + localStorage.setItem("CISelectedRowId", ""); + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); } + $scope.hiderow = false; + } + } + + + +}] +); + + + + diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/Link/Link-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/Link/Link-view.html index 756a49b..0329f61 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/Link/Link-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/Link/Link-view.html @@ -1,34 +1,34 @@ -
-
-
-
- - -
-
-
- - - - +
+
+
+
+ + +
+
+
+ + + +