Commit a2a99e48c4c1bd06c6250848b9d5cb6f1871dcb0

Authored by Nikita Kulshreshtha
1 parent e1a24cf7

Develop-IPAD-MAC code

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