Commit 7e67a9e859139e9c36926c67c0bacfecfdb98108

Authored by Utkarsh Singh
2 parents 6ac32877 43fbaf77

committing code to avoid conflict

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -36,19 +36,18 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
36 36 $scope.activePinArray = [];
37 37 $scope.showTabButton = true;
38 38 $scope.isListViewDataLoaded = true;
39   -
  39 +
40 40 $scope.setActiveTab = function (tabToSet) {
41   -
  41 +
42 42 $scope.activeTab = tabToSet;
43 43 localStorage.setItem("activeTab", $scope.activeTab);
44 44 if ($scope.activeTab == 1) {
45   - $('#grid-view').css("display","block");
  45 + $('#grid-view').css("display", "block");
46 46 $('#list-view').css("display", "none");
47 47 $("#demoView").remove();
48 48 }
49   - else
50   - {
51   -
  49 + else {
  50 +
52 51  
53 52 $('#grid-view').css("display", "none");
54 53 if ($scope.isListViewDataLoaded == true) {
... ... @@ -75,11 +74,10 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
75 74 $('#list-view').css("display", "block");
76 75 $scope.isListViewDataLoaded = false;
77 76 }
78   - else
79   - {
  77 + else {
80 78 $('#list-view').css("display", "block");
81 79 }
82   -
  80 +
83 81 $timeout(function () {
84 82 // if ($rootScope.isListViewRowClicked == true) {
85 83 // $rootScope.isListViewRowClicked = false;
... ... @@ -107,7 +105,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
107 105 }, 2000);
108 106 }
109 107 };
110   -
  108 +
111 109 $scope.loadForModuleById = function (moduleId) {
112 110  
113 111 if ($rootScope.refreshcheck == null) {
... ... @@ -127,7 +125,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
127 125 function (result) {
128 126  
129 127 $scope.moduleLandingData = result;
130   - // setTimeout(function () { $('#' + $rootScope.highlightid).find('.thumbnail').addClass('hightlightstate'); }, 100);
  128 + // setTimeout(function () { $('#' + $rootScope.highlightid).find('.thumbnail').addClass('hightlightstate'); }, 100);
131 129 if ($rootScope.getLocalStorageValue('AAGridViewHighlightThumbnail') !== null) {
132 130 setTimeout(function () { $('#' + $rootScope.getLocalStorageValue("AAGridViewHighlightThumbnail")).find('.thumbnail').addClass('HightLightThumbnail'); }, 100);
133 131 }
... ... @@ -152,11 +150,11 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
152 150 $scope.openModuleItemView = function (event) {
153 151  
154 152 $rootScope.MenuModuleName = "AA";
155   - localStorage.setItem("activeTab", $scope.activeTab);
  153 + localStorage.setItem("activeTab", $scope.activeTab);
156 154 //0. Get selected Image Id
157 155 if ($scope.isListViewButtonClicked == true) {
158 156 if ($scope.isOpenBtnClicked == true) {
159   -
  157 +
160 158 var moduleItemDataToBeSaved = $("#demoText").html();
161 159 $scope.isOpenBtnClicked = false;
162 160 }
... ... @@ -166,13 +164,12 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
166 164 var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
167 165 }
168 166 }
169   - else
170   - {
  167 + else {
171 168 var moduleItemDataToBeSaved = event.target.id;
172 169 localStorage.setItem("listViewSelectedID", event.currentTarget.id);
173 170 $scope.isListViewButtonClicked = false;
174 171 }
175   -
  172 +
176 173 //1.Filter selected module ietem data and get the pushed opened moduile array object
177 174 $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
178 175  
... ... @@ -188,7 +185,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
188 185 localStorage.setItem("currentViewTitle", $rootScope.OpenedTileData[6]);
189 186 localStorage.setItem("AAGridViewScroll", $($window).scrollTop());
190 187 localStorage.setItem("AAGridViewHighlightThumbnail", $(event.target).parent().parent().parent().attr('id'));
191   -
  188 +
192 189 //3. Navigate to the Module-item-view
193 190 var u = $location.url();
194 191 $location.url('/module-item-view');
... ... @@ -197,7 +194,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
197 194  
198 195  
199 196 $scope.openListViewModuleItem = function (event) {
200   -
  197 +
201 198 $("#demoView").remove();
202 199 var moduleItemDataToBeSavedID = event.currentTarget.id;
203 200 $("#list-view table tbody tr").removeClass("active");
... ... @@ -269,7 +266,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
269 266 var openedImage = new Image();
270 267 openedImage.id = 'modItemImage';
271 268 openedImage.name = $rootScope.OpenItemImagePath;
272   -
  269 +
273 270 openedImage.onload = function () {
274 271 $scope.imageWidth = this.width;
275 272 $scope.imageHeight = this.height;
... ... @@ -284,7 +281,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
284 281 if (document.getElementById('aaBodyView') != null) {
285 282  
286 283 //0.4 added some stylesheets
287   -
  284 +
288 285  
289 286 $rootScope.canvasDivHeight = $('.jsPanel-content').height() - $('.main2 .stickey-area').height();
290 287  
... ... @@ -349,7 +346,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
349 346 return true;
350 347 }
351 348  
352   -
  349 +
353 350 angular.element(document).ready(function (e) {
354 351 $("#ImagePanel").resize(function () {
355 352 $("#canvasDiv").scrollLeft($rootScope.CanvasDivLeftPosition);
... ... @@ -361,14 +358,15 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
361 358 $rootScope.selectedBodySystemName = 'All';
362 359 $rootScope.selectedBodySystemId = 0;
363 360 $rootScope.searchSelectedText = '';
364   -
  361 +
365 362 });
366 363 })
367 364  
368 365 $scope.showAllPins = function () {
369   -
  366 +
370 367 $scope.allPinDataArray = [];
371 368 var promise = ModuleService.getPinDataForImage($rootScope.imageName)
  369 +
372 370 .then(
373 371 function (result) {
374 372  
... ... @@ -407,7 +405,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
407 405 $timeout(function () {
408 406 $scope.activePinOnLayerChange();
409 407 }, 1000);
410   -
  408 +
411 409 }
412 410  
413 411 }
... ... @@ -526,17 +524,30 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
526 524  
527 525 if (selectimg === true && count >= filtercount) {
528 526  
  527 + if ($scope.activeTab == 1) {
  528 + $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName;
529 529  
530   - $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName;
531 530  
532   -
533 531 var $el = $('<div id="' + value._id + '" class="col-sm-3 col-lg-2" title = "' + value._Title + '" data-ng-click="openModuleItemView($event)">'
534 532 + '<div class="thumbnail" >'
535 533 + '<img class="tinyImg" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
536 534 + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
537 535  
538   -
539   - $compile($el)($scope);
  536 +
  537 + $compile($el)($scope);
  538 + }
  539 + else {
  540 + var htm = '';
  541 + htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  542 + //angular.forEach($scope.selectedAAListViewData, function (value, key) {
  543 + htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  544 + htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  545 + htm += "</tr>"
  546 + //});
  547 + htm += "</tbody></table>";
  548 + $("#list-view").html(htm);
  549 + $compile(htm)($scope);
  550 + }
540 551  
541 552 $(".sidebar").mCustomScrollbar({
542 553 autoHideScrollbar: true,
... ... @@ -564,9 +575,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
564 575  
565 576 });
566 577  
567   - //Show Error Message in case of gridview if no data is found
  578 + //Show Error Message in case of gridview/ ListView [if no data is found]
568 579 if ($scope.searchAAListViewData.length == 0) {
569   -
570 580 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');
571 581 $compile($el)($scope);
572 582 $('table > #ListViewDiv > #searchItem').remove();
... ... @@ -642,7 +652,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
642 652 else {
643 653 $scope.showAllPins();
644 654 }
645   - }
  655 + }
646 656 else {
647 657  
648 658 $scope.selectedSystemName = event.currentTarget.title;
... ... @@ -961,8 +971,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
961 971 if ($scope.sliderVal == 25) {
962 972 document.getElementById('speechBubbleLine' + PinId + '').style.top = ((speechBubbleDims[0].currentY + 5)) + 'px';
963 973 }
964   - else
965   - {
  974 + else {
966 975 document.getElementById('speechBubbleLine' + PinId + '').style.top = ((speechBubbleDims[0].currentY)) + 'px';
967 976 }
968 977 document.getElementById('speechBubble' + PinId + '').style.display = 'block';
... ... @@ -1065,7 +1074,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1065 1074 else {
1066 1075 $("#speechBubbleDraggedLine" + id).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 10) + 'px', 'left': (f - 5) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
1067 1076 }
1068   -
  1077 +
1069 1078 }
1070 1079 else {
1071 1080 $("#bord_annotation").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
... ... @@ -1078,118 +1087,118 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1078 1087  
1079 1088 $scope.drawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y) {
1080 1089 $scope.clickedPins = [];
1081   - // if ($scope.isSliderChange == true) {
1082   - console.log('isSliderrChange')
1083   - var radial = $('#' + canvasId).createGradient({
1084   - x1: 50, y1: 50,
1085   - x2: 50, y2: 50,
1086   - r1: 10, r2: 30,
1087   - c1: 'rgba(100, 50, 0,0)',
1088   - c2: 'rgb(216, 216, 216)'
1089   - });
1090   - $('#' + canvasId).drawLine({
1091   - layer: true,
1092   - name: "Pin_" + PinId,
1093   - groups: ["Pin_" + PinId],
1094   - strokeStyle: '#565656',
1095   - strokeWidth: 2,
1096   - visible: true,
1097   - x1: offsetX1 * $scope.sliderPercentValue, y1: offsetY1 * $scope.sliderPercentValue,
1098   - x2: x * $scope.sliderPercentValue, y2: y * $scope.sliderPercentValue,
1099   -
1100   -
1101   - }).drawArc({
1102   - name: "PinArc_" + PinId,
1103   - layer: true,
1104   - groups: ["Pin_" + PinId],
1105   - strokeStyle: 'grey',
1106   - strokeWidth: 2,
1107   - visible: true,
1108   - fillStyle: radial,
1109   - x: x * $scope.sliderPercentValue, y: y * $scope.sliderPercentValue,
1110   - radius: 5 * $scope.sliderPercentValue,
1111   -
1112   - click: function (clickedPin) {
1113   - if (clickedPin.event.ctrlKey == false) {
1114   - $scope.clickedPins = [];
1115   - }
1116   - var pinID = (clickedPin.name).substring(7, (clickedPin.name).length);
1117   - var pinData = new jinqJs()
1118   - .from($scope.aaPinData)
1119   - .where("_PinId == " + pinID)
1120   - .select();
  1090 + // if ($scope.isSliderChange == true) {
  1091 + console.log('isSliderrChange')
  1092 + var radial = $('#' + canvasId).createGradient({
  1093 + x1: 50, y1: 50,
  1094 + x2: 50, y2: 50,
  1095 + r1: 10, r2: 30,
  1096 + c1: 'rgba(100, 50, 0,0)',
  1097 + c2: 'rgb(216, 216, 216)'
  1098 + });
  1099 + $('#' + canvasId).drawLine({
  1100 + layer: true,
  1101 + name: "Pin_" + PinId,
  1102 + groups: ["Pin_" + PinId],
  1103 + strokeStyle: '#565656',
  1104 + strokeWidth: 2,
  1105 + visible: true,
  1106 + x1: offsetX1 * $scope.sliderPercentValue, y1: offsetY1 * $scope.sliderPercentValue,
  1107 + x2: x * $scope.sliderPercentValue, y2: y * $scope.sliderPercentValue,
  1108 +
  1109 +
  1110 + }).drawArc({
  1111 + name: "PinArc_" + PinId,
  1112 + layer: true,
  1113 + groups: ["Pin_" + PinId],
  1114 + strokeStyle: 'grey',
  1115 + strokeWidth: 2,
  1116 + visible: true,
  1117 + fillStyle: radial,
  1118 + x: x * $scope.sliderPercentValue, y: y * $scope.sliderPercentValue,
  1119 + radius: 5 * $scope.sliderPercentValue,
  1120 +
  1121 + click: function (clickedPin) {
  1122 + if (clickedPin.event.ctrlKey == false) {
  1123 + $scope.clickedPins = [];
  1124 + }
  1125 + var pinID = (clickedPin.name).substring(7, (clickedPin.name).length);
  1126 + var pinData = new jinqJs()
  1127 + .from($scope.aaPinData)
  1128 + .where("_PinId == " + pinID)
  1129 + .select();
1121 1130  
1122 1131  
1123   - var pinTermNumber = pinData[0]._TermId;
  1132 + var pinTermNumber = pinData[0]._TermId;
1124 1133  
1125   - var pinWithSameTerm = new jinqJs()
  1134 + var pinWithSameTerm = new jinqJs()
1126 1135  
1127   - .from($scope.aaPinData)
1128   - .where("_TermId == " + pinTermNumber)
1129   - .select();
  1136 + .from($scope.aaPinData)
  1137 + .where("_TermId == " + pinTermNumber)
  1138 + .select();
1130 1139  
1131 1140  
1132   - if (pinWithSameTerm != undefined && pinWithSameTerm != null && pinWithSameTerm.length > 0) {
  1141 + if (pinWithSameTerm != undefined && pinWithSameTerm != null && pinWithSameTerm.length > 0) {
1133 1142  
1134   - for (var i = 0; i < pinWithSameTerm.length; i++) {
1135   -
1136   - $scope.clickedPins.push({ 'id': pinWithSameTerm[i]._PinId })
1137   - }
  1143 + for (var i = 0; i < pinWithSameTerm.length; i++) {
1138 1144  
  1145 + $scope.clickedPins.push({ 'id': pinWithSameTerm[i]._PinId })
1139 1146 }
  1147 +
  1148 + }
1140 1149 $scope.isSelectedPinBtnClickedAftrSliderCange = false;
1141   - var selectedPinData = new jinqJs()
1142   - .from($scope.aaPinData)
1143   - .where("_PinId == " + pinID)
1144   - .select();
1145   - if (clickedPin.event.ctrlKey == true) {
1146   -
1147   - $scope.activePinArray.push(clickedPin.name);
1148   - var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
1149   - x1: 50, y1: 50,
1150   - x2: 50, y2: 50,
1151   - r1: 10, r2: 30,
1152   - c1: 'rgba(100, 50, 0,0)',
1153   - c2: 'rgb(126, 187, 83)'
1154   - });
1155   - clickedPin.fillStyle = radialAfterClick;
1156   - $scope.showAnnotation(selectedPinData, true, true, false);
1157   - }
1158   - else {
1159   - $scope.activePinArray = [];
1160   - $scope.activePinArray.push(clickedPin.name);
1161   - var radial = $('#aaDetailViewCanvas').createGradient({
1162   - x1: 50, y1: 50,
1163   - x2: 50, y2: 50,
1164   - r1: 10, r2: 30,
1165   - c1: 'rgba(100, 50, 0,0)',
1166   - c2: 'rgb(216, 216, 216)'
1167   - });
  1150 + var selectedPinData = new jinqJs()
  1151 + .from($scope.aaPinData)
  1152 + .where("_PinId == " + pinID)
  1153 + .select();
  1154 + if (clickedPin.event.ctrlKey == true) {
  1155 +
  1156 + $scope.activePinArray.push(clickedPin.name);
  1157 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1158 + x1: 50, y1: 50,
  1159 + x2: 50, y2: 50,
  1160 + r1: 10, r2: 30,
  1161 + c1: 'rgba(100, 50, 0,0)',
  1162 + c2: 'rgb(126, 187, 83)'
  1163 + });
  1164 + clickedPin.fillStyle = radialAfterClick;
  1165 + $scope.showAnnotation(selectedPinData, true, true, false);
  1166 + }
  1167 + else {
  1168 + $scope.activePinArray = [];
  1169 + $scope.activePinArray.push(clickedPin.name);
  1170 + var radial = $('#aaDetailViewCanvas').createGradient({
  1171 + x1: 50, y1: 50,
  1172 + x2: 50, y2: 50,
  1173 + r1: 10, r2: 30,
  1174 + c1: 'rgba(100, 50, 0,0)',
  1175 + c2: 'rgb(216, 216, 216)'
  1176 + });
1168 1177  
1169 1178  
1170   - $('#aaDetailViewCanvas').setLayers({
1171   - fillStyle: radial,
1172   - }).drawLayers();
  1179 + $('#aaDetailViewCanvas').setLayers({
  1180 + fillStyle: radial,
  1181 + }).drawLayers();
1173 1182  
1174   - //change the head color to green
1175   - var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
1176   - x1: 50, y1: 50,
1177   - x2: 50, y2: 50,
1178   - r1: 10, r2: 30,
1179   - c1: 'rgba(100, 50, 0,0)',
1180   - c2: 'rgb(126, 187, 83)'
1181   - });
  1183 + //change the head color to green
  1184 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1185 + x1: 50, y1: 50,
  1186 + x2: 50, y2: 50,
  1187 + r1: 10, r2: 30,
  1188 + c1: 'rgba(100, 50, 0,0)',
  1189 + c2: 'rgb(126, 187, 83)'
  1190 + });
1182 1191  
1183   - clickedPin.fillStyle = radialAfterClick;
1184   - $scope.showAnnotation(selectedPinData, false, true, false);
  1192 + clickedPin.fillStyle = radialAfterClick;
  1193 + $scope.showAnnotation(selectedPinData, false, true, false);
1185 1194  
1186   - }
  1195 + }
1187 1196  
1188 1197  
1189   - }
  1198 + }
  1199 +
  1200 + }).drawLayers();
1190 1201  
1191   - }).drawLayers();
1192   -
1193 1202  
1194 1203 }
1195 1204  
... ... @@ -1204,12 +1213,12 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1204 1213  
1205 1214 $scope.removePin = function (canvasId, pinId) {
1206 1215  
1207   - var pinName = 'Pin_' + pinId;
1208   - var pinArcName = 'PinArc_' + pinId;
1209   - $('#' + canvasId).removeLayer(pinName).drawLayers();
1210   - $('#' + canvasId).removeLayer(pinArcName).drawLayers();
  1216 + var pinName = 'Pin_' + pinId;
  1217 + var pinArcName = 'PinArc_' + pinId;
  1218 + $('#' + canvasId).removeLayer(pinName).drawLayers();
  1219 + $('#' + canvasId).removeLayer(pinArcName).drawLayers();
1211 1220  
1212   - $scope.removeSpeechBubble();
  1221 + $scope.removeSpeechBubble();
1213 1222  
1214 1223 //$rootScope.isSliderChanged = true;
1215 1224 //$('#aaDetailViewCanvas').removeLayers();
... ... @@ -1226,9 +1235,9 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1226 1235 $rootScope.onDrawingCanvasClick();
1227 1236 $rootScope.FreeStylePaint();
1228 1237 });
1229   -
  1238 +
1230 1239 $rootScope.loadSearchData = function () {
1231   -
  1240 +
1232 1241 //$("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
1233 1242 var imageId = $rootScope.imageId;
1234 1243 var promise = ModuleService.getTermTextDataForAAImage(imageId)
... ... @@ -1236,32 +1245,31 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1236 1245 function (response) {
1237 1246  
1238 1247 $scope.AAPinTermData = response.data.PinTermData.TermData;
1239   -
  1248 +
1240 1249 $rootScope.isLoading = false;
1241 1250 $('#setting-spinner').css('visibility', 'hidden');
1242   -
  1251 +
1243 1252 $scope.pinTermData = [];
1244 1253 var primaryLexicon = $rootScope.lexiconLanguageArray[0].id;
1245 1254 $scope.matchedLanguageTermData = new jinqJs()
1246 1255 .from($scope.AAPinTermData)
1247 1256 .where('_LanguageId == ' + primaryLexicon)
1248 1257 .select();
1249   - var sortedTermTextArray = [];
  1258 + var sortedTermTextArray = [];
1250 1259 for (var i = 0; i < $scope.matchedLanguageTermData.length; i++) {
1251 1260 sortedTermTextArray.push($scope.matchedLanguageTermData[i]._TermText);
1252 1261 sortedTermTextArray.sort();
1253 1262 }
1254   -
  1263 +
1255 1264 for (var i = 0; i <= sortedTermTextArray.length - 1; i++) {
1256   - for(var j = 0;j<= $scope.matchedLanguageTermData.length-1;j++){
1257   - if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i])
1258   - {
  1265 + for (var j = 0; j <= $scope.matchedLanguageTermData.length - 1; j++) {
  1266 + if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) {
1259 1267 $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[j]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[j]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[j]._TermText });
1260 1268 break;
1261 1269 }
1262 1270 }
1263 1271 }
1264   -
  1272 +
1265 1273 for (var i = 0; i <= sortedTermTextArray.length - 1; i++) {
1266 1274 for (var j = 0; j <= $scope.matchedLanguageTermData.length - 1; j++) {
1267 1275 if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) {
... ... @@ -1271,12 +1279,12 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1271 1279 }
1272 1280 }
1273 1281  
1274   -
  1282 +
1275 1283 $scope.$watch('$scope.pinTermData', function (newValue, oldValue, scope) {
1276   -
  1284 +
1277 1285 if (($('#termlistfilter').html() != ""))
1278   -
1279   - $('#termlistfilter').empty();
  1286 +
  1287 + $('#termlistfilter').empty();
1280 1288 if ($scope.pinTermData.length > 0) {
1281 1289 $timeout(function () {
1282 1290 console.log('pinTermData= ' + $scope.pinTermData.length);
... ... @@ -1285,12 +1293,12 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1285 1293 var $el = $('<li><a id= "' + $scope.pinTermData[j].TermNumber + '" href="" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</a></li>').appendTo('#termlistfilter')
1286 1294 $compile($el)($scope);
1287 1295 var $selectedOptions = $('<option title= "' + $scope.pinTermData[j].TermTxt + '" id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
1288   -
  1296 +
1289 1297 $compile($selectedOptions)($scope);
1290   -
  1298 +
1291 1299 $("#AABodySystems").empty();
1292   - $("#bodySystems").css("display","none");
1293   - $("#AABodySystems").css("display","block");
  1300 + $("#bodySystems").css("display", "none");
  1301 + $("#AABodySystems").css("display", "block");
1294 1302 $("#bodySystemList li a").each(function (key, value) {
1295 1303 var $systemOptions = $('<option id=' + $(this).attr('id') + ' >' + $(this).text() + '</option>').appendTo("#AABodySystems")
1296 1304 $compile($systemOptions)($scope);
... ... @@ -1311,19 +1319,18 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1311 1319  
1312 1320  
1313 1321 $scope.$on('listManagerEvent', function (event, data) {
1314   -
  1322 +
1315 1323 $("#viewName").empty();
1316 1324 $("#viewName").append("<option>" + $rootScope.listArray[0].text + "</option>");
1317 1325 $rootScope.isLoading = false;
1318 1326 $('#spinner').css('visibility', 'hidden');
1319   -
  1327 +
1320 1328 if ($rootScope.bodySystemSeletedId == null) {
1321   -
  1329 +
1322 1330 $rootScope.loadSearchData();
1323 1331 }
1324   - else
1325   - {
1326   -
  1332 + else {
  1333 +
1327 1334 $rootScope.refreshTermListOnAASystemSelection($rootScope.bodySystemSeletedId);
1328 1335 }
1329 1336 $timeout(function () {
... ... @@ -1335,13 +1342,13 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1335 1342  
1336 1343  
1337 1344 $rootScope.refreshTermListOnAASystemSelection = function (bodySystemId) {
1338   - $('#termList').empty();
  1345 + $('#termList').empty();
1339 1346 $rootScope.bodySystemSeletedId = bodySystemId;
1340 1347 $('#termList').empty();
1341 1348 var bodySystemName = $("#AABodySystems #" + bodySystemId).val();
1342 1349 if (bodySystemName == "All") {
1343 1350 for (var j = 0; j <= $scope.pinTermData.length - 1; j++) {
1344   -
  1351 +
1345 1352 $compile($selectedOptions)($scope);
1346 1353 }
1347 1354 $("#totalTerms").empty();
... ... @@ -1351,7 +1358,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1351 1358 var imageId = $rootScope.imageId;
1352 1359 $scope.pinDataUrl = "aa_dat_pinterm_" + imageId;
1353 1360 $rootScope.bodySystemTermArray = [];
1354   -
  1361 +
1355 1362 $.ajax({
1356 1363 url: '~/../content/data/json/aa/aa_pinterm/' + $scope.pinDataUrl + '.json',
1357 1364 type: 'GET',
... ... @@ -1381,7 +1388,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1381 1388 }
1382 1389 }
1383 1390 $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {
1384   -
  1391 +
1385 1392  
1386 1393 var languageArray = $rootScope.lexiconLanguageArray;
1387 1394  
... ... @@ -1391,11 +1398,11 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1391 1398 .from($scope.AAPinTermData)
1392 1399 .where('_TermNumber == ' + actualTermNo)
1393 1400 .select();
1394   -
  1401 +
1395 1402 if ($scope.matchedTermNoData != null || $scope.matchedTermNoData != undefined) {
1396   -
  1403 +
1397 1404 for (var j = 0; j <= languageArray.length - 1; j++) {
1398   -
  1405 +
1399 1406 $scope.matchedLanguageTermNoData = new jinqJs()
1400 1407 .from($scope.matchedTermNoData)
1401 1408 .where('_LanguageId == ' + languageArray[j].id)
... ... @@ -1463,9 +1470,9 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1463 1470 }
1464 1471 };
1465 1472  
1466   -
  1473 +
1467 1474 $scope.showSelectedPins = function () {
1468   -
  1475 +
1469 1476  
1470 1477 $rootScope.isLoading = true;
1471 1478 $('#spinner').css('visibility', 'visible');
... ... @@ -1533,7 +1540,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1533 1540  
1534 1541 // }
1535 1542 })
1536   -
  1543 +
1537 1544 angular.forEach(seletedSystemPinData, function (aaPinDataValue, aaPinDataKey) {
1538 1545  
1539 1546 var pinName = 'Pin_' + aaPinDataValue._PinId;
... ... @@ -1550,6 +1557,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1550 1557 })
1551 1558  
1552 1559  
  1560 + // $scope.clickedPins = [];
1553 1561 }
1554 1562  
1555 1563 else {
... ... @@ -1618,19 +1626,19 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1618 1626 }
1619 1627  
1620 1628 $scope.highlightPinBasedOnSerachItem = function (event) {
1621   -
1622   - $scope.searchItemId = event.currentTarget.id;
1623   - $scope.searchItemText = event.currentTarget.innerHTML;
1624   - $rootScope.searchSelectedText = $("#" + event.currentTarget.id).text();
1625   - $('#termList option[selected="selected"]').prop("selected", false);
1626   - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true);
1627   - $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
1628   - $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
1629 1629  
1630   - $("#termlistfilter li a").css({ "background-color": "#ffffff", "color": "#000000" });
1631   - $("#termlistfilter li #" + $scope.searchItemId).css({ "background-color": "#3399FF", "color": "#ffffff" });
1632   - $scope.searchFilter = event.currentTarget.innerHTML;
1633   - selectedTermName.placeholder = event.currentTarget.innerHTML;
  1630 + $scope.searchItemId = event.currentTarget.id;
  1631 + $scope.searchItemText = event.currentTarget.innerHTML;
  1632 + $rootScope.searchSelectedText = $("#" + event.currentTarget.id).text();
  1633 + $('#termList option[selected="selected"]').prop("selected", false);
  1634 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true);
  1635 + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
  1636 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
  1637 +
  1638 + $("#termlistfilter li a").css({ "background-color": "#ffffff", "color": "#000000" });
  1639 + $("#termlistfilter li #" + $scope.searchItemId).css({ "background-color": "#3399FF", "color": "#ffffff" });
  1640 + $scope.searchFilter = event.currentTarget.innerHTML;
  1641 + selectedTermName.placeholder = event.currentTarget.innerHTML;
1634 1642  
1635 1643  
1636 1644 //get data from pindata for this trem
... ... @@ -1644,7 +1652,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1644 1652 // maintaing scroll position on selection of options in list manager.
1645 1653 var annotationTopPos = $(".common-drag").css("top").split("p");
1646 1654 $("#canvasDiv").scrollTop(annotationTopPos[0]);
1647   -
  1655 +
1648 1656 $scope.IsSearchVisible = false;
1649 1657 }
1650 1658  
... ... @@ -1687,14 +1695,14 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1687 1695 x1: 50, y1: 50,
1688 1696 x2: 50, y2: 50,
1689 1697 r1: 10, r2: 30,
1690   - c1: 'rgba(100, 50, 0,0)',
1691   - c2: 'rgb(126, 187, 83)'
  1698 + c1: 'rgba(100, 50, 0,0)',
  1699 + c2: 'rgb(126, 187, 83)'
1692 1700 });
1693 1701 var clickedPin = $scope.activePinArray[i];
1694 1702 $('#aaDetailViewCanvas').setLayer(clickedPin, {
1695 1703 fillStyle: radialAfterClick
1696 1704 }).drawLayers();
1697   -
  1705 +
1698 1706 }
1699 1707 }
1700 1708  
... ... @@ -1859,7 +1867,7 @@ function openModuleItemView(event) {
1859 1867 }
1860 1868  
1861 1869 function openListViewModuleItem(event) {
1862   -
  1870 +
1863 1871 var scope = angular.element(document.getElementById("list-view")).scope();
1864 1872 scope.isListViewButtonClicked = true;
1865 1873 scope.$apply(function () {
... ... @@ -1878,7 +1886,7 @@ function openCurrentView(event) {
1878 1886 }
1879 1887  
1880 1888 function onZoom(scope) {
1881   -
  1889 +
1882 1890 //$(".common-drag").remove();
1883 1891 //$(".commonDot").remove();
1884 1892 //$(".commonDraggedLine").remove();
... ... @@ -1894,14 +1902,14 @@ function onZoom(scope) {
1894 1902 //}).drawLayers();
1895 1903 // scope.removePin();
1896 1904 // scope.showAllPins();
1897   -
  1905 +
1898 1906  
1899 1907 //6. Show all pins on AA opened item
1900 1908 }
1901 1909  
1902 1910  
1903 1911 $(document).ready(function () {
1904   -
  1912 +
1905 1913 $(".slider").slider({
1906 1914 min: 25,
1907 1915 max: 100,
... ... @@ -1916,40 +1924,40 @@ $(document).ready(function () {
1916 1924 var relativeWidth = 0;
1917 1925 var relativeHeight = 0;
1918 1926 if (ui.value == 25 || ui.value == 40 || ui.value == 55 || ui.value == 70 || ui.value == 85 || ui.value == 100) {
1919   - if (ui.value == 100) {
1920   - relativeWidth = scope.ViewImageWidth;
1921   - relativeHeight = scope.ViewImageHeight
1922   - scope.sliderPercentValue = 1.0;
1923   - }
1924   - else if (ui.value == 85) {
1925   - relativeWidth = scope.ViewImageWidth * 0.85;
1926   - relativeHeight = scope.ViewImageHeight * 0.85;
1927   - scope.sliderPercentValue = 0.85;
  1927 + if (ui.value == 100) {
  1928 + relativeWidth = scope.ViewImageWidth;
  1929 + relativeHeight = scope.ViewImageHeight
  1930 + scope.sliderPercentValue = 1.0;
  1931 + }
  1932 + else if (ui.value == 85) {
  1933 + relativeWidth = scope.ViewImageWidth * 0.85;
  1934 + relativeHeight = scope.ViewImageHeight * 0.85;
  1935 + scope.sliderPercentValue = 0.85;
1928 1936  
1929   - } else if (ui.value == 70) {
1930   - relativeWidth = scope.ViewImageWidth * 0.70;
1931   - relativeHeight = scope.ViewImageHeight * 0.70;
1932   - scope.sliderPercentValue = 0.70;
1933   - } else if (ui.value == 55) {
  1937 + } else if (ui.value == 70) {
  1938 + relativeWidth = scope.ViewImageWidth * 0.70;
  1939 + relativeHeight = scope.ViewImageHeight * 0.70;
  1940 + scope.sliderPercentValue = 0.70;
  1941 + } else if (ui.value == 55) {
1934 1942  
1935   - relativeWidth = scope.ViewImageWidth * 0.55;
1936   - relativeHeight = scope.ViewImageHeight * 0.55;
1937   - scope.sliderPercentValue = 0.55;
  1943 + relativeWidth = scope.ViewImageWidth * 0.55;
  1944 + relativeHeight = scope.ViewImageHeight * 0.55;
  1945 + scope.sliderPercentValue = 0.55;
1938 1946  
1939   - } else if (ui.value == 40) {
  1947 + } else if (ui.value == 40) {
1940 1948  
1941   - relativeWidth = scope.ViewImageWidth * 0.40;
1942   - relativeHeight = scope.ViewImageHeight * 0.40;
1943   - scope.sliderPercentValue = 0.40;
  1949 + relativeWidth = scope.ViewImageWidth * 0.40;
  1950 + relativeHeight = scope.ViewImageHeight * 0.40;
  1951 + scope.sliderPercentValue = 0.40;
1944 1952  
1945   - } else if (ui.value == 25) {
  1953 + } else if (ui.value == 25) {
1946 1954  
1947   - relativeWidth = scope.ViewImageWidth * 0.25;
1948   - relativeHeight = scope.ViewImageHeight * 0.25;
1949   - scope.sliderPercentValue = 0.25;
  1955 + relativeWidth = scope.ViewImageWidth * 0.25;
  1956 + relativeHeight = scope.ViewImageHeight * 0.25;
  1957 + scope.sliderPercentValue = 0.25;
1950 1958  
  1959 + }
1951 1960 }
1952   - }
1953 1961  
1954 1962 if (ui.value == 25 || ui.value == 40 || ui.value == 55 || ui.value == 70 || ui.value == 85 || ui.value == 100) {
1955 1963 $("#modItemImage").css("width", relativeWidth + "px");
... ... @@ -1959,7 +1967,7 @@ $(document).ready(function () {
1959 1967  
1960 1968 $("#modItemImage").attr('src', '');
1961 1969  
1962   -
  1970 +
1963 1971 $("#aaDetailViewCanvas").remove();
1964 1972 //0.5 create canvas on the top of image so that I can draw a line over the canvas.
1965 1973 var canvas = document.createElement('canvas');
... ... @@ -1970,7 +1978,7 @@ $(document).ready(function () {
1970 1978 canvas.style.left = '0px';
1971 1979 canvas.style.top = '0px';
1972 1980 canvas.style.position = "absolute";
1973   -
  1981 +
1974 1982 $("#canvasDiv").append(canvas);
1975 1983 scope.context = canvas.getContext("2d")
1976 1984 $("#modItemImage").attr('src', scope.OpenItemImagePath);
... ... @@ -1985,7 +1993,7 @@ $(document).ready(function () {
1985 1993 });
1986 1994 scope.isSelectedPinBtnClickedAftrSliderCange = true;
1987 1995 switch (btnID) {
1988   -
  1996 +
1989 1997 case "hidePinBtn":
1990 1998 break;
1991 1999 case "allPinBtn":
... ... @@ -2000,7 +2008,7 @@ $(document).ready(function () {
2000 2008 break;
2001 2009 }
2002 2010 }
2003   -
  2011 +
2004 2012 });
2005 2013 }
2006 2014 })
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js.orig 0 โ†’ 100644
  1 +๏ปฟ'use strict';
  2 +
  3 +AIA.controller("TileViewListController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "BodyRegions", "BodySystems", "ViewOrientations", "ImageTypes", "DataService", "ModuleService",
  4 +function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, BodyRegions, BodySystems, ViewOrientations, ImageTypes, DataService, ModuleService) {
  5 +
  6 +
  7 + $rootScope.OpenedTileData = [];
  8 + var DISSECTIBLE_ANATOMY = 'Dissectible Anatomy';
  9 + var ATLAS_ANATOMY = 'Atlas Anatomy';
  10 + var CLINICAL_ILLUSTRATION = 'Clinical Illustrations';
  11 + var CLINICAL_ANIMATION = 'Clinical Animations';
  12 + $rootScope.closeBtnImgPath = "~/../content/images/speeachBubbleClose.png";
  13 + //variables to bind Filter by Controls
  14 + $scope.searchAAListViewData = [];
  15 + $scope.SelectedAAthumbImage = [];
  16 + $scope.SelectedAAImage = [];
  17 + $scope.SelectedAASummary = [];
  18 + $scope.SelectedAAId = [];
  19 + $scope.SelectedAATitle = [];
  20 + $scope.selectedAAListViewData = [];
  21 + $scope.filterstring = false;
  22 + $scope.AllBodyRegion = [];
  23 + $scope.AllBodySystem = [];
  24 + $scope.AllOrientation = [];
  25 + $scope.AllImageType = [];
  26 + $rootScope.speechBubbleDimaensions = [];
  27 + $scope.runningSearchWorkers = [];
  28 + $scope.clickedPins = [];
  29 + $scope.sliderPercentValue = 1;
  30 + $scope.query = {
  31 + selectedbodyregion: '',
  32 + selectedbodysystem: '',
  33 + selectedorientation: '',
  34 + selectedimagetype: '',
  35 + };
  36 + $scope.activePinArray = [];
  37 + $scope.showTabButton = true;
  38 + $scope.isListViewDataLoaded = true;
  39 +
  40 + $scope.setActiveTab = function (tabToSet) {
  41 +
  42 + $scope.activeTab = tabToSet;
  43 + localStorage.setItem("activeTab", $scope.activeTab);
  44 + if ($scope.activeTab == 1) {
  45 + $('#grid-view').css("display", "block");
  46 + $('#list-view').css("display", "none");
  47 + $("#demoView").remove();
  48 + }
  49 +<<<<<<< HEAD
  50 + else
  51 + {
  52 +
  53 +=======
  54 + else {
  55 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  56 +
  57 + $('#grid-view').css("display", "none");
  58 + if ($scope.isListViewDataLoaded == true) {
  59 + var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
  60 + .then(
  61 + function (result) {
  62 + // alert(JSON.stringify($scope.moduleLandingData));
  63 + $scope.moduleLandingData = result;
  64 + $scope.selectedAAListViewData = new jinqJs()
  65 + .from($scope.moduleLandingData.data.root.Item)
  66 + .orderBy([{ field: '_Title', sort: 'asc' }])
  67 + .select();
  68 + var htm = '';
  69 + htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  70 + angular.forEach($scope.selectedAAListViewData, function (value, key) {
  71 + htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  72 + htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  73 + htm += "</tr>"
  74 + });
  75 + htm += "</tbody></table>";
  76 + $("#list-view").html(htm);
  77 + $compile(htm)($scope);
  78 + });
  79 + $('#list-view').css("display", "block");
  80 + $scope.isListViewDataLoaded = false;
  81 + }
  82 + else {
  83 + $('#list-view').css("display", "block");
  84 + }
  85 +
  86 + $timeout(function () {
  87 + // if ($rootScope.isListViewRowClicked == true) {
  88 + // $rootScope.isListViewRowClicked = false;
  89 + $("#demoView").remove();
  90 + $("#viewList").append("<div class='col-xs-12 text-center' style='padding-top:15px;padding-bottom:15px;' id='demoView'><div class='col-xs-12' style='padding:15px;background-color:#fff;'><div class='col-xs-2' style='border:1px solid #000;padding:5px;color:#000;font-size:12px;'><div class='thumbnail' style='margin-bottom:10px;'><img style='width:auto;height:95px!important;' src=" + $rootScope.listArray[0].imageName + "></div><div class='col-xs-12' id='demoText' style='padding:0;'>" + $rootScope.listArray[0].text + "</div></div></div><a style='position:absolute;right:30px;bottom:34px;' onclick='openCurrentView(event)' href='javascript:void(0)' class='pull-right btn btn-primary'>Open</a></div>");
  91 + var moduleItemDataToBeSavedID
  92 + $("#list-view table tbody tr").removeClass("active");
  93 + var moduleItemDataToBeSavedID = $rootScope.getLocalStorageValue("listViewSelectedID");
  94 + $("#list-view table tbody #" + moduleItemDataToBeSavedID).addClass("active");
  95 + $scope.isListViewButtonClicked = true;
  96 + var curAAListViewScroll = $rootScope.getLocalStorageValue("AAListViewScroll");
  97 +
  98 + if (typeof (curAAListViewScroll) !== "undefined" && curAAListViewScroll !== null && curAAListViewScroll !== '') {
  99 + if (typeof InstallTrigger !== 'undefined') {
  100 +
  101 + $('#list-view table tbody').animate({ scrollTop: $rootScope.getLocalStorageValue("AAListViewScroll") });
  102 + }
  103 + else {
  104 +
  105 + $('#list-view table tbody').scrollTop($rootScope.getLocalStorageValue("AAListViewScroll"));
  106 + }
  107 +
  108 + }
  109 + // }
  110 + }, 2000);
  111 + }
  112 + };
  113 +
  114 + $scope.loadForModuleById = function (moduleId) {
  115 +<<<<<<< HEAD
  116 +
  117 +=======
  118 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  119 + if ($rootScope.refreshcheck == null) {
  120 + $location.path('/');
  121 + }
  122 + $scope.moduleId = moduleId;
  123 + $scope.activeTab = 1;
  124 + console.log('loadForModuleById is called')
  125 + $rootScope.moduleName = Modules[moduleId].Name;
  126 + $rootScope.currentActiveModuleTitle = $rootScope.moduleName;
  127 + $scope.AllBodyRegion = BodyRegions;
  128 + $scope.AllBodySystem = BodySystems;
  129 + $scope.AllOrientation = ViewOrientations;
  130 + $scope.AllImageType = ImageTypes;
  131 + var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
  132 + .then(
  133 + function (result) {
  134 +
  135 + $scope.moduleLandingData = result;
  136 +<<<<<<< HEAD
  137 + // setTimeout(function () { $('#' + $rootScope.highlightid).find('.thumbnail').addClass('hightlightstate'); }, 100);
  138 + if ($rootScope.getLocalStorageValue('AAGridViewHighlightThumbnail') !== null) {
  139 + setTimeout(function () { $('#' + $rootScope.getLocalStorageValue("AAGridViewHighlightThumbnail")).find('.thumbnail').addClass('HightLightThumbnail'); }, 100);
  140 +=======
  141 + // setTimeout(function () { $('#' + $rootScope.highlightid).find('.thumbnail').addClass('hightlightstate'); }, 100);
  142 + if (localStorage.getItem('AAGridViewHighlightThumbnail') !== null) {
  143 + setTimeout(function () { $('#' + localStorage.getItem("AAGridViewHighlightThumbnail")).find('.thumbnail').addClass('HightLightThumbnail'); }, 100);
  144 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  145 + }
  146 + //console.log(JSON.stringify(result, null, 4));
  147 + },
  148 + function (error) {
  149 + // handle errors here
  150 + console.log(' error: ' + error.statusText);
  151 + }
  152 + )
  153 + if ($rootScope.getLocalStorageValue('AAGridViewScroll') !== null) {
  154 + $('html, body').animate({ scrollTop: $rootScope.getLocalStorageValue('AAGridViewScroll') }, 'slow');
  155 + }
  156 + }
  157 +
  158 + //$scope.$on('$viewContentLoaded', function (event) {
  159 +
  160 + // $scope.loadForModuleById();
  161 +
  162 + //});
  163 + $scope.isOpenBtnClicked = false;
  164 + $scope.openModuleItemView = function (event) {
  165 +
  166 + $rootScope.MenuModuleName = "AA";
  167 + localStorage.setItem("activeTab", $scope.activeTab);
  168 + //0. Get selected Image Id
  169 + if ($scope.isListViewButtonClicked == true) {
  170 + if ($scope.isOpenBtnClicked == true) {
  171 +
  172 + var moduleItemDataToBeSaved = $("#demoText").html();
  173 + $scope.isOpenBtnClicked = false;
  174 + }
  175 + else {
  176 + var moduleItemDataToBeSavedID = event.currentTarget.id;
  177 + localStorage.setItem("listViewSelectedID", moduleItemDataToBeSavedID);
  178 + var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
  179 + }
  180 + }
  181 + else {
  182 + var moduleItemDataToBeSaved = event.target.id;
  183 + localStorage.setItem("listViewSelectedID", event.currentTarget.id);
  184 + $scope.isListViewButtonClicked = false;
  185 + }
  186 +
  187 + //1.Filter selected module ietem data and get the pushed opened moduile array object
  188 + $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
  189 +
  190 + //2. Pick the image name to create a source to open
  191 + $rootScope.imageId = $rootScope.OpenedTileData[0];
  192 + $rootScope.imageName = $rootScope.OpenedTileData[3];
  193 + $rootScope.bodySystemName = $rootScope.OpenedTileData[2];
  194 + $rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
  195 + $scope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
  196 + $rootScope.listArray = [];
  197 + $rootScope.listArray.push({ "imageName": $rootScope.OpenItemImagePath, "text": moduleItemDataToBeSaved });
  198 + //3. set opened module item ti
  199 + localStorage.setItem("currentViewTitle", $rootScope.OpenedTileData[6]);
  200 + localStorage.setItem("AAGridViewScroll", $($window).scrollTop());
  201 + localStorage.setItem("AAGridViewHighlightThumbnail", $(event.target).parent().parent().parent().attr('id'));
  202 +
  203 + //3. Navigate to the Module-item-view
  204 + var u = $location.url();
  205 + $location.url('/module-item-view');
  206 +
  207 + }
  208 +
  209 +
  210 + $scope.openListViewModuleItem = function (event) {
  211 +
  212 + $("#demoView").remove();
  213 + var moduleItemDataToBeSavedID = event.currentTarget.id;
  214 + $("#list-view table tbody tr").removeClass("active");
  215 + localStorage.setItem("listViewSelectedID", moduleItemDataToBeSavedID);
  216 + $("#list-view table tbody #" + moduleItemDataToBeSavedID).addClass("active");
  217 + localStorage.setItem("AAListViewScroll", $("#list-view table tbody").scrollTop());
  218 + var moduleItemDataToBeSaved = $("#list-view table tbody #" + moduleItemDataToBeSavedID).find('td:eq(0)').text();
  219 + $rootScope.OpenedTileData = ModuleService.GetOpenedTileData(moduleItemDataToBeSaved, $scope.moduleLandingData);
  220 + $rootScope.OpenItemImagePath = "../../../content/images/aa/images/" + $rootScope.OpenedTileData[3];
  221 + $rootScope.listArray = [];
  222 + $rootScope.listArray.push({ "imageName": $rootScope.OpenItemImagePath, "text": moduleItemDataToBeSaved });
  223 + $("#viewList").append("<div class='col-xs-12 text-center' style='padding-top:15px;padding-bottom:15px;' id='demoView'><div class='col-xs-12' style='padding:15px;background-color:#fff;'><div class='col-xs-2' style='border:1px solid #000;padding:5px;color:#000;font-size:12px;'><div class='thumbnail' style='margin-bottom:10px;'><img style='width:auto;height:95px!important;' src=" + $rootScope.OpenItemImagePath + "></div><div class='col-xs-12' id='demoText' style='padding:0;'>" + moduleItemDataToBeSaved + "</div></div></div><a style='position:absolute;right:30px;bottom:34px;' onclick='openCurrentView(event)' href='javascript:void(0)' class='pull-right btn btn-primary'>Open</a></div>");
  224 + }
  225 +
  226 +
  227 + $scope.openModuleItem = function () {
  228 +<<<<<<< HEAD
  229 +
  230 +=======
  231 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  232 + if ($rootScope.refreshcheck == null) {
  233 + $location.path('/');
  234 + }
  235 + var jsContentURL;
  236 + var moduleItemViewDivId;
  237 +
  238 + //1. create a jsPanel and load the module item view
  239 + if ($rootScope.moduleName == ATLAS_ANATOMY) {
  240 +
  241 + jsContentURL = 'app/views/aa/atlas-anatomy-detail.html';
  242 + moduleItemViewDivId = 'aaDetailPageDiv';
  243 + }
  244 + else if ($rootScope.moduleName == CLINICAL_ANIMATION) {
  245 + //to do, in next phase of project
  246 +
  247 + }
  248 + else if ($rootScope.moduleName == CLINICAL_ILLUSTRATION) {
  249 + //to do, in next phase of project
  250 +
  251 + }
  252 +
  253 + //1. create a jsPanel and load the module item view
  254 + if ($rootScope.moduleName == ATLAS_ANATOMY) {
  255 + $.jsPanel({
  256 + id: 'ImagePanel',
  257 + selector: '.aaBodyView',
  258 + theme: 'success',
  259 + currentController: 'TileViewListController',
  260 + parentSlug: 'tile-view-list',
  261 + ajax: {
  262 + url: jsContentURL
  263 + },
  264 + title: $rootScope.getLocalStorageValue("currentViewTitle"),
  265 +
  266 + position: {
  267 + top: 70,
  268 + left: 1,
  269 + },
  270 +
  271 + size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 },
  272 +
  273 + });
  274 +
  275 + console.log('jsPanel loaded ImagePanel exist= ' + document.getElementById('ImagePanel'))
  276 +
  277 + //0.3
  278 + var aaViewElement = angular.element(document.getElementById(moduleItemViewDivId));
  279 +
  280 + //0.4 for Opening module item, load it into image
  281 + $rootScope.isLoading = true;
  282 + $('#spinner').css('visibility', 'visible');
  283 + var openedImage = new Image();
  284 + openedImage.id = 'modItemImage';
  285 + openedImage.name = $rootScope.OpenItemImagePath;
  286 +
  287 + openedImage.onload = function () {
  288 + $scope.imageWidth = this.width;
  289 + $scope.imageHeight = this.height;
  290 +
  291 + $('#aaBodyView').css("height", $(window).outerHeight());
  292 +
  293 + $('#aaBodyView').css("width", $(window).outerWidth());
  294 + $timeout(function () {
  295 + $compile(aaViewElement.contents())($scope);
  296 +
  297 + //if (document.getElementById('aaDetailPageDiv') != null) {
  298 + if (document.getElementById('aaBodyView') != null) {
  299 +
  300 + //0.4 added some stylesheets
  301 +<<<<<<< HEAD
  302 +
  303 +
  304 +=======
  305 +
  306 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  307 + $rootScope.canvasDivHeight = $('.jsPanel-content').height() - $('.main2 .stickey-area').height();
  308 +
  309 + $('.canvasDivClass').css("height", $rootScope.canvasDivHeight);
  310 +
  311 + $scope.currentTitleFromJson = $rootScope.getLocalStorageValue("currentViewTitle");
  312 + $("#modItemImage").attr('src', $rootScope.OpenItemImagePath);
  313 +
  314 +
  315 + $rootScope.ViewImageWidth = $("#modItemImage").width();
  316 + $scope.ViewImageWidth = $("#modItemImage").width();
  317 + $scope.ViewImageHeight = $("#modItemImage").height();
  318 +
  319 + $scope.relativeDimesion = 0;
  320 + $("#modItemImage").css("width", $rootScope.ViewImageWidth + "px");
  321 + //0.5 create canvas on the top of image so that I can draw a line over the canvas.
  322 + var canvas = document.createElement('canvas');
  323 + canvas.id = 'aaDetailViewCanvas';
  324 + canvas.className = '.aaCanvas'
  325 + canvas.height = parseInt(($scope.imageHeight));
  326 + canvas.width = parseInt($scope.imageWidth);
  327 + canvas.style.left = '0px';
  328 + canvas.style.top = '0px';
  329 + canvas.style.position = "absolute";
  330 + $("#canvasDiv").append(canvas);
  331 + $scope.context = canvas.getContext("2d")
  332 +
  333 + //6. Show all pins on AA opened item
  334 + $scope.showAllPins();
  335 +
  336 + //7. Highlight all system body list in left side
  337 + $scope.highlightBodySystemList();
  338 + }
  339 + }, 500);
  340 + }
  341 +
  342 + openedImage.onerror = loadFailure;
  343 + openedImage.src = $rootScope.OpenItemImagePath;
  344 + }
  345 +
  346 + }
  347 +
  348 + $scope.highlightBodySystemList = function () {
  349 + $rootScope.bodySystemNames = $rootScope.bodySystemName.trim().split(/\s*,\s*/);
  350 + var bodySystemListObj = document.getElementById("bodySystemList").getElementsByTagName("a");
  351 + var bodySystemListlength = bodySystemListObj.length;
  352 + for (var i = 0; i < bodySystemListlength; i++) {
  353 +
  354 + //var boldTag = lis[i];
  355 + for (var j = 0; j < $rootScope.bodySystemNames.length; j++) {
  356 + if ((bodySystemListObj[i].innerHTML) == ($rootScope.bodySystemNames[j])) {
  357 + $("#" + i).parent().removeClass("disabledSelectedSystem");
  358 +
  359 + }
  360 +
  361 + }
  362 +
  363 + }
  364 + }
  365 + function loadFailure() {
  366 + console.log('unable to load opened module ietem');
  367 + return true;
  368 + }
  369 +
  370 +
  371 + angular.element(document).ready(function (e) {
  372 + $("#ImagePanel").resize(function () {
  373 + $("#canvasDiv").scrollLeft($rootScope.CanvasDivLeftPosition);
  374 + $("#canvasDiv").scrollTop($rootScope.CanvasDivTopPosition);
  375 + });
  376 + $(document).on("click", "#ImagePanel .jsPanel-hdr .jsPanel-hdr-r .jsPanel-btn-close .jsglyph-remove", function () {
  377 + $scope.setActiveTab(parseInt($rootScope.getLocalStorageValue("activeTab")));
  378 + $(".tools").css("z-index", "15000");
  379 + $rootScope.selectedBodySystemName = 'All';
  380 + $rootScope.selectedBodySystemId = 0;
  381 + $rootScope.searchSelectedText = '';
  382 +
  383 + });
  384 + })
  385 +
  386 + $scope.showAllPins = function () {
  387 +<<<<<<< HEAD
  388 +
  389 + $scope.allPinDataArray = [];
  390 +=======
  391 +
  392 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  393 + var promise = ModuleService.getPinDataForImage($rootScope.imageName)
  394 + .then(
  395 + function (result) {
  396 +
  397 + //load navigator image
  398 + if (result.data.Root._NavigatorImage != undefined) {
  399 + document.getElementById('navimg').src = '~/../content/images/aa/images/navigator/' + result.data.Root._NavigatorImage;
  400 + }
  401 + else {
  402 + document.getElementById('navimg').style.visibility = 'hidden';
  403 + document.getElementById('navigatorBtn').style.visibility = 'hidden';
  404 + document.getElementById('navigatorDiv').style.visibility = 'hidden';
  405 +
  406 + }
  407 +
  408 + //draw pins
  409 + $scope.aaPinData = result.data.Root.Item;
  410 + if ($scope.aaPinData != null && $scope.aaPinData.length > 0) {
  411 +
  412 + angular.forEach($scope.aaPinData, function (value, key) {
  413 + $scope.allPinDataArray.push(value._PinId);
  414 + $scope.drawStaticPinsOnImage('aaDetailViewCanvas', value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY)
  415 + })
  416 +
  417 +
  418 +
  419 + //load search/vocab data
  420 + $rootScope.loadSearchData();
  421 + }
  422 + },
  423 + function (error) {
  424 +
  425 + console.log(' error in showAllPins: ' + error.statusText);
  426 + }
  427 + )
  428 + if ($scope.isSliderChange == true) {
  429 + $timeout(function () {
  430 + $scope.activePinOnLayerChange();
  431 + }, 1000);
  432 +
  433 + }
  434 +
  435 + }
  436 +
  437 +
  438 + $scope.FilterByImage = function (moduleId, query) {
  439 +
  440 + $scope.moduleId = moduleId;
  441 +
  442 + console.log('loadForModuleById is called')
  443 + $rootScope.moduleName = Modules[moduleId].Name;
  444 + while ($scope.searchAAListViewData.length) {
  445 + $scope.searchAAListViewData.pop();
  446 + }
  447 +
  448 + var filtercount = 0;
  449 + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {
  450 + filtercount = filtercount + 1;
  451 + localStorage.setItem("CurrentBodyRegion", query.selectedbodyregion);
  452 + }
  453 + else {
  454 + localStorage.setItem("CurrentBodyRegion", '');
  455 + }
  456 +
  457 + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) {
  458 + filtercount = filtercount + 1;
  459 + localStorage.setItem("CurrentBodySystem", query.selectedbodysystem);
  460 + }
  461 + else {
  462 + localStorage.setItem("CurrentBodySystem", '');
  463 + }
  464 +
  465 + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== '')) {
  466 + filtercount = filtercount + 1;
  467 + localStorage.setItem("CurrentOrientation", query.selectedorientation);
  468 + }
  469 + else {
  470 + localStorage.setItem("CurrentOrientation", '');
  471 + }
  472 +
  473 + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== '')) {
  474 + filtercount = filtercount + 1;
  475 + localStorage.setItem("CurrentImageType", query.selectedimagetype);
  476 + }
  477 + else {
  478 + localStorage.setItem("CurrentImageType", '');
  479 + }
  480 +
  481 + var promise = ModuleService.loadModuleDataBasedOnModuleName($scope.moduleName)
  482 + .then(
  483 + function (result) {
  484 + // alert(JSON.stringify($scope.moduleLandingData));
  485 + $scope.moduleLandingData = result;
  486 + $scope.selectedAAListViewData = new jinqJs()
  487 + .from($scope.moduleLandingData.data.root.Item)
  488 + .orderBy([{ field: '_Title', sort: 'asc' }])
  489 + .select();
  490 +
  491 + $('#grid-view').empty();
  492 + //alert(JSON.stringify($scope.selectedAAListViewData))
  493 + angular.forEach($scope.selectedAAListViewData, function (value, key) {
  494 +
  495 + var selectimg = true;
  496 + var count = 0;
  497 +
  498 +
  499 + if (typeof (query.selectedbodyregion) !== "undefined" && (query.selectedbodyregion !== null && query.selectedbodyregion !== "")) {
  500 + var posbodyregion = value._BodyRegion.indexOf((query.selectedbodyregion.trim()));
  501 + if (posbodyregion > -1) {
  502 + selectimg = true;
  503 + count = count + 1;
  504 + }
  505 + else {
  506 + selectimg = false;
  507 + count = count - 1;
  508 + }
  509 +
  510 + }
  511 +
  512 + if (typeof (query.selectedbodysystem) !== "undefined" && (query.selectedbodysystem !== null && query.selectedbodysystem !== "")) {
  513 + var posbodysystem = value._BodySystem.indexOf(query.selectedbodysystem);
  514 + if (posbodysystem > -1) {
  515 + count = count + 1;
  516 + selectimg = true;
  517 + } else {
  518 + selectimg = false;
  519 + count = count - 1;
  520 + }
  521 + }
  522 +
  523 + if (typeof (query.selectedorientation) !== "undefined" && (query.selectedorientation !== null && query.selectedorientation !== "")) {
  524 + var posorientation = value._ViewOrientation.indexOf(query.selectedorientation);
  525 + if (posorientation > -1) {
  526 + count = count + 1;
  527 + selectimg = true;
  528 +
  529 + } else {
  530 + selectimg = false;
  531 + count = count - 1;
  532 + }
  533 +
  534 + }
  535 +
  536 + if (typeof (query.selectedimagetype) !== "undefined" && (query.selectedimagetype !== null && query.selectedimagetype !== "")) {
  537 + var posimagetype = value._ImageType.indexOf(query.selectedimagetype);
  538 + if (posimagetype > -1) {
  539 + count = count + 1;
  540 + selectimg = true;
  541 +
  542 + } else {
  543 + selectimg = false;
  544 + count = count - 1;
  545 + }
  546 +
  547 + }
  548 +
  549 + if (selectimg === true && count >= filtercount) {
  550 +
  551 + if ($scope.activeTab == 1) {
  552 + $scope.imagePath = "../content/images/aa/thumbnails/" + value._TileImageName;
  553 +
  554 +
  555 + var $el = $('<div id="' + value._id + '" class="col-sm-3 col-lg-2" title = "' + value._Title + '" data-ng-click="openModuleItemView($event)">'
  556 + + '<div class="thumbnail" >'
  557 + + '<img class="tinyImg" id="' + value._Title + '"ng-src="' + $scope.imagePath + '" alt="" title="" >'
  558 + + '<div class="caption"><p>' + value._Title + '</p></div></a></div></div>').appendTo('#grid-view');
  559 +
  560 +
  561 + $compile($el)($scope);
  562 + }
  563 + else {
  564 + var htm = '';
  565 + htm += "<table class='table table-hover table-fixed bg-white table-txt12'> <thead class='clsthead'><tr class='active'><th width='25%'>Title</th> <th width='15%'>Region</th> <th width='30%'>System</th><th width='15%'>View</th> <th width='15%'>Type</th></tr></thead><tbody class='clstbody'>";
  566 + //angular.forEach($scope.selectedAAListViewData, function (value, key) {
  567 + htm += "<tr id=" + value._Id + " onclick='openListViewModuleItem(event)' ondblclick='openModuleItemView(event)'>"
  568 + htm += '<td width="25%">' + value._Title + '</td><td width="15%">' + value._BodyRegion + '</td><td width="30%">' + value._BodySystem + '</td><td width="15%">' + value._ViewOrientation + '</td><td width="15%">' + value._ImageType + '</td>';
  569 + htm += "</tr>"
  570 + //});
  571 + htm += "</tbody></table>";
  572 + $("#list-view").html(htm);
  573 + $compile(htm)($scope);
  574 + }
  575 +
  576 + $(".sidebar").mCustomScrollbar({
  577 + autoHideScrollbar: true,
  578 + //theme:"rounded"
  579 + });
  580 +
  581 +
  582 + $scope.searchAAListViewData.push(
  583 + {
  584 + "_id": value._id,
  585 + "_ImageId": value._ImageId,
  586 + "_Title": value._Title,
  587 + "_ImageName": value._contentImage,
  588 + "_TileImageName": value._ThumbnailImage,
  589 + "_BodySystem": value._BodySystem,
  590 + "_BodyRegion": value._BodyRegion,
  591 + "_ViewOrientation": value._ViewOrientation,
  592 + "_ImageType": value._ImageType
  593 + //"$$hashKey": value._Summary
  594 +
  595 + });
  596 +
  597 + }
  598 +
  599 +
  600 + });
  601 +
  602 +<<<<<<< HEAD
  603 + //Show Error Message in case of gridview if no data is found
  604 + if ($scope.searchAAListViewData.length == 0) {
  605 +
  606 +=======
  607 + //Show Error Message in case of gridview/ ListView [if no data is found]
  608 + if ($scope.searchAAListViewData.length == 0) {
  609 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  610 + 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');
  611 + $compile($el)($scope);
  612 + $('table > #ListViewDiv > #searchItem').remove();
  613 +
  614 + $('#ListViewDiv').append('<tr id="searchItem"><td colspan="6"><strong style="color:black;">No illustration found for the selected search criteria!</strong></td></tr>');
  615 + }
  616 + console.log(JSON.stringify(result, null, 4));
  617 + },
  618 + function (error) {
  619 + // handle errors here
  620 + console.log(' error: ' + error.statusText);
  621 + }
  622 + )
  623 +
  624 + }
  625 +
  626 + $scope.Reset = function (moduleId, query) {
  627 +
  628 + query.selectedbodyregion = "";
  629 + query.selectedbodysystem = "";
  630 + query.selectedorientation = "";
  631 + query.selectedimagetype = "";
  632 + query.selectedspecialty = "";
  633 +
  634 +
  635 + //set localstorage values
  636 + localStorage.setItem("CurrentBodyRegion", '');
  637 + localStorage.setItem("CurrentBodySystem", '');
  638 + localStorage.setItem("CurrentOrientation", '');
  639 + localStorage.setItem("CurrentImageType", '');
  640 + //localStorage.setItem("CISelectedRowId", "");
  641 + //localStorage.setItem("CIListViewScroll", '');
  642 +
  643 + if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
  644 +
  645 + $('#ListViewDiv').scrollTop(0);
  646 +
  647 + // $scope.HideListViewDiv();
  648 +
  649 + $scope.filterstring = false;
  650 + //while ($scope.searchCIListViewData.length) {
  651 + // $scope.searchCIListViewData.pop();
  652 + //}
  653 +
  654 + $scope.FilterByImage(1, query);
  655 +
  656 + }
  657 +
  658 + $scope.showSelectedSystemPins = function (event) {
  659 +
  660 +
  661 + var bodySystemListObj = document.getElementById("bodySystemList").getElementsByTagName("a");
  662 + var bodySystemListlength = bodySystemListObj.length;
  663 + for (var i = 0; i < bodySystemListlength; i++)
  664 + {
  665 +
  666 + $("#" + i).parent().removeClass("activeAASystemSelect");
  667 + }
  668 + $("#" + event.currentTarget.id).parent().addClass("activeAASystemSelect");
  669 +
  670 + $rootScope.isLoading = true;
  671 + $('#spinner').css('visibility', 'visible');
  672 +
  673 + $scope.removeSpeechBubble();
  674 + if (event.currentTarget.id == "0") {
  675 +
  676 + $scope.selectedSystemName = null;
  677 + if ($scope.isHidePinBtnClicked) {
  678 +
  679 + // $scope.showAllPinsAfterHide($scope.aaPinData);
  680 + $scope.showAllPinsAfterHide();
  681 + }
  682 + else {
  683 + $scope.showAllPins();
  684 + }
  685 + }
  686 + else {
  687 +
  688 + $scope.selectedSystemName = event.currentTarget.title;
  689 + // get termText info
  690 + var promise = ModuleService.getTermTextDataForPin($scope.moduleName)
  691 + .then(
  692 + function (response) {
  693 +
  694 + $scope.TermInfo = response.data.Terms.Term;
  695 +
  696 + //on gettng all required data, draw pins
  697 + if ($scope.aaPinData != null && $scope.aaPinData.length > 0) {
  698 +
  699 + $scope.selectedSystemPinData = new jinqJs()
  700 + .from($scope.aaPinData)
  701 + .where("_BodySystemName == " + $scope.selectedSystemName)
  702 + .select();
  703 + if ($scope.isHidePinBtnClicked) {
  704 + // $scope.showAllPinsAfterHide($scope.selectedSystemPinData);
  705 + $scope.showAllPinsAfterHide();
  706 +
  707 + }
  708 + else {
  709 + //remove other system pins
  710 + if ($scope.selectedSystemPinData != null && $scope.selectedSystemPinData.length > 0) {
  711 +
  712 + angular.forEach($scope.aaPinData, function (aaPinDataValue, aaPinDataKey) {
  713 +
  714 + if (aaPinDataValue._BodySystemName != $scope.selectedSystemName)
  715 + $scope.removePin('aaDetailViewCanvas', aaPinDataValue._PinId);
  716 + })
  717 +
  718 + angular.forEach($scope.selectedSystemPinData, function (value, key) {
  719 +
  720 +
  721 + $scope.drawStaticPinsOnImage('aaDetailViewCanvas', value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY)
  722 +
  723 + })
  724 + //show annotation on first pin of the sysyem
  725 + $scope.showAnnotation($scope.selectedSystemPinData, false, false, false);
  726 + }
  727 + }
  728 + }
  729 + },
  730 + function (error) {
  731 + // handle errors here
  732 + console.log(' error: ' + error.statusText);
  733 + }
  734 + )
  735 +
  736 + }
  737 + }
  738 +
  739 + $scope.showAnnotation = function (selectedPinData, isCtrlPressed, isPinClicked, isItemSearched) {
  740 +
  741 + $scope.selectedPin = [];
  742 + var isSameTermWithMultiPin = false;
  743 + var firstPinId = selectedPinData[0]._PinId;
  744 + var pinTermNumber = selectedPinData[0]._TermId;
  745 +
  746 + //check if other pin have same termNumber
  747 + if ($scope.aaPinData != null && $scope.aaPinData.length > 0) {
  748 +
  749 + var pinDataWithFirstTermNumber = new jinqJs()
  750 + .from($scope.aaPinData)
  751 + .where("_TermId == " + pinTermNumber)
  752 + .select();
  753 +
  754 + $scope.MultiLanguageAnnationArray = [];
  755 +
  756 + $scope.GetAnnotationBasedOnActualTermNo(pinTermNumber);
  757 +
  758 + if (isCtrlPressed) {
  759 +
  760 + }
  761 + else {
  762 + if (isPinClicked || isItemSearched) {
  763 + var existingSpeechBubble = $("div[id*='speechBubble']");
  764 + for (var i = 0; i < existingSpeechBubble.length; i++) {
  765 + existingSpeechBubble[i].parentNode.removeChild(existingSpeechBubble[i]);
  766 +
  767 + //make all pin heads grey
  768 + var radial = $('#aaDetailViewCanvas').createGradient({
  769 + x1: 50, y1: 50,
  770 + x2: 50, y2: 50,
  771 + r1: 10, r2: 30,
  772 + c1: 'rgba(100, 50, 0,0)',
  773 + c2: 'rgb(216, 216, 216)'
  774 + });
  775 +
  776 +
  777 + $('#aaDetailViewCanvas').setLayers({
  778 + fillStyle: radial,
  779 + }).drawLayers();
  780 + }
  781 +
  782 + var existingSpeechBubbleLine = $("div[id*='speechBubbleLine']");
  783 + for (var i = 0; i < existingSpeechBubbleLine.length; i++) {
  784 + existingSpeechBubbleLine[i].parentNode.removeChild(existingSpeechBubbleLine[i]);
  785 + }
  786 + var speechBubbleDraggedLine = $("div[id*='speechBubbleDraggedLine']");
  787 + for (var i = 0; i < speechBubbleDraggedLine.length; i++) {
  788 + speechBubbleDraggedLine[i].parentNode.removeChild(speechBubbleDraggedLine[i]);
  789 + }
  790 + }
  791 + }
  792 + if (pinDataWithFirstTermNumber.length > 1) {
  793 + isSameTermWithMultiPin = true;
  794 + }
  795 +
  796 + angular.forEach(pinDataWithFirstTermNumber, function (value, key) {
  797 + $scope.selectedPin.push(value._PinId);
  798 + var headX = (parseInt(value._HeadX));
  799 + var headY = (parseInt(value._HeadY));
  800 + $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10, value._PinId, isCtrlPressed, isPinClicked, isSameTermWithMultiPin);
  801 + })
  802 +
  803 +
  804 +
  805 + }
  806 +
  807 + $rootScope.isLoading = false;
  808 + $('#spinner').css('visibility', 'hidden');
  809 + // $scope.MultiLanguageAnnationArray.push($rootScope.annotationText[i])
  810 + }
  811 +
  812 + $scope.removeSpeechBubble = function () {
  813 +
  814 +
  815 + //clear speech bubbles
  816 + var speechBubbles = $("div[id*='speechBubble']");
  817 + if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) {
  818 + for (var j = 0; j < speechBubbles.length; j++) {
  819 +
  820 + speechBubbles[j].parentNode.removeChild(speechBubbles[j]);
  821 + }
  822 + }
  823 + var speechBubbleLines = $("div[id*='speechBubbleLine']");
  824 + if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) {
  825 + for (var j = 0; j < speechBubbleLines.length; j++) {
  826 +
  827 + speechBubbleLines[j].parentNode.removeChild(speechBubbleLines[j]);
  828 + }
  829 + }
  830 +
  831 + var speechBubbleDraggedLines = $("div[id*='speechBubbleDraggedLine']");
  832 + if (speechBubbleDraggedLines != null || speechBubbleDraggedLines != undefined && speechBubbleDraggedLines.length > 0) {
  833 + for (var j = 0; j < speechBubbleDraggedLines.length; j++) {
  834 +
  835 + speechBubbleDraggedLines[j].parentNode.removeChild(speechBubbleDraggedLines[j]);
  836 + }
  837 + }
  838 + };
  839 +
  840 + $scope.showSpeechBubble = function () {
  841 +
  842 +
  843 + //clear speech bubbles
  844 + var speechBubbles = $("div[id*='speechBubble']");
  845 + if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) {
  846 + for (var j = 0; j < speechBubbles.length; j++) {
  847 +
  848 + document.getElementById(speechBubbles[j].id).style.visibility = 'visible';
  849 + }
  850 + }
  851 + var speechBubbleLines = $("div[id*='speechBubbleLine']");
  852 + if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) {
  853 + for (var j = 0; j < speechBubbleLines.length; j++) {
  854 +
  855 + document.getElementById(speechBubbleLines[j].id).style.visibility = 'visible';
  856 + }
  857 + }
  858 +
  859 + var speechBubbleDraggedLines = $("div[id*='speechBubbleDraggedLine']");
  860 + if (speechBubbleDraggedLines != null || speechBubbleDraggedLines != undefined && speechBubbleDraggedLines.length > 0) {
  861 + for (var j = 0; j < speechBubbleDraggedLines.length; j++) {
  862 +
  863 + document.getElementById(speechBubbleDraggedLines[j].id).style.visibility = 'visible';
  864 + }
  865 + }
  866 + };
  867 +
  868 + $scope.hideSpeechBubble = function () {
  869 +
  870 +
  871 + //clear speech bubbles
  872 + var speechBubbles = $("div[id*='speechBubble']");
  873 + if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) {
  874 + for (var j = 0; j < speechBubbles.length; j++) {
  875 +
  876 + document.getElementById(speechBubbles[j].id).style.visibility = 'hidden';
  877 + }
  878 + }
  879 + var speechBubbleLines = $("div[id*='speechBubbleLine']");
  880 + if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) {
  881 + for (var j = 0; j < speechBubbleLines.length; j++) {
  882 +
  883 + document.getElementById(speechBubbleLines[j].id).style.visibility = 'hidden';
  884 + }
  885 + }
  886 +
  887 + var speechBubbleDraggedLines = $("div[id*='speechBubbleDraggedLine']");
  888 + if (speechBubbleDraggedLines != null || speechBubbleDraggedLines != undefined && speechBubbleDraggedLines.length > 0) {
  889 + for (var j = 0; j < speechBubbleDraggedLines.length; j++) {
  890 +
  891 + document.getElementById(speechBubbleDraggedLines[j].id).style.visibility = 'hidden';
  892 + }
  893 + }
  894 + };
  895 +
  896 +
  897 + $scope.createSpeechBubble = function (x, y, PinId, isCtrlPressed, isPinClicked, isSameTermWithMultiPin) {
  898 +
  899 + $scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; });
  900 +
  901 + $scope.createSpeechBubbleBasedOnAnnotationLength(x, y, PinId);
  902 +
  903 + $('#speechBubble').draggable(
  904 + {
  905 + drag: function (evt) {
  906 + $("#dot").css("visibility", "hidden");
  907 + var verticalScrollPosition = canvasDiv.scrollTop;
  908 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  909 + $scope.angle(x * $scope.sliderPercentValue, y * $scope.sliderPercentValue, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  910 + },
  911 + });
  912 +
  913 + }
  914 + $scope.sliderVal = 100;
  915 + $scope.createSpeechBubbleBasedOnAnnotationLength = function (x, y, PinId) {
  916 +
  917 + x = x * $scope.sliderPercentValue;
  918 + y = y * $scope.sliderPercentValue;
  919 +
  920 + var speechBubbleHTML = '<div id="speechBubbleLine' + PinId + '" style="position:absolute;height:15px;width:35px;display:none;z-index:10000;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);"></div>'
  921 + + '<div id="speechBubble' + PinId + '" class="common-drag" style="height:auto!important;z-index:10000;margin-left:25px;border:1px solid #000;padding:5px 10px;position:absolute;color:#fff;text-align:left;font-size:12px;background-color:#19100e;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;-o-border-radius:5px;-ms-border-radius:5px;font-weight:bold;">'
  922 + + '<span style="position:absolute;right:-3px;top:-4px;color:#ffffff;cursor:pointer;">'
  923 + + '<img id="closeBtn' + PinId + ' " class="crossDiv_temp" style="width:18px" src=' + $rootScope.closeBtnImgPath + '></span></div>'
  924 +
  925 + + '<div style="position:absolute;border:1px solid #000;display:none;z-index:9000;" id="speechBubbleDraggedLine' + PinId + '">'
  926 + + '</div>';
  927 +
  928 + //Issue #7286 :Undefined annotation should not appear
  929 + for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) {
  930 + var MultipleLanguage = $scope.MultiLanguageAnnationArray[i];
  931 + }
  932 +
  933 + if (MultipleLanguage == undefined) {
  934 + console.log("No text is found");
  935 + } else {
  936 + $('#canvasDiv').append(speechBubbleHTML);
  937 +
  938 + if ($scope.MultiLanguageAnnationArray.length > 0) {
  939 + for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) {
  940 + var MultipleLanguage = $scope.MultiLanguageAnnationArray[i];
  941 + $("#speechBubble" + PinId).append("<p style='margin-bottom:2px;'>" + MultipleLanguage + "</p>");
  942 + }
  943 + }
  944 + else {
  945 + console.log('MultiLanguageAnnationArray.length is :' + $scope.MultiLanguageAnnationArray.length)
  946 + }
  947 + if ($scope.longestAnnotation != null || $scope.longestAnnotation != undefined) {
  948 + if ($scope.longestAnnotation.length <= 10) {
  949 +
  950 +
  951 + $("#speechBubble").css("width", "100px");
  952 +
  953 + }
  954 +
  955 + else if ($scope.longestAnnotation.length > 10 && $scope.longestAnnotation.length <= 17) {
  956 +
  957 +
  958 +
  959 + $("#speechBubble").css("width", "140px");
  960 +
  961 + }
  962 + else if ($scope.longestAnnotation.length > 17 && $scope.longestAnnotation.length <= 26) {
  963 +
  964 +
  965 + $("#speechBubble").css("width", "195px");
  966 +
  967 + }
  968 + else if ($scope.longestAnnotation.length > 26 && $scope.longestAnnotation.length <= 34) {
  969 +
  970 + $("#speechBubble").css("width", "248px");
  971 +
  972 + }
  973 + else if ($scope.longestAnnotation.length > 34 && $scope.longestAnnotation.length <= 44) {
  974 +
  975 +
  976 + $("#speechBubble").css("width", "300px");
  977 + }
  978 +
  979 + else if ($scope.longestAnnotation.length > 44 && $scope.longestAnnotation.length <= 54) {
  980 +
  981 + $("#speechBubble").css("width", "370px");
  982 + }
  983 +
  984 + else if ($scope.longestAnnotation.length > 54 && $scope.longestAnnotation.length <= 69) {
  985 + $("#speechBubble").css("width", "450px");
  986 + }
  987 + else if ($scope.longestAnnotation.length > 69 && $scope.longestAnnotation.length <= 75) {
  988 + $("#speechBubble").css("width", "510px");
  989 + }
  990 + else {
  991 + $("#speechBubble").css("width", ($scope.longestAnnotation.length) + "%");
  992 + }
  993 + }
  994 + }
  995 + var speechBubbleDims = [];
  996 +
  997 + $rootScope.speechBubbleDimaensions.push({ "currentX": x, "currentY": y, "id": PinId });
  998 + speechBubbleDims.push({ currentX: x, currentY: y });
  999 + document.getElementById('speechBubbleLine' + PinId + '').style.display = 'block';
  1000 + document.getElementById('speechBubbleLine' + PinId + '').style.left = ((speechBubbleDims[0].currentX - 12)) + 'px';
  1001 + if ($scope.sliderVal == 25) {
  1002 + document.getElementById('speechBubbleLine' + PinId + '').style.top = ((speechBubbleDims[0].currentY + 5)) + 'px';
  1003 + }
  1004 + else {
  1005 + document.getElementById('speechBubbleLine' + PinId + '').style.top = ((speechBubbleDims[0].currentY)) + 'px';
  1006 + }
  1007 + document.getElementById('speechBubble' + PinId + '').style.display = 'block';
  1008 + document.getElementById('speechBubble' + PinId + '').style.left = (speechBubbleDims[0].currentX - 4) + 'px';
  1009 + document.getElementById('speechBubble' + PinId + '').style.top = (speechBubbleDims[0].currentY) + 'px';
  1010 + $('.common-drag').draggable(
  1011 + {
  1012 +
  1013 + drag: function (evt) {
  1014 +
  1015 + var verticalScrollPosition = document.getElementById('canvasDiv').scrollTop;
  1016 + var horizontlScrollPosition = document.getElementById('canvasDiv').scrollLeft;
  1017 + var clickedSpeechBubbleId = $(this).attr("id");
  1018 +
  1019 + var clickedPinId = clickedSpeechBubbleId.substring(12, clickedSpeechBubbleId.length);
  1020 +
  1021 + $("#speechBubbleLine" + clickedPinId).css("visibility", "hidden");
  1022 + $("#speechBubbleLine" + clickedPinId).css("display", "none");
  1023 +
  1024 + for (var i = 0; i <= $rootScope.speechBubbleDimaensions.length - 1; i++) {
  1025 + if ($rootScope.speechBubbleDimaensions[i].id == clickedPinId) {
  1026 + $scope.angle(clickedPinId, $rootScope.speechBubbleDimaensions[i].currentX, $rootScope.speechBubbleDimaensions[i].currentY, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true);
  1027 + }
  1028 + }
  1029 +
  1030 + },
  1031 + });
  1032 + $('.crossDiv_temp').on('click', function (evt) {
  1033 +
  1034 + var imgId = $(this).attr("id");
  1035 + var pinId = imgId.substring(8, imgId.length);
  1036 + $('#speechBubble' + pinId).remove();
  1037 + $("#speechBubbleDraggedLine" + pinId).remove();
  1038 + $("#speechBubbleLine" + pinId).remove();
  1039 +
  1040 + //make all pin heads grey
  1041 + var pinHeadName = 'PinArc_' + pinId;
  1042 + var radial = $('#aaDetailViewCanvas').createGradient({
  1043 + x1: 50, y1: 50,
  1044 + x2: 50, y2: 50,
  1045 + r1: 10, r2: 30,
  1046 + c1: 'rgba(100, 50, 0,0)',
  1047 + c2: 'rgb(216, 216, 216)'
  1048 + });
  1049 +
  1050 +
  1051 + $('#aaDetailViewCanvas').setLayer(pinHeadName, {
  1052 + fillStyle: radial,
  1053 + }).drawLayers();
  1054 + });
  1055 +
  1056 + //make the head green
  1057 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1058 + x1: 50, y1: 50,
  1059 + x2: 50, y2: 50,
  1060 + r1: 10, r2: 30,
  1061 + c1: 'rgba(100, 50, 0,0)',
  1062 + c2: 'rgb(126, 187, 83)'
  1063 + });
  1064 + var pinHeadName = 'PinArc_' + PinId;
  1065 + var pin = $('#aaDetailViewCanvas').getLayer(pinHeadName);
  1066 + // pin.fillStyle = radialAfterClick;
  1067 +
  1068 + $('#aaDetailViewCanvas').setLayer(pinHeadName, {
  1069 + fillStyle: radialAfterClick,
  1070 + }).drawLayers();
  1071 + }
  1072 +
  1073 +
  1074 + $scope.angle = function (id, cx, cy, ex, ey, BoolValues) {
  1075 +
  1076 + var dy = ey - cy;
  1077 + var dx = ex - cx;
  1078 + var theta = 0;
  1079 + if (dx < 0) {
  1080 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1081 + theta = theta + 180;
  1082 +
  1083 + }
  1084 + else if (dy < 0) {
  1085 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1086 + theta = theta + 360;
  1087 +
  1088 + }
  1089 + else {
  1090 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1091 + }
  1092 +
  1093 + var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey));
  1094 + var e = cy;
  1095 + var f = cx;
  1096 +
  1097 + if (BoolValues == true) {
  1098 + if ($scope.sliderVal == 40) {
  1099 + $("#speechBubbleDraggedLine" + id).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 5) + 'px', 'left': (f - 5) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  1100 + }
  1101 + else if ($scope.sliderVal == 25) {
  1102 + $("#speechBubbleDraggedLine" + id).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 2) + 'px', 'left': (f - 2) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  1103 + }
  1104 + else {
  1105 + $("#speechBubbleDraggedLine" + id).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 10) + 'px', 'left': (f - 5) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  1106 + }
  1107 +
  1108 + }
  1109 + else {
  1110 + $("#bord_annotation").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
  1111 + }
  1112 +
  1113 +
  1114 +
  1115 + }
  1116 +
  1117 +
  1118 + $scope.drawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y) {
  1119 + $scope.clickedPins = [];
  1120 + // if ($scope.isSliderChange == true) {
  1121 + console.log('isSliderrChange')
  1122 + var radial = $('#' + canvasId).createGradient({
  1123 + x1: 50, y1: 50,
  1124 + x2: 50, y2: 50,
  1125 + r1: 10, r2: 30,
  1126 + c1: 'rgba(100, 50, 0,0)',
  1127 + c2: 'rgb(216, 216, 216)'
  1128 + });
  1129 + $('#' + canvasId).drawLine({
  1130 + layer: true,
  1131 + name: "Pin_" + PinId,
  1132 + groups: ["Pin_" + PinId],
  1133 + strokeStyle: '#565656',
  1134 + strokeWidth: 2,
  1135 + visible: true,
  1136 + x1: offsetX1 * $scope.sliderPercentValue, y1: offsetY1 * $scope.sliderPercentValue,
  1137 + x2: x * $scope.sliderPercentValue, y2: y * $scope.sliderPercentValue,
  1138 +
  1139 +
  1140 + }).drawArc({
  1141 + name: "PinArc_" + PinId,
  1142 + layer: true,
  1143 + groups: ["Pin_" + PinId],
  1144 + strokeStyle: 'grey',
  1145 + strokeWidth: 2,
  1146 + visible: true,
  1147 + fillStyle: radial,
  1148 + x: x * $scope.sliderPercentValue, y: y * $scope.sliderPercentValue,
  1149 + radius: 5 * $scope.sliderPercentValue,
  1150 +
  1151 + click: function (clickedPin) {
  1152 + if (clickedPin.event.ctrlKey == false) {
  1153 + $scope.clickedPins = [];
  1154 + }
  1155 + var pinID = (clickedPin.name).substring(7, (clickedPin.name).length);
  1156 + var pinData = new jinqJs()
  1157 + .from($scope.aaPinData)
  1158 + .where("_PinId == " + pinID)
  1159 + .select();
  1160 +
  1161 +
  1162 + var pinTermNumber = pinData[0]._TermId;
  1163 +
  1164 + var pinWithSameTerm = new jinqJs()
  1165 +
  1166 + .from($scope.aaPinData)
  1167 + .where("_TermId == " + pinTermNumber)
  1168 + .select();
  1169 +
  1170 +
  1171 + if (pinWithSameTerm != undefined && pinWithSameTerm != null && pinWithSameTerm.length > 0) {
  1172 +
  1173 + for (var i = 0; i < pinWithSameTerm.length; i++) {
  1174 +
  1175 + $scope.clickedPins.push({ 'id': pinWithSameTerm[i]._PinId })
  1176 + }
  1177 +
  1178 + }
  1179 +
  1180 +<<<<<<< HEAD
  1181 + }
  1182 + $scope.isSelectedPinBtnClickedAftrSliderCange = false;
  1183 + var selectedPinData = new jinqJs()
  1184 + .from($scope.aaPinData)
  1185 + .where("_PinId == " + pinID)
  1186 + .select();
  1187 + if (clickedPin.event.ctrlKey == true) {
  1188 +
  1189 + $scope.activePinArray.push(clickedPin.name);
  1190 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1191 + x1: 50, y1: 50,
  1192 + x2: 50, y2: 50,
  1193 + r1: 10, r2: 30,
  1194 + c1: 'rgba(100, 50, 0,0)',
  1195 + c2: 'rgb(126, 187, 83)'
  1196 + });
  1197 + clickedPin.fillStyle = radialAfterClick;
  1198 + $scope.showAnnotation(selectedPinData, true, true, false);
  1199 + }
  1200 + else {
  1201 + $scope.activePinArray = [];
  1202 + $scope.activePinArray.push(clickedPin.name);
  1203 + var radial = $('#aaDetailViewCanvas').createGradient({
  1204 + x1: 50, y1: 50,
  1205 + x2: 50, y2: 50,
  1206 + r1: 10, r2: 30,
  1207 + c1: 'rgba(100, 50, 0,0)',
  1208 + c2: 'rgb(216, 216, 216)'
  1209 + });
  1210 +=======
  1211 + var selectedPinData = new jinqJs()
  1212 + .from($scope.aaPinData)
  1213 + .where("_PinId == " + pinID)
  1214 + .select();
  1215 + if (clickedPin.event.ctrlKey == true) {
  1216 +
  1217 + $scope.activePinArray.push(clickedPin.name);
  1218 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1219 + x1: 50, y1: 50,
  1220 + x2: 50, y2: 50,
  1221 + r1: 10, r2: 30,
  1222 + c1: 'rgba(100, 50, 0,0)',
  1223 + c2: 'rgb(126, 187, 83)'
  1224 + });
  1225 + clickedPin.fillStyle = radialAfterClick;
  1226 + $scope.showAnnotation(selectedPinData, true, true, false);
  1227 + }
  1228 + else {
  1229 + $scope.activePinArray = [];
  1230 + $scope.activePinArray.push(clickedPin.name);
  1231 + var radial = $('#aaDetailViewCanvas').createGradient({
  1232 + x1: 50, y1: 50,
  1233 + x2: 50, y2: 50,
  1234 + r1: 10, r2: 30,
  1235 + c1: 'rgba(100, 50, 0,0)',
  1236 + c2: 'rgb(216, 216, 216)'
  1237 + });
  1238 +
  1239 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  1240 +
  1241 + $('#aaDetailViewCanvas').setLayers({
  1242 + fillStyle: radial,
  1243 + }).drawLayers();
  1244 +
  1245 + //change the head color to green
  1246 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1247 + x1: 50, y1: 50,
  1248 + x2: 50, y2: 50,
  1249 + r1: 10, r2: 30,
  1250 + c1: 'rgba(100, 50, 0,0)',
  1251 + c2: 'rgb(126, 187, 83)'
  1252 + });
  1253 +
  1254 + clickedPin.fillStyle = radialAfterClick;
  1255 + $scope.showAnnotation(selectedPinData, false, true, false);
  1256 +
  1257 + }
  1258 +
  1259 +
  1260 + }
  1261 +
  1262 + }).drawLayers();
  1263 +
  1264 +
  1265 + }
  1266 +
  1267 +
  1268 + $scope.getMousePos = function (evt) {
  1269 +
  1270 + return {
  1271 + x: Math.round(evt.pageX - $('#canvasDiv').offset().left),
  1272 + y: Math.round(evt.pageY - $('#canvasDiv').offset().top)
  1273 + }
  1274 + }
  1275 +
  1276 + $scope.removePin = function (canvasId, pinId) {
  1277 +
  1278 + var pinName = 'Pin_' + pinId;
  1279 + var pinArcName = 'PinArc_' + pinId;
  1280 + $('#' + canvasId).removeLayer(pinName).drawLayers();
  1281 + $('#' + canvasId).removeLayer(pinArcName).drawLayers();
  1282 +
  1283 + $scope.removeSpeechBubble();
  1284 +
  1285 + //$rootScope.isSliderChanged = true;
  1286 + //$('#aaDetailViewCanvas').removeLayers();
  1287 + }
  1288 +
  1289 + $rootScope.$on('annotationToolEvent', function (event, data) {
  1290 + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)")
  1291 + $('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });
  1292 + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)")
  1293 + $('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });
  1294 +
  1295 + $("#canvas").css("display", "block");
  1296 + $("#canvasPaint").css("display", "block");
  1297 + $rootScope.onDrawingCanvasClick();
  1298 + $rootScope.FreeStylePaint();
  1299 + });
  1300 +
  1301 + $rootScope.loadSearchData = function () {
  1302 +
  1303 + //$("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
  1304 + var imageId = $rootScope.imageId;
  1305 + var promise = ModuleService.getTermTextDataForAAImage(imageId)
  1306 + .then(
  1307 + function (response) {
  1308 +
  1309 + $scope.AAPinTermData = response.data.PinTermData.TermData;
  1310 +
  1311 + $rootScope.isLoading = false;
  1312 + $('#setting-spinner').css('visibility', 'hidden');
  1313 +
  1314 + $scope.pinTermData = [];
  1315 + var primaryLexicon = $rootScope.lexiconLanguageArray[0].id;
  1316 + $scope.matchedLanguageTermData = new jinqJs()
  1317 + .from($scope.AAPinTermData)
  1318 + .where('_LanguageId == ' + primaryLexicon)
  1319 + .select();
  1320 + var sortedTermTextArray = [];
  1321 + for (var i = 0; i < $scope.matchedLanguageTermData.length; i++) {
  1322 + sortedTermTextArray.push($scope.matchedLanguageTermData[i]._TermText);
  1323 + sortedTermTextArray.sort();
  1324 + }
  1325 +
  1326 + for (var i = 0; i <= sortedTermTextArray.length - 1; i++) {
  1327 + for (var j = 0; j <= $scope.matchedLanguageTermData.length - 1; j++) {
  1328 + if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) {
  1329 + $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[j]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[j]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[j]._TermText });
  1330 + break;
  1331 + }
  1332 + }
  1333 + }
  1334 +
  1335 + for (var i = 0; i <= sortedTermTextArray.length - 1; i++) {
  1336 + for (var j = 0; j <= $scope.matchedLanguageTermData.length - 1; j++) {
  1337 + if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) {
  1338 + $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[j]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[j]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[j]._TermText });
  1339 + break;
  1340 + }
  1341 + }
  1342 + }
  1343 +
  1344 +
  1345 + $scope.$watch('$scope.pinTermData', function (newValue, oldValue, scope) {
  1346 +
  1347 + if (($('#termlistfilter').html() != ""))
  1348 +
  1349 + $('#termlistfilter').empty();
  1350 + if ($scope.pinTermData.length > 0) {
  1351 + $timeout(function () {
  1352 + console.log('pinTermData= ' + $scope.pinTermData.length);
  1353 + $('#termList').empty();
  1354 + for (var j = 0; j < $scope.pinTermData.length; j++) {
  1355 + var $el = $('<li><a id= "' + $scope.pinTermData[j].TermNumber + '" href="" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</a></li>').appendTo('#termlistfilter')
  1356 + $compile($el)($scope);
  1357 + var $selectedOptions = $('<option title= "' + $scope.pinTermData[j].TermTxt + '" id= "' + $scope.pinTermData[j].TermNumber + '" onclick="onSearchItemSelection(event)" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList")
  1358 +
  1359 + $compile($selectedOptions)($scope);
  1360 +
  1361 + $("#AABodySystems").empty();
  1362 + $("#bodySystems").css("display", "none");
  1363 + $("#AABodySystems").css("display", "block");
  1364 + $("#bodySystemList li a").each(function (key, value) {
  1365 + var $systemOptions = $('<option id=' + $(this).attr('id') + ' >' + $(this).text() + '</option>').appendTo("#AABodySystems")
  1366 + $compile($systemOptions)($scope);
  1367 + });
  1368 + }
  1369 + }, 500);
  1370 + }
  1371 + })
  1372 + },
  1373 + function (error) {
  1374 + // handle errors here
  1375 + console.log(' error: ' + error.statusText);
  1376 + }
  1377 + )
  1378 + }
  1379 +
  1380 +
  1381 +
  1382 +
  1383 + $scope.$on('listManagerEvent', function (event, data) {
  1384 +
  1385 + $("#viewName").empty();
  1386 + $("#viewName").append("<option>" + $rootScope.listArray[0].text + "</option>");
  1387 + $rootScope.isLoading = false;
  1388 + $('#spinner').css('visibility', 'hidden');
  1389 +
  1390 + if ($rootScope.bodySystemSeletedId == null) {
  1391 +
  1392 + $rootScope.loadSearchData();
  1393 + }
  1394 + else {
  1395 +
  1396 + $rootScope.refreshTermListOnAASystemSelection($rootScope.bodySystemSeletedId);
  1397 + }
  1398 + $timeout(function () {
  1399 + $("#totalTerms").empty();
  1400 + $("#totalTerms").html("<span class='pull-left marginTop5'>" + $("#termList option").length + " Structures</span>");
  1401 + }, 1000);
  1402 + });
  1403 +
  1404 +
  1405 +
  1406 + $rootScope.refreshTermListOnAASystemSelection = function (bodySystemId) {
  1407 + $('#termList').empty();
  1408 + $rootScope.bodySystemSeletedId = bodySystemId;
  1409 + $('#termList').empty();
  1410 + var bodySystemName = $("#AABodySystems #" + bodySystemId).val();
  1411 + if (bodySystemName == "All") {
  1412 + for (var j = 0; j <= $scope.pinTermData.length - 1; j++) {
  1413 +
  1414 + $compile($selectedOptions)($scope);
  1415 + }
  1416 + $("#totalTerms").empty();
  1417 + $("#totalTerms").html("<span class='pull-left marginTop5'>" + $("#termList option").length + " Structures</span>");
  1418 + }
  1419 + else {
  1420 + var imageId = $rootScope.imageId;
  1421 + $scope.pinDataUrl = "aa_dat_pinterm_" + imageId;
  1422 + $rootScope.bodySystemTermArray = [];
  1423 +
  1424 + $.ajax({
  1425 + url: '~/../content/data/json/aa/aa_pinterm/' + $scope.pinDataUrl + '.json',
  1426 + type: 'GET',
  1427 + dataType: "json",
  1428 + async: false,
  1429 + success: function (result) {
  1430 + $(result.PinTermData.TermData).each(function (key, value) {
  1431 + $rootScope.bodySystemTermArray.push({ "termNumbr": result.PinTermData.TermData[key]._TermNumber, "text": result.PinTermData.TermData[key]._TermText, "language": result.PinTermData.TermData[key]._LanguageId });
  1432 + });
  1433 + for (var i = 0; i <= $scope.aaPinData.length - 1; i++) {
  1434 + if ($scope.aaPinData[i]._BodySystemName.toLowerCase() == bodySystemName.toLowerCase()) {
  1435 + for (var j = 0 ; j <= $rootScope.bodySystemTermArray.length - 1; j++) {
  1436 + if ($scope.aaPinData[i]._TermId == $rootScope.bodySystemTermArray[j].termNumbr) {
  1437 + if ($rootScope.bodySystemTermArray[j].language == "1") {
  1438 + console.log($rootScope.bodySystemTermArray[j].text);
  1439 + var $selectedOptions = $('<option title= "' + $rootScope.bodySystemTermArray[j].text + '" id= "' + $rootScope.bodySystemTermArray[j].termNumbr + '" onclick="onSearchItemSelection(event)">' + $rootScope.bodySystemTermArray[j].text + '</option>').appendTo("#termList")
  1440 + $compile($selectedOptions)($scope);
  1441 + }
  1442 + }
  1443 + }
  1444 + }
  1445 + }
  1446 + }
  1447 + });
  1448 + $("#totalTerms").empty();
  1449 + $("#totalTerms").html("<span class='pull-left marginTop5'>" + $("#termList option").length + " Structures</span>");
  1450 + }
  1451 + }
  1452 + $scope.GetAnnotationBasedOnActualTermNo = function (actualTermNo) {
  1453 +
  1454 +
  1455 + var languageArray = $rootScope.lexiconLanguageArray;
  1456 +
  1457 + if ($scope.AAPinTermData != null || $scope.AAPinTermData != undefined) {
  1458 +
  1459 + $scope.matchedTermNoData = new jinqJs()
  1460 + .from($scope.AAPinTermData)
  1461 + .where('_TermNumber == ' + actualTermNo)
  1462 + .select();
  1463 +
  1464 + if ($scope.matchedTermNoData != null || $scope.matchedTermNoData != undefined) {
  1465 +
  1466 + for (var j = 0; j <= languageArray.length - 1; j++) {
  1467 +
  1468 + $scope.matchedLanguageTermNoData = new jinqJs()
  1469 + .from($scope.matchedTermNoData)
  1470 + .where('_LanguageId == ' + languageArray[j].id)
  1471 + .select();
  1472 + var termText = $scope.matchedLanguageTermNoData[0]._TermText;
  1473 + $scope.MultiLanguageAnnationArray.push(termText);
  1474 + };
  1475 + }
  1476 + }
  1477 + }
  1478 +
  1479 + $scope.hidePins = function () {
  1480 +
  1481 + $rootScope.isLoading = true;
  1482 + $('#spinner').css('visibility', 'visible');
  1483 +
  1484 + $scope.hideSpeechBubble();
  1485 +
  1486 + $scope.isHidePinBtnClicked = true;
  1487 + angular.forEach($scope.aaPinData, function (aaPinDataValue, aaPinDataKey) {
  1488 +
  1489 + var pinName = 'Pin_' + aaPinDataValue._PinId;
  1490 + var pinArcName = 'PinArc_' + aaPinDataValue._PinId;
  1491 +
  1492 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1493 + visible: false // set to true instead to show the layer again
  1494 + }).drawLayers();
  1495 +
  1496 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1497 + visible: false // set to true instead to show the layer again
  1498 + }).drawLayers();
  1499 + })
  1500 +
  1501 + $rootScope.isLoading = false;
  1502 + $('#spinner').css('visibility', 'hidden');
  1503 + $(".tooltip-custom").removeClass("btn-primary");
  1504 + $(".tooltip-custom").addClass("btn-black");
  1505 + $("#hidePinBtn").addClass("btn-primary");
  1506 + }
  1507 +
  1508 + $scope.showAllPinsAfterHide = function (event) {
  1509 +
  1510 + $rootScope.isLoading = true;
  1511 + $('#spinner').css('visibility', 'visible');
  1512 +
  1513 +
  1514 + $scope.isHidePinBtnClicked = false;
  1515 +
  1516 + if ($scope.selectedSystemName != null && $scope.selectedSystemName != undefined) {
  1517 +
  1518 + $scope.showSystemPins($scope.selectedSystemPinData, false);
  1519 +
  1520 + } else {
  1521 +
  1522 + $scope.showSystemPins($scope.aaPinData, false);
  1523 + }
  1524 + $scope.showSpeechBubble();
  1525 + $(".tooltip-custom").removeClass("btn-primary");
  1526 + $(".tooltip-custom").addClass("btn-black");
  1527 + $("#allPinBtn").addClass("btn-primary");
  1528 + if ($scope.isSliderChange == true) {
  1529 + $scope.isSliderChange = false;
  1530 + $scope.showAllPins();
  1531 +
  1532 + }
  1533 + };
  1534 +
  1535 +
  1536 + $scope.showSelectedPins = function () {
  1537 +<<<<<<< HEAD
  1538 +
  1539 +
  1540 + $rootScope.isLoading = true;
  1541 + $('#spinner').css('visibility', 'visible');
  1542 +
  1543 + $scope.isHidePinBtnClicked = false;
  1544 +
  1545 + if ($scope.selectedSystemName != null && $scope.selectedSystemName != undefined) {
  1546 +
  1547 + $scope.showSystemPins($scope.selectedSystemPinData, true);
  1548 +
  1549 + }
  1550 + else {
  1551 + $scope.showSystemPins($scope.aaPinData, true);
  1552 +
  1553 + }
  1554 + $scope.showSpeechBubble();
  1555 + $(".tooltip-custom").removeClass("btn-primary");
  1556 + $(".tooltip-custom").addClass("btn-black");
  1557 + $("#selectedPin").addClass("btn-primary");
  1558 +
  1559 + if ($scope.isSelectedPinBtnClickedAftrSliderCange == true) {
  1560 +
  1561 + for (var i = 0; i <= $scope.activePinArray.length - 1; i++) {
  1562 + var pinName = $scope.activePinArray[i].split("_");
  1563 + var activePinName = 'Pin_' + pinName[1];
  1564 + var pinArcName = 'PinArc_' + pinName[1];
  1565 + $('#aaDetailViewCanvas').setLayer(activePinName, {
  1566 + visible: true // set to true instead to show the layer again
  1567 + }).drawLayers();
  1568 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1569 + visible: true // set to true instead to show the layer again
  1570 + }).drawLayers();
  1571 + }
  1572 +
  1573 + }
  1574 +=======
  1575 +
  1576 + $rootScope.isLoading = true;
  1577 + $('#spinner').css('visibility', 'visible');
  1578 +
  1579 + $scope.isHidePinBtnClicked = false;
  1580 +
  1581 + if ($scope.selectedSystemName != null && $scope.selectedSystemName != undefined) {
  1582 +
  1583 + $scope.showSystemPins($scope.selectedSystemPinData, true);
  1584 +
  1585 + }
  1586 + else {
  1587 + $scope.showSystemPins($scope.aaPinData, true);
  1588 +
  1589 + }
  1590 + $scope.showSpeechBubble();
  1591 + $(".tooltip-custom").removeClass("btn-primary");
  1592 + $(".tooltip-custom").addClass("btn-black");
  1593 + $("#selectedPin").addClass("btn-primary");
  1594 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  1595 + };
  1596 +
  1597 +
  1598 + $scope.showSystemPins = function (seletedSystemPinData, isShowSelectedPins) {
  1599 +
  1600 + if (isShowSelectedPins) {
  1601 +
  1602 + angular.forEach($scope.clickedPins, function (value, key) {
  1603 +
  1604 + seletedSystemPinData = new jinqJs()
  1605 + .from(seletedSystemPinData)
  1606 + .where('_PinId != ' + value.id)
  1607 + .select();
  1608 + })
  1609 + angular.forEach($scope.clickedPins, function (value1, key1) {
  1610 +
  1611 + // if (aaPinDataValue._PinId != value.id) {
  1612 + var pinName = 'Pin_' + value1.id;
  1613 + var pinArcName = 'PinArc_' + value1.id;
  1614 +
  1615 +
  1616 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1617 + visible: true // set to true instead to show the layer again
  1618 + }).drawLayers();
  1619 +
  1620 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1621 + visible: true // set to true instead to show the layer again
  1622 + }).drawLayers();
  1623 +
  1624 +
  1625 + // }
  1626 + })
  1627 +
  1628 + angular.forEach(seletedSystemPinData, function (aaPinDataValue, aaPinDataKey) {
  1629 +
  1630 + var pinName = 'Pin_' + aaPinDataValue._PinId;
  1631 + var pinArcName = 'PinArc_' + aaPinDataValue._PinId;
  1632 +
  1633 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1634 + visible: false // set to true instead to show the layer again
  1635 + }).drawLayers();
  1636 +
  1637 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1638 + visible: false // set to true instead to show the layer again
  1639 + }).drawLayers();
  1640 +
  1641 + })
  1642 +
  1643 +<<<<<<< HEAD
  1644 +
  1645 +=======
  1646 + // })
  1647 + // $scope.clickedPins = [];
  1648 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  1649 + }
  1650 +
  1651 + else {
  1652 + angular.forEach(seletedSystemPinData, function (aaPinDataValue, aaPinDataKey) {
  1653 +
  1654 + var pinName = 'Pin_' + aaPinDataValue._PinId;
  1655 + var pinArcName = 'PinArc_' + aaPinDataValue._PinId;
  1656 +
  1657 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1658 + visible: true // set to true instead to show the layer again
  1659 + }).drawLayers();
  1660 +
  1661 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1662 + visible: true // set to true instead to show the layer again
  1663 + }).drawLayers();
  1664 + })
  1665 + }
  1666 +
  1667 + $rootScope.isLoading = false;
  1668 + $('#spinner').css('visibility', 'hidden');
  1669 +
  1670 +
  1671 + }
  1672 +
  1673 + $scope.showItemsForSearch = function () {
  1674 + console.log('showItemsForSearch is called');
  1675 + //this check is for log only because we are writing length so need to check if its not null or undefined
  1676 +
  1677 +
  1678 + $timeout(function () {
  1679 + if (($scope.AAPinTermData != null || $scope.AAPinTermData != undefined) && ($scope.AAPinTermData.length > 0)) {
  1680 +
  1681 + $scope.IsSearchVisible = true;
  1682 + document.getElementById("termlistfilter").style.display = "block";
  1683 + }
  1684 + else {
  1685 + $rootScope.loadSearchData();
  1686 + if ($scope.AAPinTermData.length > 0) {
  1687 + $scope.showItemsForSearch();
  1688 + }
  1689 + }
  1690 +
  1691 + if ($rootScope.isSearchInputClicked == true) {
  1692 + $rootScope.isSearchInputClicked = false;
  1693 + $rootScope.searchListArray = [];
  1694 + $("#backdrop > #searchListDivAA > #termlistfilter > li").each(function (key, value) {
  1695 + $rootScope.searchListArray.push({ "name": $(this).find("a").html(), "id": $(this).find("a").attr("id") });
  1696 + });
  1697 +
  1698 + }
  1699 +
  1700 + }, 500);
  1701 +
  1702 + }
  1703 +
  1704 +
  1705 + $scope.HideSearchList = function () {
  1706 +
  1707 + $timeout(function () {
  1708 +
  1709 + $("#termlistfilter").css("display", "none");
  1710 +
  1711 +
  1712 + }, 1000);
  1713 +
  1714 + }
  1715 +
  1716 + $scope.highlightPinBasedOnSerachItem = function (event) {
  1717 +
  1718 + $scope.searchItemId = event.currentTarget.id;
  1719 + $scope.searchItemText = event.currentTarget.innerHTML;
  1720 + $rootScope.searchSelectedText = $("#" + event.currentTarget.id).text();
  1721 + $('#termList option[selected="selected"]').prop("selected", false);
  1722 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true);
  1723 + $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" });
  1724 + $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" });
  1725 +
  1726 + $("#termlistfilter li a").css({ "background-color": "#ffffff", "color": "#000000" });
  1727 + $("#termlistfilter li #" + $scope.searchItemId).css({ "background-color": "#3399FF", "color": "#ffffff" });
  1728 + $scope.searchFilter = event.currentTarget.innerHTML;
  1729 + selectedTermName.placeholder = event.currentTarget.innerHTML;
  1730 +
  1731 +
  1732 + //get data from pindata for this trem
  1733 +
  1734 + var pinDataForTerm = new jinqJs()
  1735 + .from($scope.aaPinData)
  1736 + .where("_TermId == " + $scope.searchItemId)
  1737 + .select();
  1738 +
  1739 + $scope.showAnnotation(pinDataForTerm, false, false, true);
  1740 + // maintaing scroll position on selection of options in list manager.
  1741 + var annotationTopPos = $(".common-drag").css("top").split("p");
  1742 + $("#canvasDiv").scrollTop(annotationTopPos[0]);
  1743 +
  1744 + $scope.IsSearchVisible = false;
  1745 + }
  1746 +
  1747 + $rootScope.isShowHideButtonClicked = true;
  1748 + $scope.ShowHideAnnotation = function () {
  1749 + if ($rootScope.isShowHideButtonClicked == true) {
  1750 + $rootScope.annotationArray = [];
  1751 + $("#canvasDiv").find(".common-drag").each(function () {
  1752 + var speechBubbleID = $(this).attr("id");
  1753 + var sppechBubbleId = $(this).attr("id").substring(12);
  1754 + var b = $("#speechBubbleDraggedLine" + sppechBubbleId).css("display");
  1755 + var speechBubbleLineDispProp = $("#speechBubbleLine" + sppechBubbleId).css("display");
  1756 + var speechBubbleLineID = "speechBubbleLine" + sppechBubbleId;
  1757 + var speechBubbleDraggedLineID = "speechBubbleDraggedLine" + sppechBubbleId;
  1758 + if (speechBubbleLineDispProp == "block") {
  1759 + $rootScope.annotationArray.push({ "speechBuubleId": speechBubbleID, "speechBubbleLineId": speechBubbleLineID });
  1760 + }
  1761 + else {
  1762 + $rootScope.annotationArray.push({ "speechBuubleId": speechBubbleID, "speechBubbleLineId": speechBubbleDraggedLineID });
  1763 + }
  1764 + });
  1765 + $rootScope.isShowHideButtonClicked = false;
  1766 + for (var i = 0; i <= $rootScope.annotationArray.length - 1; i++) {
  1767 + $("#" + $rootScope.annotationArray[i].speechBuubleId).css("display", "none");
  1768 + $("#" + $rootScope.annotationArray[i].speechBubbleLineId).css("display", "none");
  1769 + }
  1770 + }
  1771 + else {
  1772 + $rootScope.isShowHideButtonClicked = true;
  1773 + for (var i = 0; i <= $rootScope.annotationArray.length - 1; i++) {
  1774 + $("#" + $rootScope.annotationArray[i].speechBuubleId).css("display", "block");
  1775 + $("#" + $rootScope.annotationArray[i].speechBubbleLineId).css("display", "block");
  1776 + }
  1777 + }
  1778 + }
  1779 + $scope.activePinOnLayerChange = function () {
  1780 +
  1781 + for (var i = 0; i <= $scope.activePinArray.length - 1; i++) {
  1782 + var radialAfterClick = $('#aaDetailViewCanvas').createGradient({
  1783 + x1: 50, y1: 50,
  1784 + x2: 50, y2: 50,
  1785 + r1: 10, r2: 30,
  1786 + c1: 'rgba(100, 50, 0,0)',
  1787 + c2: 'rgb(126, 187, 83)'
  1788 + });
  1789 + var clickedPin = $scope.activePinArray[i];
  1790 + $('#aaDetailViewCanvas').setLayer(clickedPin, {
  1791 + fillStyle: radialAfterClick
  1792 + }).drawLayers();
  1793 +
  1794 + }
  1795 + }
  1796 +
  1797 +
  1798 + $scope.activePinOnSliderChange = function () {
  1799 + if ($scope.activePinArray.length == 1)
  1800 + {
  1801 + for (var i = 0; i <= $scope.allPinDataArray.length - 1; i++) {
  1802 + var activeArc = $scope.activePinArray[0].split("_");
  1803 + if ($scope.allPinDataArray[i] == activeArc[1]) {
  1804 + var pinName = 'Pin_' + $scope.allPinDataArray[i];
  1805 + var pinArcName = 'PinArc_' + $scope.allPinDataArray[i];
  1806 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1807 + visible: true // set to true instead to show the layer again
  1808 + }).drawLayers();
  1809 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1810 + visible: true // set to true instead to show the layer again
  1811 + }).drawLayers();
  1812 + }
  1813 + else {
  1814 + var pinName = 'Pin_' + $scope.allPinDataArray[i];
  1815 + var pinArcName = 'PinArc_' + $scope.allPinDataArray[i];
  1816 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1817 + visible: false // set to true instead to show the layer again
  1818 + }).drawLayers();
  1819 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1820 + visible: false // set to true instead to show the layer again
  1821 + }).drawLayers();
  1822 + }
  1823 + }
  1824 + }
  1825 + else {
  1826 + var seletedSystemPinData;
  1827 + angular.forEach($scope.activePinArray, function (value, key) {
  1828 + var pinID = value.split("_");
  1829 + seletedSystemPinData = new jinqJs()
  1830 + .from($scope.allPinDataArray)
  1831 + .where('_PinId != ' + pinID[1])
  1832 + .select();
  1833 + })
  1834 +
  1835 + angular.forEach(seletedSystemPinData, function (aaPinDataValue, aaPinDataKey) {
  1836 +
  1837 + var pinName = 'Pin_' + aaPinDataValue;
  1838 + var pinArcName = 'PinArc_' + aaPinDataValue;
  1839 +
  1840 + $('#aaDetailViewCanvas').setLayer(pinName, {
  1841 + visible: false // set to true instead to show the layer again
  1842 + }).drawLayers();
  1843 +
  1844 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1845 + visible: false // set to true instead to show the layer again
  1846 + }).drawLayers();
  1847 +
  1848 + })
  1849 + for (var i = 0; i <= $scope.activePinArray.length - 1; i++) {
  1850 + var pinName = $scope.activePinArray[i].split("_");
  1851 + var activePinName = 'Pin_' + pinName[1];
  1852 + var pinArcName = 'PinArc_' + pinName[1];
  1853 + $('#aaDetailViewCanvas').setLayer(activePinName, {
  1854 + visible: true // set to true instead to show the layer again
  1855 + }).drawLayers();
  1856 + $('#aaDetailViewCanvas').setLayer(pinArcName, {
  1857 + visible: true // set to true instead to show the layer again
  1858 + }).drawLayers();
  1859 + }
  1860 + }
  1861 + }
  1862 +}]);
  1863 +
  1864 +
  1865 +function refreshTermListOnSystemSel(bodySystemId) {
  1866 + var rootScope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1867 + rootScope.$apply(function () {
  1868 + rootScope.refreshTermListOnAASystemSelection(bodySystemId);
  1869 + });
  1870 +}
  1871 +
  1872 +
  1873 +function showSelectedSystemPins(event) {
  1874 + console.log('OnBodySystem chnaged is called outside ');
  1875 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1876 + scope.$apply(function () {
  1877 + scope.showSelectedSystemPins(event);
  1878 + });
  1879 +}
  1880 +
  1881 +function hidePins(event) {
  1882 +
  1883 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1884 + scope.$apply(function () {
  1885 + scope.hidePins(event);
  1886 + });
  1887 +}
  1888 +
  1889 +function showAllPins(event) {
  1890 +
  1891 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1892 + scope.$apply(function () {
  1893 + scope.showAllPinsAfterHide(event);
  1894 + });
  1895 +}
  1896 +
  1897 +function onSearchAA(event) {
  1898 + console.log('AA search is called')
  1899 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1900 + scope.$apply(function () {
  1901 + scope.showItemsForSearch();
  1902 + });
  1903 +}
  1904 +
  1905 +function hideSearchList(event) {
  1906 + console.log('AA hide search is called')
  1907 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1908 + scope.$apply(function () {
  1909 + scope.HideSearchList();
  1910 + });
  1911 +}
  1912 +
  1913 +function onSearchItemSelection(event) {
  1914 + console.log('AA hide search is called')
  1915 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1916 + scope.$apply(function () {
  1917 + scope.highlightPinBasedOnSerachItem(event);
  1918 + });
  1919 +}
  1920 +
  1921 +//function onListManagerTermSelection(event) {
  1922 +// var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1923 +// scope.isTermListOptionClicked = true;
  1924 +// scope.$apply(function () {
  1925 +// scope.highlightPinBasedOnSerachItem1(event);
  1926 +// });
  1927 +
  1928 +//}
  1929 +
  1930 +
  1931 +function showHideAnnotation(event) {
  1932 +
  1933 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1934 + scope.$apply(function () {
  1935 + scope.ShowHideAnnotation(event);
  1936 + });
  1937 +}
  1938 +
  1939 +function showSelectedPins(event) {
  1940 +
  1941 + console.log('showSelectedPins is called')
  1942 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  1943 + scope.$apply(function () {
  1944 + scope.showSelectedPins(event);
  1945 + });
  1946 +}
  1947 +
  1948 +
  1949 +function openModuleItemView(event) {
  1950 + var scope = angular.element(document.getElementById("list-view")).scope();
  1951 + scope.isListViewButtonClicked = true;
  1952 + scope.$apply(function () {
  1953 + scope.openModuleItemView(event);
  1954 + });
  1955 +}
  1956 +
  1957 +function openListViewModuleItem(event) {
  1958 +
  1959 + var scope = angular.element(document.getElementById("list-view")).scope();
  1960 + scope.isListViewButtonClicked = true;
  1961 + scope.$apply(function () {
  1962 + scope.openListViewModuleItem(event);
  1963 + });
  1964 +}
  1965 +
  1966 +function openCurrentView(event) {
  1967 +
  1968 + var scope = angular.element(document.getElementById("list-view")).scope();
  1969 + scope.isOpenBtnClicked = true;
  1970 + scope.$apply(function () {
  1971 + scope.openModuleItemView(event);
  1972 + });
  1973 +
  1974 +}
  1975 +
  1976 +function onZoom(scope) {
  1977 +
  1978 + //$(".common-drag").remove();
  1979 + //$(".commonDot").remove();
  1980 + //$(".commonDraggedLine").remove();
  1981 + //var radial = $('#aaDetailViewCanvas').createGradient({
  1982 + // x1: 50, y1: 50,
  1983 + // x2: 50, y2: 50,
  1984 + // r1: 10, r2: 30,
  1985 + // c1: 'rgba(100, 50, 0,0)',
  1986 + // c2: 'rgb(216, 216, 216)'
  1987 + //});
  1988 + //$('#aaDetailViewCanvas').setLayers({
  1989 + // fillStyle: radial,
  1990 + //}).drawLayers();
  1991 + // scope.removePin();
  1992 + // scope.showAllPins();
  1993 +
  1994 +
  1995 + //6. Show all pins on AA opened item
  1996 +}
  1997 +
  1998 +
  1999 +$(document).ready(function () {
  2000 +
  2001 + $(".slider").slider({
  2002 + min: 25,
  2003 + max: 100,
  2004 + value: 100,
  2005 + range: "min",
  2006 + orientation: "vertical",
  2007 + slide: function (event, ui) {
  2008 + var scope = angular.element(document.getElementById("aaDetailPageDiv")).scope();
  2009 + scope.$apply(function () {
  2010 + scope.sliderVal = ui.value;
  2011 + scope.removeSpeechBubble();
  2012 + var relativeWidth = 0;
  2013 + var relativeHeight = 0;
  2014 + if (ui.value == 25 || ui.value == 40 || ui.value == 55 || ui.value == 70 || ui.value == 85 || ui.value == 100) {
  2015 + if (ui.value == 100) {
  2016 + relativeWidth = scope.ViewImageWidth;
  2017 + relativeHeight = scope.ViewImageHeight
  2018 + scope.sliderPercentValue = 1.0;
  2019 + }
  2020 + else if (ui.value == 85) {
  2021 + relativeWidth = scope.ViewImageWidth * 0.85;
  2022 + relativeHeight = scope.ViewImageHeight * 0.85;
  2023 + scope.sliderPercentValue = 0.85;
  2024 +
  2025 + } else if (ui.value == 70) {
  2026 + relativeWidth = scope.ViewImageWidth * 0.70;
  2027 + relativeHeight = scope.ViewImageHeight * 0.70;
  2028 + scope.sliderPercentValue = 0.70;
  2029 + } else if (ui.value == 55) {
  2030 +
  2031 + relativeWidth = scope.ViewImageWidth * 0.55;
  2032 + relativeHeight = scope.ViewImageHeight * 0.55;
  2033 + scope.sliderPercentValue = 0.55;
  2034 +
  2035 + } else if (ui.value == 40) {
  2036 +
  2037 + relativeWidth = scope.ViewImageWidth * 0.40;
  2038 + relativeHeight = scope.ViewImageHeight * 0.40;
  2039 + scope.sliderPercentValue = 0.40;
  2040 +
  2041 + } else if (ui.value == 25) {
  2042 +
  2043 + relativeWidth = scope.ViewImageWidth * 0.25;
  2044 + relativeHeight = scope.ViewImageHeight * 0.25;
  2045 + scope.sliderPercentValue = 0.25;
  2046 +
  2047 + }
  2048 + }
  2049 +
  2050 + if (ui.value == 25 || ui.value == 40 || ui.value == 55 || ui.value == 70 || ui.value == 85 || ui.value == 100) {
  2051 + $("#modItemImage").css("width", relativeWidth + "px");
  2052 + $("#modItemImage").css("height", relativeHeight + "px");
  2053 + $("#aaDetailViewCanvas").css("width", relativeWidth + "px");
  2054 + $("#modItemImage").css("height", relativeHeight + "px");
  2055 +
  2056 + $("#modItemImage").attr('src', '');
  2057 +
  2058 +
  2059 + $("#aaDetailViewCanvas").remove();
  2060 + //0.5 create canvas on the top of image so that I can draw a line over the canvas.
  2061 + var canvas = document.createElement('canvas');
  2062 + canvas.id = 'aaDetailViewCanvas';
  2063 + canvas.className = 'aaCanvas';
  2064 + canvas.height = relativeHeight;
  2065 + canvas.width = relativeWidth;
  2066 + canvas.style.left = '0px';
  2067 + canvas.style.top = '0px';
  2068 + canvas.style.position = "absolute";
  2069 +
  2070 + $("#canvasDiv").append(canvas);
  2071 + scope.context = canvas.getContext("2d")
  2072 + $("#modItemImage").attr('src', scope.OpenItemImagePath);
  2073 + scope.isSliderChange = true;
  2074 +<<<<<<< HEAD
  2075 + var btnID = '';
  2076 + $("div.tools div:eq(1) div").each(function () {
  2077 + if ($(this).find("button").hasClass("btn-primary")) {
  2078 + btnID = $(this).find("button").attr("id");
  2079 + $('#' + btnID).removeClass("btn-black");
  2080 + $('#' + btnID).addClass("btn-primary");
  2081 + }
  2082 + });
  2083 + scope.isSelectedPinBtnClickedAftrSliderCange = true;
  2084 + switch (btnID) {
  2085 +
  2086 + case "hidePinBtn":
  2087 + break;
  2088 + case "allPinBtn":
  2089 + scope.showAllPins();
  2090 + break;
  2091 + case "selectedPin":
  2092 + scope.showAllPins();
  2093 + setTimeout(function () {
  2094 + console.log(scope.allPinDataArray);
  2095 + scope.activePinOnSliderChange();
  2096 + }, 1000);
  2097 + break;
  2098 + }
  2099 +=======
  2100 +
  2101 + scope.showAllPins();
  2102 +
  2103 +>>>>>>> 43fbaf7767a7db0e8ec18055b596d1112084dad8
  2104 + }
  2105 +
  2106 + });
  2107 + }
  2108 + })
  2109 + .slider("pips", {
  2110 + rest: "label",
  2111 + step: "15"
  2112 + });
  2113 +});
0 2114 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/tile-view.html
... ... @@ -55,8 +55,8 @@
55 55 <h6 class="text-center text-primary txt-white f11">Search</h6>
56 56  
57 57 <div class="btn-group col-xs-12" style="padding:0;">
58   - <button type="button" class="btn btn-primary btn-sm col-xs-9" ng-click="Reset(1,query)"><i class="fa fa-eye"></i> Show All</button>
59   - <button type="button" class="btn btn-primary btn-sm col-xs-3" ng-click="FilterByImage(1,query)">
  58 + <button type="button" class="btn btn-primary btn-sm col-xs-9" ng-click="Reset(1, query)"><i class="fa fa-eye"></i> Show All</button>
  59 + <button type="button" class="btn btn-primary btn-sm col-xs-3" ng-click="FilterByImage(1, query)">
60 60 <i class="fa fa-search"></i>
61 61 </button>
62 62  
... ...