From d7ebbfa510b48c6068724eb7e84f18fc4f088ba1 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 31 Aug 2018 17:40:54 +0530 Subject: [PATCH] fixed 3d anatomy bug i.e when user goes back open a view again view does not appear. --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js | 423 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1 file changed, 213 insertions(+), 210 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index b6d5265..bc9b8f2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -1,211 +1,214 @@ -AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", -function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) { - - - $scope.showTabButton = false; - $scope.threeDAnatomyData; - $scope.Id; - $scope.$on('$viewContentLoaded', function (event) { - 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; - }) - if ($rootScope.refreshcheck == null) { - $location.path('/'); - } - $scope.scroll(); - var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') - promise.then( - function (result) { - $scope.threeDAnatomyData = result; - - // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData; - - $scope.selectedThreeDAdata = new jinqJs() - .from($scope.threeDAnatomyData.root.ThreeDAData) - .orderBy([{ field: '_Title', sort: 'asc' }]) - .select(); - - // console.log($scope.selectedCIListViewData); - $('#grid-view').empty(); - angular.forEach($scope.selectedThreeDAdata, function (value, key) { - $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage; - - var $el = $('
' - + '
' - + '' - + '

' + value._Title + '

').appendTo('#grid-view'); - - - $compile($el)($scope); - - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); - - }); - - }, - function (error) { - // handle errors here - console.log(' $scope.threeDAnatomyData = ' + error.statusText); - } - ); - - }); - $scope.scroll = function () { - // $window.scrollTo(0, 0); - $("html,body").scrollTop(0); - //alert("scroll"); - } - $scope.IsVisible = function () { - //$scope.scroll(); - - $location.url("/3dAnatomy"); - - } - - - $scope.Open3DModel = function ($event) { - $rootScope.currentBodyViewId = $event.currentTarget.id; - if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") { - var ThreeDTitle = []; - ThreeDTitle = new jinqJs() - .from($scope.selectedThreeDAdata) - .where('_id = ' + $event.currentTarget.id) - .select('_Title'); - - $rootScope.ViewTitle = ThreeDTitle[0]._Title; - } - else { - $rootScope.ViewTitle = $event.currentTarget.textContent; - - } - - - localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); - localStorage.setItem("currentBodyViewId", $event.currentTarget.id); - - var u = $location.url(); - $location.url('/3d-anatomy-details'); - - } - - $scope.Open3DModelBody = function () { - - if ($rootScope.refreshcheck == null) { - $location.path('/'); - - } - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - //alert($rootScope.getLocalStorageValue("currentBodyViewId")); - $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId"); - - //alert($scope.voId3D); - - - //once you get id in scope push detail in jspanel content - - var openViews; - if ($rootScope.openViews.length > 0) { - openViews = new jinqJs() - .from($rootScope.openViews) - .where("BodyViewId==" + $scope.voId3D) - .select(); - } - var counter = 1; - var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); - - if (openViews != null && openViews.length > 0) { - 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/3da/3da_dat_contentlist.json') - promise.then( - function (result) { - $scope.threeDAnatomyData = result; - - var clicked3dAview = []; - clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData) - .where('_id == ' + $scope.voId3D) - .select('_Title', '_3dimagepath'); - $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath; - $scope.threeDBodySystemTitle = clicked3dAview[0]._Title; - - if (clicked3dAview.length > 0) { - - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); - - $.jsPanel({ - id: '3DImagePanel', - selector: '.threeDView', - theme: 'success', - currentController: '3dAController', - parentSlug: '3d-anatomy-list', - content: '
' + - '' + - '
', - title: $rootScope.getLocalStorageValue("currentViewTitle"), - position: { - top: 70, - left: 1, - }, - - size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 }, - - }); - - $rootScope.currentSlug = '3d-anatomy-details'; - - $rootScope.openViews.push( - { - "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, - "slug": $rootScope.currentSlug - }); - - - } - - - }, - function (error) { - // handle errors here - console.log(' $scope.CIllustrationData = ' + error.statusText); - } - - ); - $('#ThreeDView').css("height", $(window).outerHeight()); - - $('#ThreeDView').css("width", $(window).outerWidth()); - - } - - - -}] - - - +AIA.controller("3dAController", ["$scope", "$rootScope", "pages", "$log", '$http', 'DataService', '$filter', '$location', '$document', '$sce', "$compile", +function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location, $document, $sce, $compile) { + + + $scope.showTabButton = false; + $scope.threeDAnatomyData; + $scope.Id; + $scope.$on('$viewContentLoaded', function (event) { + var currentURL = $location.path(); + var selectedModuleName = ''; + //set module title + angular.forEach($rootScope.userModules, function (value, key) { + //if (value.slug === currentURL.replace('/', '')) { + if (value.slug === "3d-anatomy-list") { + selectedModuleName = value.name; + } + $rootScope.currentActiveModuleTitle = selectedModuleName; + }) + if ($rootScope.refreshcheck == null) { + $location.path('/'); + } + $scope.scroll(); + var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') + promise.then( + function (result) { + $scope.threeDAnatomyData = result; + + // $scope.selectedThreeDAdata = $scope.threeDAnatomyData.root.ThreeDAData; + + $scope.selectedThreeDAdata = new jinqJs() + .from($scope.threeDAnatomyData.root.ThreeDAData) + .orderBy([{ field: '_Title', sort: 'asc' }]) + .select(); + + // console.log($scope.selectedCIListViewData); + $('#grid-view').empty(); + angular.forEach($scope.selectedThreeDAdata, function (value, key) { + $scope.imagePath = "~/../content/images/3da/thumbnails/" + value._ThumbnailImage; + + var $el = $('
' + + '
' + + '' + + '

