Commit 36460961697b9b7f6055782200b0f0617752a4fb

Authored by unknown
1 parent a1d80475

Deleted File

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js.orig deleted
1 -'use strict';  
2 -  
3 -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout",  
4 - function ($rootScope, Modules, $log, $location, $timeout) {  
5 -  
6 - //$scope.pageToOpen = {  
7 - // name: 'MainMenu'  
8 - //};  
9 - $rootScope.pageToOpen = 'app/widget/MainMenu.html';  
10 - $rootScope.currentBodyViewId;  
11 - $rootScope.currentActiveModuleTitle = 'Welcome to A.D.A.M. Interactive Anatomy';//Modules[0].Name;  
12 - $rootScope.currentActiveViewTitle;  
13 - $rootScope.cuurentActiveModuleId;  
14 - $rootScope.openModules = [];  
15 - $rootScope.openViews = [];  
16 - $rootScope.currentSlug;  
17 - $rootScope.jsPanelTitle;  
18 - $rootScope.ViewTitle;  
19 - $rootScope.isLoading = false;  
20 - $rootScope.isAnnotationWindowOpen = false;  
21 - $rootScope.isDrawingToolSelected = false;  
22 - $rootScope.isIdetifyClicked = true;  
23 - $rootScope.paint = false;  
24 - $rootScope.clickX = new Array();  
25 - $rootScope.clickY = new Array();  
26 - $rootScope.clickDrag = new Array();  
27 - $rootScope.isLineDrawSelecyed = false;  
28 - $rootScope.isAnnotationWindowClose = false;  
29 - $rootScope.lastX;  
30 - $rootScope.lastY;  
31 - $rootScope.CommonData;  
32 - $rootScope.shapeType;  
33 - $rootScope.globalSetting = {  
34 - ethnicity: 'W',  
35 - modesty: 'Y',  
36 - };  
37 - $rootScope.formsetting = {  
38 - ethnicity: null,  
39 - modesty: null  
40 - };  
41 -  
42 - $rootScope.isModestyOn;  
43 - $rootScope.isModestyOff;  
44 - $rootScope.SetSettingActiveTab;  
45 -  
46 - //jspanel functionality..  
47 -  
48 - $rootScope.openParent = function (slug) {  
49 - // debugger;  
50 - var openViews = $rootScope.openViews;  
51 - if (openViews.length > 0) {  
52 - $rootScope.openViews.splice(openViews.length - 1);  
53 - }  
54 - if (openViews.length > 0) {  
55 - var lastOpenMoudle = $rootScope.openViews[openViews.length - 1];  
56 - }  
57 - $('#daImagePanel').remove();  
58 - $location.url('/' + slug);  
59 -  
60 - $rootScope.$broadcast('jsPanelCloseEvent', true);  
61 - }  
62 -  
63 - //called on jsanel minimize  
64 - $rootScope.setState = function (state, title) {  
65 -  
66 -  
67 - var alreadyOpenThisView = new jinqJs()  
68 - .from($rootScope.openViews)  
69 - .where("body-views == " + title)  
70 - .select();  
71 - var k = 0;  
72 - if (alreadyOpenThisView != null) {  
73 - for (var i = 0; i < $rootScope.openViews.length; i++) {  
74 - k++;  
75 - if ($rootScope.openViews[i].body-views == title) {  
76 - $rootScope.openViews.splice((k - 1), 1);  
77 -  
78 - $rootScope.openViews.push(  
79 - {  
80 - "module": $rootScope.currentActiveModuleTitle, "body-views": title, "state": state, "BodyViewId": $rootScope.currentBodyViewId,  
81 - "slug": $rootScope.currentSlug  
82 - }  
83 - );  
84 - }  
85 - }  
86 - }  
87 - if (state == 'max') {  
88 - $('#daBodyview').css('width', '100%')  
89 - }  
90 - }  
91 -  
92 - $rootScope.DrawLine = function () {  
93 - //$rootScope.isIdetifyClicked = false;  
94 - //$rootScope.isDrawingToolSelected = true;  
95 - //$rootScope.isLineDrawSelecyed = true;  
96 - $rootScope.shapeType = "Line";  
97 - // alert($rootScope.shapeType);  
98 -  
99 -  
100 - }  
101 -  
102 - $rootScope.ClearIframe = function () {  
103 - if ($('#daImagePanel') != null)  
104 - $('#daImagePanel').remove();  
105 -  
106 - $rootScope.hideScrollbar();  
107 - }  
108 -  
109 - //ends  
110 -  
111 - $rootScope.hideScrollbar = function () {  
112 - $(".sidebar").mCustomScrollbar({  
113 - autoHideScrollbar: true,  
114 - //theme:"rounded"  
115 - });  
116 - }  
117 -  
118 - //annotation tool custom events  
119 - $rootScope.ShowAnnotationWindow = function () {  
120 - $rootScope.isAnnotationWindowOpen = true;  
121 - $(".annotationTollbar").css("display", "block");  
122 - $rootScope.$broadcast('annotationToolEvent', true);  
123 -  
124 - }  
125 -  
126 - $rootScope.CloseAnnotationTool = function () {  
127 - console.log('close')  
128 - $(".annotationTollbar").css("display", "none");  
129 - $rootScope.isAnnotationWindowClose = true;  
130 - }  
131 -  
132 - $rootScope.OnIdentifyClick = function () {  
133 - $rootScope.isIdetifyClicked = true;  
134 - $rootScope.isDrawingToolSelected = false;  
135 - }  
136 -  
137 - //----Annotation Toolbar: Jcanvas-----  
138 -  
139 - $rootScope.DrawLine = function (e) {  
140 - $rootScope.switchCanvas();  
141 - $rootScope.shapeType = "Line";  
142 -<<<<<<< HEAD  
143 -  
144 -  
145 - $('.btnCursor').removeClass('activebtncolor');  
146 - $(".btn-annotation").removeClass("activebtncolor");  
147 - $(".btn-annotation-line").addClass("activebtncolor");  
148 -  
149 -  
150 -=======  
151 -  
152 -  
153 - $('.btnCursor').removeClass('activebtncolor');  
154 - $(".btn-annotation").removeClass("activebtncolor");  
155 - $(".btn-annotation-line").addClass("activebtncolor");  
156 -  
157 -  
158 ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482  
159 - }  
160 -  
161 -  
162 - $rootScope.DrawPin = function (e) {  
163 - $rootScope.switchCanvas();  
164 - $rootScope.shapeType = "Pin";  
165 -<<<<<<< HEAD  
166 -  
167 -=======  
168 -  
169 ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482  
170 - $('.btnCursor').removeClass('activebtncolor');  
171 - $(".btn-annotation").removeClass("activebtncolor");  
172 - $(".btn-annotation-pin").addClass("activebtncolor");  
173 - }  
174 -  
175 - $rootScope.Cursor = function () {  
176 - $rootScope.switchCanvas();  
177 - $rootScope.shapeType = "cursor";  
178 -  
179 - $(".btn-annotation").removeClass("activebtncolor");  
180 - // $("#" + e.currentTarget.id).removeClass("activebtncolor");  
181 - $('.btnCursor').addClass('activebtncolor');  
182 - }  
183 -  
184 - $rootScope.DrawRectangle = function (e) {  
185 - $rootScope.switchCanvas();  
186 - $rootScope.shapeType = "Rectangle";  
187 - $('.btnCursor').removeClass('activebtncolor');  
188 - $(".btn-annotation").removeClass("activebtncolor");  
189 - $(".btn-annotation-rectangle").addClass("activebtncolor");  
190 - }  
191 - $rootScope.paintBrush = function () {  
192 - $rootScope.switchCanvas();  
193 - $rootScope.shapeType = "brush";  
194 -  
195 - }  
196 -  
197 - $rootScope.DrawCircle = function (e) {  
198 - $rootScope.switchCanvas();  
199 - $rootScope.shapeType = "Circle";  
200 - $('.btnCursor').removeClass('activebtncolor');  
201 - $(".btn-annotation").removeClass("activebtncolor");  
202 - $(".btn-annotation-circle").addClass("activebtncolor");  
203 - }  
204 -  
205 - $rootScope.DrawArrow = function (e) {  
206 - $rootScope.switchCanvas();  
207 - $rootScope.shapeType = "Arrow";  
208 - $('.btnCursor').removeClass('activebtncolor');  
209 - $(".btn-annotation").removeClass("activebtncolor");  
210 - $(".btn-annotation-arrow").addClass("activebtncolor");  
211 - }  
212 - $rootScope.DrawText = function () {  
213 -<<<<<<< HEAD  
214 - $rootScope.switchCanvas();  
215 -  
216 - $rootScope.shapeType = "TextArea";  
217 - $('.btnCursor').removeClass('activebtncolor');  
218 - $(".btn-annotation").removeClass("activebtncolor");  
219 - $(".btn-annotation-Text").addClass("activebtncolor");  
220 -=======  
221 -  
222 - $("#myModal").modal("toggle");  
223 - $rootScope.shapeType = "TextArea";  
224 - // $('.btnCursor').removeClass('activebtncolor');  
225 - // $(".btn-annotation").removeClass("activebtncolor");  
226 - // $(".btn-annotation-Text").addClass("activebtncolor");  
227 ->>>>>>> 914a4ac836533cab3ea430e240a2036b112c6482  
228 - //$('.btnCursor').removeClass('activebtncolor');  
229 - //$(".btn-annotation").removeClass("activebtncolor");  
230 - //$("#" + e.currentTarget.id).addClass("activebtncolor");  
231 - }  
232 -  
233 - $rootScope.DrawPolygon = function () {  
234 - $rootScope.shapeType = "DrawPolygon";  
235 -  
236 - }  
237 -  
238 -  
239 - $rootScope.OpacityModal = function () {  
240 -  
241 -  
242 - }  
243 - $rootScope.switchCanvas = function () {  
244 - var x = $('#canvasPaint').css("z-index");  
245 -  
246 - var y = $('#canvas').css("z-index");  
247 - if (x > y) {  
248 - y = parseInt(x) + 1;  
249 - } else {  
250 - y = parseInt(y) + 1;  
251 - }  
252 - $('#canvas').css("z-index", y);  
253 - }  
254 - $rootScope.EraseDrawing = function () {  
255 - document.getElementById('paintCanvas').getContext('2d').setTransform(1, 0, 0, 1, 0, 0);  
256 - document.getElementById('paintCanvas').getContext('2d').clearRect(0, 0, document.getElementById('paintCanvas').getContext('2d').canvas.width, document.getElementById('paintCanvas').getContext('2d').canvas.height);  
257 -  
258 - }  
259 - //----End-------------  
260 -  
261 - $rootScope.AddClick=function (x, y, dragging) {  
262 - $rootScope.clickX.push(x);  
263 - $rootScope.clickY.push(y);  
264 - $rootScope.clickDrag.push(dragging);  
265 - }  
266 -  
267 - $rootScope.Redraw = function () {  
268 - var context = document.getElementById('paintCanvas').getContext('2d');  
269 -  
270 - context.clearRect(0, 0, context.canvas.width, context.canvas.height); // Clears the canvas  
271 -  
272 - context.strokeStyle = "#FFFFFF";  
273 - context.lineJoin = "round";  
274 - context.lineWidth = 5;  
275 -  
276 -  
277 - for (var i = 0; i < $rootScope.clickX.length; i++) {  
278 - context.beginPath();  
279 - if ($rootScope.clickDrag[i] && i) {  
280 - context.moveTo($rootScope.clickX[i - 1], $rootScope.clickY[i - 1]);  
281 - } else {  
282 - context.moveTo($rootScope.clickX[i] - 1, $rootScope.clickY[i]);  
283 - }  
284 - context.lineTo($rootScope.clickX[i], $rootScope.clickY[i]);  
285 - context.closePath();  
286 - context.stroke();  
287 - }  
288 - }  
289 -  
290 - $rootScope.PaintCanvasMousedownListener = function (canvasContext,x,y) {  
291 - if ($rootScope.isLineDrawSelecyed == true) {  
292 -  
293 - canvasContext.lineWidth = 0.1;  
294 - //$scope.paintCanvasContext.lineJoin = 'round';  
295 - //$scope.paintCanvasContext.lineCap = 'round';  
296 - canvasContext.strokeStyle = 'red';  
297 -  
298 -  
299 - canvasContext.beginPath();  
300 -  
301 - //var canvasOffset = $("#myCanvas").offset();  
302 - //var offsetX = canvasOffset.left;  
303 - //var offsetY = canvasOffset.top;  
304 - canvasContext.moveTo(x, y);  
305 - }  
306 -  
307 - }  
308 -  
309 - $rootScope.PaintCanvasMouseupListener = function (canvasContext) {  
310 - if ($scope.isLineDrawSelecyed == true) {  
311 -  
312 - }  
313 - }  
314 -  
315 - $rootScope.PaintCanvasMousemoveListener = function (canvasContext,x,y) {  
316 - if ($rootScope.isLineDrawSelecyed == true) {  
317 - console.log('hm moving')  
318 - canvasContext.lineTo(x, y);  
319 - canvasContext.stroke();  
320 - }  
321 - }  
322 -  
323 - $rootScope.Draw = function (x, y, isDown,context) {  
324 - if (isDown) {  
325 - context.beginPath();  
326 - context.strokeStyle = '#000000';  
327 - context.lineWidth = 1//$('#selWidth').val();  
328 - context.lineJoin = "round";  
329 - context.moveTo($rootScope.lastX, $rootScope.lastY);  
330 - context.lineTo(x, y);  
331 - context.closePath();  
332 - context.stroke();  
333 - }  
334 - $rootScope.lastX = x; $rootScope.lastY = y;  
335 - }  
336 -  
337 -  
338 -  
339 -  
340 - //list manager function  
341 -  
342 - //list manager function  
343 -  
344 - $rootScope.ShowListManager = function () {  
345 - console.log('ShowListManager')  
346 -  
347 - $rootScope.isLoading = true;  
348 - $('#spinner').css('visibility', 'visible');  
349 -  
350 - $('#listManager').css('display', 'block');  
351 - $("#listManager").css("visibility", "visible");  
352 - $('#listManager').draggable();  
353 -  
354 -  
355 - $rootScope.islistManagerEventAlredayDispachted = true;  
356 -  
357 - $rootScope.$broadcast('listManagerEvent', true);  
358 - }  
359 -  
360 - $rootScope.CloseListManager = function () {  
361 - console.log('close')  
362 - $rootScope.isListManagerSelected = false;  
363 - $('#listManager').css('display', 'none');  
364 - $("#listManager").css("visibility", "hidden");  
365 - // $rootScope.isAnnotationWindowClose = true;  
366 - // if('#termList')  
367 - if ($('#termList option').length > 0) {  
368 - //$('#termList option') = null;  
369 - //$('#termList').innerHTML='';  
370 - $('#termList')  
371 - .find('option')  
372 - .remove()  
373 - .end()  
374 - if ($('#termList option').length > 0) {  
375 -  
376 - }  
377 - }  
378 -  
379 -  
380 - }  
381 -  
382 - function fillListManagerTerms() {  
383 -  
384 - var len = $rootScope.openModules.length;  
385 - var openViewLen = $rootScope.openViews.length;  
386 -  
387 - var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId;  
388 - var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId;  
389 - if (currentOpenModuleId == 1) {  
390 -  
391 - }  
392 -  
393 - }  
394 -  
395 - //setrtings  
396 - $rootScope.SetSettingActiveTab = function (tabToSet) {  
397 - $rootScope.SettingsTab = tabToSet;  
398 - };  
399 -  
400 - $rootScope.loadsettings = function () {  
401 -  
402 - //1. For now we are by default opening DA settings tab  
403 - $rootScope.SettingsTab = 3;  
404 -  
405 - //2.  
406 - var curentEthnicity = localStorage.getItem("globalEthnicity");  
407 - if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) {  
408 - $rootScope.globalSetting.ethnicity = curentEthnicity;  
409 - }  
410 - else {  
411 - localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity);  
412 - }  
413 -  
414 - var curentmodesty = localStorage.getItem("globalmodesty");  
415 - if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) {  
416 - $rootScope.globalSetting.modesty = curentmodesty  
417 - }  
418 - else {  
419 - localStorage.setItem("globalmodesty", $rootScope.globalSetting.modesty);  
420 - }  
421 -  
422 - //3.  
423 - $rootScope.setModestySettings($rootScope.globalSetting.modesty);  
424 -  
425 - //4.  
426 - $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity);  
427 -  
428 -  
429 - };  
430 -  
431 - $rootScope.setModestySettings = function (currentmodsetting) {  
432 -  
433 - if (currentmodsetting == 'Y') {  
434 - $rootScope.isModestyOn = true;  
435 - $rootScope.isModestyOff = false;  
436 - }  
437 - else {  
438 - $rootScope.isModestyOn = false;  
439 - $rootScope.isModestyOff = true;  
440 - }  
441 - }  
442 -  
443 - $rootScope.setEthncitySettings = function (currentEthncitysetting) {  
444 -  
445 - // this code is used for maintaing the currently selected Ethencity.  
446 - if (currentEthncitysetting == 'L') {  
447 - $("#btnEthnicA").addClass("skindefault");  
448 - if ($("#btnEthnicB").hasClass("skindefault")) { $("#btnEthnicB").removeClass("skindefault"); }  
449 - if ($("#btnEthnicL").hasClass("skindefault")) { $("#btnEthnicL").removeClass("skindefault"); }  
450 - if ($("#btnEthnicW").hasClass("skindefault")) { $("#btnEthnicW").removeClass("skindefault"); }  
451 - }  
452 - if (currentEthncitysetting == 'B') {  
453 - $("#btnEthnicB").addClass("skindefault");  
454 - if ($("#btnEthnicL").hasClass("skindefault")) { $("#btnEthnicL").removeClass("skindefault"); }  
455 - if ($("#btnEthnicW").hasClass("skindefault")) { $("#btnEthnicW").removeClass("skindefault"); }  
456 - if ($("#btnEthnicA").hasClass("skindefault")) { $("#btnEthnicA").removeClass("skindefault"); }  
457 - }  
458 - if (currentEthncitysetting == 'A') {  
459 - $("#btnEthnicL").addClass("skindefault");  
460 - if ($("#btnEthnicB").hasClass("skindefault")) { $("#btnEthnicB").removeClass("skindefault"); }  
461 - if ($("#btnEthnicW").hasClass("skindefault")) { $("#btnEthnicW").removeClass("skindefault"); }  
462 - if ($("#btnEthnicA").hasClass("skindefault")) { $("#btnEthnicA").removeClass("skindefault"); }  
463 - }  
464 - if (currentEthncitysetting == 'W') {  
465 - $("#btnEthnicW").addClass("skindefault");  
466 - if ($("#btnEthnicB").hasClass("skindefault")) { $("#btnEthnicB").removeClass("skindefault"); }  
467 - if ($("#btnEthnicL").hasClass("skindefault")) { $("#btnEthnicL").removeClass("skindefault"); }  
468 - if ($("#btnEthnicA").hasClass("skindefault")) { $("#btnEthnicA").removeClass("skindefault"); }  
469 - }  
470 - }  
471 -  
472 - $rootScope.ChangeEthnicity = function (formsetting, skintone) {  
473 - formsetting.ethnicity = skintone;  
474 - $rootScope.setEthncitySettings(formsetting.ethnicity);  
475 -  
476 - }  
477 -  
478 - $rootScope.ChangeModesty = function (formsetting, modestyValue) {  
479 - formsetting.modesty = modestyValue;  
480 - $rootScope.setModestySettings(formsetting.modesty);  
481 -  
482 - }  
483 -  
484 - $rootScope.CloseSetting = function () {  
485 -  
486 - $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity);  
487 - $rootScope.setModestySettings($rootScope.globalSetting.modesty);  
488 - $('#modal-settings').modal('hide');  
489 - }  
490 -  
491 - $rootScope.UpdateAndCloseSetting = function (setting) {  
492 -  
493 - $rootScope.UpdateSetting(setting);  
494 - $('#modal-settings').modal('hide');  
495 -  
496 - };  
497 -  
498 - $rootScope.UpdateSetting = function (setting) {  
499 -  
500 - //1.  
501 - if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) {  
502 - $rootScope.globalSetting.ethnicity = setting.ethnicity;  
503 - $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity);  
504 - }  
505 - if (typeof (setting.modesty) !== "undefined" && setting.modesty !== null) {  
506 - $rootScope.globalSetting.modesty = setting.modesty;  
507 - $rootScope.setModestySettings($rootScope.globalSetting.modesty);  
508 - }  
509 -  
510 - //2.  
511 - localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity);  
512 -  
513 - //3.  
514 - localStorage.setItem("globalmodesty", $rootScope.globalSetting.modesty);  
515 -  
516 - //4.  
517 - $rootScope.reloadChildController();  
518 -  
519 - };  
520 -  
521 - $rootScope.reloadChildController = function () {  
522 -  
523 - var len = $rootScope.openModules.length;  
524 -  
525 - var currentOpenModuleId = $rootScope.openModules[len - 1].ModuleId;  
526 -  
527 - //checking is DA module is opend.  
528 - if (currentOpenModuleId == 1) {  
529 -  
530 - //Check that what current bodyview is open  
531 - if ($rootScope.openViews.length > 0) {  
532 - var openViewLen = $rootScope.openViews.length;  
533 - var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId;  
534 - $rootScope.$broadcast('reloadDABodyViewEvent', { reloadDABodyViewId: currentOpenViewId });  
535 - }  
536 - else {  
537 - $rootScope.$broadcast('reloadDAControllerEvent', true);  
538 -  
539 - }  
540 - }  
541 - };  
542 -  
543 -  
544 - }]  
545 -);  
546 \ No newline at end of file 0 \ No newline at end of file