Blame view

js/app/models/InteractiveNode.js 26.5 KB
42e2e019   Benjamin Renard   Next step for cac...
1
/**
16035364   Benjamin Renard   First commit
2
3
4
5
6
7
8
9
10
11
 * Project  : AMDA-NG4
 * Name     : InteractiveNode.js
 * @class   amdaModel.InteractiveNode
 * @extends amdaModel.AmdaNode
 * @brief   Generic Model of Interactive Node
 * @author  CDA
 * @version $Id: InteractiveNode.js 2683 2014-12-02 10:58:53Z elena $
 */

Ext.define('amdaModel.InteractiveNode', {
eec153c1   Elena.Budnik   formattage, netto...
12
	extend: 'amdaModel.AmdaNode',
16035364   Benjamin Renard   First commit
13

42e2e019   Benjamin Renard   Next step for cac...
14
	fields: [
eec153c1   Elena.Budnik   formattage, netto...
15
		{name: 'contextNode', type: 'amdaModel.AmdaNode', persist: false},
42e2e019   Benjamin Renard   Next step for cac...
16
		{name: 'objectDataModel', type: 'string', persist: false},
eec153c1   Elena.Budnik   formattage, netto...
17
18
19
		{name: 'object', type: 'object', persist: false},
		{name: 'moduleId', type: 'string', persist: false},
		{name: 'filtered', type: 'boolean', defaultValue: false, persist: false},
f29c5e66   Elena.Budnik   plot only option
20
		{name: 'needsArgs', type:'boolean', defaultValue: false},
2fa56f95   Benjamin Renard   Predefined templa...
21
		{name: 'predefinedArgs', type:'boolean', defaultValue: false},
eec153c1   Elena.Budnik   formattage, netto...
22
23
		{name: 'disable', type: 'boolean', defaultValue: false, persist: false}
	],
16035364   Benjamin Renard   First commit
24

eec153c1   Elena.Budnik   formattage, netto...
25
26
27
	statics: {
		preloadNodes : function(node,onready)
		{
42e2e019   Benjamin Renard   Next step for cac...
28
			var me = this;
eec153c1   Elena.Budnik   formattage, netto...
29
30
31
32
33
34
35
36
37
			var nodesToLoad = new Array();
			nodesToLoad.push(node);
			this.preloadTreeNode(node, nodesToLoad, function (node)
				{
					var isFinish = true;
					nodesToLoad.forEach(function (element, index, array)
					{
							if (!element.isLoaded())
								isFinish = false;
42e2e019   Benjamin Renard   Next step for cac...
38
					});
eec153c1   Elena.Budnik   formattage, netto...
39
40
41
42
					if (isFinish && onready)
						onready.call();
				});
		},
16035364   Benjamin Renard   First commit
43

eec153c1   Elena.Budnik   formattage, netto...
44
45
46
		preloadTreeNode : function(node, nodesToLoad, onloaded)
		{
			var me = this;
42e2e019   Benjamin Renard   Next step for cac...
47

eec153c1   Elena.Budnik   formattage, netto...
48
49
50
			if (node.isLoaded())
			{
				node.eachChild(function(n)
42e2e019   Benjamin Renard   Next step for cac...
51
					{
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
52
						if (!n.isLoaded() && !n.isLeaf())
eec153c1   Elena.Budnik   formattage, netto...
53
54
55
56
57
						{
							nodesToLoad.push(n);
							me.preloadTreeNode(n,nodesToLoad,onloaded);
						}
					});
42e2e019   Benjamin Renard   Next step for cac...
58

eec153c1   Elena.Budnik   formattage, netto...
59
60
61
					if (onloaded)
						onloaded.call(me,node);
					return;
42e2e019   Benjamin Renard   Next step for cac...
62
63
			}

eec153c1   Elena.Budnik   formattage, netto...
64
			node.store.load({
42e2e019   Benjamin Renard   Next step for cac...
65
				node : node,
eec153c1   Elena.Budnik   formattage, netto...
66
67
68
				callback : function(records, operation, successful)
					{
						records.forEach(function (record)
42e2e019   Benjamin Renard   Next step for cac...
69
							{
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
70
								if (!record.isLoaded() && !record.isLeaf())
eec153c1   Elena.Budnik   formattage, netto...
71
72
73
74
75
76
77
78
79
80
81
									{
										nodesToLoad.push(record);
										me.preloadTreeNode(record,nodesToLoad,onloaded);
									}
							});
						if (onloaded)
							onloaded.call(me,node);
					}
			});
		}
	},
42e2e019   Benjamin Renard   Next step for cac...
82

0c154100   Elena.Budnik   redmine #5141 part.2
83
	onReady : null,
42e2e019   Benjamin Renard   Next step for cac...
84

eec153c1   Elena.Budnik   formattage, netto...
85
86
	constructor : function(config)
	{
42e2e019   Benjamin Renard   Next step for cac...
87
88
		this.callParent(arguments);
		this.set('nodeType',this.self.nodeType);
74b77f58   Elena.Budnik   init remote branch
89
90
		this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
		if (this.get('id')) { // TODO why sometimes (delete in remote interoper tree) this.get('id') = undefined ?
42e2e019   Benjamin Renard   Next step for cac...
91
			// if id of this node have root category suffix
74b77f58   Elena.Budnik   init remote branch
92
93
94
95
			if (Ext.util.Format.substr(this.get('id'), -(amdaUI.ExplorerUI.CAT_SUFFIX.length), this.get('id').length) === amdaUI.ExplorerUI.CAT_SUFFIX)
			{
			// set the expanded property to true
				this.set('expanded',true);
42e2e019   Benjamin Renard   Next step for cac...
96
			}
74b77f58   Elena.Budnik   init remote branch
97
		}
eec153c1   Elena.Budnik   formattage, netto...
98
	},
429f876c   Benjamin Renard   Fix plot request ...
99

eec153c1   Elena.Budnik   formattage, netto...
100
101
102
103
104
105
106
/**
* this method is overriden into ExecutableNode to return true
*/
	isExecutable: function()
	{
		return false;
	},
16035364   Benjamin Renard   First commit
107

eec153c1   Elena.Budnik   formattage, netto...
108
109
110
/**
* open Module with THIS NODE
*/
42e2e019   Benjamin Renard   Next step for cac...
111
	editInModule : function (contextNode, onReady)
eec153c1   Elena.Budnik   formattage, netto...
112
113
114
115
116
117
118
	{
		// set the contextNode of this node
		this.set('contextNode',contextNode);
		// parameter module
		var me = this;
		myDesktopApp.getLoadedModule(this.get('moduleId'),true, function (module) {
		// If the node to edit is not already linked to this module
42e2e019   Benjamin Renard   Next step for cac...
119
			if (module.getLinkedNode() != me)
eec153c1   Elena.Budnik   formattage, netto...
120
121
			{
				// set relative node into parameter Module
42e2e019   Benjamin Renard   Next step for cac...
122
123
				module.setLinkedNode(me);
				if (contextNode==null)
eec153c1   Elena.Budnik   formattage, netto...
124
125
126
				{
					// set the root node as contextNode
					contextNode = me.getRootNode();
42e2e019   Benjamin Renard   Next step for cac...
127
128
129
				}
				module.setContextNode(contextNode);

f6206fd6   Elena.Budnik   rm 6522 First Der...
130
			} else if (module.getLinkedNode() != null){
eec153c1   Elena.Budnik   formattage, netto...
131
132
133
134
135
			//TODO the node to edit is already edited
				// myDesktopApp.warningMsg('This object is  being edited');
				//Sol1: msg alert: "warning this node is already edited! If you want to get the original, please press the 'reset' button"->'OK'
				//Sol2: msg with user choice: "warning this node is already edited! Would you confirm this action and lost your modification?"->'Confirm','Cancel'
			}
42e2e019   Benjamin Renard   Next step for cac...
136
137
138
			// Opening parameter window
			module.createWindow(onReady);
		});
eec153c1   Elena.Budnik   formattage, netto...
139
	},
16035364   Benjamin Renard   First commit
140

eec153c1   Elena.Budnik   formattage, netto...
141
142
143
/**
* Method to rename the workspace node
*/
42e2e019   Benjamin Renard   Next step for cac...
144
145
	rename: function(value,callBackFn)
	{
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
146
		var dataToSend = {id : this.get('id'), old_name: this.modified.text, name: value,  parent : this.data.parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')};
42e2e019   Benjamin Renard   Next step for cac...
147
		AmdaAction.renameObject(dataToSend, callBackFn);
eec153c1   Elena.Budnik   formattage, netto...
148
	},
42e2e019   Benjamin Renard   Next step for cac...
149

eec153c1   Elena.Budnik   formattage, netto...
150
151
152
/**
* Method to rename the workspace node when D&D
*/
42e2e019   Benjamin Renard   Next step for cac...
153
154
	renameDD: function(parentId, callBackFn)
	{
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
155
		var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')};
eec153c1   Elena.Budnik   formattage, netto...
156
157
		AmdaAction.renameObject(dataToSend, callBackFn);
	},
42e2e019   Benjamin Renard   Next step for cac...
158

eec153c1   Elena.Budnik   formattage, netto...
159
160
161
/**
* validation method on name (used in module forms)
* @param name the name to validate
42e2e019   Benjamin Renard   Next step for cac...
162
* @returns
eec153c1   Elena.Budnik   formattage, netto...
163
164
165
*/
	isValidName : function(name, callBackFn)
	{
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
166
		var dataToSend = {name: name, nodeType: this.get('nodeType'), leaf: this.isLeaf()};
65ac4a9d   Nathanaël Jourdane   Fix folders debug...
167
		AmdaAction.validNameObject(dataToSend, callBackFn);
eec153c1   Elena.Budnik   formattage, netto...
168
	},
16035364   Benjamin Renard   First commit
169

eec153c1   Elena.Budnik   formattage, netto...
170
171
172
173
174
/**
* Method to persist modifications of an AmdaObject by Server side and update the workspace
* node linked to a Module
*/
	update : function(opt)
42e2e019   Benjamin Renard   Next step for cac...
175
	{
eec153c1   Elena.Budnik   formattage, netto...
176
		AmdaAction.modifyObject(this.get('object').getJsonValues(true), function(res,e){
42e2e019   Benjamin Renard   Next step for cac...
177

eec153c1   Elena.Budnik   formattage, netto...
178
			if(e.status) {
42e2e019   Benjamin Renard   Next step for cac...
179
				if (res.id) {
eec153c1   Elena.Budnik   formattage, netto...
180
181
182
183
184
185
					if (!this.get('contextNode')) {
						// set the root node of 'Derived Parameters' tree as contextNode
						this.set('contextNode',this.getRootNode());
					}
					this.get('contextNode').expand(false,false);
					this.myGetOwnerTree().getSelectionModel().select(this);
42e2e019   Benjamin Renard   Next step for cac...
186

eec153c1   Elena.Budnik   formattage, netto...
187
188
					if (opt)
					{
5b64c444   Hacene SI HADJ MOHAND   rm-6903 corrected
189

eec153c1   Elena.Budnik   formattage, netto...
190
191
192
						var scope = opt.scope ? opt.scope : this;
						if (opt.callback)
							opt.callback.call(scope,'update');
833e6c62   Hacene SI HADJ MOHAND   corrections to ca...
193
              if(opt.notDisplayMsg || opt.callback ){
42e2e019   Benjamin Renard   Next step for cac...
194
195
196
197
198
199
                   //do nothing
              }else{
                  Ext.Msg.alert('Complete', 'Object '+this.get('object').get('name')+' has been modified');
              }

					 }
5b64c444   Hacene SI HADJ MOHAND   rm-6903 corrected
200

eec153c1   Elena.Budnik   formattage, netto...
201
202
					// fix the modifications for object
					this.get('object').commit();
42e2e019   Benjamin Renard   Next step for cac...
203

eec153c1   Elena.Budnik   formattage, netto...
204
205
					if (res.info) {
						this.set('info',res.info);
eec153c1   Elena.Budnik   formattage, netto...
206
					}
42e2e019   Benjamin Renard   Next step for cac...
207

7cab5983   Benjamin Renard   Add modif. time f...
208
209
210
211
					if (res.last_update) {
						this.get('object').set('last_update', res.last_update);
					}

8ba47f72   Benjamin Renard   rest actualisatio...
212
					// myDataParam  and Parameter special update
75a3182b   Elena.Budnik   special MyDataPar...
213
					this.specialUpdate(res, false);
42e2e019   Benjamin Renard   Next step for cac...
214

eec153c1   Elena.Budnik   formattage, netto...
215
216
217
					// reload object into the view of corresponding Module
					var me = this;
					myDesktopApp.getLoadedModule(this.get('moduleId'), true, function (module) {
8dddc557   Benjamin Renard   Fix plot reload
218
219
220
221
222
223
						if (!opt || !opt.plot) {
							module.getUiContent().setObject(me.get('object'));
						}
						else {
							module.getUiContent().reloadPlot(me);
						}
eec153c1   Elena.Budnik   formattage, netto...
224
225
226
227
					});
				}
				else {
					//TODO proper error message handling
42e2e019   Benjamin Renard   Next step for cac...
228
					// error code from server; but e.status==true
eec153c1   Elena.Budnik   formattage, netto...
229
230
231
232
233
234
235
236
					// revert all modifications since last load or commit
					this.get('object').reject();
					myDesktopApp.errorMsg(res.error);
				}
			}
			else {
				// revert all modifications since last load or commit
				this.get('object').reject();
42e2e019   Benjamin Renard   Next step for cac...
237
				myDesktopApp.errorMsg(e.message);
eec153c1   Elena.Budnik   formattage, netto...
238
239
240
			}
		},this);
	},
16035364   Benjamin Renard   First commit
241

eec153c1   Elena.Budnik   formattage, netto...
242
243
244
245
/**
* Method to create a new AmdaObject by server side and create the workspace node linked to a Module
* under its contextNode or the root node corresponding to this nodeType category
*/
42e2e019   Benjamin Renard   Next step for cac...
246
	create : function(opt)
eec153c1   Elena.Budnik   formattage, netto...
247
248
249
250
	{
		if (!this.get('contextNode') || (this.get('contextNode').data.id == 'sharedtimeTable-treeRootNode') || (this.get('contextNode').data.id == 'sharedcatalog-treeRootNode')) {
			// set the root node of 'Derived Parameters' tree as contextNode
			this.set('contextNode',this.getRootNode());
42e2e019   Benjamin Renard   Next step for cac...
251
252
253
		}
		// call the Ext.Direct method to create parameter
		AmdaAction.createObject(this.get('object').getJsonValues(false), this.get('contextNode').get('id'), function(res,e){
eec153c1   Elena.Budnik   formattage, netto...
254
			//success
42e2e019   Benjamin Renard   Next step for cac...
255
256
			if(e.status)
			{
eec153c1   Elena.Budnik   formattage, netto...
257
258
259
				// if correct response received
				if (res.id) {   //if (res.id || res.error == 'NAME_EXISTS') {
					// 'save as' case ; delete old node if it exists
42e2e019   Benjamin Renard   Next step for cac...
260
					if (this.toRename)
eec153c1   Elena.Budnik   formattage, netto...
261
					{
42e2e019   Benjamin Renard   Next step for cac...
262
						this.toRename	= false;
eec153c1   Elena.Budnik   formattage, netto...
263
264
265
266
267
						var myRoot = this.getRootNode();
						// search the same named node to override
						var updateNode = myRoot.findChild('text',this.get('object').get('name'),true);
						// destroy the overrided node
						updateNode.parentNode.removeChild(updateNode);//TODO ??if destroy==true => too many recursions....
42e2e019   Benjamin Renard   Next step for cac...
268
269
						updateNode.destroy();
					}
eec153c1   Elena.Budnik   formattage, netto...
270
271
					// set text of this node
					this.set('text',this.get('object').get('name'));
f6206fd6   Elena.Budnik   rm 6522 First Der...
272

eec153c1   Elena.Budnik   formattage, netto...
273
274
275
					//set id of this node
					this.set('id',res.id);
					this.internalId = res.id;
f6206fd6   Elena.Budnik   rm 6522 First Der...
276

eec153c1   Elena.Budnik   formattage, netto...
277
					// set id of node's object
42e2e019   Benjamin Renard   Next step for cac...
278
					this.get('object').set('id',res.id);
eec153c1   Elena.Budnik   formattage, netto...
279
280
281
282
					if (res.created){
						// set the created date
						this.get('object').set('created',res.created);
					}
42e2e019   Benjamin Renard   Next step for cac...
283

eec153c1   Elena.Budnik   formattage, netto...
284
285
286
					if (res.info){
						// set the tooltip
						this.set('info',res.info);
75a3182b   Elena.Budnik   special MyDataPar...
287
					}
7cab5983   Benjamin Renard   Add modif. time f...
288
289
290
291
292
293
294

					var reloadObject = false;
					if (res.last_update) {
						this.get('object').set('last_update', res.last_update);
						reloadObject = true;
					}

75a3182b   Elena.Budnik   special MyDataPar...
295
296
					//set globalStart & global Stop to be used for time selection
					this.specialUpdate(res, true);
42e2e019   Benjamin Renard   Next step for cac...
297

7cab5983   Benjamin Renard   Add modif. time f...
298
299
300
301
302
303
304
305
306
307
308
309
310
					// reload object into the view of corresponding Module
					var me = this;
					if (reloadObject) {
						myDesktopApp.getLoadedModule(this.get('moduleId'), true, function (module) {
							if (!opt || !opt.plot) {
								module.getUiContent().setObject(me.get('object'));
							}
							else {
								module.getUiContent().reloadPlot(me);
							}
 						});
					}

eec153c1   Elena.Budnik   formattage, netto...
311
312
					//TODO do we need this commission ???
					// fix the modifications for object
42e2e019   Benjamin Renard   Next step for cac...
313
					this.get('object').commit();
663f6395   Elena.Budnik   nettoyage
314

eec153c1   Elena.Budnik   formattage, netto...
315
					// if ownerTree panel is not active
663f6395   Elena.Budnik   nettoyage
316
					if (this.myGetOwnerTree().ownerCt.getActiveTab()!==this.myGetOwnerTree()) {
eec153c1   Elena.Budnik   formattage, netto...
317
						// set ownerTree panel as the active tab - to enable selection of this node his ownerTree must have a view
42e2e019   Benjamin Renard   Next step for cac...
318
						this.myGetOwnerTree().ownerCt.setActiveTab(this.myGetOwnerTree());
eec153c1   Elena.Budnik   formattage, netto...
319
					}
134b0d67   Benjamin Renard   Fix typo (#7238)
320
                                                                                                    if(opt && opt.notDisplayMsg){
5b64c444   Hacene SI HADJ MOHAND   rm-6903 corrected
321
                                                                                                        //do nothing
42e2e019   Benjamin Renard   Next step for cac...
322
323
                                                                                                        }else{
                                                                                                                       Ext.Msg.alert('Complete', 'New object '+this.get('object').get('name')+' has been created');
5b64c444   Hacene SI HADJ MOHAND   rm-6903 corrected
324
                                                                                                            }
42e2e019   Benjamin Renard   Next step for cac...
325

eec153c1   Elena.Budnik   formattage, netto...
326
					// expand the contextNode
663f6395   Elena.Budnik   nettoyage
327
					this.get('contextNode').expand(false, function() {
eec153c1   Elena.Budnik   formattage, netto...
328
						if (!this.get('contextNode').findChild('text',this.get('text'))) {
42e2e019   Benjamin Renard   Next step for cac...
329
330
							// create node in tree as child of contextNode
							this.get('contextNode').appendChild(this);
eec153c1   Elena.Budnik   formattage, netto...
331
						}
42e2e019   Benjamin Renard   Next step for cac...
332
						// select the new node
eec153c1   Elena.Budnik   formattage, netto...
333
						this.myGetOwnerTree().getSelectionModel().select(this);
663f6395   Elena.Budnik   nettoyage
334
						if (opt) {
eec153c1   Elena.Budnik   formattage, netto...
335
336
337
							var scope = opt.scope ? opt.scope : this;
							if (opt.callback)
									opt.callback.call(scope,'create');
42e2e019   Benjamin Renard   Next step for cac...
338
						}
eec153c1   Elena.Budnik   formattage, netto...
339
					}, this);
42e2e019   Benjamin Renard   Next step for cac...
340
				}
eec153c1   Elena.Budnik   formattage, netto...
341
342
				// error code from server; but e.status==true
				else {
42e2e019   Benjamin Renard   Next step for cac...
343
					myDesktopApp.errorMsg(res.error);
eec153c1   Elena.Budnik   formattage, netto...
344
345
346
347
348
349
350
351
352
353
354
					// revert all modifications since last load or commit
					this.get('object').reject();
				}
			}
			// failure: e.status == false
			else {
				// revert all modifications since last load or commit
				this.get('object').reject();
				//TODO: this.destroy();
				myDesktopApp.errorMsg(e.message);
			}
42e2e019   Benjamin Renard   Next step for cac...
355
		},this);
eec153c1   Elena.Budnik   formattage, netto...
356
	},
16035364   Benjamin Renard   First commit
357

75a3182b   Elena.Budnik   special MyDataPar...
358
	specialUpdate : function() {},
eec153c1   Elena.Budnik   formattage, netto...
359
360
/**
* Generic part of Context Menu
42e2e019   Benjamin Renard   Next step for cac...
361
362
*
*/
eec153c1   Elena.Budnik   formattage, netto...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
	allMenuItems : function() {
		var src = this.self.objectName;
		var menuItems =
		[ {
			fnId : 'root-createLeaf',
			text : 'Create '+ src
		}, {
			fnId : 'root-createDir',
			text : 'Create Folder'
		}, {
			fnId : 'dire-createLeaf',
			text : 'Create ' + src
		}, {
			fnId : 'dire-createDir',
			text : 'Create Folder'
		}, {
			fnId : 'dire-renameNode',
			text : 'Rename Folder'
		}, {
			fnId : 'dire-deleteNode',
			text : 'Delete Folder'
		}, {
			fnId : 'leaf-editLeaf',
			text : 'Edit ' + src
		}, {
			fnId : 'leaf-renameNode',
			text : 'Rename ' + src
		}, {
			fnId : 'leaf-deleteNode',
			text : 'Delete '+ src
		} ];
		return menuItems;
	},
16035364   Benjamin Renard   First commit
396

eec153c1   Elena.Budnik   formattage, netto...
397
398
399
400
401
402
403
404
405
	allMenuMultiItems : function() {
		var menuMulti = [
		{
			fnId : 'mult-deleteMulti',
			text : 'Delete selected ' + this.self.objectName + 's'
		}
		];
		return menuMulti;
	},
d18b535d   elena   catalog draft + c...
406

42e2e019   Benjamin Renard   Next step for cac...
407
408
	getAllContextMenuItems: function(){
		return  this.allMenuItems();
eec153c1   Elena.Budnik   formattage, netto...
409
410
411
412
413
	},

	getMultiContextMenuItems: function(){
		return this.allMenuMultiItems();
	},
42e2e019   Benjamin Renard   Next step for cac...
414

eec153c1   Elena.Budnik   formattage, netto...
415
416
417
418
419
420
421
/**
* default implementation
* no menu display if there's no override of this function
*/
	getMultiContextMenuItems: function(){
		return null;
	},
42e2e019   Benjamin Renard   Next step for cac...
422

eec153c1   Elena.Budnik   formattage, netto...
423
424
/**
*  Context Menu Actions
42e2e019   Benjamin Renard   Next step for cac...
425
426
*
*/
eec153c1   Elena.Budnik   formattage, netto...
427
428
429
	onMenuItemClick : function(menu,item,event) {
		// fnId parsing :
		var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
16035364   Benjamin Renard   First commit
430

eec153c1   Elena.Budnik   formattage, netto...
431
432
		switch (fnId) {
			case 'deleteNode':
42e2e019   Benjamin Renard   Next step for cac...
433
				this.deleteNode();
eec153c1   Elena.Budnik   formattage, netto...
434
435
				break;
			case 'createDir':
42e2e019   Benjamin Renard   Next step for cac...
436
				this.createDir();
eec153c1   Elena.Budnik   formattage, netto...
437
438
439
				break;
			case 'createLeaf':
				this.createLeaf(this);
42e2e019   Benjamin Renard   Next step for cac...
440
				break;
eec153c1   Elena.Budnik   formattage, netto...
441
			case 'renameNode':
11d21073   Nathanaël Jourdane   Fix bugs when cre...
442
				this.renameNode(false);
eec153c1   Elena.Budnik   formattage, netto...
443
				break;
42e2e019   Benjamin Renard   Next step for cac...
444
445
446
			case 'editLeaf':
				this.editLeaf();
				break;
eec153c1   Elena.Budnik   formattage, netto...
447
448
			case 'deleteMulti':
				this.deleteMulti();
eec153c1   Elena.Budnik   formattage, netto...
449
				break;
42e2e019   Benjamin Renard   Next step for cac...
450
451
452
453
454
455
			case 'plotParam':
				this.createPlot(this);
				break;
			case 'downParam':
				this.createDownload(this);
				break;
eec153c1   Elena.Budnik   formattage, netto...
456
457
458
459
			default:
				break;
		} // switch end
	},
42e2e019   Benjamin Renard   Next step for cac...
460

eec153c1   Elena.Budnik   formattage, netto...
461
	getTimeFromNode: function(node)  {
eec153c1   Elena.Budnik   formattage, netto...
462
463
		var startString = new String(node.get('globalStart'));
		var stopString = new String(node.get('globalStop'));
a0f13ed1   Elena.Budnik   small format + ti...
464

42e2e019   Benjamin Renard   Next step for cac...
465
		var startDate =  new Date(startString.replace(/\-/g,'\/').replace(/[T|Z]/g,' '));
eec153c1   Elena.Budnik   formattage, netto...
466
		var stopDate =  new Date(stopString.replace(/\-/g,'\/').replace(/[T|Z]/g,' '));
a0f13ed1   Elena.Budnik   small format + ti...
467

eec153c1   Elena.Budnik   formattage, netto...
468
		if (stopDate -  startDate  > 86400000 ) {
42e2e019   Benjamin Renard   Next step for cac...
469
			var startTime = Ext.Date.add(stopDate, Ext.Date.DAY, -1);
a0f13ed1   Elena.Budnik   small format + ti...
470
471
			// var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d H:i:s'), stop: Ext.Date.format(stopDate, 'Y/m/d H:i:s')};
			var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d'), stop: Ext.Date.format(stopDate, 'Y/m/d')};
42e2e019   Benjamin Renard   Next step for cac...
472
		}
eec153c1   Elena.Budnik   formattage, netto...
473
474
475
		else {
			var timeObj = {start:  node.get('globalStart'), stop:  node.get('globalStop')};
		}
42e2e019   Benjamin Renard   Next step for cac...
476
		return timeObj;
eec153c1   Elena.Budnik   formattage, netto...
477
	},
16035364   Benjamin Renard   First commit
478

42e2e019   Benjamin Renard   Next step for cac...
479
480
481
	createPlot: function(node)
	{
		if (node.get('disable')) return;
eec153c1   Elena.Budnik   formattage, netto...
482
		myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) {
57e15214   Benjamin Renard   Fix addParameter ...
483
                    module.addParameter(node);
eec153c1   Elena.Budnik   formattage, netto...
484
485
		});
	},
42e2e019   Benjamin Renard   Next step for cac...
486
487
488

	createDownload: function(node)
	{
eec153c1   Elena.Budnik   formattage, netto...
489
		myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id, true, function (module) {
42e2e019   Benjamin Renard   Next step for cac...
490
			if (!myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.download.id)) {
eec153c1   Elena.Budnik   formattage, netto...
491
				var request = Ext.create(amdaModel.Download.$className);
42e2e019   Benjamin Renard   Next step for cac...
492
				amdaModel.DownloadNode.set('object',request);
eec153c1   Elena.Budnik   formattage, netto...
493
494
				// singleton!
				amdaModel.DownloadNode.editInModule();
a0f13ed1   Elena.Budnik   small format + ti...
495
				if ((node.get('globalStart') != null) && (node.get('globalStop') != null) && node.get('globalStart') != 'depending on mission' &&  node.get('isParameter')) {
42e2e019   Benjamin Renard   Next step for cac...
496
					module.getUiContent().setTimeFromData(node.getTimeFromNode(node));
eec153c1   Elena.Budnik   formattage, netto...
497
				}
42e2e019   Benjamin Renard   Next step for cac...
498
499
			}
				var paramName;
eec153c1   Elena.Budnik   formattage, netto...
500
501
				var components = null;
				switch (node.$className) {
42e2e019   Benjamin Renard   Next step for cac...
502
					case 'amdaModel.AliasNode'        :
eec153c1   Elena.Budnik   formattage, netto...
503
504
						paramName = "#"+node.get('text');
						break;
42e2e019   Benjamin Renard   Next step for cac...
505
                                                                                                    case 'amdaModel.DerivedParamComponentNode' :
5f341ae7   Hacene SI HADJ MOHAND   ok pour download
506
                                                                                                                                                            
f85f44e4   Benjamin Renard   us okkkkkkkkkk
507
508
509
510
511
512
                                                                                                    paramId = node.get('text');
                                                                                                    var parentId = paramId.substr(0, paramId.length - 3);
                                                                                                    paramName= "ws_" + parentId;
                                                                                                    var regExp = /\(([\d]+)\)/;
                                                                                                     var component_index = regExp.exec(paramId);
                                                                                                      if (component_index)
5f341ae7   Hacene SI HADJ MOHAND   ok pour download
513
514
515
516
517
518
519
520
521
522
523
524
                                                                                                      {
                                                                                                        components = [];
                                                                                                        components['index1'] = component_index[1];
                                                                                                        }
                                                                                                    break;
                                                                                                    case 'amdaModel.MyDataParamComponentNode' : 
                                                                                                      paramId = node.get('text');
                                                                                                    var parentId = paramId.substr(0, paramId.length - 3);
                                                                                                    paramName= "wsd_" + parentId;
                                                                                                    var regExp = /\(([\d]+)\)/;
                                                                                                     var component_index = regExp.exec(paramId);
                                                                                                      if (component_index)
f85f44e4   Benjamin Renard   us okkkkkkkkkk
525
526
527
528
529
                                                                                                      {
                                                                                                        components = [];
                                                                                                        components['index1'] = component_index[1];
                                                                                                        }
                                                                                                    break;
42e2e019   Benjamin Renard   Next step for cac...
530
					case 'amdaModel.DerivedParamNode' :
eec153c1   Elena.Budnik   formattage, netto...
531
532
533
						paramName = "ws_"+node.get('text');
						break;
					case 'amdaModel.MyDataParamNode' :
42e2e019   Benjamin Renard   Next step for cac...
534
535
536
						paramName = 'wsd_'+node.get('text');
						break;
					default :
eec153c1   Elena.Budnik   formattage, netto...
537
538
						if (node.get('alias')!= "" )
							paramName = "#"+node.get('alias');
42e2e019   Benjamin Renard   Next step for cac...
539
						else
eec153c1   Elena.Budnik   formattage, netto...
540
							paramName = node.get('id');
42e2e019   Benjamin Renard   Next step for cac...
541
				}
f21cd402   Benjamin Renard   Fix components se...
542
 				var component_info = node.get('component_info');
51713556   Benjamin Renard   Templated paramet...
543
				var predefinedArgs = node.get('predefinedArgs');
f21cd402   Benjamin Renard   Fix components se...
544
545
546
547
548
549
550
551
 				if (component_info && component_info.parentId) {
 					//It's a component
 					paramName = component_info.parentId;
 					components = [];
 					if (component_info.index1)
 						components['index1'] = component_info.index1;
 					if (component_info.index2)
 						components['index2'] = component_info.index2;
51713556   Benjamin Renard   Templated paramet...
552
					predefinedArgs = node.parentNode.get('predefinedArgs');
42e2e019   Benjamin Renard   Next step for cac...
553
 				}
51713556   Benjamin Renard   Templated paramet...
554
555
556
557
558
559
560
561
				if (predefinedArgs) {
					module.parseTemplatedParam(paramName, function(param_info) {
						module.addParam(param_info.paramid, true, node.get('needsArgs'), components, param_info.template_args);
					});
				}
				else {
					module.addParam(paramName,true,node.get('needsArgs'),components);
				}
42e2e019   Benjamin Renard   Next step for cac...
562
		});
eec153c1   Elena.Budnik   formattage, netto...
563
	},
