Blame view

js/app/models/TimeTableNode.js 4.53 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
/** 
 * Project  : AMDA-NG4
 * Name     : TimeTableNode.js
 * @class   amdaModel.TimeTableNode
 * @extends amdaModel.InteractiveNode
 * @brief   Basic Model of Node corresponding to a amda Time Table
 * @author  
 * @version $Id: TimeTableNode.js 1904 2013-11-25 12:42:02Z elena $
16035364   Benjamin Renard   First commit
9
10
11
12
13
14
15
16
 */

Ext.define('amdaModel.TimeTableNode', {

    extend: 'amdaModel.InteractiveNode',
    
    statics: {
        nodeType: 'timeTable',
eec153c1   Elena.Budnik   formattage, netto...
17
        objectName: 'TimeTable'
16035364   Benjamin Renard   First commit
18
19
    },

3a5f60a1   elena   proper use os sta...
20
21
    constructor : function(config)
    {	
16035364   Benjamin Renard   First commit
22
        this.callParent(arguments);
3a5f60a1   elena   proper use os sta...
23
24
        this.set('moduleId',myDesktopApp.dynamicModules.tt.id);
        this.set('objectDataModel','amdaModel.TimeTable');       
16035364   Benjamin Renard   First commit
25
26
27
        if (this.get('leaf')) this.set('iconCls', 'icon-timetable');
    },
  
3a5f60a1   elena   proper use os sta...
28
29
    localMenuItems : function() 
    {
16035364   Benjamin Renard   First commit
30
        var menuItems =
169f14d2   Benjamin Renard   Add shared object...
31
32
         [
        {
16035364   Benjamin Renard   First commit
33
34
35
            fnId : 'leaf-shareLeaf',
            text : 'Share Time Table',
            hidden : true
169f14d2   Benjamin Renard   Add shared object...
36
        },{
16035364   Benjamin Renard   First commit
37
38
39
40
            fnId : 'leaf-download',
            text : 'Download Time Table',
            hidden : true
        },{
1b2281a1   Hacene SI HADJ MOHAND   ok for tt
41
42
43
44
            fnId : 'leaf-plot',
            text : 'Plot Time Table',
            hidden : true
        },{
16035364   Benjamin Renard   First commit
45
46
47
            fnId : 'leaf-operations',
            text : 'Operations',
            hidden : true
1913b8cc   Hacene SI HADJ MOHAND   ok for tt
48
49
50
51
        },{
            fnId : 'leaf-generateCatalog',
            text : 'Generate Catalog',
            hidden : true
16035364   Benjamin Renard   First commit
52
53
54
55
56
57
58
        }];
     
        return menuItems;
    },

    localMultiMenuItems : function() {
        var menuItems =
169f14d2   Benjamin Renard   Add shared object...
59
60
         [
        {
16035364   Benjamin Renard   First commit
61
            fnId : 'mult-downloadMulti',
eec153c1   Elena.Budnik   formattage, netto...
62
            text : 'Download selected '+ this.self.objectName + 's'
1b2281a1   Hacene SI HADJ MOHAND   ok for tt
63
64
65
66
        }, {
            fnId : 'mult-plotMulti',
            text : 'Plot selected '+ this.self.objectName + 's'
        }, {
16035364   Benjamin Renard   First commit
67
68
69
70
71
72
73
74
            fnId : 'mult-operationsMulti',
            text : 'Operations'
        }];
     
        return menuItems;
    },
    
    getAllContextMenuItems: function(){
d18b535d   elena   catalog draft + c...
75
76
        
        var menuItems = this.allMenuItems();
16035364   Benjamin Renard   First commit
77
        var locMenuItems = this.localMenuItems();
d18b535d   elena   catalog draft + c...
78
79
        
        return  Ext.Array.merge(menuItems,locMenuItems);       
16035364   Benjamin Renard   First commit
80
81
    },
    
d18b535d   elena   catalog draft + c...
82
83
84
85
86
87
     getMultiContextMenuItems: function(){
        
        var menuItems = this.allMenuMultiItems();
        var locMenuItems = this.localMultiMenuItems();
        
        return  Ext.Array.merge(menuItems,locMenuItems);       
16035364   Benjamin Renard   First commit
88
    },
d18b535d   elena   catalog draft + c...
89
    
16035364   Benjamin Renard   First commit
90
91
92
93
94
    onMenuItemClick : function(menu,item,event) {
 
        this.callParent(arguments);
        
	    var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
eec153c1   Elena.Budnik   formattage, netto...
95
 
16035364   Benjamin Renard   First commit
96
97
	    switch (fnId) {
	    
16035364   Benjamin Renard   First commit
98
99
100
101
102
103
104
 	    case 'shareLeaf':   
 	        this.shareNode(this); 
 	        break;

	    case 'download':
	    	this.ttDownload();
	    	break;
86c573e5   Hacene SI HADJ MOHAND   correction du tic...
105
                
1b2281a1   Hacene SI HADJ MOHAND   ok for tt
106
	    case 'plot':
86c573e5   Hacene SI HADJ MOHAND   correction du tic...
107
	    	this.createPlot(this);
1b2281a1   Hacene SI HADJ MOHAND   ok for tt
108
	    	break;	
16035364   Benjamin Renard   First commit
109
110
111
112
	    case 'operations':
	        this.ttOperations();
	        break;

1913b8cc   Hacene SI HADJ MOHAND   ok for tt
113
114
115
116
	    case 'generateCatalog':
	        this.generateCatalog(this);
	        break;

16035364   Benjamin Renard   First commit
117
118
119
120
//	    case 'deleteMulti':
//	        this.deleteMulti();
//	        break;

16035364   Benjamin Renard   First commit
121
122
123
	    case 'downloadMulti':
	        this.downloadMulti();
	        break;
1b2281a1   Hacene SI HADJ MOHAND   ok for tt
124
125
126
127
                
                      case 'plotMulti':
	        this.plotMulti();
	        break;
16035364   Benjamin Renard   First commit
128
129
130
131

	    case 'operationsMulti':
	        this.operationsMulti();
	        break;
5cfea1f2   elena   vizu draft
132
133
134
135
	   
	    case 'visu':
	        this.visu();
	        break;
16035364   Benjamin Renard   First commit
136
137
138

	    default:
	        break;
eec153c1   Elena.Budnik   formattage, netto...
139
	    } // switch end 	 
16035364   Benjamin Renard   First commit
140
141
     },
 
eec153c1   Elena.Budnik   formattage, netto...
142
143
144
145
146
147
148
149
	ttDownload : function() {
		// download Module	 
		var me = this;
		myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id, true, function (module) {
			module.createWindow();
			var uidownload = module.getUiContent();
			uidownload.addTTdownload(me.get('text'), me.get('id'));
		});
86c573e5   Hacene SI HADJ MOHAND   correction du tic...
150
	},     
eec153c1   Elena.Budnik   formattage, netto...
151
152
153
154
	ttOperations : function() {	 
		var me = this;   
		myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt_op.id, true, function (module) {
			module.createWindow();
aa23703f   Benjamin Renard   Fix TT operation ...
155
			module.getUiContent().addTT(me.get('text'), me.get('id'), me.get('nodeType'));
eec153c1   Elena.Budnik   formattage, netto...
156
157
		});
	},
16035364   Benjamin Renard   First commit
158
 
eec153c1   Elena.Budnik   formattage, netto...
159
160
161
162
163
	shareNode: function(node) {  
		myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt.id, true, function (module) {
			module.shareTT({'name' : node.get('text'), 'id' : node.get('id')});
		});
	},
16035364   Benjamin Renard   First commit
164
     
eec153c1   Elena.Budnik   formattage, netto...
165
166
167
168
169
170
	downloadMulti: function(){
		var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
		Ext.Array.each(selection,function(item,index,allItems){
			item.ttDownload();
		})
	},
16035364   Benjamin Renard   First commit
171
     
eec153c1   Elena.Budnik   formattage, netto...
172
173
174
175
176
177
	operationsMulti: function(){
		var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
		alert(selection.length+' time tables to send into operationsTT module!');
		Ext.Array.each(selection,function(item,index,allItems){
			item.ttOperations();
		})
3b63d483   Hacene SI HADJ MOHAND   shared in progress
178
	} 
16035364   Benjamin Renard   First commit
179
});