Commit ee3c0e26294912f03b04099a70c66d76dffa4ac0

Authored by Nikita Kulshreshtha
2 parents 25f89888 0efe67a2

Merge branch 'CIAnnotatonIssue1' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js
1 -AIA.controller("CIController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "pages", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "MedicalSpecialties", "DataService",  
2 -function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout, pages, BodyRegions, BodySystems, ViewOrientations, ImageTypes, MedicalSpecialties, DataService) {  
3 - // $rootScope.currentActiveModuleTitle = pages[3].name;  
4 - $scope.showme = true;  
5 - $scope.IllustrationData;  
6 - $scope.CIAllBodyRegion = [];  
7 - $scope.CIAllBodySystem = [];  
8 - $scope.CIAllOrientation = [];  
9 - $scope.CIAllImageType = [];  
10 - $scope.CIAllSpeciality = [];  
11 - $scope.searchCIListViewData = [];  
12 - $scope.SelectedCIthumbImage = [];  
13 - $scope.SelectedCIImage = [];  
14 - $scope.SelectedCISummary = [];  
15 - $scope.SelectedCIId = [];  
16 - $scope.SelectedCITitle = [];  
17 - $scope.selectedCIListViewData = [];  
18 - $scope.filterstring = false;  
19 - $scope.idSelected;  
20 - $scope.srollListView;  
21 - $scope.query = {  
22 - selectedbodyregion: '',  
23 - selectedbodysystem: '',  
24 - selectedorientation: '',  
25 - selectedimagetype: '',  
26 - selectedspecialty: '',  
27 - };  
28 -  
29 - $scope.setActiveTab = function (tabToSet) {  
30 - $scope.activeTab = tabToSet;  
31 - localStorage.setItem("currentCITabView", $scope.activeTab);  
32 - };  
33 -  
34 - $scope.$on('$viewContentLoaded', function (event) {  
35 - // code that will be executed ...  
36 - // every time this view is loaded  
37 - 1 +AIA.controller("CIController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "pages", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "MedicalSpecialties", "DataService",
  2 +function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout, pages, BodyRegions, BodySystems, ViewOrientations, ImageTypes, MedicalSpecialties, DataService) {
  3 + // $rootScope.currentActiveModuleTitle = pages[3].name;
  4 + $scope.showme = true;
  5 + $scope.IllustrationData;
  6 + $scope.CIAllBodyRegion = [];
  7 + $scope.CIAllBodySystem = [];
  8 + $scope.CIAllOrientation = [];
  9 + $scope.CIAllImageType = [];
  10 + $scope.CIAllSpeciality = [];
  11 + $scope.searchCIListViewData = [];
  12 + $scope.SelectedCIthumbImage = [];
  13 + $scope.SelectedCIImage = [];
  14 + $scope.SelectedCISummary = [];
  15 + $scope.SelectedCIId = [];
  16 + $scope.SelectedCITitle = [];
  17 + $scope.selectedCIListViewData = [];
  18 + $scope.filterstring = false;
  19 + $scope.idSelected;
  20 + $scope.srollListView;
  21 + $scope.query = {
  22 + selectedbodyregion: '',
  23 + selectedbodysystem: '',
  24 + selectedorientation: '',
  25 + selectedimagetype: '',
  26 + selectedspecialty: '',
  27 + };
  28 +
  29 + $scope.setActiveTab = function (tabToSet) {
  30 + $scope.activeTab = tabToSet;
  31 + localStorage.setItem("currentCITabView", $scope.activeTab);
  32 + };
  33 +
  34 + $scope.$on('$viewContentLoaded', function (event) {
  35 + // code that will be executed ...
  36 + // every time this view is loaded
  37 +
38 //get current path 38 //get current path
39 var currentURL = $location.path(); 39 var currentURL = $location.path();
40 var selectedModuleName = ''; 40 var selectedModuleName = '';
@@ -44,649 +44,651 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout @@ -44,649 +44,651 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout
44 selectedModuleName = value.name; 44 selectedModuleName = value.name;
45 } 45 }
46 $rootScope.currentActiveModuleTitle = selectedModuleName; 46 $rootScope.currentActiveModuleTitle = selectedModuleName;
47 - })  
48 -  
49 - $scope.LoadCIJsonData();  
50 -  
51 - $scope.CIAllBodyRegion = BodyRegions;  
52 - $scope.CIAllBodySystem = BodySystems;  
53 - $scope.CIAllOrientation = ViewOrientations;  
54 - $scope.CIAllImageType = ImageTypes;  
55 - $scope.CIAllSpeciality = MedicalSpecialties;  
56 - $scope.scroll();  
57 - //push the details of open module in array $rootScope.openModules  
58 - $rootScope.openModules.push({ "ModuleId": 4 });  
59 -  
60 - //set the local storage  
61 -  
62 - var curtab = localStorage.getItem("currentCITabView");  
63 - if (curtab == 2) {  
64 - $scope.setActiveTab(2);  
65 - var curSelectedRowId = localStorage.getItem("CISelectedRowId");  
66 - if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') {  
67 - $scope.reRunSearchOnLoad();  
68 - $scope.idSelected = curSelectedRowId;  
69 - $scope.ReloadListViewImageDiv($scope.idSelected);  
70 - }  
71 - else {  
72 - $scope.reRunSearchOnLoad()  
73 - $scope.idSelected = '';  
74 - }  
75 - }  
76 - else {  
77 - $scope.setActiveTab(1);  
78 - $scope.reRunSearchOnLoad();  
79 - }  
80 -  
81 -  
82 -  
83 - });  
84 -  
85 - $scope.reRunSearchOnLoad = function () {  
86 -  
87 - var curBodyRegion = localStorage.getItem("CICurBodyRegion");  
88 - if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') {  
89 - $scope.query.selectedbodyregion = curBodyRegion;  
90 - }  
91 - else {  
92 - $scope.query.selectedbodyregion = "";  
93 - }  
94 -  
95 - var curBodySystem = localStorage.getItem("CICurBodySystem");  
96 - if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null && curBodySystem !== '') {  
97 - $scope.query.selectedbodysystem = curBodySystem;  
98 - }  
99 - else {  
100 - $scope.query.selectedbodysystem = "";  
101 - }  
102 -  
103 - var curOrientation = localStorage.getItem("CICurOrientation");  
104 - if (typeof (curOrientation) !== "undefined" && curOrientation !== null && curOrientation !== '') {  
105 - $scope.query.selectedorientation = curOrientation;  
106 - }  
107 - else {  
108 - $scope.query.selectedorientation = "";  
109 - }  
110 -  
111 - var curImageType = localStorage.getItem("CICurImageType");  
112 - if (typeof (curImageType) !== "undefined" && curImageType !== null && curImageType !== '') {  
113 - $scope.query.selectedimagetype = curImageType;  
114 - }  
115 - else {  
116 - $scope.query.selectedimagetype = "";  
117 - }  
118 -  
119 - var curSpeciality = localStorage.getItem("CICurSpeciality");  
120 - if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null && curSpeciality !== '') {  
121 - $scope.query.selectedspecialty = curSpeciality;  
122 - }  
123 - else {  
124 - $scope.query.selectedspecialty = "";  
125 - }  
126 -  
127 -  
128 - if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedorientation == "" && $scope.query.selectedimagetype == "" && $scope.query.selectedspecialty == "") {  
129 - $scope.loadAllCI();  
130 - }  
131 - else {  
132 - $scope.ApplySearch($scope.query);  
133 - }  
134 -  
135 - }  
136 -  
137 - $scope.LoadCIJsonData = function () {  
138 -  
139 - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')  
140 - promise.then(  
141 - function (result) {  
142 - $scope.IllustrationData = result;  
143 - $scope.selectedCIListViewData = new jinqJs()  
144 - .from($scope.IllustrationData.root.CIData)  
145 - .orderBy([{ field: '_Title', sort: 'asc' }])  
146 - .select();  
147 -  
148 - },  
149 - function (error) {  
150 - // handle errors here  
151 - console.log(' $scope.IllustrationData = ' + error.statusText);  
152 - }  
153 - );  
154 -  
155 -  
156 - };  
157 -  
158 - $scope.loadAllCI = function () {  
159 -  
160 - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')  
161 - promise.then(  
162 - function (result) {  
163 - $scope.IllustrationData = result;  
164 -  
165 - $scope.selectedCIListViewData = new jinqJs()  
166 - .from($scope.IllustrationData.root.CIData)  
167 - .orderBy([{ field: '_Title', sort: 'asc' }])  
168 - .select();  
169 -  
170 - // console.log($scope.selectedCIListViewData);  
171 - $('#grid-view').empty();  
172 - angular.forEach($scope.selectedCIListViewData, function (value, key) {  
173 - $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage;  
174 -  
175 - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="openView($event)">'  
176 - + '<div class="thumbnail" >'  
177 - + '<img id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'  
178 - + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');  
179 -  
180 -  
181 - $compile($el)($scope);  
182 -  
183 - $(".sidebar").mCustomScrollbar({  
184 - autoHideScrollbar: true,  
185 - //theme:"rounded"  
186 - });  
187 -  
188 - });  
189 -  
190 - },  
191 - function (error) {  
192 - // handle errors here  
193 - console.log(' $scope.IllustrationData = ' + error.statusText);  
194 - }  
195 - );  
196 -  
197 - }  
198 -  
199 - $scope.IsVisible = function () {  
200 - $scope.scroll();  
201 -  
202 - }  
203 -  
204 - $scope.showItem = function (id) {  
205 - $scope.idSelected = id;  
206 - localStorage.setItem("CISelectedRowId", id);  
207 -  
208 - //Set the vertical scroll value of the table.  
209 - var y = $('#ListViewDiv').scrollTop();  
210 - localStorage.setItem("CIListViewScroll", y);  
211 -  
212 - $scope.hiderow = true;  
213 - if ($scope.filterstring == false) {  
214 -  
215 - var SelectedCIthumbImage = [];  
216 - SelectedCIthumbImage = new jinqJs()  
217 - .from($scope.selectedCIListViewData)  
218 - .where('_id = ' + id)  
219 - .select('_ThumbnailImage', '_Summary', '_id', '_Title');  
220 -  
221 - $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;  
222 - $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;  
223 - $scope.SelectedCIId = SelectedCIthumbImage[0]._id;  
224 - $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;  
225 -  
226 - }  
227 - else {  
228 - if ($scope.searchCIListViewData.length > 0) {  
229 -  
230 - var SelectedCIthumbImage = [];  
231 - SelectedCIthumbImage = new jinqJs()  
232 - .from($scope.searchCIListViewData)  
233 - .where('_id = ' + id)  
234 - .select('_ThumbnailImage', '_Summary', '_id', '_Title');  
235 -  
236 - $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;  
237 - $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;  
238 - $scope.SelectedCIId = SelectedCIthumbImage[0]._id;  
239 - $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;  
240 -  
241 - }  
242 - }  
243 - };  
244 -  
245 - $scope.Reset = function (query) {  
246 -  
247 - query.selectedbodyregion = "";  
248 - query.selectedbodysystem = "";  
249 - query.selectedorientation = "";  
250 - query.selectedimagetype = "";  
251 - query.selectedspecialty = "";  
252 -  
253 -  
254 - //set localstorage values  
255 - localStorage.setItem("CICurBodyRegion", '');  
256 - localStorage.setItem("CICurBodySystem", '');  
257 - localStorage.setItem("CICurOrientation", '');  
258 - localStorage.setItem("CICurImageType", '');  
259 - localStorage.setItem("CICurSpeciality", '');  
260 - localStorage.setItem("CISelectedRowId", "");  
261 - localStorage.setItem("CIListViewScroll", '');  
262 -  
263 - if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }  
264 -  
265 - $('#ListViewDiv').scrollTop(0);  
266 -  
267 - $scope.hideListViewDiv();  
268 -  
269 - $scope.filterstring = false;  
270 - while ($scope.searchCIListViewData.length) {  
271 - $scope.searchCIListViewData.pop();  
272 - }  
273 -  
274 - $scope.loadAllCI();  
275 -  
276 - }  
277 -  
278 - $scope.ApplySearch = function (query) {  
279 -  
280 - $scope.filterstring = true;  
281 -  
282 - while ($scope.searchCIListViewData.length) {  
283 - $scope.searchCIListViewData.pop();  
284 - }  
285 -  
286 - //$('#grid-view').empty();  
287 -  
288 - filtercount = 0;  
289 - if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {  
290 - filtercount = filtercount + 1;  
291 - localStorage.setItem("CICurBodyRegion", query.selectedbodyregion);  
292 - }  
293 - else {  
294 - localStorage.setItem("CICurBodyRegion", '');  
295 - }  
296 -  
297 - if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !=="")) {  
298 - filtercount = filtercount + 1;  
299 - localStorage.setItem("CICurBodySystem", query.selectedbodysystem);  
300 - }  
301 - else {  
302 - localStorage.setItem("CICurBodySystem", '');  
303 - }  
304 -  
305 - if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) {  
306 - filtercount = filtercount + 1;  
307 - localStorage.setItem("CICurOrientation", query.selectedorientation);  
308 - }  
309 - else {  
310 - localStorage.setItem("CICurOrientation", '');  
311 - }  
312 -  
313 - if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) {  
314 - filtercount = filtercount + 1;  
315 - localStorage.setItem("CICurImageType", query.selectedimagetype);  
316 - }  
317 - else {  
318 - localStorage.setItem("CICurImageType", '');  
319 - }  
320 -  
321 - if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== '')) {  
322 - filtercount = filtercount + 1;  
323 - localStorage.setItem("CICurSpeciality", query.selectedspecialty);  
324 - }  
325 - else {  
326 - localStorage.setItem("CICurSpeciality", '');  
327 - }  
328 -  
329 -  
330 - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')  
331 - promise.then(  
332 - function (result) {  
333 - $scope.IllustrationData = result;  
334 -  
335 - $scope.selectedCIListViewData = new jinqJs()  
336 - .from($scope.IllustrationData.root.CIData)  
337 - .orderBy([{ field: '_Title', sort: 'asc' }])  
338 - .select();  
339 -  
340 - $('#grid-view').empty();  
341 -  
342 - angular.forEach($scope.selectedCIListViewData, function (value, key) {  
343 -  
344 - var selectimg = true;  
345 - var count = 0;  
346 -  
347 -  
348 - if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {  
349 - var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim()));  
350 - if (posbodyregion > -1) {  
351 - selectimg = true;  
352 - count = count + 1;  
353 -  
354 - }  
355 - else {  
356 - selectimg = false;  
357 - count = count - 1;  
358 - }  
359 -  
360 - }  
361 -  
362 - if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) {  
363 - var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem);  
364 - if (posbodysystem > -1) {  
365 - count = count + 1;  
366 - selectimg = true;  
367 - } else {  
368 - selectimg = false;  
369 - count = count - 1;  
370 - }  
371 - }  
372 -  
373 - if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) {  
374 - var posorientation = value._ViewOrientation.indexOf(query.selectedorientation);  
375 - if (posorientation > -1) {  
376 - count = count + 1;  
377 - selectimg = true;  
378 -  
379 - } else {  
380 - selectimg = false;  
381 - count = count - 1;  
382 - }  
383 -  
384 - }  
385 -  
386 - if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) {  
387 - var posimagetype = value._ImageType.indexOf(query.selectedimagetype);  
388 - if (posimagetype > -1) {  
389 - count = count + 1;  
390 - selectimg = true;  
391 -  
392 - } else {  
393 - selectimg = false;  
394 - count = count - 1;  
395 - }  
396 -  
397 - }  
398 -  
399 - if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== "")) {  
400 - var posspeciality = value._MedicalSpecialty.indexOf(query.selectedspecialty);  
401 - if (posspeciality > -1) {  
402 - count = count + 1;  
403 - selectimg = true;  
404 - } else {  
405 - selectimg = false;  
406 - count = count - 1;  
407 - }  
408 -  
409 - }  
410 -  
411 - if (selectimg === true && count >= filtercount) {  
412 -  
413 -  
414 - $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage;  
415 -  
416 - var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="openView($event)">'  
417 - + '<div class="thumbnail" >'  
418 - + '<img id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'  
419 - + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');  
420 -  
421 -  
422 - $compile($el)($scope);  
423 -  
424 - $(".sidebar").mCustomScrollbar({  
425 - autoHideScrollbar: true,  
426 - //theme:"rounded"  
427 - });  
428 -  
429 -  
430 - $scope.searchCIListViewData.push(  
431 - {  
432 - "_id": value._id,  
433 - "_ImageId": value._ImageId,  
434 - "_Title": value._Title,  
435 - "_contentImage": value._contentImage,  
436 - "_ThumbnailImage": value._ThumbnailImage,  
437 - "_BodySystem": value._BodySystem,  
438 - "_BodyRegion": value._BodyRegion,  
439 - "_ViewOrientation": value._ViewOrientation,  
440 - "_MedicalSpecialty": value._MedicalSpecialty,  
441 - "_ImageType": value._ImageType,  
442 - "_Summary": value._Summary  
443 -  
444 - });  
445 -  
446 - }  
447 -  
448 -  
449 - });  
450 -  
451 - //Show Error Message in case of gridview if no data is found  
452 - if ($scope.searchCIListViewData.length == 0) {  
453 -  
454 - var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view');  
455 - $compile($el)($scope);  
456 - }  
457 - },  
458 - function (error) {  
459 - // handle errors here  
460 - console.log(' $scope.IllustrationData = ' + error.statusText);  
461 - }  
462 - );  
463 -  
464 -  
465 - }  
466 -  
467 -  
468 - $scope.scroll = function () {  
469 - $("html,body").scrollTop(0);  
470 - }  
471 -  
472 -  
473 - $scope.openView = function ($event) {  
474 - $rootScope.disableAnnotationTB = false;  
475 - $rootScope.CIAnotationIdentifyModeOff = true;  
476 - $rootScope.currentBodyViewId = $event.currentTarget.id;  
477 - if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") {  
478 - var CITitle = [];  
479 - CITitle = new jinqJs()  
480 - .from($scope.selectedCIListViewData)  
481 - .where('_id = ' + $event.currentTarget.id)  
482 - .select('_Title');  
483 -  
484 - // console.log(CITitle);  
485 - // console.log($scope.selectedCIListViewData);  
486 -  
487 - $rootScope.ViewTitle = CITitle[0]._Title;  
488 - }  
489 - else {  
490 - $rootScope.ViewTitle = $event.currentTarget.textContent;  
491 -  
492 - }  
493 -  
494 -  
495 - localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle);  
496 - localStorage.setItem("currentBodyViewId", $event.currentTarget.id);  
497 -  
498 - var u = $location.url();  
499 - $location.url('/clinical-illustrations-detail');  
500 -  
501 - // console.log($location.url('/clinical-illustrations-detail'));  
502 -  
503 - }  
504 -  
505 - $scope.openBodyView = function () {  
506 -  
507 - $rootScope.isLoading = true;  
508 - $('#spinner').css('visibility', 'visible');  
509 - $scope.voId = localStorage.getItem("currentBodyViewId");  
510 -  
511 - // alert($scope.voId);  
512 -  
513 -  
514 - //once you get id in scope push detail in jspanel content  
515 -  
516 - var openViews;  
517 - if ($rootScope.openViews.length > 0) {  
518 - openViews = new jinqJs()  
519 - .from($rootScope.openViews)  
520 - .where("BodyViewId==" + $scope.voId)  
521 - .select();  
522 - }  
523 - var counter = 1;  
524 - var tittle = localStorage.getItem("currentViewTitleFromJson");  
525 -  
526 - if (openViews != null && openViews.length > 0) {  
527 - angular.forEach(openViews, function (value, key) {  
528 -  
529 - if (value.body - views == tittle) {  
530 - tittle = localStorage.getItem("currentViewTitleFromJson") + counter++;  
531 - $rootScope.currentActiveViewTitle = tittle;  
532 - localStorage.setItem("currentViewTitle", tittle);  
533 - }  
534 -  
535 - });  
536 - }  
537 - else {  
538 - localStorage.setItem("currentViewTitle", tittle);  
539 -  
540 - }  
541 -  
542 - //alert(localStorage.getItem("currentViewTitle"));  
543 -  
544 - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')  
545 - promise.then(  
546 - function (result) {  
547 - $scope.CIllustrationData = result;  
548 - $scope.CIlistViewData = $scope.CIllustrationData.root.CIData;  
549 -  
550 - var clickedCIImage = [];  
551 - clickedCIImage = new jinqJs()  
552 - .from($scope.CIlistViewData)  
553 - .where('_id == ' + $scope.voId)  
554 - .select('_contentImage');  
555 -  
556 - $scope.clickedCIImage = "~/../content/images/ci/images/" + clickedCIImage[0]._contentImage;  
557 -  
558 - var clickedCISummary = [];  
559 - clickedCISummary = new jinqJs()  
560 - .from($scope.CIlistViewData)  
561 - .where('_id == ' + $scope.voId)  
562 - .select('_Summary');  
563 -  
564 - $scope.clickedCISummary = clickedCISummary[0]._Summary  
565 -  
566 - if (clickedCIImage.length > 0 && clickedCISummary.length > 0) {  
567 -  
568 - $rootScope.isLoading = false;  
569 - $('#spinner').css('visibility', 'hidden');  
570 -  
571 - $.jsPanel({  
572 - id: 'ciImagePanel',  
573 - selector: '.ciView',  
574 - theme: 'success',  
575 - currentController: 'CIController',  
576 - parentSlug: 'clinical-illustrations',  
577 - content: '<div class="row" id="canvasDiv"><div style="align:left;width:100%;height:100%"><canvas id="canvas" ng-click="onDrawingCanvasClick($event)" width="1369" height="325" class="canvas-annotationStyle" style="position: absolute; background-color: transparent;z-index:1 "></canvas></div> <canvas id="canvasPaint" ng-click="FreeStylePaint($event)" width="1369" height="325" class="canvas-annotationStyle1" style="position: absolute;z-index:0;"></canvas>' +  
578 - '<div class="col-sm-12 img-thumbnail" align="center">' +  
579 - '<img src="' + $scope.clickedCIImage + '" alt="" title="" class="img-responsive "><div class="col-sm-12 well">' +  
580 - '<div align="left" id="sid"><p>' + $scope.clickedCISummary + '</p></div><button id="btnTxtOnOff" class="btn btn-primary pull-right">Text Off</button>' +  
581 - '<script>$(document).ready(function(){$("#btnTxtOnOff").click(function(){$("#sid").toggle();if($.trim($(this).text()) === "Text Off"){$(this).text("Text On");}else{$(this).text("Text Off");}});});</script></div>' +  
582 - '</div></div>',  
583 - //ajax: {  
584 - // url: 'app/views/ci/ci-view-detail.html'  
585 - //},  
586 - title: localStorage.getItem("currentViewTitle"),  
587 - position: {  
588 - top: 70,  
589 - left: 1,  
590 - },  
591 -  
592 - size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },  
593 -  
594 - });  
595 -  
596 - $rootScope.currentSlug = 'clinical-illustrations-detail';  
597 -  
598 - $rootScope.openViews.push(  
599 - {  
600 - "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,  
601 - "slug": $rootScope.currentSlug  
602 - });  
603 -  
604 -  
605 - }  
606 -  
607 -  
608 - },  
609 - function (error) {  
610 - // handle errors here  
611 - console.log(' $scope.CIllustrationData = ' + error.statusText);  
612 - }  
613 -  
614 - );  
615 -  
616 - // console.log($rootScope.openViews);  
617 - $('#CIView').css("height", $(window).outerHeight());  
618 -  
619 - $('#CIView').css("width", $(window).outerWidth());  
620 -  
621 - }  
622 -  
623 - $scope.$on('annotationToolEvent', function (event, data) {  
624 -  
625 - $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)")  
626 - $('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });  
627 - $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)")  
628 - $('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });  
629 -  
630 - $("#canvas").css("display", "block");  
631 - $("#canvasPaint").css("display", "block");  
632 -  
633 - $rootScope.onDrawingCanvasClick();  
634 - $rootScope.FreeStylePaint();  
635 - });  
636 -  
637 - $scope.ReloadListViewImageDiv = function (id) {  
638 - //console.log(id);  
639 - $scope.idSelected = id;  
640 - $scope.hiderow = true;  
641 -  
642 - var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')  
643 - promise.then(  
644 - function (result) {  
645 - $scope.IllustrationData = result;  
646 -  
647 - var SelectedCIthumbImage = [];  
648 - SelectedCIthumbImage = new jinqJs()  
649 - .from($scope.IllustrationData.root.CIData)  
650 - .where('_id = ' + id)  
651 - .select('_ThumbnailImage', '_Summary', '_id', '_Title');  
652 -  
653 - $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;  
654 - $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;  
655 - $scope.SelectedCIId = SelectedCIthumbImage[0]._id;  
656 - $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;  
657 -  
658 - //Set the scroll position of the tablebody to show selected row.  
659 -  
660 - var curCIListViewScroll = localStorage.getItem("CIListViewScroll");  
661 - if (typeof (curCIListViewScroll) !== "undefined" && curCIListViewScroll !== null && curCIListViewScroll !== '') {  
662 -  
663 - $('#ListViewDiv').scrollTop(localStorage.getItem("CIListViewScroll"));  
664 - }  
665 - //else {  
666 - // $('#ListViewDiv').scrollTop(0);  
667 - //}  
668 -  
669 - },  
670 - function (error) {  
671 - // handle errors here  
672 - console.log(' $scope.AnimationData = ' + error.statusText);  
673 - }  
674 - );  
675 - };  
676 -  
677 - $scope.hideListViewDiv = function () {  
678 - if (localStorage.getItem("currentCITabView") == 2) {  
679 - localStorage.setItem("CISelectedRowId", "");  
680 - if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }  
681 - $scope.hiderow = false;  
682 - }  
683 - }  
684 -  
685 -}]  
686 -  
687 -  
688 -);  
689 -  
690 -  
691 -  
692 - 47 + })
  48 +
  49 + $scope.LoadCIJsonData();
  50 +
  51 + $scope.CIAllBodyRegion = BodyRegions;
  52 + $scope.CIAllBodySystem = BodySystems;
  53 + $scope.CIAllOrientation = ViewOrientations;
  54 + $scope.CIAllImageType = ImageTypes;
  55 + $scope.CIAllSpeciality = MedicalSpecialties;
  56 + $scope.scroll();
  57 + //push the details of open module in array $rootScope.openModules
  58 + $rootScope.openModules.push({ "ModuleId": 4 });
  59 +
  60 + //set the local storage
  61 +
  62 + var curtab = localStorage.getItem("currentCITabView");
  63 + if (curtab == 2) {
  64 + $scope.setActiveTab(2);
  65 + var curSelectedRowId = localStorage.getItem("CISelectedRowId");
  66 + if (typeof (curSelectedRowId) !== "undefined" && curSelectedRowId !== null && curSelectedRowId !== '') {
  67 + $scope.reRunSearchOnLoad();
  68 + $scope.idSelected = curSelectedRowId;
  69 + $scope.ReloadListViewImageDiv($scope.idSelected);
  70 + }
  71 + else {
  72 + $scope.reRunSearchOnLoad()
  73 + $scope.idSelected = '';
  74 + }
  75 + }
  76 + else {
  77 + $scope.setActiveTab(1);
  78 + $scope.reRunSearchOnLoad();
  79 + }
  80 +
  81 +
  82 +
  83 + });
  84 +
  85 + $scope.reRunSearchOnLoad = function () {
  86 +
  87 + var curBodyRegion = localStorage.getItem("CICurBodyRegion");
  88 + if (typeof (curBodyRegion) !== "undefined" && curBodyRegion !== null && curBodyRegion !== '') {
  89 + $scope.query.selectedbodyregion = curBodyRegion;
  90 + }
  91 + else {
  92 + $scope.query.selectedbodyregion = "";
  93 + }
  94 +
  95 + var curBodySystem = localStorage.getItem("CICurBodySystem");
  96 + if (typeof (curBodySystem) !== "undefined" && curBodySystem !== null && curBodySystem !== '') {
  97 + $scope.query.selectedbodysystem = curBodySystem;
  98 + }
  99 + else {
  100 + $scope.query.selectedbodysystem = "";
  101 + }
  102 +
  103 + var curOrientation = localStorage.getItem("CICurOrientation");
  104 + if (typeof (curOrientation) !== "undefined" && curOrientation !== null && curOrientation !== '') {
  105 + $scope.query.selectedorientation = curOrientation;
  106 + }
  107 + else {
  108 + $scope.query.selectedorientation = "";
  109 + }
  110 +
  111 + var curImageType = localStorage.getItem("CICurImageType");
  112 + if (typeof (curImageType) !== "undefined" && curImageType !== null && curImageType !== '') {
  113 + $scope.query.selectedimagetype = curImageType;
  114 + }
  115 + else {
  116 + $scope.query.selectedimagetype = "";
  117 + }
  118 +
  119 + var curSpeciality = localStorage.getItem("CICurSpeciality");
  120 + if (typeof (curSpeciality) !== "undefined" && curSpeciality !== null && curSpeciality !== '') {
  121 + $scope.query.selectedspecialty = curSpeciality;
  122 + }
  123 + else {
  124 + $scope.query.selectedspecialty = "";
  125 + }
  126 +
  127 +
  128 + if ($scope.query.selectedbodyregion == "" && $scope.query.selectedbodysystem == "" && $scope.query.selectedorientation == "" && $scope.query.selectedimagetype == "" && $scope.query.selectedspecialty == "") {
  129 + $scope.loadAllCI();
  130 + }
  131 + else {
  132 + $scope.ApplySearch($scope.query);
  133 + }
  134 +
  135 + }
  136 +
  137 + $scope.LoadCIJsonData = function () {
  138 +
  139 + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')
  140 + promise.then(
  141 + function (result) {
  142 + $scope.IllustrationData = result;
  143 + $scope.selectedCIListViewData = new jinqJs()
  144 + .from($scope.IllustrationData.root.CIData)
  145 + .orderBy([{ field: '_Title', sort: 'asc' }])
  146 + .select();
  147 +
  148 + },
  149 + function (error) {
  150 + // handle errors here
  151 + console.log(' $scope.IllustrationData = ' + error.statusText);
  152 + }
  153 + );
  154 +
  155 +
  156 + };
  157 +
  158 + $scope.loadAllCI = function () {
  159 +
  160 + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')
  161 + promise.then(
  162 + function (result) {
  163 + $scope.IllustrationData = result;
  164 +
  165 + $scope.selectedCIListViewData = new jinqJs()
  166 + .from($scope.IllustrationData.root.CIData)
  167 + .orderBy([{ field: '_Title', sort: 'asc' }])
  168 + .select();
  169 +
  170 + // console.log($scope.selectedCIListViewData);
  171 + $('#grid-view').empty();
  172 + angular.forEach($scope.selectedCIListViewData, function (value, key) {
  173 + $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage;
  174 +
  175 + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="openView($event)">'
  176 + + '<div class="thumbnail" >'
  177 + + '<img id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
  178 + + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
  179 +
  180 +
  181 + $compile($el)($scope);
  182 +
  183 + $(".sidebar").mCustomScrollbar({
  184 + autoHideScrollbar: true,
  185 + //theme:"rounded"
  186 + });
  187 +
  188 + });
  189 +
  190 + },
  191 + function (error) {
  192 + // handle errors here
  193 + console.log(' $scope.IllustrationData = ' + error.statusText);
  194 + }
  195 + );
  196 +
  197 + }
  198 +
  199 + $scope.IsVisible = function () {
  200 + $scope.scroll();
  201 +
  202 + }
  203 +
  204 + $scope.showItem = function (id) {
  205 + $scope.idSelected = id;
  206 + localStorage.setItem("CISelectedRowId", id);
  207 +
  208 + //Set the vertical scroll value of the table.
  209 + var y = $('#ListViewDiv').scrollTop();
  210 + localStorage.setItem("CIListViewScroll", y);
  211 +
  212 + $scope.hiderow = true;
  213 + if ($scope.filterstring == false) {
  214 +
  215 + var SelectedCIthumbImage = [];
  216 + SelectedCIthumbImage = new jinqJs()
  217 + .from($scope.selectedCIListViewData)
  218 + .where('_id = ' + id)
  219 + .select('_ThumbnailImage', '_Summary', '_id', '_Title');
  220 +
  221 + $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;
  222 + $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;
  223 + $scope.SelectedCIId = SelectedCIthumbImage[0]._id;
  224 + $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;
  225 +
  226 + }
  227 + else {
  228 + if ($scope.searchCIListViewData.length > 0) {
  229 +
  230 + var SelectedCIthumbImage = [];
  231 + SelectedCIthumbImage = new jinqJs()
  232 + .from($scope.searchCIListViewData)
  233 + .where('_id = ' + id)
  234 + .select('_ThumbnailImage', '_Summary', '_id', '_Title');
  235 +
  236 + $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;
  237 + $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;
  238 + $scope.SelectedCIId = SelectedCIthumbImage[0]._id;
  239 + $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;
  240 +
  241 + }
  242 + }
  243 + };
  244 +
  245 + $scope.Reset = function (query) {
  246 +
  247 + query.selectedbodyregion = "";
  248 + query.selectedbodysystem = "";
  249 + query.selectedorientation = "";
  250 + query.selectedimagetype = "";
  251 + query.selectedspecialty = "";
  252 +
  253 +
  254 + //set localstorage values
  255 + localStorage.setItem("CICurBodyRegion", '');
  256 + localStorage.setItem("CICurBodySystem", '');
  257 + localStorage.setItem("CICurOrientation", '');
  258 + localStorage.setItem("CICurImageType", '');
  259 + localStorage.setItem("CICurSpeciality", '');
  260 + localStorage.setItem("CISelectedRowId", "");
  261 + localStorage.setItem("CIListViewScroll", '');
  262 +
  263 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  264 +
  265 + $('#ListViewDiv').scrollTop(0);
  266 +
  267 + $scope.hideListViewDiv();
  268 +
  269 + $scope.filterstring = false;
  270 + while ($scope.searchCIListViewData.length) {
  271 + $scope.searchCIListViewData.pop();
  272 + }
  273 +
  274 + $scope.loadAllCI();
  275 +
  276 + }
  277 +
  278 + $scope.ApplySearch = function (query) {
  279 +
  280 + $scope.filterstring = true;
  281 +
  282 + while ($scope.searchCIListViewData.length) {
  283 + $scope.searchCIListViewData.pop();
  284 + }
  285 +
  286 + //$('#grid-view').empty();
  287 +
  288 + filtercount = 0;
  289 + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {
  290 + filtercount = filtercount + 1;
  291 + localStorage.setItem("CICurBodyRegion", query.selectedbodyregion);
  292 + }
  293 + else {
  294 + localStorage.setItem("CICurBodyRegion", '');
  295 + }
  296 +
  297 + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !=="")) {
  298 + filtercount = filtercount + 1;
  299 + localStorage.setItem("CICurBodySystem", query.selectedbodysystem);
  300 + }
  301 + else {
  302 + localStorage.setItem("CICurBodySystem", '');
  303 + }
  304 +
  305 + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) {
  306 + filtercount = filtercount + 1;
  307 + localStorage.setItem("CICurOrientation", query.selectedorientation);
  308 + }
  309 + else {
  310 + localStorage.setItem("CICurOrientation", '');
  311 + }
  312 +
  313 + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) {
  314 + filtercount = filtercount + 1;
  315 + localStorage.setItem("CICurImageType", query.selectedimagetype);
  316 + }
  317 + else {
  318 + localStorage.setItem("CICurImageType", '');
  319 + }
  320 +
  321 + if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== '')) {
  322 + filtercount = filtercount + 1;
  323 + localStorage.setItem("CICurSpeciality", query.selectedspecialty);
  324 + }
  325 + else {
  326 + localStorage.setItem("CICurSpeciality", '');
  327 + }
  328 +
  329 +
  330 + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')
  331 + promise.then(
  332 + function (result) {
  333 + $scope.IllustrationData = result;
  334 +
  335 + $scope.selectedCIListViewData = new jinqJs()
  336 + .from($scope.IllustrationData.root.CIData)
  337 + .orderBy([{ field: '_Title', sort: 'asc' }])
  338 + .select();
  339 +
  340 + $('#grid-view').empty();
  341 +
  342 + angular.forEach($scope.selectedCIListViewData, function (value, key) {
  343 +
  344 + var selectimg = true;
  345 + var count = 0;
  346 +
  347 +
  348 + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {
  349 + var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim()));
  350 + if (posbodyregion > -1) {
  351 + selectimg = true;
  352 + count = count + 1;
  353 +
  354 + }
  355 + else {
  356 + selectimg = false;
  357 + count = count - 1;
  358 + }
  359 +
  360 + }
  361 +
  362 + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) {
  363 + var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem);
  364 + if (posbodysystem > -1) {
  365 + count = count + 1;
  366 + selectimg = true;
  367 + } else {
  368 + selectimg = false;
  369 + count = count - 1;
  370 + }
  371 + }
  372 +
  373 + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) {
  374 + var posorientation = value._ViewOrientation.indexOf(query.selectedorientation);
  375 + if (posorientation > -1) {
  376 + count = count + 1;
  377 + selectimg = true;
  378 +
  379 + } else {
  380 + selectimg = false;
  381 + count = count - 1;
  382 + }
  383 +
  384 + }
  385 +
  386 + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) {
  387 + var posimagetype = value._ImageType.indexOf(query.selectedimagetype);
  388 + if (posimagetype > -1) {
  389 + count = count + 1;
  390 + selectimg = true;
  391 +
  392 + } else {
  393 + selectimg = false;
  394 + count = count - 1;
  395 + }
  396 +
  397 + }
  398 +
  399 + if (typeof (query.selectedspecialty) !== "undefined" && (query.selectedspecialty !== null && query.selectedspecialty !== "")) {
  400 + var posspeciality = value._MedicalSpecialty.indexOf(query.selectedspecialty);
  401 + if (posspeciality > -1) {
  402 + count = count + 1;
  403 + selectimg = true;
  404 + } else {
  405 + selectimg = false;
  406 + count = count - 1;
  407 + }
  408 +
  409 + }
  410 +
  411 + if (selectimg === true && count >= filtercount) {
  412 +
  413 +
  414 + $scope.imagePath = "~/../content/images/ci/thumbnails/" + value._ThumbnailImage;
  415 +
  416 + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-md-2" title = "' + value._Title + '" data-ng-click="openView($event)">'
  417 + + '<div class="thumbnail" >'
  418 + + '<img id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
  419 + + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
  420 +
  421 +
  422 + $compile($el)($scope);
  423 +
  424 + $(".sidebar").mCustomScrollbar({
  425 + autoHideScrollbar: true,
  426 + //theme:"rounded"
  427 + });
  428 +
  429 +
  430 + $scope.searchCIListViewData.push(
  431 + {
  432 + "_id": value._id,
  433 + "_ImageId": value._ImageId,
  434 + "_Title": value._Title,
  435 + "_contentImage": value._contentImage,
  436 + "_ThumbnailImage": value._ThumbnailImage,
  437 + "_BodySystem": value._BodySystem,
  438 + "_BodyRegion": value._BodyRegion,
  439 + "_ViewOrientation": value._ViewOrientation,
  440 + "_MedicalSpecialty": value._MedicalSpecialty,
  441 + "_ImageType": value._ImageType,
  442 + "_Summary": value._Summary
  443 +
  444 + });
  445 +
  446 + }
  447 +
  448 +
  449 + });
  450 +
  451 + //Show Error Message in case of gridview if no data is found
  452 + if ($scope.searchCIListViewData.length == 0) {
  453 +
  454 + var $el = $('<div class="col-sm-12" style="padding-left:25px;padding-top:10px;"><strong style="color:white">No illustration found for the selected search criteria!</strong></div>').appendTo('#grid-view');
  455 + $compile($el)($scope);
  456 + }
  457 + },
  458 + function (error) {
  459 + // handle errors here
  460 + console.log(' $scope.IllustrationData = ' + error.statusText);
  461 + }
  462 + );
  463 +
  464 +
  465 + }
  466 +
  467 +
  468 + $scope.scroll = function () {
  469 + $("html,body").scrollTop(0);
  470 + }
  471 +
  472 +
  473 + $scope.openView = function ($event) {
  474 +
  475 + $rootScope.MenuModuleName = "CI";
  476 + $rootScope.disableAnnotationTB = false;
  477 + $rootScope.CIAnotationIdentifyModeOff = true;
  478 + $rootScope.currentBodyViewId = $event.currentTarget.id;
  479 + if ($event.currentTarget.textContent !== null && typeof ($event.currentTarget.textContent) !== "undefined") {
  480 + var CITitle = [];
  481 + CITitle = new jinqJs()
  482 + .from($scope.selectedCIListViewData)
  483 + .where('_id = ' + $event.currentTarget.id)
  484 + .select('_Title');
  485 +
  486 + // console.log(CITitle);
  487 + // console.log($scope.selectedCIListViewData);
  488 +
  489 + $rootScope.ViewTitle = CITitle[0]._Title;
  490 + }
  491 + else {
  492 + $rootScope.ViewTitle = $event.currentTarget.textContent;
  493 +
  494 + }
  495 +
  496 +
  497 + localStorage.setItem("currentViewTitleFromJson", $rootScope.ViewTitle);
  498 + localStorage.setItem("currentBodyViewId", $event.currentTarget.id);
  499 +
  500 + var u = $location.url();
  501 + $location.url('/clinical-illustrations-detail');
  502 +
  503 + // console.log($location.url('/clinical-illustrations-detail'));
  504 +
  505 + }
  506 +
  507 + $scope.openBodyView = function () {
  508 +
  509 + $rootScope.isLoading = true;
  510 + $('#spinner').css('visibility', 'visible');
  511 + $scope.voId = localStorage.getItem("currentBodyViewId");
  512 +
  513 + // alert($scope.voId);
  514 +
  515 +
  516 + //once you get id in scope push detail in jspanel content
  517 +
  518 + var openViews;
  519 + if ($rootScope.openViews.length > 0) {
  520 + openViews = new jinqJs()
  521 + .from($rootScope.openViews)
  522 + .where("BodyViewId==" + $scope.voId)
  523 + .select();
  524 + }
  525 + var counter = 1;
  526 + var tittle = localStorage.getItem("currentViewTitleFromJson");
  527 +
  528 + if (openViews != null && openViews.length > 0) {
  529 + angular.forEach(openViews, function (value, key) {
  530 +
  531 + if (value.body - views == tittle) {
  532 + tittle = localStorage.getItem("currentViewTitleFromJson") + counter++;
  533 + $rootScope.currentActiveViewTitle = tittle;
  534 + localStorage.setItem("currentViewTitle", tittle);
  535 + }
  536 +
  537 + });
  538 + }
  539 + else {
  540 + localStorage.setItem("currentViewTitle", tittle);
  541 +
  542 + }
  543 +
  544 + //alert(localStorage.getItem("currentViewTitle"));
  545 +
  546 + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')
  547 + promise.then(
  548 + function (result) {
  549 + $scope.CIllustrationData = result;
  550 + $scope.CIlistViewData = $scope.CIllustrationData.root.CIData;
  551 +
  552 + var clickedCIImage = [];
  553 + clickedCIImage = new jinqJs()
  554 + .from($scope.CIlistViewData)
  555 + .where('_id == ' + $scope.voId)
  556 + .select('_contentImage');
  557 +
  558 + $scope.clickedCIImage = "~/../content/images/ci/images/" + clickedCIImage[0]._contentImage;
  559 +
  560 + var clickedCISummary = [];
  561 + clickedCISummary = new jinqJs()
  562 + .from($scope.CIlistViewData)
  563 + .where('_id == ' + $scope.voId)
  564 + .select('_Summary');
  565 +
  566 + $scope.clickedCISummary = clickedCISummary[0]._Summary
  567 +
  568 + if (clickedCIImage.length > 0 && clickedCISummary.length > 0) {
  569 +
  570 + $rootScope.isLoading = false;
  571 + $('#spinner').css('visibility', 'hidden');
  572 +
  573 + $.jsPanel({
  574 + id: 'ciImagePanel',
  575 + selector: '.ciView',
  576 + theme: 'success',
  577 + currentController: 'CIController',
  578 + parentSlug: 'clinical-illustrations',
  579 + content: '<div class="row" id="canvasDiv"><div style="align:left;width:100%;height:100%"><canvas id="canvas" ng-click="onDrawingCanvasClick($event)" width="1369" height="325" class="canvas-annotationStyle" style="position: absolute; background-color: transparent;z-index:1 "></canvas></div> <canvas id="canvasPaint" ng-click="FreeStylePaint($event)" width="1369" height="325" class="canvas-annotationStyle1" style="position: absolute;z-index:0;"></canvas>' +
  580 + '<div class="col-sm-12 img-thumbnail" align="center">' +
  581 + '<img src="' + $scope.clickedCIImage + '" alt="" title="" class="img-responsive "><div class="col-sm-12 well">' +
  582 + '<div align="left" id="sid"><p>' + $scope.clickedCISummary + '</p></div><button id="btnTxtOnOff" class="btn btn-primary pull-right">Text Off</button>' +
  583 + '<script>$(document).ready(function(){$("#btnTxtOnOff").click(function(){$("#sid").toggle();if($.trim($(this).text()) === "Text Off"){$(this).text("Text On");}else{$(this).text("Text Off");}});});</script></div>' +
  584 + '</div></div>',
  585 + //ajax: {
  586 + // url: 'app/views/ci/ci-view-detail.html'
  587 + //},
  588 + title: localStorage.getItem("currentViewTitle"),
  589 + position: {
  590 + top: 70,
  591 + left: 1,
  592 + },
  593 +
  594 + size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
  595 +
  596 + });
  597 +
  598 + $rootScope.currentSlug = 'clinical-illustrations-detail';
  599 +
  600 + $rootScope.openViews.push(
  601 + {
  602 + "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId,
  603 + "slug": $rootScope.currentSlug
  604 + });
  605 +
  606 +
  607 + }
  608 +
  609 +
  610 + },
  611 + function (error) {
  612 + // handle errors here
  613 + console.log(' $scope.CIllustrationData = ' + error.statusText);
  614 + }
  615 +
  616 + );
  617 +
  618 + // console.log($rootScope.openViews);
  619 + $('#CIView').css("height", $(window).outerHeight());
  620 +
  621 + $('#CIView').css("width", $(window).outerWidth());
  622 +
  623 + }
  624 +
  625 + $scope.$on('annotationToolEvent', function (event, data) {
  626 +
  627 + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)")
  628 + $('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });
  629 + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)")
  630 + $('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });
  631 +
  632 + $("#canvas").css("display", "block");
  633 + $("#canvasPaint").css("display", "block");
  634 +
  635 + $rootScope.onDrawingCanvasClick();
  636 + $rootScope.FreeStylePaint();
  637 + });
  638 +
  639 + $scope.ReloadListViewImageDiv = function (id) {
  640 + //console.log(id);
  641 + $scope.idSelected = id;
  642 + $scope.hiderow = true;
  643 +
  644 + var promise = DataService.getJson('~/../content/data/json/ci/ci_dat_contentlist.json')
  645 + promise.then(
  646 + function (result) {
  647 + $scope.IllustrationData = result;
  648 +
  649 + var SelectedCIthumbImage = [];
  650 + SelectedCIthumbImage = new jinqJs()
  651 + .from($scope.IllustrationData.root.CIData)
  652 + .where('_id = ' + id)
  653 + .select('_ThumbnailImage', '_Summary', '_id', '_Title');
  654 +
  655 + $scope.SelectedCIthumbImage = "~/../content/images/ci/thumbnails/" + SelectedCIthumbImage[0]._ThumbnailImage;
  656 + $scope.SelectedCISummary = SelectedCIthumbImage[0]._Summary;
  657 + $scope.SelectedCIId = SelectedCIthumbImage[0]._id;
  658 + $scope.SelectedCITitle = SelectedCIthumbImage[0]._Title;
  659 +
  660 + //Set the scroll position of the tablebody to show selected row.
  661 +
  662 + var curCIListViewScroll = localStorage.getItem("CIListViewScroll");
  663 + if (typeof (curCIListViewScroll) !== "undefined" && curCIListViewScroll !== null && curCIListViewScroll !== '') {
  664 +
  665 + $('#ListViewDiv').scrollTop(localStorage.getItem("CIListViewScroll"));
  666 + }
  667 + //else {
  668 + // $('#ListViewDiv').scrollTop(0);
  669 + //}
  670 +
  671 + },
  672 + function (error) {
  673 + // handle errors here
  674 + console.log(' $scope.AnimationData = ' + error.statusText);
  675 + }
  676 + );
  677 + };
  678 +
  679 + $scope.hideListViewDiv = function () {
  680 + if (localStorage.getItem("currentCITabView") == 2) {
  681 + localStorage.setItem("CISelectedRowId", "");
  682 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  683 + $scope.hiderow = false;
  684 + }
  685 + }
  686 +
  687 +}]
  688 +
  689 +
  690 +);
  691 +
  692 +
  693 +
  694 +
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -225,7 +225,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -225,7 +225,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
225 //annotation tool custom events 225 //annotation tool custom events
226 $rootScope.ShowAnnotationWindow = function () { 226 $rootScope.ShowAnnotationWindow = function () {
227 //7904 227 //7904
228 - if ($rootScope.MenuModuleName == "DA") { 228 + if ($rootScope.MenuModuleName == "DA" || $rootScope.MenuModuleName == "CI") {
229 if ($rootScope.disableAnnotationtoolOnListManager == true) { 229 if ($rootScope.disableAnnotationtoolOnListManager == true) {
230 $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); 230 $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled');
231 $('#slider-range-min-2').slider('disable'); 231 $('#slider-range-min-2').slider('disable');