42e2e019   Benjamin Renard   Next step for cac...
564
565

	deleteNode: function() {
eec153c1   Elena.Budnik   formattage, netto...
566
			// if the target is a directory
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
567
			if (!this.isLeaf()) {
eec153c1   Elena.Budnik   formattage, netto...
568
				// determine if this directory is empty before launching the delete confirmation method
42e2e019   Benjamin Renard   Next step for cac...
569
				this.isNotEmptyDir(this.confirmDirectoryDeletion);
eec153c1   Elena.Budnik   formattage, netto...
570
571
572
573
574
575
			// else (the target is a leaf)
			} else {
				// no confirmation prompt for leaves
				this.confirmDirectoryDeletion(false);
			}
	},
42e2e019   Benjamin Renard   Next step for cac...
576

eec153c1   Elena.Budnik   formattage, netto...
577
578
579
580
581
582
583
/**
* this method return if node has Childs even if it was not already loaded
*/
	isNotEmptyDir : function(callbackFn) {
		var hasChilds;
		// if node not already loaded
		if (!this.isLoaded()){
42e2e019   Benjamin Renard   Next step for cac...
584
			// call directFunction to load this node
eec153c1   Elena.Budnik   formattage, netto...
585
586
587
			AmdaAction.getTree({node:this.get('id'),nodeType:this.get('nodeType')},function(res,e){
				callbackFn.call(this,res.length>0?true:false);
			},this);
42e2e019   Benjamin Renard   Next step for cac...
588
		}
eec153c1   Elena.Budnik   formattage, netto...
589
590
591
592
		else {
			callbackFn.call(this,this.hasChildNodes());
		}
	},
