Blame view

js/app/controllers/TimeTableModule.js 3.57 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * Project   : AMDA-NG
 * Name      : TimeTableModule.js
 * @class    amdaDesktop.TimeTableModule
 * @extends  amdaDesktop.InteractiveModule
 * @brief  	 Time Table Module controller definition 
 * @author   Myriam
 * @version $Id: TimeTableModule.js 1605 2013-06-11 13:38:47Z myriam $ 
 ******************************************************************************
 *    FT Id     :   Date   : Name - Description
 ******************************************************************************
 *	           08/06/2011: Myriam - Migration extjs4
 */

Ext.define('amdaDesktop.TimeTableModule', {
	extend: 'amdaDesktop.InteractiveModule',
	
	requires: [
169f14d2   Benjamin Renard   Add shared object...
19
20
         'amdaUI.TimeTableUI',
         'amdaUI.ShareObjectUI'
16035364   Benjamin Renard   First commit
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
    ],
    
	contentId : 'timeTableUi',
	
    /**
     * @cfg {String} data models
     * @required
     */
	nodeDataModel : 'amdaModel.TimeTableNode',
	
    /**
     * @cfg {String} window definitions
     * @required
     */
	width : 850,
	height: 650,
	uiType : 'panelTimeTable',
	helpTitle : 'Help on Time Table Module',
	helpFile : 'timetableHelp',
	
	/**
	 * @override
	 */
a73f0195   Benjamin Renard   Insert interval i...
44
	createWindow : function(onshowfn) {
16035364   Benjamin Renard   First commit
45
46
47
48
49
50
51
52

	    this.callParent(arguments);
	    var win = this.app.getDesktop().getWindow(this.id);	

		if (win) {
			/* Reset if form in form ( OperationsTT in TimeTable ) */
			this.getUiContent().down('form').getForm().reset();
		}
169f14d2   Benjamin Renard   Add shared object...
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
	},
	
	shareTT : function(ttObj) {
		var win = myDesktopApp.desktop.getWindow('sharett-win');     
        if(!win)
        {
        	var me = this;
        	var win = myDesktopApp.desktop.createWindow(
            {
            	border: false,
                id : 'sharett-win',
                title : 'Share TimeTable',
                width : 400,
                height : 300,
                layout : 'fit',
                maximizable : false,
                items : [
                         {
                        	 xtype : 'shareobject',
                        	 id : 'shareTTUI',
                        	 onAfterShareObject : function(folder_id, object_id) {
                        		 win.close();
                        		 var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);	
                        		 var sharedTTRootNode = explorerTree.getRootNode().findChild('id','sharedtimeTable-treeRootNode',true);
                        		 amdaModel.InteractiveNode.preloadNodes(sharedTTRootNode, function() {
                        			 sharedTTRootNode.expand();
                        			 var folderNode = explorerTree.getRootNode().findChild('id', folder_id, true);
                        			 folderNode.removeAll();
                        			 folderNode.set('loaded',false);
                        			 amdaModel.InteractiveNode.preloadNodes(folderNode, function() {
                        				 folderNode.expand();
                        				 var objectNode = explorerTree.getRootNode().findChild('id',object_id,true);
                            			 sharedTTRootNode.myGetOwnerTree().getSelectionModel().select(objectNode);
                            		 });
                        		 });
                        	 }
                         }
                ]
            });	
        }
        
        var sharePanel = win.down('#shareTTUI');
        if (sharePanel)
        	sharePanel.setProperties('timeTable', ttObj);
        
09eefb2d   Benjamin Renard   Shared TT and Cat...
98
99
100
101
102
103
104
        AmdaAction.getObject(ttObj.id, 'timeTable', function(result,remoteEvent) {
            	if (result) {
            		if (result.description)
            			sharePanel.setDescription(result.description);
            	} 
        	}, this.getObjectCallback, this);
        
169f14d2   Benjamin Renard   Add shared object...
105
106
        win.show();
	}
16035364   Benjamin Renard   First commit
107
108
 
});