Blame view

js/app/AmdaApp.js 19.1 KB
10200969   Roipoussiere   Remove whitespace...
1
/**
16035364   Benjamin Renard   First commit
2
3
 * Project  : AMDA-NG4
 * Name     : AmdaApp.js
10200969   Roipoussiere   Remove whitespace...
4
 * @class   amdaApp.AmdaApp
16035364   Benjamin Renard   First commit
5
6
7
 * @extends Ext.ux.desktop.App
 * @brief   Main class defining Amda Desktop and its Modules
 * @author  Ext JS Library 4.0 Copyright(c) 2006-2011 Sencha Inc. licensing@sencha.com
16035364   Benjamin Renard   First commit
8
9
 */

16035364   Benjamin Renard   First commit
10
Ext.define('amdaApp.AmdaApp', {
7baca0ef   Elena.Budnik   user special sett...
11
12
13
14
15
	extend: 'Ext.ux.desktop.App',

	requires: [
		'Ext.window.MessageBox',
		'Ext.ux.desktop.ShortcutModel',
851cf2f0   Erdogan Furkan   For now
16
		'amdaUI.DefaultValuesWindow',
7baca0ef   Elena.Budnik   user special sett...
17
18
		'amdaUI.SampToolBarUI',
		'amdaDesktop.DynamicModule',
e995f4ad   Erdogan Furkan   Added codeTextAre...
19
20
21
22
		'MyDesktop.Settings',
		'amdaModel.Function',
		'amdaModel.Constant',
		'amdaModel.ParametersList'
7baca0ef   Elena.Budnik   user special sett...
23
24
	],

bf776dc8   Benjamin Renard   working
25
	dynamicModules: {
7baca0ef   Elena.Budnik   user special sett...
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
		visu : {
				id          : 'visu-win',
				icon        : 'icon-visu_catalog',
				title       : 'Visualization',
				source      : 'amdaDesktop.VisuModule',
				useLauncher : true
			},
		statistics : {
				id          : 'statistics-win',
				icon        : 'icon-statistics',
				title       : 'Statistics',
				source      : 'amdaDesktop.StatisticsModule',
				useLauncher : true
			},
		catalog : {
				id          : 'catalog-win',
				icon        : 'icon-catalog',
				title       : 'Manage catalogs',
				source      : 'amdaDesktop.CatalogModule',
				useLauncher : true
			},
		param : {
			id          : 'param-win',
			icon        : 'icon-parameters',
			title       : 'Create/modify parameters',
			source      : 'amdaDesktop.ParameterModule',
			useLauncher : true
		},
		tt : {
			id          : 'timetab-win',
			icon        : 'icon-manage-tt',
			title       : 'Manage Time Tables',
			source      : 'amdaDesktop.TimeTableModule',
			useLauncher : true
		},
		tt_op : {
			id          : 'ttsOpe-win',
			icon        : 'icon-tts',
			title       : 'Operations on Time Tables',
			source      : 'amdaDesktop.TimeTableOperationModule',
			useLauncher : true
		},
		plot : {
			id          : 'plot-win',
			icon         : 'icon-plot',
			title       : 'Plot Manager',
			source      : 'amdaDesktop.PlotModule',
			useLauncher : true
		},
		search : {
			id          : 'search-win',
			icon        : 'icon-search',
			title       : 'Data Mining',
			source      : 'amdaDesktop.SearchModule',
			useLauncher : true
		},
		download : {
			id          : 'down-win',
			icon        : 'icon-download',
			title       : 'Download data',
			source      : 'amdaDesktop.DownloadModule',
			useLauncher : true
		},
		upload : {
			id          : 'up-win',
			icon        : 'icon-mydata',
			title       : 'Upload data',
			source      : 'amdaDesktop.UploadModule',
			useLauncher : true
		},
		interop : {
			id          : 'interop-win',
			icon        : 'icon-interop',
			title       : 'Interoperability',
			source      : 'amdaDesktop.InteropModule',
			useLauncher : true
		},
b185823c   Nathanael Jourdane   Use IntervalUI mo...
103
104
		epntap : {
			id          : 'epntap-win',
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
105
			icon        : 'icon-interop',
b185823c   Nathanael Jourdane   Use IntervalUI mo...
106
107
			title       : 'EPN-TAP data',
			source      : 'amdaDesktop.EpnTapModule',
d53e0fe6   Nathanael Jourdane   Move EPN-TAP modu...
108
			useLauncher : false
b185823c   Nathanael Jourdane   Use IntervalUI mo...
109
		},
7baca0ef   Elena.Budnik   user special sett...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
		info : {
			id          : 'info-win',
			icon        : 'icon-information',
			title       : 'About AMDA',
			source      : 'amdaDesktop.AboutModule',
			useLauncher : false
		},
		explorer : {
			id          : 'explorer-win',
			icon        : 'icon-elements',
			title       : 'Workspace Explorer',
			source      : 'amdaDesktop.ExplorerModule',
			useLauncher : false
		},
		my_data : {
			id          : 'mydata-win',
			icon        : 'icon-mydata',
			title       : 'Define parameter',
			source      : 'amdaDesktop.MyDataModule',
			useLauncher : false
		},
		help : {
			id          : 'help-win',
			icon        : 'icon-help',
			title       : 'Help',
			source      : 'amdaDesktop.HelpModule',
			useLauncher : false
		},
		feedback : {
			id          : 'feed-win',
			icon        : 'icon-feedback',
			title       : 'Feedback',
			source      : 'amdaDesktop.FeedbackModule',
			useLauncher : false
		},
		filters : {
			id          : 'filters-win',
			icon        : 'icon-filter',
			title       : 'Filters',
			source      : 'amdaDesktop.FiltersModule',
			useLauncher : false
		},
		result : {
			id          : 'result-win',
			contentId   : 'resultUI',
			icon        : 'icon-results',
			title       : 'Results',
			source      : 'amdaDesktop.ResultModule',
			useLauncher : false
		},
		astro : {
			id          : 'astroimages-win',
			icon        : 'icon-interop',
			title       : 'Astronomical Images',
			source      : 'amdaDesktop.AstroImagesModule',
			useLauncher : false
0f9ec8f6   Benjamin Renard   Add reset passwor...
166
167
168
169
170
171
172
173
		},
        resetpwd : {
			id          : 'resetpwd-win',
			icon        : 'icon-resetpwd',
			title       : 'Reset Password',
			source      : 'amdaDesktop.ResetPwdModule',
			useLauncher : false
		},
7baca0ef   Elena.Budnik   user special sett...
174
	},
e995f4ad   Erdogan Furkan   Added codeTextAre...
175
176
177
	functionList : [],
	constantList : [],
	parametersList : [],
7baca0ef   Elena.Budnik   user special sett...
178
179
180
181
182
183
184
185
	// IDs of Modules working with  parameters; used in Alias Node
	//TODO stats-win
	paramModulesID : ['plot-win', 'param-win', 'search-win', 'down-win'],

	// Important system constants
	MAX_UPLOADED_FILE_SIZE : max_uploaded_file_size, // in B, from my_config.php

	listeners : {
16035364   Benjamin Renard   First commit
186
187
188
		scope : this,
		beforeunload : function ()
		{
16035364   Benjamin Renard   First commit
189
190
191
192
193
			var interopModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id);
			if (interopModule)
				interopModule.forceSampDisconnect();
			return true;
		},
10200969   Roipoussiere   Remove whitespace...
194
		ready : function ()
7baca0ef   Elena.Budnik   user special sett...
195
		{
7baca0ef   Elena.Budnik   user special sett...
196
			AmdaAction.cleanUserWS(function(res,e){},this);
aa94fd24   elena   Merge with last svn
197
		}
16035364   Benjamin Renard   First commit
198
	},
10200969   Roipoussiere   Remove whitespace...
199

7baca0ef   Elena.Budnik   user special sett...
200
201
202
203
	init: function() 
	{
		// custom logic before getXYZ methods get called...
		this.callParent();
a5da368d   Erdogan Furkan   #9505 - Done
204
205

		// TT duration management
ce13ae63   Erdogan Furkan   #9505 - Minor fix
206
        Ext.state.Manager.getProvider().set('tt_duration', 3);
f5ed8bb2   Erdogan Furkan   #9505 - Added dur...
207
208
209

		// Cat duration management
        Ext.state.Manager.getProvider().set('cat_duration', 3);
e995f4ad   Erdogan Furkan   Added codeTextAre...
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258

		Ext.create('Ext.data.Store', {
			model: 'amdaModel.Function',
			storeId:'functionsStore',
			autoLoad:true,
			listeners:{
				scope:this,
				load : function (store, records, operation, success)
				{
					var me = this;
					Ext.each(records, function(record){
						me.functionList.push(record.data.name.split('(')[0]);
					});
				}
			}
		});

		Ext.create('Ext.data.Store', {
			model: 'amdaModel.Constant',
			storeId:'constantsStore',
			autoLoad:true,
			listeners:{
				scope:this,
				load : function (store, records, operation, success)
				{
					var me = this;
					Ext.each(records, function(record){
						me.constantList.push("@"+record.data.name);
					});
				}
			}
		});

		Ext.create('Ext.data.Store', {
			model: 'amdaModel.ParametersList',
			storeId:'parametersStore',
			autoLoad:true,
			listeners:{
				scope:this,
				load : function (store, records, operation, success)
				{
					var me = this;
					Ext.each(records, function(record){
						me.parametersList.push(record.raw);
					});
				}
			}
		});

7baca0ef   Elena.Budnik   user special sett...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
		// now ready...
		//override createWindow method of desktop
		Ext.override(Ext.ux.desktop.Desktop, {
			createWindow: function (config, cls) {
				var me = this;
				var win = this.callParent([config,cls]);
				win.on({
					boxready: function (w) {
						w.dd.xTickSize = me.xTickSize;
						w.dd.yTickSize = me.yTickSize;

						if (w.resizer) {
								w.resizer.widthIncrement = me.xTickSize;
								w.resizer.heightIncrement = me.yTickSize;
						}

						if (w.y < 0)
								w.el.setY(0);

						if (w.x + w.width > me.el.getWidth())
								w.el.setX(me.el.getWidth()-w.width);

						if (w.y + w.height > me.el.getHeight())
								w.el.setY((me.el.getHeight()-w.height > 0) ? me.el.getHeight()-w.height : 0);

					},
					single: true
				});
				return win;
			}
		});
	},
	
	//create InfoBox
	infoMsg : function(msg) {
		Ext.Msg.show({
			title: 'AMDA Info',
			cls: 'infoMsg',
			msg: msg,
			modal: false,
			autoScroll: true,
			resizable: true,
			icon: Ext.Msg.INFO,
			buttons: Ext.Msg.OK
		});
	},
7034023d   Elena.Budnik   infoMsgLong class...
305
306
307
308
309
310
311
312
313
314
315
316
317
	//create InfoBox
	infoMsgLong : function(msg) {
		Ext.Msg.show({
			title: 'AMDA Info',
			cls: 'infoMsgLong',
			msg: msg,
			modal: false,
			autoScroll: true,
			resizable: true,
			icon: Ext.Msg.INFO,
			buttons: Ext.Msg.OK
		});
	},
7baca0ef   Elena.Budnik   user special sett...
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
	//create WarningBox
	warningMsg : function(msg) {
		Ext.Msg.show({
			title: 'Attention',
			msg: msg,
			icon: Ext.Msg.WARNING,
			buttons: Ext.Msg.OK
		});
	},

	//create ErrorBox
	errorMsg : function(msg) {
		Ext.Msg.show({
			title: 'Failure',
			msg: msg,
			icon: Ext.Msg.ERROR,
			buttons: Ext.Msg.OK
		});
	},

9b3f49e3   Elena.Budnik   info bulls Plot r...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
	// add info icon; onCick AmdaHelp is shown
	addAmdaInfo : function(help, style) {
		if (style) {
			help +=  '" style="' + style;
		}
		var html =  '<img amda_clicktip="' + help + '" src="js/resources/images/16x16/info_mini.png"'
		return {
			xtype: 'label',
			html: html,
			listeners: {
				click: {
					element: 'el',
					fn: function(e,t) { 
						var me = t,
						text = me.getAttribute('amda_clicktip');
						if (text) {
							e.preventDefault();
							AmdaAction.getInfo({name : text}, function(res,e) {
								if (res.success) myDesktopApp.infoMsg(res.result);
							}); 
						}
					}
				}
			}
		};
	},

7baca0ef   Elena.Budnik   user special sett...
365
366
367
368
369
370
371
372
373
	getModules : function(){
		var allModules = [];

		//Add dynamic modules
		Ext.Object.each(this.dynamicModules, function(key, def) {
			allModules.push(new amdaDesktop.DynamicModule(def.id, def.icon, def.title, def.source, def.useLauncher));
		});

		return allModules;
16035364   Benjamin Renard   First commit
374
	},
10200969   Roipoussiere   Remove whitespace...
375

7baca0ef   Elena.Budnik   user special sett...
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
	getDesktopConfig: function () 
	{
		var me = this, ret = me.callParent();

		var desktopId = 'AmdaDesktop';
		var wallpaper = Ext.state.Manager.getProvider().get(desktopId+'_wallpaper');
		if (!wallpaper)
				wallpaper = 'js/resources/images/desktop/wallpapers/Cdpp2.jpg';
		return Ext.apply(ret, {
			id       : desktopId,
			contextMenuItems: [
					{ text: 'Change Settings', handler: me.onSettings, scope: me }
			],
			shortcuts: Ext.create('Ext.data.Store', {
				model: 'Ext.ux.desktop.ShortcutModel',
				data: [
					{ name: 'Help',  iconCls: 'help', module: 'help-win' },
					{ name: 'Create/Modify parameter',  iconCls: 'edit', module: 'param-win' },
					{ name: 'Plot data',  iconCls: 'plot', module: 'plot-win'},
					{ name: 'Data mining',  iconCls: 'search', module: 'search-win'},
					{ name: 'Statistics',  iconCls: 'statistics', module: 'statistics-win'},
					{ name: 'Download data',  iconCls: 'download_manager', module: 'down-win'},
					{ name: 'Upload data',  iconCls: 'mydata', module: 'up-win'},
					{ name: 'Manage TimeTables',    iconCls: 'timeTable', module: 'timetab-win' },
					{ name: 'TimeTables operations',   iconCls: 'operations', module: 'ttsOpe-win' },
					{ name: 'Manage catalogs',  iconCls: 'catalog', module: 'catalog-win'},
					{ name: 'Visualize catalogs',  iconCls: 'visu_catalog', module: 'visu-win'},
					{ name: 'Interoperability',   iconCls: 'interop', module: 'interop-win' }
				]
			}),

			wallpaper: wallpaper,
			wallpaperStretch: false
		});
10200969   Roipoussiere   Remove whitespace...
410
411
	},

7baca0ef   Elena.Budnik   user special sett...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
	// config for the start menu
	getStartConfig : function() 
	{
		var me = this, ret = me.callParent();
		return Ext.apply(ret, {
			title: sessionID,
			iconCls: 'icon-user',
			height: 270,
			toolConfig: {
				width: 130,
				items: [
					{
						text:'Settings',
						iconCls:'settings',
						handler: me.onSettings,
						scope: me
					}, '-',
					{
						text : 'Profile',
						iconCls : 'icon-user',
						id : 'profile-win-tool',
						handler : function(obj, e) {
								e.stopEvent();
								AmdaAction.getUserInfo(this.onGetUserInfo,this);
						},
						scope : this
					},
0f9ec8f6   Benjamin Renard   Add reset passwor...
439
440
441
442
                    {
						text : 'Reset password',
						iconCls : 'icon-resetpwd',
						id : 'resetpwd-win-tool',
0df0a6ec   Benjamin Renard   guest and impex u...
443
                        disabled: isGuest || (sessionID == 'impex'),
0f9ec8f6   Benjamin Renard   Add reset passwor...
444
445
446
447
448
449
450
451
452
						handler : function(obj, e) {
								e.stopEvent();
								var moduleId = obj.el.id;
								this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
								module.createWindow();
								});
						},
						scope : this
					},
7baca0ef   Elena.Budnik   user special sett...
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
					{
						text : 'Feedback',
						iconCls : 'icon-feedback',
						id : 'feed-win-tool',
						handler : function(obj, e) {
								e.stopEvent();
								var moduleId = obj.el.id;
								this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
								module.createWindow();
								});
						},
						scope : this
					}, 
					{
						text : 'Help',
						iconCls : 'icon-help',
						id : 'help-win-tool',
						scope : this,
						handler : function(obj, e) {
								e.stopEvent();
								var moduleId = obj.el.id;
								this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
								module.createWindow();
							});
						}
					}, 
					{
						text : 'About AMDA',
						iconCls : 'icon-information',
						id : 'info-win-tool',
						scope : this,
						handler : function(obj, e) {
								e.stopEvent();
								var moduleId = obj.el.id;
								this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
								module.createWindow();
								});
						}
					}, '-', 
					{
						text : 'Workspaces',
						iconCls : 'icon-ws',
88905aa3   Benjamin Renard   Disable Workspace...
495
						disabled: true,
851cf2f0   Erdogan Furkan   For now
496
497
498
499
500
						scope : this,
						handler:function(obj, e){
							e.stopEvent();
							Ext.create('amdaUI.DefaultValuesWindow').show();
						}
7baca0ef   Elena.Budnik   user special sett...
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
					}, '-', 
					{
						text : 'Logout',
						iconCls : 'logout',
						scope : this,
						handler : me.onLogout
					}
				]
			}
		});
	},

	getModuleDefinition: function(id) {
		return this.getModule(id);
	},

	getLoadedModule: function(id, forceLoad, onReady) {
		var moduleDef = this.getModuleDefinition(id);
		if (!moduleDef)
			return null;
		if (!moduleDef.isReady())
		{
			if (forceLoad)
			{
				//loadMask.show();
				moduleDef.get(function (module) {
					//loadMask.hide();
					if (onReady)
						onReady(module);
				});
			}
			return null;
		}
		if (onReady)
16035364   Benjamin Renard   First commit
535
			onReady(moduleDef.get());
7baca0ef   Elena.Budnik   user special sett...
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
		return moduleDef.get();
	},

	getTaskbarConfig: function () 
	{
		var ret = this.callParent();
		return Ext.apply(ret, {
			quickStart: [],
			trayItems: [
				{
					name: this.dynamicModules.feedback.title, iconCls: 'icon-feedback',
					tooltip: { text: this.dynamicModules.feedback.title, align: 'bl-tl' },
					overflowText: this.dynamicModules.feedback.title,
					iconCls: this.dynamicModules.feedback.icon,
					scope: this,
					handler : function(obj, e) {
						e.stopEvent();
						this.getLoadedModule(this.dynamicModules.feedback.id, true, function(module) {
								module.createWindow();
						});
					}
				},
				{
					name: this.dynamicModules.info.title, iconCls: 'icon-information',
					tooltip: { text: this.dynamicModules.info.title, align: 'bl-tl' },
					overflowText: this.dynamicModules.info.title,
					iconCls: this.dynamicModules.info.icon,
					scope: this,
					handler : function(obj, e) {
						e.stopEvent();
						this.getLoadedModule(this.dynamicModules.info.id, true, function(module) {
								module.createWindow();
						});
					}
				},
				{
					name: 'Logout', iconCls : 'logout',
					tooltip: { text: 'Logout', align: 'bl-tl' },
					overflowText: 'Logout',
					scope : this,
					handler : this.onLogout
				}, '-',
				{ xtype: 'trayclock', flex: 1 }
			]
		});
	},

	onLogout: function (obj,e) {
		e.stopEvent();
		if (isGuest) {
				this.guestLogout();
			}
		else {
			this.saveSessionState();
		}
	},

	onGetUserInfo : function (result, e){
		var t = e.getTransaction();
10200969   Roipoussiere   Remove whitespace...
595
596
		if (e.status)
		{
16035364   Benjamin Renard   First commit
597
598
			if (result && result.success)
			{
10200969   Roipoussiere   Remove whitespace...
599
				// SUCCESS
16035364   Benjamin Renard   First commit
600
				var msg = '<b>Login :</b> '+result['login']+'<br/>';
db4f24d1   Elena.Budnik   redmine #5385, #4...
601
				msg += ('<b> Name :</b> '+result['first_name']+' '+result['name']+'<br/>');
16035364   Benjamin Renard   First commit
602
603
604
				msg += ('<b>Groups :</b> '+result['group']+'<br/>');
				msg += ('<b>Email :</b> '+result['email']+'<br/>');
				msg += ('<b>Registration date :</b> '+result['date']+'<br/>');
db4f24d1   Elena.Budnik   redmine #5385, #4...
605
				msg += ('<b>Disk space total / used / available :</b> '+result['total']+' / '+result['used']+' / '+result['available']+' MB<br/>');
16035364   Benjamin Renard   First commit
606
607
608
609
610
611
612
613
614
615
616
617
				this.infoMsg(msg);
			}
			else
			{
				//ERROR
				this.errorMsg('Cannot get user info');
			}
		}
		else
		{
			// FAILURE
			this.errorMsg('Cannot get user info : '+e.message);
10200969   Roipoussiere   Remove whitespace...
618
		}
16035364   Benjamin Renard   First commit
619
	},