42e2e019   Benjamin Renard   Next step for cac...
593

eec153c1   Elena.Budnik   formattage, netto...
594
595
596
597
/**
* this method is used to display a confirmation message
*/
	confirmDirectoryDeletion : function(isNotEmptyDir)
42e2e019   Benjamin Renard   Next step for cac...
598
	{
eec153c1   Elena.Budnik   formattage, netto...
599
600
601
602
603
604
605
606
607
		// if this is a non-empty directory
		if (isNotEmptyDir) {
			// Prompt to the user if he also wants to delete its content
			Ext.Msg.confirm('non-empty directory', 'The target is a non-empty directory!<br>Do you want to continue and also delete its content?', function(btn, text){
				if (btn == 'yes'){
					// do delete
					this.realDelete();
				}
			},this);
42e2e019   Benjamin Renard   Next step for cac...
608
		}
eec153c1   Elena.Budnik   formattage, netto...
609
610
		else {
			this.realDelete();
42e2e019   Benjamin Renard   Next step for cac...
611
		}
eec153c1   Elena.Budnik   formattage, netto...
612
	},
42e2e019   Benjamin Renard   Next step for cac...
613

eec153c1   Elena.Budnik   formattage, netto...
614
615
/*
*    Call the extDirect method to delete parameter
42e2e019   Benjamin Renard   Next step for cac...
616
*    Callback method needed to execute node deletion in tree if id in result or to show error msg
eec153c1   Elena.Budnik   formattage, netto...
617
618
*/
	realDelete : function()
