Commit 2d7dd3e2f40ef57a36fd72579e44697a0640fa78

Authored by Mukul Rajput
1 parent c78cfb13

deleted home.orig

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