' + value._Title + '

').appendTo('#grid-view'); + + + $compile($el)($scope); + + $(".sidebar").mCustomScrollbar({ + autoHideScrollbar: true, + //theme:"rounded" + }); + + }); + + }, + function (error) { + // handle errors here + console.log(' $scope.threeDAnatomyData = ' + error.statusText); + } + ); + + }); + $scope.scroll = function () { + // $window.scrollTo(0, 0); + $("html,body").scrollTop(0); + //alert("scroll"); + } + $scope.IsVisible = function () { + //$scope.scroll(); + + $location.url("/3dAnatomy"); + + } + + + $scope.Open3DModel = function ($event) { + $rootScope.currentBodyViewId = $event.currentTarget.id; + if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") { + var ThreeDTitle = []; + ThreeDTitle = new jinqJs() + .from($scope.selectedThreeDAdata) + .where('_id = ' + $event.currentTarget.id) + .select('_Title'); + + $rootScope.ViewTitle = ThreeDTitle[0]._Title; + } + else { + $rootScope.ViewTitle = $event.currentTarget.textContent; + + } + + + localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle); + localStorage.setItem("currentBodyViewId", $event.currentTarget.id); + + var u = $location.url(); + $location.url('/3d-anatomy-details'); + + } + + $scope.Open3DModelBody = function () { + + if ($rootScope.refreshcheck == null) { + $location.path('/'); + + } + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + //alert($rootScope.getLocalStorageValue("currentBodyViewId")); + $scope.voId3D = $rootScope.getLocalStorageValue("currentBodyViewId"); + + //alert($scope.voId3D); + + + //once you get id in scope push detail in jspanel content + + var openViews; + //if ($rootScope.openViews.length > 0) { + // openViews = new jinqJs() + // .from($rootScope.openViews) + // .where("BodyViewId==" + $scope.voId3D) + // .select(); + //} + // var counter = 1; + var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); + $rootScope.currentActiveViewTitle = tittle; + localStorage.setItem("currentViewTitle", tittle); + + //if (openViews != null && openViews.length > 0) { + // 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/3da/3da_dat_contentlist.json') + promise.then( + function (result) { + $scope.threeDAnatomyData = result; + + var clicked3dAview = []; + clicked3dAview = new jinqJs().from($scope.threeDAnatomyData.root.ThreeDAData) + .where('_id == ' + $scope.voId3D) + .select('_Title', '_3dimagepath'); + $scope.Selected3DImagePath = clicked3dAview[0]._3dimagepath; + $scope.threeDBodySystemTitle = clicked3dAview[0]._Title; + + if (clicked3dAview.length > 0) { + + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + + $.jsPanel({ + id: '3DImagePanel', + selector: '.threeDView', + theme: 'success', + currentController: '3dAController', + parentSlug: '3d-anatomy-list', + content: '
' + + '' + + '
', + title: $rootScope.getLocalStorageValue("currentViewTitle"), + position: { + top: 70, + left: 1, + }, + + size: { width: $(window).outerWidth() - 20, height: $(window).outerHeight() - 10 }, + + }); + + $rootScope.currentSlug = '3d-anatomy-details'; + + $rootScope.openViews.push( + { + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, + "slug": $rootScope.currentSlug + }); + + + } + + + }, + function (error) { + // handle errors here + console.log(' $scope.CIllustrationData = ' + error.statusText); + } + + ); + $('#ThreeDView').css("height", $(window).outerHeight()); + + $('#ThreeDView').css("width", $(window).outerWidth()); + + } + + + +}] + + + ); \ No newline at end of file -- libgit2 0.21.4