42e2e019   Benjamin Renard   Next step for cac...
619
	{
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
620
		AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){
42e2e019   Benjamin Renard   Next step for cac...
621
622
			//TODO proper errors handling
			// node deletion in tree
eec153c1   Elena.Budnik   formattage, netto...
623
624
625
626
			if (res) {  // if success
				if (res.id) {
					//Ext.Msg.show({title:'Warning', msg: 'Requests with parameter '+node.data.text+' are deleted', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
					if (this.parentNode) {
e1798fcc   Benjamin Renard   Cleanup PlotTabNode
627
						if (this.isLeaf()){
eec153c1   Elena.Budnik   formattage, netto...
628
							var moduleId = this.get('moduleId');
42e2e019   Benjamin Renard   Next step for cac...
629
							// if really interactive node
eec153c1   Elena.Budnik   formattage, netto...
630
							if (moduleId) {
3e9f7a84   Elena.Budnik   check if window i...
631
632
633
634
635
636
								var win = myDesktopApp.getDesktop().getWindow(moduleId);
								// if window is really open
								if (win) {
									var me = this;
									myDesktopApp.getLoadedModule(moduleId, true, function (module) {
										var editedNode = module.getLinkedNode();
42e2e019   Benjamin Renard   Next step for cac...
637
638

										// file node is not linked directly to the module
3e9f7a84   Elena.Budnik   check if window i...
639
										var isThisFile = false;
42e2e019   Benjamin Renard   Next step for cac...
640
										if (editedNode && editedNode.$className == 'amdaModel.MyDataParamNode')
3e9f7a84   Elena.Budnik   check if window i...
641
											if (editedNode.get('fileObject').get('fileName') == me.get('text'))
42e2e019   Benjamin Renard   Next step for cac...
642
643
644
												isThisFile = true;

										// node was created BEFORE tree loading; node.id are different ; but it is the same node
3e9f7a84   Elena.Budnik   check if window i...
645
646
647
648
										if ( editedNode && editedNode.get('id') == me.get('id') && editedNode !== me ) {
											module.setLinkedNode(me);
											isThisFile = true;
										}
42e2e019   Benjamin Renard   Next step for cac...
649

3e9f7a84   Elena.Budnik   check if window i...
650
651
652
653
654
655
										if (me.$className == 'amdaModel.DerivedParamNode') {
											var obj = {
												paramId : 'ws_'+me.get('text')
											};
											AmdaAction.compilParamDelete(obj);
										}
42e2e019   Benjamin Renard   Next step for cac...
656
657

										if (editedNode === me || isThisFile ){
3e9f7a84   Elena.Budnik   check if window i...
658
659
660
661
											var newNode = Ext.ModelManager.create({leaf : true}, me.$className);
											// several tabs could be connected to one node
											if (moduleId === myDesktopApp.dynamicModules.plot.id) {
												var linkedNodes = module.linkedNodes;
42e2e019   Benjamin Renard   Next step for cac...
662

3e9f7a84   Elena.Budnik   check if window i...
663
												if (linkedNodes) {
42e2e019   Benjamin Renard   Next step for cac...
664
665
													linkedNodes.each(function(key, value){
														if (value === me) {
3e9f7a84   Elena.Budnik   check if window i...
666
667
															linkedNodes.replace(key,newNode);
															var tabPanel = module.getUiContent().tabPanel.items.getByKey(key);
42e2e019   Benjamin Renard   Next step for cac...
668
669
															tabPanel.setObject(Ext.create(amdaModel.Plot.$className, {}));
														}
3e9f7a84   Elena.Budnik   check if window i...
670
													}, me);
42e2e019   Benjamin Renard   Next step for cac...
671
672
												}
											}
3e9f7a84   Elena.Budnik   check if window i...
673
674
											newNode.editInModule();
										}
42e2e019   Benjamin Renard   Next step for cac...
675
									});
eec153c1   Elena.Budnik   formattage, netto...
676
								}
eec153c1   Elena.Budnik   formattage, netto...
677
							}
42e2e019   Benjamin Renard   Next step for cac...
678
679
						}
						//update mask info in myData
eec153c1   Elena.Budnik   formattage, netto...
680
681
682
						if (res.maskDesc && !res.maskDeleted) {
							this.parentNode.set('info', res.maskDesc);
							this.updateMyDataParam(res.mask, res.maskDesc);
42e2e019   Benjamin Renard   Next step for cac...
683
684
						}
						this.remove();
eec153c1   Elena.Budnik   formattage, netto...
685
					}
42e2e019   Benjamin Renard   Next step for cac...
686
687
					//TODO Several special node-dependent actions - to move to node functions..
					// nodes of another nodeType to be deleted as they depend on deleted node
eec153c1   Elena.Budnik   formattage, netto...
688
689
690
					if (res.params) {
						this.deleteDependence(res.params);
						//TODO reset
42e2e019   Benjamin Renard   Next step for cac...
691
692
					}
					// mask was deleted or updated - to update mydata tree
eec153c1   Elena.Budnik   formattage, netto...
693
					if (res.maskDeleted) {
42e2e019   Benjamin Renard   Next step for cac...
694
695
						this.updateMyData();
					}
eec153c1   Elena.Budnik   formattage, netto...
696
697
				}
				else {
42e2e019   Benjamin Renard   Next step for cac...
698
					myDesktopApp.warningMsg(res.error);
eec153c1   Elena.Budnik   formattage, netto...
699
700
701
				}
			}
			else {
42e2e019   Benjamin Renard   Next step for cac...
702
				myDesktopApp.errorMsg(e.message);
eec153c1   Elena.Budnik   formattage, netto...
703
704
705
			}
		}, this);
	},
