TileViewListController.js
4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
'use strict';
AIA.controller("TileViewListController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService", "ModuleService",
function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService, ModuleService) {
$rootScope.OpenedTileData = [];
var ATLAS_ANATOMY = 'Atlas Anatomy';
var CLINICAL_ILLUSTRATION = 'Clinical Illustrations';
var CLINICAL_ANIMATION = 'Clinical Animations';
$scope.loadForModuleById = function (moduleId) {
$scope.moduleId = moduleId;
console.log('loadForModuleById is called')
$rootScope.moduleName = Modules[moduleId].Name;
var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
.then(
function (result) {
$scope.moduleLandingData = result;
console.log(JSON.stringify(result, null, 4));
},
function (error) {
// handle errors here
console.log(' error: ' + error.statusText);
}
)
}
$scope.openModuleItemView = function (event) {
//0. Get selected Image Id
var moduleItemDataToBeSaved = event.target.id;
//1.Filter selected module ietem data and get the pushed opened moduile array object
$rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
//2. Pick the image name to create a source to open
$rootScope.imageName = $rootScope.OpenedTileData[3];
$rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
//3. Navigate to the Module-item-view
var u = $location.url();
$location.url('/module-item-view');
}
$scope.openModuleItem = function () {
var jsContentURL;
var moduleItemViewDivId;
//1. create a jsPanel and load the module item view
if ($rootScope.moduleName == ATLAS_ANATOMY) {
jsContentURL = 'app/views/aa/atlas-anatomy-detail.html';
moduleItemViewDivId = 'aaDetailPageDiv';
//$scope.showAllPins();
}
else if ($rootScope.moduleName == CLINICAL_ANIMATION) {
//to do, in next phase of project
}
else if ($rootScope.moduleName == CLINICAL_ILLUSTRATION) {
//to do, in next phase of project
}
$.jsPanel({
id: 'ImagePanel',
selector: '.aaBodyView',
theme: 'success',
currentController: 'TileViewListController',
parentSlug: 'tile-view',
ajax: {
url: jsContentURL
},
//title: localStorage.getItem("currentViewTitle"),
position: {
top: 70,
left: 1,
},
size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
});
console.log('jsPanel loaded ImagePanel exist= ' + document.getElementById('ImagePanel'))
//0.3
var aaViewElement = angular.element(document.getElementById(moduleItemViewDivId));
$timeout(function () {
$compile(aaViewElement.contents())($scope);
alert('aaView val: ' + document.getElementById(moduleItemViewDivId));
//console.log('html is compiled' + document.getElementById('daView'))
if (document.getElementById('aaDetailPageDiv') != null) {
////0.4 added some stylesheets
$('#aaBodyView').css("height", $(window).outerHeight());
$('#aaBodyView').css("width", $(window).outerWidth());
$scope.currentTitleFromJson = localStorage.getItem("currentViewTitle");
$("#modItemImage").attr('src', $rootScope.OpenItemImagePath);
//$('#aaBodyView').css("height", $(window).outerHeight());
//$('#aaBodyView').css("width", $(window).outerWidth());
}
}, 250);
}
angular.element(document).ready(function (e) {
$("#ImagePanel").resize(function () {
$("#imageDiv").scrollLeft($rootScope.CanvasDivLeftPosition);
$("#imageDiv").scrollTop($rootScope.CanvasDivTopPosition);
});
})
}]);