10200969   Roipoussiere   Remove whitespace...
620

7baca0ef   Elena.Budnik   user special sett...
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
	guestLogout: function() {
		Ext.Msg.show({
			title : 'Logout',
			msg   :'Your guest workspace is to be deleted. Continue logout ?',
			buttons : Ext.Msg.YESNO,
			iconCls : 'logout',
			fn : function(btn) {
				if (btn == 'yes'){
					AmdaAction.logout(true, function(){
						sessionID = '';
						window.location.href ='index.html';
					});
				}
			}
		});
	},
10200969   Roipoussiere   Remove whitespace...
637

7baca0ef   Elena.Budnik   user special sett...
638
639
640
641
642
	forceLogout: function(){
		//  myDesktopApp.warningMsg('Your guest session is finished');
		AmdaAction.logout(true, function(){
			sessionID = '';
			window.location.href ='index.html';
aa94fd24   elena   Merge with last svn
643
		});
7baca0ef   Elena.Budnik   user special sett...
644
	},
10200969   Roipoussiere   Remove whitespace...
645

7baca0ef   Elena.Budnik   user special sett...
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
	saveSessionState : function()
	{
		var me = this;
		Ext.Msg.show({
			title : 'Logout',
			msg   :'Do you want to keep current windows sizes and locations<br/> for the next sessions?',
			buttons : Ext.Msg.YESNOCANCEL,
			iconCls : 'logout',
			fn : function(btn) {
				if (btn == 'yes'){
					//set wallpaper
					Ext.state.Manager.getProvider().set(me.desktop.id+'_wallpaper',me.desktop.getWallpaper());
					Ext.state.Manager.getProvider().on({
						scope : this,
						aftersave : function(provider) {
							sessionID = '';
							window.location.href ='index.html';
						}
					});
					Ext.state.Manager.getProvider().saveState();
3bedf627   Elena.Budnik   correct logout() ...
666
					AmdaAction.logout(false);
7baca0ef   Elena.Budnik   user special sett...
667
668
669
670
671
672
673
674
675
676
677
678
				}
				else if (btn == 'no')
				{
					Ext.state.Manager.getProvider().on({
						scope : this,
						aftersave : function(provider) {
							sessionID = '';
							window.location.href ='index.html';
						}
					});
					Ext.state.Manager.getProvider().set(me.desktop.id+'_wallpaper',me.desktop.getWallpaper());
					Ext.state.Manager.getProvider().saveLastTime();
3bedf627   Elena.Budnik   correct logout() ...
679
					AmdaAction.logout(false);
7baca0ef   Elena.Budnik   user special sett...
680
681
				}
			}
aa94fd24   elena   Merge with last svn
682
		});
7baca0ef   Elena.Budnik   user special sett...
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
	},

	onSettings: function () {
		var dlg = new MyDesktop.Settings({
			desktop: this.desktop
		});
		dlg.show();
	},

	/**
	* initialization at the start of AMDA-NG webApplication
	*/
	initProject : function() 
	{
		moduleIds = new Ext.util.MixedCollection();
		// Adding Workspace Explorer Id
		moduleIds.add(this.dynamicModules.explorer.id);

		moduleIds.each(function(item) {
			this.getLoadedModule(item, true, function (module) {
				module.createWindow();
			});
		}, this);

		if (freeSpace < diskQuota / 20) {
			myDesktopApp.warningMsg('Think of cleaning up your work space.<br/>Only ' +
0c8a88ea   Erdogan Furkan   #11346 - Done
709
710
			Math.round(freeSpace/1024/1024)+ 'MB out of '+Math.round(diskQuota/1024/1024) +
			'MB remain');
7baca0ef   Elena.Budnik   user special sett...
711
712
		}

c3976709   Elena.Budnik   rm 7589 + clean u...
713
714
715
716
		if (isFirstVisit && !isGuest) {
            myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.help.id, true, function(module) {
                module.createWindow();
            });
7baca0ef   Elena.Budnik   user special sett...
717
718
719
720
		}
		else {
			if (isSpecialInfo && !isNewInfo) {
				myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
d95e8421   Elena.Budnik   ws transfer : ini...
721
					module.createWindow(isSpecialInfo, 'Welcome on AMDA', true);
7baca0ef   Elena.Budnik   user special sett...
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
				});
			}
		}

		if (isNewInfo) {
			myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
				//  module.createWindow('releaseNotes.' + AMDAVERSION, 'New Release V'+ AMDAVERSION);
				module.createWindow(news, 'Amda Latest News');
			});
		}

		if (isGuest) {
			myDesktopApp.warningMsg("Welcome to Guest Session<br/>Guest session lasts for "+
				guestSessionDuration/3600+" h maximum<br/>"+
				"For extended use time and functionalities (saved sessions)<br/> please register at amda@irap.omp.eu");
			Ext.Function.defer(myDesktopApp.warningMsg,(guestSessionDuration-300)*1000, this, ["Your session will be closed in 5 min!"]);
			Ext.Function.defer(myDesktopApp.forceLogout, guestSessionDuration*1000);
		}

		this.desktop.taskbar.tray.width = 130;
		this.desktop.taskbar.insert(4,new amdaUI.SampToolBarUI({id : 'samptb', onSwitchConnect : function () {
			myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function(module) {
				module.switchSampConnect();
			});
		}}));
	}
16035364   Benjamin Renard   First commit
748
});