16035364   Benjamin Renard   First commit
706

eec153c1   Elena.Budnik   formattage, netto...
707
708
709
710
711
712
713
714
715
716
717
/*
*  Delete musti selection
*/
	deleteMulti: function()
	{
		var selection = this.myGetOwnerTree().getSelectionModel().selected.items;
		alert(selection.length +' to delete!');
		Ext.Array.each(selection,function(item,index,allItems){
			item.deleteNode();
		})
	},
42e2e019   Benjamin Renard   Next step for cac...
718

eec153c1   Elena.Budnik   formattage, netto...
719
720
721
722
/*
*  Create Folder
*/
	createDir: function() {
eec153c1   Elena.Budnik   formattage, netto...
723
724
725
726
727
728
		var me = this;
		amdaModel.InteractiveNode.preloadNodes(this.getRootNode(),
			function()
			{
				var newNode = Ext.create(me.$className,
				{
82560cb2   Nathanaël Jourdane   fix folders (wip)
729
730
					leaf : false, nodeType : me.get('nodeType'),
					text : amdaModel.AmdaNode.NEW_DIR_NAME,
11d21073   Nathanaël Jourdane   Fix bugs when cre...
731
732
					children : [],
          parentId: me.get('id')
eec153c1   Elena.Budnik   formattage, netto...
733
				});
16035364   Benjamin Renard   First commit
734

82560cb2   Nathanaël Jourdane   fix folders (wip)
735
				// insert the new node as a child of node
65ac4a9d   Nathanaël Jourdane   Fix folders debug...
736
        me.insertChild(0, newNode);
eec153c1   Elena.Budnik   formattage, netto...
737
738
739
				// start text edition on this new directory node
				me.expand(false);
				newNode.expand(false);
16035364   Benjamin Renard   First commit
740

eec153c1   Elena.Budnik   formattage, netto...
741
742
743
				// select the new node
				me.myGetOwnerTree().getSelectionModel().select(newNode);
				// call the renameNode method for this new node
11d21073   Nathanaël Jourdane   Fix bugs when cre...
744
				newNode.renameNode(true);
eec153c1   Elena.Budnik   formattage, netto...
745
746
			});
	},
42e2e019   Benjamin Renard   Next step for cac...
747

eec153c1   Elena.Budnik   formattage, netto...
748
/*
42e2e019   Benjamin Renard   Next step for cac...
749
*
eec153c1   Elena.Budnik   formattage, netto...
750
751
752
753
*/
	createLeaf: function(contextNode) {
		// create new node with the same type than the contextNode
		var newNode = Ext.create(contextNode.$className, {leaf : true});
16035364   Benjamin Renard   First commit
754

eec153c1   Elena.Budnik   formattage, netto...
755
756
757
758
759
760
761
762
		// load the rootNode and recursively all its child nodes
		amdaModel.InteractiveNode.preloadNodes(contextNode.getRootNode(),
			function()
			{
				// edit newNode into Parameter Module with node as contextNode
				newNode.editInModule(contextNode);
			});
	},
16035364   Benjamin Renard   First commit
763

11d21073   Nathanaël Jourdane   Fix bugs when cre...
764
	renameNode: function(deleteOnFailure)
65ac4a9d   Nathanaël Jourdane   Fix folders debug...
765
	{
eec153c1   Elena.Budnik   formattage, netto...
766
		if (this.myGetOwnerTree())
42e2e019   Benjamin Renard   Next step for cac...
767
		{
eec153c1   Elena.Budnik   formattage, netto...
768
769
770
771
772
773
			// load the rootNode and recursively all its child nodes if not already loaded
			var me = this;
			amdaModel.InteractiveNode.preloadNodes(this.getRootNode(),
				function()
				{
					// fire the edition event on tree
11d21073   Nathanaël Jourdane   Fix bugs when cre...
774
775
776
777
					var item = me.myGetOwnerTree().getSelectionModel().selected.items[0];
					item.deleteOnFailure = deleteOnFailure;
					me.myGetOwnerTree().fireEvent('edition', me.myGetOwnerTree().view, item);
				});
eec153c1   Elena.Budnik   formattage, netto...
778
779
780
781
782
783
		}
		else
		{
			myDesktopApp.errorMsg('tree is undefined');
		}
	},
16035364   Benjamin Renard   First commit
784

eec153c1   Elena.Budnik   formattage, netto...
785
786
787
788
/*
*       load the rootNode and recursively all its child nodes
*       to know all names of DerivedParameters
*/
42e2e019   Benjamin Renard   Next step for cac...
789
790
	editLeaf: function(onReady)
	{
eec153c1   Elena.Budnik   formattage, netto...
791
792
793
794
		var me = this;
		amdaModel.InteractiveNode.preloadNodes(this.getRootNode(),
		function()
		{
42e2e019   Benjamin Renard   Next step for cac...
795
			if (me.get('object'))
eec153c1   Elena.Budnik   formattage, netto...
796
797
798
799
800
			{
				// launch edition of parameter into parameter module
				me.editInModule(null, onReady);
			}
			else
42e2e019   Benjamin Renard   Next step for cac...
801
			{
eec153c1   Elena.Budnik   formattage, netto...
802
				// call the ext method to get the details of parameter
42e2e019   Benjamin Renard   Next step for cac...
803
804
				// the edition of real parameter is done into callback method getObjectCallback
				if (onReady)
0c154100   Elena.Budnik   redmine #5141 part.2
805
					me.onReady = onReady;
42e2e019   Benjamin Renard   Next step for cac...
806

eec153c1   Elena.Budnik   formattage, netto...
807
808
				AmdaAction.getObject(me.get('id'), me.get('nodeType'), me.getObjectCallback, me);
			}
42e2e019   Benjamin Renard   Next step for cac...
809
		});
eec153c1   Elena.Budnik   formattage, netto...
810
	},
16035364   Benjamin Renard   First commit
811

eec153c1   Elena.Budnik   formattage, netto...
812
/*
42e2e019   Benjamin Renard   Next step for cac...
813
*
eec153c1   Elena.Budnik   formattage, netto...
814
815
816
*/
	getObjectCallback : function(result,remoteEvent)
	{
eec153c1   Elena.Budnik   formattage, netto...
817
		var t = remoteEvent.getTransaction();
42e2e019   Benjamin Renard   Next step for cac...
818
819

		if (result) {
eec153c1   Elena.Budnik   formattage, netto...
820
821
822
			var paramObj = Ext.create(this.get('objectDataModel'), result);
			// set parameter into node
			this.set('object',paramObj);
42e2e019   Benjamin Renard   Next step for cac...
823
			// Edition of parameter into parameter Module
0c154100   Elena.Budnik   redmine #5141 part.2
824
			this.editInModule(null, this.onReady);
8b11b1af   Benjamin Renard   Insert intervals ...
825
			this.onReady = null;
42e2e019   Benjamin Renard   Next step for cac...
826
		}
eec153c1   Elena.Budnik   formattage, netto...
827
828
829
		else {
		// EXCEPTION : parameter not found !?
			myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"
42e2e019   Benjamin Renard   Next step for cac...
830
			+ this.get('name') + "' found!");
eec153c1   Elena.Budnik   formattage, netto...
831
		}
42e2e019   Benjamin Renard   Next step for cac...
832
	}
16035364   Benjamin Renard   First commit
833
});