Commit 0ffd5931d64b7c80cac6e7718ade16ef34c4ae63

Authored by Benjamin Renard
2 parents db902412 2a243af4

Fix conflit

.gitignore
... ... @@ -17,3 +17,4 @@ logs/*
17 17 php/log
18 18 _test*
19 19 *.idea
  20 +/nbproject/
... ...
js/app/controllers/ExplorerModule.js
... ... @@ -284,24 +284,53 @@ Ext.define('amdaDesktop.ExplorerModule',
284 284 }
285 285 }, this)
286 286 },
287   -
288 287 getParamInfo: function (paramId, onReady) {
289   - var me = this
290   -
  288 + var me = this;
291 289 if (this.paramInfoRegistry[paramId]) {
292 290 if (onReady) {
293 291 onReady(this.paramInfoRegistry[paramId])
294 292 }
295 293 return this.paramInfoRegistry[paramId]
296 294 }
  295 + var pattParam = new RegExp("ws_");
  296 + if(pattParam .test(paramId)){
  297 + var regExp = /\(([\d]+)\)/;
  298 + var matches = regExp.exec(paramId);
  299 + if(matches)
  300 + {
  301 + paramId=paramId.substr(0,paramId.length-3);
  302 + }
  303 + /* case of derived parameter */
  304 + AmdaAction.getDerivedParamInfo({paramId: paramId}, function (result, e) {
  305 + var paramInfo = null
  306 + if (e.status === true) {
  307 + // No available info for this parameter, do not display an error message if no success
  308 + if (result.success) {
  309 + // Store parameter info in registry
  310 + me.paramInfoRegistry[paramId] = result;
  311 + paramInfo = result
  312 + }
  313 + } else {
  314 + Ext.Msg.show({
  315 + title: 'Error System',
  316 + msg: e.message,
  317 + icon: Ext.MessageBox.ERROR,
  318 + buttons: Ext.Msg.OK
  319 + })
  320 + }
297 321  
  322 + if (onReady) {
  323 + onReady(paramInfo)
  324 + }
  325 + })
  326 + }else{
298 327 AmdaAction.getParamInfo({paramId: paramId}, function (result, e) {
299 328 var paramInfo = null
300 329 if (e.status === true) {
301 330 // No available info for this parameter, do not display an error message if no success
302 331 if (result.success) {
303 332 // Store parameter info in registry
304   - me.paramInfoRegistry[paramId] = result
  333 + me.paramInfoRegistry[paramId] = result;
305 334 paramInfo = result
306 335 }
307 336 } else {
... ... @@ -317,6 +346,7 @@ Ext.define('amdaDesktop.ExplorerModule',
317 346 onReady(paramInfo)
318 347 }
319 348 })
  349 + }
320 350  
321 351 return null
322 352 }
... ...
js/app/models/AmdaNode.js
... ... @@ -85,7 +85,6 @@ Ext.define('amdaModel.AmdaNode', {
85 85 */
86 86 getFilteredContextMenu : function(itemKind) {
87 87 var menuitems = this.getAllContextMenuItems();
88   -
89 88 var realmenuitems = 0;
90 89 if (menuitems && menuitems.length){
91 90 for ( var i = 0; i < menuitems.length; i++) {
... ... @@ -128,10 +127,10 @@ Ext.define(&#39;amdaModel.AmdaNode&#39;, {
128 127 itemKind = amdaUI.ExplorerUI.ITEM_KIND_ROOT;
129 128 }
130 129 // if this node is a leaf and have no child
131   - else if (this.isLeaf()) {
  130 + else if (this.isLeaf() || this.get('nodeType' ) == 'derivedParam' ) {
132 131 itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF;
133 132 }
134   - else if (this.get('isParameter')) {
  133 + else if (this.get('isParameter') && this.get('nodeType' ) != 'derivedParam' ) {
135 134 itemKind = amdaUI.ExplorerUI.ITEM_KIND_PARA;
136 135 }
137 136 else if (this.get('rank')) {
... ...
js/app/models/DerivedParamNode.js
... ... @@ -8,24 +8,94 @@
8 8 * @version $Id: DerivedParamNode.js 2544 2014-10-03 10:21:56Z elena $
9 9 */
10 10  
11   -Ext.define('amdaModel.DerivedParamNode', {
  11 +Ext.define('amdaModel.DerivedParamComponentNode', {
  12 + extend: 'amdaModel.InteractiveNode',
  13 +
  14 + text: '',
  15 +
  16 + constructor : function(config)
  17 + {
  18 + this.callParent(arguments);
  19 + this.set('text', config && config.text ? config.text : this.text);
  20 + this.set('iconCls', 'icon-scalar');
  21 + this.set('leaf',true);
  22 + this.set('isParameter',true);
  23 + },
  24 + localMenuItems : function(){
  25 + var menuItems=
  26 + [{
  27 + fnId : 'leaf-plotParam',
  28 + text : 'Plot Parameter',
  29 + hidden : true
  30 + }, {
  31 + fnId : 'leaf-downParam',
  32 + text : 'Download Parameter',
  33 + hidden : true
  34 + }]
  35 + return menuItems;
  36 + },
  37 + getAllContextMenuItems: function(){
  38 + return this.localMenuItems ();
  39 +},
  40 +});
12 41  
  42 +Ext.define('amdaModel.DerivedParamNode', {
13 43 extend: 'amdaModel.InteractiveNode',
14 44  
  45 + requires:[],
  46 +
  47 + fields : [
  48 + { name : 'dim_1', type:'number', defaultValue:1, persist: false},
  49 + { name : 'dim_2', type:'number', defaultValue:1, persist: false}
  50 + ],
  51 +
15 52 statics:{
16 53 nodeType: 'derivedParam',
17 54 objectName: 'Parameter'
18 55 },
19 56  
20   - constructor : function(config){
  57 + constructor : function(config){
21 58 this.callParent(arguments);
22 59 this.set('moduleId',myDesktopApp.dynamicModules.param.id);
23 60 this.set('objectDataModel',amdaModel.Parameter.$className);
24 61 this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
25   - if (this.get('leaf')) this.set('iconCls', 'icon-scalar');
  62 + this.updateIcon();
  63 + this.updateComponents();
26 64 },
27 65  
28   - localMenuItems : function() {
  66 + updateIcon: function() {
  67 + if (this.get('isParameter')) {
  68 + if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3)){
  69 + this.set('iconCls', 'icon-vector');
  70 + } else if( (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)){
  71 + this.set('iconCls', 'icon-vector');
  72 +
  73 + } else if ( (this.get('dim_1') > 1 && this.get('dim_2') >=1)|| (this.get('dim_1') >=1 && this.get('dim_2') >1)) {
  74 + this.set('iconCls','icon-spectra');
  75 + } else {
  76 + this.set('iconCls', 'icon-scalar');
  77 + }
  78 + }
  79 + },
  80 +
  81 + updateComponents: function() {
  82 + this.removeAll();
  83 + if (!this.get('isParameter')) {
  84 + return;
  85 + }
  86 +
  87 + if( (this.get('dim_1') == 3 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 3) ||
  88 + (this.get('dim_1') == 2 && this.get('dim_2') == 1) || (this.get('dim_1') == 1 && this.get('dim_2') == 2)) {
  89 + for (var i = 0; i < this.get('dim_1') *this.get('dim_2'); ++i) {
  90 + var ch=new amdaModel.DerivedParamComponentNode({text: this.get('text') + '(' + i + ')'
  91 + });
  92 +
  93 + ch.set('nodeType','derivedParam');
  94 + this.appendChild(ch);
  95 + }
  96 + }
  97 + },
  98 +localMenuItems : function() {
29 99 var menuItems =
30 100 [{
31 101 fnId : 'leaf-plotParam',
... ... @@ -45,10 +115,22 @@ Ext.define(&#39;amdaModel.DerivedParamNode&#39;, {
45 115 var locMenuItems = this.localMenuItems();
46 116  
47 117 return Ext.Array.merge(menuItems,locMenuItems);
48   - },
  118 + },
49 119  
50   - isParameter : function(){
51   - return this.get('isParameter');
  120 +isParameter : function(){
  121 + return this.get('isParameter');
  122 +},
  123 +
  124 +specialUpdate : function(res, timeUpdate) {
  125 + if (res && res.dim_1) {
  126 + this.set('dim_1', res.dim_1);
  127 + }
  128 + if (res && res.dim_2) {
  129 + this.set('dim_2', res.dim_2);
52 130 }
  131 +
  132 + this.updateIcon();
  133 + this.updateComponents();
  134 +}
53 135  
54 136 });
... ...
js/app/models/InteractiveNode.js
... ... @@ -202,7 +202,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
202 202 this.set('info',res.info);
203 203 }
204 204  
205   - // myDataParam special update
  205 + // myDataParam and Parameter special update
206 206 this.specialUpdate(res, false);
207 207  
208 208 // reload object into the view of corresponding Module
... ... @@ -475,6 +475,18 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
475 475 case 'amdaModel.AliasNode' :
476 476 paramName = "#"+node.get('text');
477 477 break;
  478 + case 'amdaModel.DerivedParamComponentNode' :
  479 + paramId = node.get('text');
  480 + var parentId = paramId.substr(0, paramId.length - 3);
  481 + paramName= "ws_" + parentId;
  482 + var regExp = /\(([\d]+)\)/;
  483 + var component_index = regExp.exec(paramId);
  484 + if (component_index)
  485 + {
  486 + components = [];
  487 + components['index1'] = component_index[1];
  488 + }
  489 + break;
478 490 case 'amdaModel.DerivedParamNode' :
479 491 paramName = "ws_"+node.get('text');
480 492 break;
... ...
js/app/models/Parameter.js
... ... @@ -23,7 +23,9 @@ Ext.define(&#39;amdaModel.Parameter&#39;, {
23 23 {name: 'units', type: 'string'},
24 24 {name: 'buildchain', type: 'string'},
25 25 {name: 'description', type: 'string'},
26   - {name: 'ytitle', type: 'string'}
  26 + {name: 'ytitle', type: 'string'},
  27 + {name: 'dim_1', type: 'number'},
  28 + {name: 'dim_2', type: 'number'}
27 29 ],
28 30  
29 31 /**
... ... @@ -49,6 +51,8 @@ Ext.define(&#39;amdaModel.Parameter&#39;, {
49 51 if (this.get('units').match(/[a-z,0-9]/gi) != null) {
50 52 myValues.units = this.get('units');
51 53 }
  54 + myValues.dim_1 = this.get('dim_1');
  55 + myValues.dim_2 = this.get('dim_2');
52 56 myValues.nodeType = amdaModel.DerivedParamNode.nodeType;
53 57 return myValues;
54 58 }
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -305,9 +305,6 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
305 305 }
306 306 }
307 307  
308   - // if (is2d) {
309   - // recs[0].set('dim2-index','0');
310   - // }
311 308 // activate legend if vector & TimePlot
312 309 if ( isVector && this.get('panel-plot-type') == 'timePlot' ) {
313 310 this.loadSeriesLegend();
... ...
js/app/views/DownloadUI.js
... ... @@ -9,806 +9,823 @@
9 9 */
10 10  
11 11 Ext.define('amdaUI.DownloadUI', {
12   - extend: 'Ext.container.Container',
13   - alias: 'widget.panelDownload',
14   -
15   - requires: [
16   - 'amdaUI.TimeSelectorUI',
17   - 'amdaUI.ParamArgumentsPlug',
18   - 'amdaUI.SendToSampButtonUI',
19   - 'amdaModel.DownloadParam'
20   - ],
21   -
22   - //Old kernel time formats
23   - //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']],
24   - //New kernel time formats
25   - timeformatData : [['YYYY-MM-DDThh:mm:ss', 'YYYY-MM-DDThh:mm:ss.ms', 'ISO format with msecs'],
26   - ['DD Time', 'YYYYDOYhhmmssms', 'Day-Of-Year, 1 Jan : DOY = 0'],
27   - ['Timestamp', 'Seconds from 1970', 'Total of seconds from the Unix Epoch on January 1st, 1970 at UTC.']],
28   - timeformatTTData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss']],
29   - fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable'],['cdf', 'CDF'],['json', 'JSON']],
30   - fileformatTTData : [['text', 'plain text'], ['vot','VOTable']],
31   - filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']],
32   - filecompressTT : [['zip', 'zip'], ['tar+gzip', 'tar+gzip'], ['none', 'none']],
33   - filestructureData : [['0','All In One File'], ['1','One File Per Time Interval'], ['2','One File Per Param/Interval']],
34   -
35   - constructor: function(config) {
36   - this.init(config);
37   - this.callParent(arguments);
38   - // load object into view
39   - if (this.object) this.loadObject();
40   - //
41   - var paramArgsPlug = this.getPlugin('download-param-arguments-plugin');
42   - if (paramArgsPlug)
43   - paramArgsPlug.onApply = this.onApplyParameterArgs;
44   - },
45   -
46   - addTT : function(newTTName,newTTid)
47   - {
48   - var tabPanel = this.formPanel.down();
49   - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab());
50   -
51   - if (downloadSrc === 0) {
52   - this.timeSelector.addTT(newTTName,newTTid);
53   - }
54   - else {
55   - // search for an existing record in store with this unique name
56   - var existingIndex = this.TTGrid.store.findExact( 'name', newTTName);
57   - // if no corresponding TT found
58   - if (existingIndex == -1){
59   - // adding the time table to the TTGrid of TT download
60   - var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName });
61   - this.TTGrid.store.insert(this.TTGrid.store.getCount(),r);
62   - }
63   - }
64   - },
65   -
66   - addTTs : function(TTarray) {
67   - // set TTTab
68   - this.timeSelector.setTTTab(TTarray);
69   - },
70   -
71   - // Add TT in download TT module
72   - addTTdownload : function(newTTName,newTTid){
73   - var tabPanel = this.formPanel.down();
74   - tabPanel.setActiveTab(1);
75   - this.addTT(newTTName,newTTid);
76   -
77   - },
78   -
79   - /**
80   - * Set Start-Stop from parameter info (Local & MyData)
81   - */
82   - setTimeFromData : function(obj) {
83   - if (!obj.start || !obj.stop)
84   - return;
85   - var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
86   - var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
87   -
88   - this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop });
89   - this.timeSelector.intervalSel.updateDuration();
90   - },
91   -
92   - addParam : function(paramId, isLeaf, needArgs, components)
93   - {
94   - // adding the parameter to the paramGrid
95   - var paramObj = {
96   - paramid: paramId,
97   - type: 0,
98   - 'dim1-is-range': false,
99   - 'dim1-min-range': 0.,
100   - 'dim1-max-range': 0.,
101   - 'dim1-index': '*',
102   - 'dim2-is-range': false,
103   - 'dim2-min-range': 0.,
104   - 'dim2-max-range': 0.,
105   - 'dim2-index': '*',
106   - template_args: {}
107   - };
108   -
109   - if (components) {
110   - if (components['index1']) {
111   - paramObj['dim1-index'] = components['index1'];
112   - ++paramObj['type'];
113   - }
114   -
115   - if (components['index2']) {
116   - paramObj['dim2-index'] = components['index2'];
117   - ++paramObj['type'];
118   - }
119   - }
120   -
121   - var r = Ext.create('amdaModel.DownloadParam', paramObj);
122   - var pos = this.paramGrid.store.getCount();
123   - this.paramGrid.store.insert(pos,r);
124   - this.paramGrid.getView().refresh();
125   - if (needArgs)
126   - this.editParameterArgs(r);
127   - },
128   -
129   - addParams: function(arrayParams)
130   - {
131   - var arrayRec = new Array();
132   - var index = 1;
133   - if (arrayParams)
134   - {
135   - index = 0;
136   - Ext.Array.each(arrayParams,function(item){
137   - if (Ext.isObject(item)) {
138   - if (typeof paramId !== 'undefined')
139   - {
140   - // for Parameter Name in Download Module
141   - var paramObj = {
142   - paramid: paramId,
143   - type: 0,
144   - 'dim1-is-range': false,
145   - 'dim1-min-range': 0.,
146   - 'dim1-max-range': 0.,
147   - 'dim1-index': item.get('dim1'),
148   - 'dim2-is-range': false,
149   - 'dim2-min-range': 0.,
150   - 'dim2-max-range': 0.,
151   - 'dim2-index': item.get('dim2'),
152   - template_args: {}
153   - };
154   -
155   - var r = Ext.create('amdaModel.DownloadParam', paramObj);
156   - }
157   - else
158   - {
159   - //for download from get Data in Plot module
160   - var r = Ext.create('amdaModel.DownloadParam', item);
161   - }
162   -
163   - }
164   - else {
165   - // for Download By Request in Operations menu
166   - //TODO BRE - Components selection
167   - var r = Ext.create('amdaModel.DownloadParam', { paramid: item });
168   - }
169   - arrayRec.push(r);
170   - });
171   - }
172   - this.paramGrid.getStore().loadData(arrayRec);
173   - },
174   -
175   - // parameter name -> alias
176   - updateConstruct : function(oldval,newval) {
177   - var index = this.paramGrid.store.findExact('name', oldval);
178   - if (index != -1) {
179   - this.paramGrid.getStore().getAt(index).set('name',newval);
180   - this.paramGrid.getStore().getAt(index).set('text',newval);
181   - }
182   - },
183   -
184   - setObject : function(obj) {
185   - this.object = obj;
186   - this.loadObject();
187   - },
188   -
189   - /**
190   - * update this.object from form
191   - */
192   - updateObject : function()
193   - {
194   - // get the basic form
195   - var tabPanel = this.formPanel.down();
196   - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab());
197   - var basicForm = this.formPanel.getForm();
198   - var updateStatus = true;
199   - var values = basicForm.getValues();
200   -
201   - // data download
202   - if (downloadSrc === 0)
203   - {
204   - var timeformat = values.timeformat;
205   - var timeSource = this.timeSelector.getActiveTimeSource();
206   - var structure = values.filestructure;
207   - var sampling = values.sampling ? values.sampling : 600;
208   - var refparamSampling = values.refparamsampling == 'on';
209   - var fileprefix = values.fileprefix ? values.fileprefix : '';
210   - var fileformat = values.fileformat;
211   - var compression = values.compression;
212   -
213   - var fieldsWithoutName = basicForm.getFields().items;
214   - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){
215   - if (!item.isValid()) {
216   - if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) &&
217   - ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) {
218   - updateStatus = true;
219   - }
220   - else {
221   - // set update isn't allowed
222   - updateStatus = false;
223   - return false;
224   - }
225   - }
226   - }, this);
227   -
228   - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
229   - && this.timeSelector.TTGrid.getStore().count() == 0) {
230   - myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!'
231   - +'<br>You must add one or choose Time Selection `by Interval`');
232   - updateStatus = false;
233   - }
234   -
235   - if (updateStatus)
236   - {
237   - /// real object update
238   - // update TimeTable object with the content of form
239   - basicForm.updateRecord(this.object);
240   - this.object.set('timesrc', timeSource);
241   - // set valid intervals into TimeTable object
242   - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
243   - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
244   - // set parameters
245   - this.object.set('list',this.paramGrid.getStore().data.items);
246   - this.object.set('structure', structure);
247   - this.object.set('refparamSampling', refparamSampling);
248   - this.object.set('sampling', sampling);
249   - this.object.set('fileprefix',fileprefix);
250   - this.object.set('timeformat',timeformat);
251   - this.object.set('fileformat',fileformat);
252   - this.object.set('compression',compression);
253   - }
254   - }
255   - //TT download
256   - else
257   - {
258   - var timeformat = values.timeformatTT;
259   - var compression = values.compressionTT;
260   - var fileformat = values.fileformatTT;
261   - if (compression === 'none'
262   - && this.TTGrid.getStore().count() > 1) {
263   - myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please');
264   - updateStatus = false;
265   - }
266   - this.object.set('timeTables',this.TTGrid.getStore().data.items);
267   - this.object.set('timeformatTT',timeformat);
268   - this.object.set('fileformatTT',fileformat);
269   - this.object.set('compressionTT',compression);
270   - }
271   -
272   - this.object.set('downloadSrc',downloadSrc);
273   - // return the update status
274   - return updateStatus;
275   - },
276   -
277   - /**
278   - * load this.object into form
279   - */
280   - loadObject : function(){
281   -
282   - if (!this.object.get('timeformat'))
283   - this.object.set('timeformat', this.timeformatData[0][0]);
284   -
285   - if (!this.object.get('timeformatTT'))
286   - this.object.set('timeformatTT', this.timeformatTTData[0][0]);
287   -
288   - if (!this.object.get('fileformat'))
289   - this.object.set('fileformat', this.fileformatData[0][0]);
290   -
291   - if (!this.object.get('fileformatTT'))
292   - this.object.set('fileformatTT', this.fileformatTTData[0][0]);
293   -
294   - if (!this.object.get('compression'))
295   - this.object.set('compression', this.filecompressData[1][0]);
296   -
297   - if (!this.object.get('compressionTT'))
298   - this.object.set('compressionTT', this.filecompressData[1][0]);
299   -
300   - // load object into form
301   - this.formPanel.getForm().loadRecord(this.object);
302   - // set object's TTs into the timeselector
303   - this.addTTs(this.object.get('timeTables'));
304   - // set parameters
305   - this.addParams(this.object.get('list'));
306   - },
  12 + extend: 'Ext.container.Container',
  13 + alias: 'widget.panelDownload',
307 14  
308   -/**
309   -* download method called by 'Download' button to launch the download process
310   -*/
311   - doDownload : function(sendToSamp, clientId){
312   - var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id);
313   - if (downloadModule)
314   - downloadModule.linkedNode.execute(sendToSamp, clientId);
315   - },
316   -
317   - actionItem: function(grid, cell, cellIndex, record, row, recordIndex, e){
318   -
319   - var isTimeTable = record instanceof amdaModel.TTobject;
320   -
321   - if ( cellIndex == 3 || ( cellIndex == 2 && isTimeTable ))
322   - grid.getStore().remove(record);
323   - else if ( cellIndex == 2 ) {
324   - this.paramGrid.getView().select(row);
325   - this.editParameterArgs(record);
326   - }
327   - },
328   -
329   - editParameterArgs: function(record) {
330   - var paramArgsPlug = this.getPlugin('download-param-arguments-plugin');
331   - if (paramArgsPlug)
332   - paramArgsPlug.show('download-param-arguments-plugin', record);
333   - },
334   -
335   - onApplyParameterArgs : function(parentUI, paramObject) {
336   - parentUI.paramGrid.getView().refresh();
337   - },
338   -
339   - onFileStructureChange : function(combo, newValue, oldValue){
340   - if (!this.formPanel)
341   - return;
342   -
343   - var refParamCheck = this.formPanel.getForm().findField('refparamsampling');
344   - var samplingField = this.formPanel.getForm().findField('sampling');
345   -
346   - if (samplingField && newValue !== oldValue) {
347   - refParamCheck.setDisabled(newValue == 2);
348   - samplingField.setDisabled((newValue == 2) || refParamCheck.getValue());
349   - }
350   - },
351   -
352   - onRefParamSamplingChange : function(check, newValue, oldValue){
353   - if (!this.formPanel)
354   - return;
355   -
356   - var samplingField = this.formPanel.getForm().findField('sampling');
357   - var structureCombo = this.formPanel.getForm().findField('filestructure');
358   -
359   - if (samplingField && newValue !== oldValue)
360   - samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue());
361   - },
362   -
363   - onSendVOTableToSamp : function (clientId, sendOpt){
364   - var me = sendOpt.scope;
365   - if(me.updateObject()){
366   - me.doDownload(true, clientId);
367   - }
368   - },
369   -
370   - /**
371   - * Check if changes were made before closing window
372   - * @return false
373   - */
374   - fclose : function() {
375   - return false;
376   - },
377   -
378   - init : function (config){
379   - var me = this;
380   -
381   - this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector',flex: 1});
382   -
383   - this.paramGrid = Ext.create('Ext.grid.Panel', {
384   - flex: 2,
385   - store : Ext.create('Ext.data.Store', { model: 'amdaModel.DownloadParam'} ),
386   - columns: [
387   - { xtype: 'rownumberer', width: 20 },
388   - {
389   - header: "Parameter Name",
390   - dataIndex: 'name',
391   - flex:1,
392   - sortable: false,
393   - menuDisabled : true ,
394   - renderer: function (val, meta, rec) {
395   - return rec.getParamFullName();
396   - }
397   - },
398   - {
399   - menuDisabled : true, width: 30, renderer: function(){
400   - return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>';
401   - }
402   - },
403   - {
404   - menuDisabled : true, width: 30, renderer: function(){
405   - return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>';
406   - }
407   - }
408   - ],
409   - //TODO - BRE - Wait the fix for drag&drop issue
410   - listeners :
411   - {
412   - render : function(o,op)
413   - {
414   - var me = this;
415   - var el = me.body.dom;
416   - var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
417   - ddGroup: 'explorerTree',
418   - notifyEnter : function(ddSource, e, data) { },
419   - notifyOver : function(ddSource, e, data)
420   - {
421   - if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet'))
422   - {
423   - this.valid = false;
424   - return this.dropNotAllowed;
425   - }
426   - if (((data.records[0].data.nodeType == 'localParam') ||
427   - (data.records[0].data.nodeType == 'remoteParam') ||
428   - (data.records[0].data.nodeType == 'remoteSimuParam') ||
429   - (data.records[0].data.nodeType == 'derivedParam') ||
430   - (data.records[0].data.nodeType == 'myDataParam') ||
431   - (data.records[0].data.nodeType == 'alias'))&&
432   - (data.records[0].isLeaf() || data.records[0].data.isParameter) &&
433   - !data.records[0].data.disable)
434   - {
435   - this.valid = true;
436   - return this.dropAllowed;
437   - }
438   -
439   - this.valid = false;
440   - return this.dropNotAllowed;
441   - },
442   - notifyDrop : function(ddSource, e, data)
443   - {
444   - if (!this.valid)
445   - return false;
446   - var idToSent;
447   - var components = null;
448   - switch (data.records[0].data.nodeType)
449   - {
450   - case 'localParam' :
451   - case 'remoteParam':
452   - case 'remoteSimuParam':
453   - idToSent = data.records[0].get('id');
454   - if (data.records[0].get('alias')!= "" )
455   - idToSent = "#"+data.records[0].get('alias');
456   - var component_info = data.records[0].get('component_info');
457   - if (component_info && component_info.parentId)
458   - {
459   - if ( component_info.index1 || component_info.index2 )
460   - {
461   - idToSent = component_info.parentId;
462   - components = [];
463   - if (component_info.index1)
464   - components['index1'] = component_info.index1;
465   - if (component_info.index2)
466   - components['index2'] = component_info.index2;
467   - }
468   - if ( data.records[0].get('needsArgs') )
469   - {
470   - idToSent = component_info.parentId;
471   - if (component_info.index1)
472   - {
473   - components = [];
474   - components['index1'] = component_info.index1;
475   - }
476   - }
477   - }
478   - break;
479   - case 'alias' :
480   - idToSent = "#"+data.records[0].get('text');
481   - break;
482   - case 'derivedParam' :
483   - idToSent = "ws_"+data.records[0].get('text');
484   - break;
485   - case 'myDataParam' :
486   - idToSent = "wsd_"+data.records[0].get('text');
487   - break;
488   - default :
489   - return false;
490   - }
491   - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id);
492   - if (downModule)
493   - downModule.addParam(idToSent,data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
494   - return true;
495   - }
496   - });
497   - }
498   - }
499   - });
500   -
501   - this.paramGrid.on('cellclick', this.actionItem, this);
502   -
503   - this.TTGrid = Ext.create('Ext.grid.Panel', {
504   - flex: 2,
505   - store : Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}),
506   - columns: [
507   - { xtype: 'rownumberer', width: 20 },
508   - { header: "TimeTable/Catalog Name", dataIndex: 'name', flex:1, sortable: false, menuDisabled: true},
509   - {
510   - menuDisabled : true, width: 30, renderer: function(){
511   - return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>';
512   - }
513   - }
514   - ],
515   - listeners :
516   - {
517   - render : function(o,op)
518   - {
519   - var me = this;
520   - var el = me.body.dom;
521   - var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
522   - ddGroup: 'explorerTree',
523   - notifyEnter : function(ddSource, e, data)
524   - {
525   -
526   - },
527   - notifyOver : function(ddSource, e, data)
528   - {
529   - var nodeType = data.records[0].get('nodeType');
530   -
531   - if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') ||
532   - (nodeType == 'catalog' || nodeType == 'sharedCatalog') &&
533   - (data.records[0].get('leaf')))
534   - {
535   - this.valid = true;
536   - return this.dropAllowed;
537   - }
538   - this.valid = false;
539   - return this.dropNotAllowed;
540   - },
541   - notifyDrop : function(ddSource, e, data)
542   - {
543   - if (!this.valid)
544   - return false;
545   - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id);
546   - if (downModule)
547   - downModule.getUiContent().addTTdownload(data.records[0].get('text'),data.records[0].get('id'));
548   - return true;
549   - }
550   - });
551   - }
552   - }
553   - });
554   -
555   - this.TTGrid.on('cellclick', this.actionItem, this);
556   -
557   - var store = new Ext.data.ArrayStore({
558   - fields: ['id', 'name', 'qtip'],
559   - data: this.timeformatData
560   - });
561   -
562   - this.paramPanel = {
563   - xtype: 'container',
564   - title: 'Parameters',
565   - layout: {
566   - type: 'hbox',
567   - align : 'stretch',
568   - defaultMargins: {top: 10, left:10, bottom: 5, right:10}
569   - },
570   - items: [
571   - {
572   - xtype: 'container',
573   - flex: 2,
574   - layout: {
575   - type: 'vbox',
576   - align : 'stretch'
577   - },
578   - items: [
579   - {
580   - xtype: 'textfield',
581   - fieldLabel: 'Request Name',
582   - disabled: true,
583   - name : 'name'
584   - },
585   - {
586   - xtype: 'splitter',
587   - flex: 0.05
588   - },
589   - this.paramGrid
590   - ]
591   - },
592   - {
593   - xtype: 'container',
594   - flex: 2,
595   - defaults : {
596   - xtype : 'combo',
597   - labelWidth: 90,
598   - queryMode: 'local',
599   - editable: false
600   - },
601   - layout: {
602   - type: 'vbox',
603   - align: 'stretch'
604   - },
605   - items: [
606   - {
607   - fieldLabel: 'Time Format',
608   - name: 'timeformat',
609   - valueField: 'id',
610   - displayField: 'name',
611   - queryMode: 'local',
612   - store: store,
613   - listConfig: {
614   - tpl: [
615   - '<tpl for=".">',
616   - '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>',
617   - '</tpl>'
618   - ]
619   - },
620   - value: store.first()
621   - },
622   - {
623   - fieldLabel: 'File Structure',
624   - name: 'filestructure',
625   - store: this.filestructureData,
626   - value: this.filestructureData[2],
627   - listeners : {
628   - change : { fn : this.onFileStructureChange },
629   - scope: this
630   - }
631   - },
632   - {
633   - xtype: 'checkbox', boxLabel: 'Header in a separate file',
634   - boxLabelAlign: 'before',
635   - name: 'separateInfoFile', checked: false
636   -
637   - },
638   - {
639   - xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling',
640   - boxLabelAlign: 'before',
641   - name: 'refparamsampling', checked: false, disabled: true,
642   - listeners : {
643   - change : { fn : this.onRefParamSamplingChange },
644   - scope : this
645   - }
646   - },
647   - {
648   - xtype: 'numberfield', name: 'sampling',
649   - fieldLabel: 'Sampling Time', value: 600,
650   - hideTrigger: true, editable: true,
651   - disabled: true
652   - },
653   - {
654   - xtype : 'checkbox', boxLabel: 'Scientific floating-point formatting',
655   - boxLabelAlign: 'before',
656   - name: 'scientificformat', checked: false
657   - },
658   - {
659   - xtype: 'textfield', name: 'fileprefix',
660   - fieldLabel: 'File Prefix',
661   - disabled: false, editable: true
662   - },
663   - {
664   - fieldLabel: 'File Format',
665   - name: 'fileformat',
666   - store: this.fileformatData,
667   - value: this.fileformatData[0]
668   - },
669   - {
670   - fieldLabel: 'Compression',
671   - name: 'compression',
672   - store: this.filecompressData,
673   - value: this.filecompressData[0]
674   - },
675   - this.timeSelector
676   - ]
677   - }
678   - ]};
679   -
680   - this.ttPanel =
681   - {
682   - xtype: 'container',
683   - title: 'Time Tables / Catalogs',
684   - layout: {
685   - type: 'hbox',
686   - align : 'stretch',
687   - defaultMargins: { top: 10, left:10, bottom: 5, right:10 }
688   - },
689   - items: [
690   - this.TTGrid,
691   - {
692   - xtype: 'container',
693   - flex: 2,
694   - defaults : {
695   - xtype : 'combo',
696   - labelWidth: 90,
697   - queryMode: 'local',
698   - editable: false
699   - },
700   - layout: {
701   - type: 'vbox',
702   - align : 'stretch'
703   - },
704   - items: [{
705   - fieldLabel:'Time Format',
706   - name:'timeformatTT',
707   - store: this.timeformatTTData,
708   - value: this.timeformatTTData[0]
709   - },
710   - {
711   - fieldLabel: 'File Format ',
712   - name: 'fileformatTT',
713   - store: this.fileformatTTData,
714   - value: this.fileformatTTData[0]
715   - },
716   - {
717   - fieldLabel: 'Compression ',
718   - name: 'compressionTT',
719   - store: this.filecompressTT,
720   - value: this.filecompressTT[0]
721   - }
722   - ]}
723   - ]
724   - };
725   -
726   - this.formPanel = new Ext.form.Panel({
727   - layout: 'fit',
728   - region: 'center',
729   - bodyStyle: { background : '#dfe8f6' },
730   - buttonAlign: 'left',
731   - trackResetOnLoad: true, //reset to the last loaded record
732   - defaults: {
733   - border: false
734   - },
735   - items: [{
736   - xtype: 'tabpanel',
737   - activeTab : 0,
738   - bodyStyle: { background : '#dfe8f6' },
739   - items: [
740   - this.paramPanel,
741   - this.ttPanel
742   - ],
743   - listeners: {
744   - 'tabchange' : function (tabPanel, tab) {
745   - var sampAvailable = (tab.title == me.paramPanel.title);
746   - me.down('sendToSampButton').setDisabled(!sampAvailable);
747   - }
748   - }
749   - }],
750   - fbar: [
751   - {
752   - text: 'Download',
753   - scope : this,
754   - handler: function(button){
755   - // if the return is true (object had been updated)
756   - if(this.updateObject()){
757   - // launch the download process
758   - this.doDownload();
759   - }
760   - }
761   - },
762   - {
763   - text: 'Reset',
764   - scope : this,
765   - handler: function(){
766   - this.formPanel.getForm().reset();
767   - var tabPanel = this.formPanel.down();
768   - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab());
769   - if (downloadSrc === 0) {
770   - // reset parameters and Time Tables in Get Data
771   - this.paramGrid.store.removeAll();
772   - this.timeSelector.TTGrid.store.removeAll();
773   - }
774   - else {
775   - // reset Time Tables in Get time Table
776   - this.TTGrid.store.removeAll();
777   - }
778   - }
779   - },
780   - '->',
781   - {
782   - xtype : 'sendToSampButton',
783   - type : 'votable',
784   - onSendToSamp : this.onSendVOTableToSamp,
785   - sendOpt : {scope : this}
786   - }]
787   - });
788   -
789   - var myConf = {
790   - layout: 'border',
791   - items: [
792   - this.formPanel,
793   - {
794   - xtype: 'panel',
795   - region: 'south',
796   - title: 'Information',
797   - collapsible: true,
798   - collapseMode: 'header',
799   - height: 100,
800   - autoHide: false,
801   - bodyStyle: 'padding:5px',
802   - iconCls: 'icon-information',
803   - loader: {
804   - autoLoad: true,
805   - url: helpDir + 'downloadHOWTO'
806   - }
807   - }
808   - ],
809   - plugins: [ {ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}]
810   - };
811   -
812   - Ext.apply (this, Ext.apply(arguments, myConf));
813   - }
  15 + requires: [
  16 + 'amdaUI.TimeSelectorUI',
  17 + 'amdaUI.ParamArgumentsPlug',
  18 + 'amdaUI.SendToSampButtonUI',
  19 + 'amdaModel.DownloadParam'
  20 + ],
  21 +
  22 + //Old kernel time formats
  23 + //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']],
  24 + //New kernel time formats
  25 + timeformatData: [['YYYY-MM-DDThh:mm:ss', 'YYYY-MM-DDThh:mm:ss.ms', 'ISO format with msecs'],
  26 + ['DD Time', 'YYYYDOYhhmmssms', 'Day-Of-Year, 1 Jan : DOY = 0'],
  27 + ['Timestamp', 'Seconds from 1970', 'Total of seconds from the Unix Epoch on January 1st, 1970 at UTC.'],
  28 + ['YYYY MM DD hh mm ss', 'YYYY MM DD hh mm ss ms', 'date with spaces'],
  29 + ['Timestamp-with-milliseconds', 'Seconds from 1970 with ms', 'Total of seconds from the Unix Epoch with milliseconds.']],
  30 + timeformatTTData: [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss']],
  31 + fileformatData: [['ASCII', 'ASCII'], ['vot', 'VOTable'], ['cdf', 'CDF'], ['json', 'JSON']],
  32 + fileformatTTData: [['text', 'plain text'], ['vot', 'VOTable']],
  33 + filecompressData: [['zip', 'zip'], ['tar+gzip', 'tar+gzip']],
  34 + filecompressTT: [['zip', 'zip'], ['tar+gzip', 'tar+gzip'], ['none', 'none']],
  35 + filestructureData: [['0', 'All In One File'], ['1', 'One File Per Time Interval'], ['2', 'One File Per Param/Interval']],
  36 +
  37 + constructor: function (config) {
  38 + this.init(config);
  39 + this.callParent(arguments);
  40 + // load object into view
  41 + if (this.object)
  42 + this.loadObject();
  43 + //
  44 + var paramArgsPlug = this.getPlugin('download-param-arguments-plugin');
  45 + if (paramArgsPlug)
  46 + paramArgsPlug.onApply = this.onApplyParameterArgs;
  47 + },
  48 +
  49 + addTT: function (newTTName, newTTid)
  50 + {
  51 + var tabPanel = this.formPanel.down();
  52 + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab());
  53 +
  54 + if (downloadSrc === 0) {
  55 + this.timeSelector.addTT(newTTName, newTTid);
  56 + } else {
  57 + // search for an existing record in store with this unique name
  58 + var existingIndex = this.TTGrid.store.findExact('name', newTTName);
  59 + // if no corresponding TT found
  60 + if (existingIndex == -1) {
  61 + // adding the time table to the TTGrid of TT download
  62 + var r = Ext.create('amdaModel.TTobject', {id: newTTid, name: newTTName});
  63 + this.TTGrid.store.insert(this.TTGrid.store.getCount(), r);
  64 + }
  65 + }
  66 + },
  67 +
  68 + addTTs: function (TTarray) {
  69 + // set TTTab
  70 + this.timeSelector.setTTTab(TTarray);
  71 + },
  72 +
  73 + // Add TT in download TT module
  74 + addTTdownload: function (newTTName, newTTid) {
  75 + var tabPanel = this.formPanel.down();
  76 + tabPanel.setActiveTab(1);
  77 + this.addTT(newTTName, newTTid);
  78 +
  79 + },
  80 +
  81 + /**
  82 + * Set Start-Stop from parameter info (Local & MyData)
  83 + */
  84 + setTimeFromData: function (obj) {
  85 + if (!obj.start || !obj.stop)
  86 + return;
  87 + var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/'));
  88 + var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/'));
  89 +
  90 + this.down('form').getForm().setValues({startDate: dateStart, stopDate: dateStop});
  91 + this.timeSelector.intervalSel.updateDuration();
  92 + },
  93 +
  94 + addParam: function (paramId, isLeaf, needArgs, components)
  95 + {
  96 + // adding the parameter to the paramGrid
  97 + var paramObj = {
  98 + paramid: paramId,
  99 + type: 0,
  100 + 'dim1-is-range': false,
  101 + 'dim1-min-range': 0.,
  102 + 'dim1-max-range': 0.,
  103 + 'dim1-index': '*',
  104 + 'dim2-is-range': false,
  105 + 'dim2-min-range': 0.,
  106 + 'dim2-max-range': 0.,
  107 + 'dim2-index': '*',
  108 + template_args: {}
  109 + };
  110 +
  111 + if (components) {
  112 + if (components['index1']) {
  113 + paramObj['dim1-index'] = components['index1'];
  114 + ++paramObj['type'];
  115 + }
  116 +
  117 + if (components['index2']) {
  118 + paramObj['dim2-index'] = components['index2'];
  119 + ++paramObj['type'];
  120 + }
  121 + }
  122 +
  123 + var r = Ext.create('amdaModel.DownloadParam', paramObj);
  124 + var pos = this.paramGrid.store.getCount();
  125 + this.paramGrid.store.insert(pos, r);
  126 + this.paramGrid.getView().refresh();
  127 +
  128 + if (needArgs)
  129 + this.editParameterArgs(r);
  130 + },
  131 +
  132 + addParams: function (arrayParams)
  133 + {
  134 + var arrayRec = new Array();
  135 + var index = 1;
  136 +
  137 + if (arrayParams)
  138 + {
  139 + Ext.Array.each(arrayParams, function (item) {
  140 + if (Ext.isObject(item)) {
  141 + // handel case of derived parameters
  142 + var patt = new RegExp("ws_");
  143 + if (typeof paramId !== 'undefined' && ! patt.test(item.paramid))
  144 + {
  145 + // for Parameter Name in Download Module
  146 + var paramObj = {
  147 + paramid: paramId,
  148 + type: 0,
  149 + 'dim1-is-range': false,
  150 + 'dim1-min-range': 0.,
  151 + 'dim1-max-range': 0.,
  152 + 'dim1-index': item.get('dim1'),
  153 + 'dim2-is-range': false,
  154 + 'dim2-min-range': 0.,
  155 + 'dim2-max-range': 0.,
  156 + 'dim2-index': item.get('dim2'),
  157 + template_args: {}
  158 + };
  159 +
  160 + var r = Ext.create('amdaModel.DownloadParam', paramObj);
  161 + } else
  162 + {
  163 + //for download from get Data in Plot module
  164 + var r = Ext.create('amdaModel.DownloadParam', item);
  165 + }
  166 +
  167 + } else {
  168 + // for Download By Request in Operations menu
  169 + //TODO BRE - Components selection
  170 + var r = Ext.create('amdaModel.DownloadParam', {paramid: item});
  171 + }
  172 + arrayRec.push(r);
  173 + });
  174 + }
  175 + this.paramGrid.getStore().loadData(arrayRec);
  176 + },
  177 +
  178 + // parameter name -> alias
  179 + updateConstruct: function (oldval, newval) {
  180 + var index = this.paramGrid.store.findExact('name', oldval);
  181 + if (index != -1) {
  182 + this.paramGrid.getStore().getAt(index).set('name', newval);
  183 + this.paramGrid.getStore().getAt(index).set('text', newval);
  184 + }
  185 + },
  186 +
  187 + setObject: function (obj) {
  188 + this.object = obj;
  189 + this.loadObject();
  190 + },
  191 +
  192 + /**
  193 + * update this.object from form
  194 + */
  195 + updateObject: function ()
  196 + {
  197 + // get the basic form
  198 + var tabPanel = this.formPanel.down();
  199 + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab());
  200 + var basicForm = this.formPanel.getForm();
  201 + var updateStatus = true;
  202 + var values = basicForm.getValues();
  203 +
  204 + // data download
  205 + if (downloadSrc === 0)
  206 + {
  207 + var timeformat = values.timeformat;
  208 + var timeSource = this.timeSelector.getActiveTimeSource();
  209 + var structure = values.filestructure;
  210 + var sampling = values.sampling ? values.sampling : 600;
  211 + var refparamSampling = values.refparamsampling == 'on';
  212 + var fileprefix = values.fileprefix ? values.fileprefix : '';
  213 + var fileformat = values.fileformat;
  214 + var compression = values.compression;
  215 +
  216 + var fieldsWithoutName = basicForm.getFields().items;
  217 + Ext.Array.each(fieldsWithoutName, function (item, index, allItems) {
  218 + if (!item.isValid()) {
  219 + if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) &&
  220 + ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) {
  221 + updateStatus = true;
  222 + } else {
  223 + // set update isn't allowed
  224 + updateStatus = false;
  225 + return false;
  226 + }
  227 + }
  228 + }, this);
  229 +
  230 + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
  231 + && this.timeSelector.TTGrid.getStore().count() == 0) {
  232 + myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!'
  233 + + '<br>You must add one or choose Time Selection `by Interval`');
  234 + updateStatus = false;
  235 + }
  236 +
  237 + if (updateStatus)
  238 + {
  239 + /// real object update
  240 + // update TimeTable object with the content of form
  241 + basicForm.updateRecord(this.object);
  242 + this.object.set('timesrc', timeSource);
  243 + // set valid intervals into TimeTable object
  244 + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
  245 + this.object.set('timeTables', this.timeSelector.TTGrid.getStore().data.items);
  246 + // set parameters
  247 + this.object.set('list', this.paramGrid.getStore().data.items);
  248 + this.object.set('structure', structure);
  249 + this.object.set('refparamSampling', refparamSampling);
  250 + this.object.set('sampling', sampling);
  251 + this.object.set('fileprefix', fileprefix);
  252 + this.object.set('timeformat', timeformat);
  253 + this.object.set('fileformat', fileformat);
  254 + this.object.set('compression', compression);
  255 + }
  256 + }
  257 + //TT download
  258 + else
  259 + {
  260 + var timeformat = values.timeformatTT;
  261 + var compression = values.compressionTT;
  262 + var fileformat = values.fileformatTT;
  263 + if (compression === 'none'
  264 + && this.TTGrid.getStore().count() > 1) {
  265 + myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please');
  266 + updateStatus = false;
  267 + }
  268 + this.object.set('timeTables', this.TTGrid.getStore().data.items);
  269 + this.object.set('timeformatTT', timeformat);
  270 + this.object.set('fileformatTT', fileformat);
  271 + this.object.set('compressionTT', compression);
  272 + }
  273 +
  274 + this.object.set('downloadSrc', downloadSrc);
  275 + // return the update status
  276 + return updateStatus;
  277 + },
  278 +
  279 + /**
  280 + * load this.object into form
  281 + */
  282 + loadObject: function () {
  283 +
  284 + if (!this.object.get('timeformat'))
  285 + this.object.set('timeformat', this.timeformatData[0][0]);
  286 +
  287 + if (!this.object.get('timeformatTT'))
  288 + this.object.set('timeformatTT', this.timeformatTTData[0][0]);
  289 +
  290 + if (!this.object.get('fileformat'))
  291 + this.object.set('fileformat', this.fileformatData[0][0]);
  292 +
  293 + if (!this.object.get('fileformatTT'))
  294 + this.object.set('fileformatTT', this.fileformatTTData[0][0]);
  295 +
  296 + if (!this.object.get('compression'))
  297 + this.object.set('compression', this.filecompressData[1][0]);
  298 +
  299 + if (!this.object.get('compressionTT'))
  300 + this.object.set('compressionTT', this.filecompressData[1][0]);
  301 +
  302 + // load object into form
  303 + this.formPanel.getForm().loadRecord(this.object);
  304 + // set object's TTs into the timeselector
  305 + this.addTTs(this.object.get('timeTables'));
  306 + // set parameters
  307 + this.addParams(this.object.get('list'));
  308 + },
  309 +
  310 + /**
  311 + * download method called by 'Download' button to launch the download process
  312 + */
  313 + doDownload: function (sendToSamp, clientId) {
  314 + var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id);
  315 + if (downloadModule)
  316 + downloadModule.linkedNode.execute(sendToSamp, clientId);
  317 + },
  318 +
  319 + actionItem: function (grid, cell, cellIndex, record, row, recordIndex, e) {
  320 +
  321 + var isTimeTable = record instanceof amdaModel.TTobject;
  322 +
  323 + if (cellIndex == 3 || (cellIndex == 2 && isTimeTable))
  324 + grid.getStore().remove(record);
  325 + else if (cellIndex == 2) {
  326 + this.paramGrid.getView().select(row);
  327 + this.editParameterArgs(record);
  328 + }
  329 + },
  330 +
  331 + editParameterArgs: function (record) {
  332 + var paramArgsPlug = this.getPlugin('download-param-arguments-plugin');
  333 + if (paramArgsPlug)
  334 + paramArgsPlug.show('download-param-arguments-plugin', record);
  335 + },
  336 +
  337 + onApplyParameterArgs: function (parentUI, paramObject) {
  338 + parentUI.paramGrid.getView().refresh();
  339 + },
  340 +
  341 + onFileStructureChange: function (combo, newValue, oldValue) {
  342 + if (!this.formPanel)
  343 + return;
  344 +
  345 + var refParamCheck = this.formPanel.getForm().findField('refparamsampling');
  346 + var samplingField = this.formPanel.getForm().findField('sampling');
  347 +
  348 + if (samplingField && newValue !== oldValue) {
  349 + refParamCheck.setDisabled(newValue == 2);
  350 + samplingField.setDisabled((newValue == 2) || refParamCheck.getValue());
  351 + }
  352 + },
  353 +
  354 + onRefParamSamplingChange: function (check, newValue, oldValue) {
  355 + if (!this.formPanel)
  356 + return;
  357 +
  358 + var samplingField = this.formPanel.getForm().findField('sampling');
  359 + var structureCombo = this.formPanel.getForm().findField('filestructure');
  360 +
  361 + if (samplingField && newValue !== oldValue)
  362 + samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue());
  363 + },
  364 +
  365 + onSendVOTableToSamp: function (clientId, sendOpt) {
  366 + var me = sendOpt.scope;
  367 + if (me.updateObject()) {
  368 + me.doDownload(true, clientId);
  369 + }
  370 + },
  371 +
  372 + /**
  373 + * Check if changes were made before closing window
  374 + * @return false
  375 + */
  376 + fclose: function () {
  377 + return false;
  378 + },
  379 +
  380 + init: function (config) {
  381 + var me = this;
  382 +
  383 + this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector', flex: 1});
  384 +
  385 + this.paramGrid = Ext.create('Ext.grid.Panel', {
  386 + flex: 2,
  387 + store: Ext.create('Ext.data.Store', {model: 'amdaModel.DownloadParam'}),
  388 + columns: [
  389 + {xtype: 'rownumberer', width: 20},
  390 + {
  391 + header: "Parameter Name",
  392 + dataIndex: 'name',
  393 + flex: 1,
  394 + sortable: false,
  395 + menuDisabled: true,
  396 + renderer: function (val, meta, rec) {
  397 + return rec.getParamFullName();
  398 + }
  399 + },
  400 + {
  401 + menuDisabled: true, width: 30, renderer: function () {
  402 + return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>';
  403 + }
  404 + },
  405 + {
  406 + menuDisabled: true, width: 30, renderer: function () {
  407 + return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>';
  408 + }
  409 + }
  410 + ],
  411 + //TODO - BRE - Wait the fix for drag&drop issue
  412 + listeners:
  413 + {
  414 + render: function (o, op)
  415 + {
  416 + var me = this;
  417 + var el = me.body.dom;
  418 + var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
  419 + ddGroup: 'explorerTree',
  420 + notifyEnter: function (ddSource, e, data) { },
  421 + notifyOver: function (ddSource, e, data)
  422 + {
  423 + if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet'))
  424 + {
  425 + this.valid = false;
  426 + return this.dropNotAllowed;
  427 + }
  428 + if (((data.records[0].data.nodeType == 'localParam') ||
  429 + (data.records[0].data.nodeType == 'remoteParam') ||
  430 + (data.records[0].data.nodeType == 'remoteSimuParam') ||
  431 + (data.records[0].data.nodeType == 'derivedParam') ||
  432 + (data.records[0].data.nodeType == 'myDataParam') ||
  433 + (data.records[0].data.nodeType == 'alias')) &&
  434 + (data.records[0].isLeaf() || data.records[0].data.isParameter) &&
  435 + !data.records[0].data.disable)
  436 + {
  437 + this.valid = true;
  438 + return this.dropAllowed;
  439 + }
  440 +
  441 + this.valid = false;
  442 + return this.dropNotAllowed;
  443 + },
  444 + notifyDrop: function (ddSource, e, data)
  445 + {
  446 + if (!this.valid)
  447 + return false;
  448 + var idToSent;
  449 + var components = null;
  450 + switch (data.records[0].data.nodeType)
  451 + {
  452 + case 'localParam' :
  453 + case 'remoteParam':
  454 + case 'remoteSimuParam':
  455 + idToSent = data.records[0].get('id');
  456 + if (data.records[0].get('alias') != "")
  457 + idToSent = "#" + data.records[0].get('alias');
  458 + var component_info = data.records[0].get('component_info');
  459 + if (component_info && component_info.parentId)
  460 + {
  461 + if (component_info.index1 || component_info.index2)
  462 + {
  463 + idToSent = component_info.parentId;
  464 + components = [];
  465 + if (component_info.index1)
  466 + components['index1'] = component_info.index1;
  467 + if (component_info.index2)
  468 + components['index2'] = component_info.index2;
  469 + }
  470 + if (data.records[0].get('needsArgs'))
  471 + {
  472 + idToSent = component_info.parentId;
  473 + if (component_info.index1)
  474 + {
  475 + components = [];
  476 + components['index1'] = component_info.index1;
  477 + }
  478 + }
  479 + }
  480 + break;
  481 + case 'alias' :
  482 + idToSent = "#" + data.records[0].get('text');
  483 + break;
  484 + case 'derivedParam' :
  485 + if (data.records[0].modelName == 'amdaModel.DerivedParamComponentNode')
  486 + {
  487 + paramId = data.records[0].get('text');
  488 + var parentId = paramId.substr(0, paramId.length - 3);
  489 + idToSent = "ws_" + parentId;
  490 + var regExp = /\(([\d]+)\)/;
  491 + var component_index = regExp.exec(paramId);
  492 + if (component_index)
  493 + {
  494 + components = [];
  495 + components['index1'] = component_index[1];
  496 + }
  497 + break;
  498 + } else
  499 + {
  500 + idToSent = "ws_" + data.records[0].get('text');
  501 + }
  502 + break;
  503 + case 'myDataParam' :
  504 + idToSent = "ws_" + data.records[0].get('text');
  505 + break;
  506 + default :
  507 + return false;
  508 + }
  509 + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id);
  510 + if (downModule)
  511 + downModule.addParam(idToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  512 + return true;
  513 + }
  514 + });
  515 + }
  516 + }
  517 + });
  518 +
  519 + this.paramGrid.on('cellclick', this.actionItem, this);
  520 +
  521 + this.TTGrid = Ext.create('Ext.grid.Panel', {
  522 + flex: 2,
  523 + store: Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}),
  524 + columns: [
  525 + {xtype: 'rownumberer', width: 20},
  526 + {header: "TimeTable/Catalog Name", dataIndex: 'name', flex: 1, sortable: false, menuDisabled: true},
  527 + {
  528 + menuDisabled: true, width: 30, renderer: function () {
  529 + return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>';
  530 + }
  531 + }
  532 + ],
  533 + listeners:
  534 + {
  535 + render: function (o, op)
  536 + {
  537 + var me = this;
  538 + var el = me.body.dom;
  539 + var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
  540 + ddGroup: 'explorerTree',
  541 + notifyEnter: function (ddSource, e, data)
  542 + {
  543 +
  544 + },
  545 + notifyOver: function (ddSource, e, data)
  546 + {
  547 + var nodeType = data.records[0].get('nodeType');
  548 +
  549 + if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') ||
  550 + (nodeType == 'catalog' || nodeType == 'sharedCatalog') &&
  551 + (data.records[0].get('leaf')))
  552 + {
  553 + this.valid = true;
  554 + return this.dropAllowed;
  555 + }
  556 + this.valid = false;
  557 + return this.dropNotAllowed;
  558 + },
  559 + notifyDrop: function (ddSource, e, data)
  560 + {
  561 + if (!this.valid)
  562 + return false;
  563 + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id);
  564 + if (downModule)
  565 + downModule.getUiContent().addTTdownload(data.records[0].get('text'), data.records[0].get('id'));
  566 + return true;
  567 + }
  568 + });
  569 + }
  570 + }
  571 + });
  572 +
  573 + this.TTGrid.on('cellclick', this.actionItem, this);
  574 +
  575 + var store = new Ext.data.ArrayStore({
  576 + fields: ['id', 'name', 'qtip'],
  577 + data: this.timeformatData
  578 + });
  579 +
  580 + this.paramPanel = {
  581 + xtype: 'container',
  582 + title: 'Parameters',
  583 + layout: {
  584 + type: 'hbox',
  585 + align: 'stretch',
  586 + defaultMargins: {top: 10, left: 10, bottom: 5, right: 10}
  587 + },
  588 + items: [
  589 + {
  590 + xtype: 'container',
  591 + flex: 2,
  592 + layout: {
  593 + type: 'vbox',
  594 + align: 'stretch'
  595 + },
  596 + items: [
  597 + {
  598 + xtype: 'textfield',
  599 + fieldLabel: 'Request Name',
  600 + disabled: true,
  601 + name: 'name'
  602 + },
  603 + {
  604 + xtype: 'splitter',
  605 + flex: 0.05
  606 + },
  607 + this.paramGrid
  608 + ]
  609 + },
  610 + {
  611 + xtype: 'container',
  612 + flex: 2,
  613 + defaults: {
  614 + xtype: 'combo',
  615 + labelWidth: 90,
  616 + queryMode: 'local',
  617 + editable: false
  618 + },
  619 + layout: {
  620 + type: 'vbox',
  621 + align: 'stretch'
  622 + },
  623 + items: [
  624 + {
  625 + fieldLabel: 'Time Format',
  626 + name: 'timeformat',
  627 + valueField: 'id',
  628 + displayField: 'name',
  629 + queryMode: 'local',
  630 + store: store,
  631 + listConfig: {
  632 + tpl: [
  633 + '<tpl for=".">',
  634 + '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>',
  635 + '</tpl>'
  636 + ]
  637 + },
  638 + value: store.first()
  639 + },
  640 + {
  641 + fieldLabel: 'File Structure',
  642 + name: 'filestructure',
  643 + store: this.filestructureData,
  644 + value: this.filestructureData[2],
  645 + listeners: {
  646 + change: {fn: this.onFileStructureChange},
  647 + scope: this
  648 + }
  649 + },
  650 + {
  651 + xtype: 'checkbox', boxLabel: 'Header in a separate file',
  652 + boxLabelAlign: 'before',
  653 + name: 'separateInfoFile', checked: false
  654 +
  655 + },
  656 + {
  657 + xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling',
  658 + boxLabelAlign: 'before',
  659 + name: 'refparamsampling', checked: false, disabled: true,
  660 + listeners: {
  661 + change: {fn: this.onRefParamSamplingChange},
  662 + scope: this
  663 + }
  664 + },
  665 + {
  666 + xtype: 'numberfield', name: 'sampling',
  667 + fieldLabel: 'Sampling Time', value: 600,
  668 + hideTrigger: true, editable: true,
  669 + disabled: true
  670 + },
  671 + {
  672 + xtype: 'checkbox', boxLabel: 'Scientific floating-point formatting',
  673 + boxLabelAlign: 'before',
  674 + name: 'scientificformat', checked: false
  675 + },
  676 + {
  677 + xtype: 'textfield', name: 'fileprefix',
  678 + fieldLabel: 'File Prefix',
  679 + disabled: false, editable: true
  680 + },
  681 + {
  682 + fieldLabel: 'File Format',
  683 + name: 'fileformat',
  684 + store: this.fileformatData,
  685 + value: this.fileformatData[0]
  686 + },
  687 + {
  688 + fieldLabel: 'Compression',
  689 + name: 'compression',
  690 + store: this.filecompressData,
  691 + value: this.filecompressData[0]
  692 + },
  693 + this.timeSelector
  694 + ]
  695 + }
  696 + ]};
  697 +
  698 + this.ttPanel =
  699 + {
  700 + xtype: 'container',
  701 + title: 'Time Tables / Catalogs',
  702 + layout: {
  703 + type: 'hbox',
  704 + align: 'stretch',
  705 + defaultMargins: {top: 10, left: 10, bottom: 5, right: 10}
  706 + },
  707 + items: [
  708 + this.TTGrid,
  709 + {
  710 + xtype: 'container',
  711 + flex: 2,
  712 + defaults: {
  713 + xtype: 'combo',
  714 + labelWidth: 90,
  715 + queryMode: 'local',
  716 + editable: false
  717 + },
  718 + layout: {
  719 + type: 'vbox',
  720 + align: 'stretch'
  721 + },
  722 + items: [{
  723 + fieldLabel: 'Time Format',
  724 + name: 'timeformatTT',
  725 + store: this.timeformatTTData,
  726 + value: this.timeformatTTData[0]
  727 + },
  728 + {
  729 + fieldLabel: 'File Format ',
  730 + name: 'fileformatTT',
  731 + store: this.fileformatTTData,
  732 + value: this.fileformatTTData[0]
  733 + },
  734 + {
  735 + fieldLabel: 'Compression ',
  736 + name: 'compressionTT',
  737 + store: this.filecompressTT,
  738 + value: this.filecompressTT[0]
  739 + }
  740 + ]}
  741 + ]
  742 + };
  743 +
  744 + this.formPanel = new Ext.form.Panel({
  745 + layout: 'fit',
  746 + region: 'center',
  747 + bodyStyle: {background: '#dfe8f6'},
  748 + buttonAlign: 'left',
  749 + trackResetOnLoad: true, //reset to the last loaded record
  750 + defaults: {
  751 + border: false
  752 + },
  753 + items: [{
  754 + xtype: 'tabpanel',
  755 + activeTab: 0,
  756 + bodyStyle: {background: '#dfe8f6'},
  757 + items: [
  758 + this.paramPanel,
  759 + this.ttPanel
  760 + ],
  761 + listeners: {
  762 + 'tabchange': function (tabPanel, tab) {
  763 + var sampAvailable = (tab.title == me.paramPanel.title);
  764 + me.down('sendToSampButton').setDisabled(!sampAvailable);
  765 + }
  766 + }
  767 + }],
  768 + fbar: [
  769 + {
  770 + text: 'Download',
  771 + scope: this,
  772 + handler: function (button) {
  773 + // if the return is true (object had been updated)
  774 + if (this.updateObject()) {
  775 + // launch the download process
  776 + this.doDownload();
  777 + }
  778 + }
  779 + },
  780 + {
  781 + text: 'Reset',
  782 + scope: this,
  783 + handler: function () {
  784 + this.formPanel.getForm().reset();
  785 + var tabPanel = this.formPanel.down();
  786 + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab());
  787 + if (downloadSrc === 0) {
  788 + // reset parameters and Time Tables in Get Data
  789 + this.paramGrid.store.removeAll();
  790 + this.timeSelector.TTGrid.store.removeAll();
  791 + } else {
  792 + // reset Time Tables in Get time Table
  793 + this.TTGrid.store.removeAll();
  794 + }
  795 + }
  796 + },
  797 + '->',
  798 + {
  799 + xtype: 'sendToSampButton',
  800 + type: 'votable',
  801 + onSendToSamp: this.onSendVOTableToSamp,
  802 + sendOpt: {scope: this}
  803 + }]
  804 + });
  805 +
  806 + var myConf = {
  807 + layout: 'border',
  808 + items: [
  809 + this.formPanel,
  810 + {
  811 + xtype: 'panel',
  812 + region: 'south',
  813 + title: 'Information',
  814 + collapsible: true,
  815 + collapseMode: 'header',
  816 + height: 100,
  817 + autoHide: false,
  818 + bodyStyle: 'padding:5px',
  819 + iconCls: 'icon-information',
  820 + loader: {
  821 + autoLoad: true,
  822 + url: helpDir + 'downloadHOWTO'
  823 + }
  824 + }
  825 + ],
  826 + plugins: [{ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}]
  827 + };
  828 +
  829 + Ext.apply(this, Ext.apply(arguments, myConf));
  830 + }
814 831 });
... ...
js/app/views/ExplorerUI.js
... ... @@ -575,13 +575,13 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
575 575 });
576 576 }
577 577  
578   - if (record.isLeaf() || record.data.isParameter)
  578 + if (record.isLeaf() || record.data.isParameter)
579 579 switch (record.get('nodeType'))
580 580 {
581 581 case 'myData' :
582 582 case 'myDataParam' :
583 583 case 'derivedParam' :
584   - case 'timeTable' :
  584 + case 'timeTable' :
585 585 case 'sharedtimeTable' :
586 586 case 'sharedcatalog' :
587 587 case 'catalog' :
... ...
js/app/views/ParamArgumentsUI.js
... ... @@ -59,6 +59,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
59 59 onReady(uiScope);
60 60 me.unmask();
61 61 });
  62 +
62 63 }
63 64 else
64 65 me.unmask();
... ... @@ -70,12 +71,11 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
70 71 this.rebuildArguments(paramInfoResult, uiScope);
71 72 //Set parameter type (scalar, vector or Tab2D)
72 73 this.paramRequestObject.set('type', this.paramType);
73   -
74 74 //Add default template args values
75 75 var templateArgsValues = this.paramRequestObject.get('template_args');
76 76 if (!templateArgsValues)
77 77 templateArgsValues = {};
78   - if (paramInfoResult.template && paramInfoResult.template.arguments) {
  78 + if (paramInfoResult.template && paramInfoResult.template.arguments) {
79 79 //Add default template args definition if needed
80 80 Ext.Object.each(paramInfoResult.template.arguments, function (argKey, argDef) {
81 81 if (!templateArgsValues[argKey])
... ... @@ -464,4 +464,4 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
464 464 }
465 465 });
466 466 }
467   -});
468 467 \ No newline at end of file
  468 +});
... ...
js/app/views/ParameterUI.js
... ... @@ -28,7 +28,6 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
28 28 // load object into form
29 29 this.formPanel.getForm().loadRecord(this.object);
30 30 var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin');
31   -
32 31 if (paramArgsPlug)
33 32 paramArgsPlug.onApply = this.onApplyParameterArgs;
34 33 },
... ... @@ -49,7 +48,8 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
49 48  
50 49 addParam : function(newParamName, isLeaf, needArgs, components)
51 50 {
52   - if (!isLeaf || needArgs || components)
  51 + //if (!isLeaf || needArgs || components)
  52 + if ( needArgs )
53 53 this.editParameterArgs(newParamName, components);
54 54 else
55 55 this.addParamInEditor(newParamName);
... ... @@ -85,7 +85,6 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
85 85 }
86 86  
87 87 var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin');
88   -
89 88 if (paramArgsPlug) {
90 89 var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj);
91 90 paramArgsPlug.show('derived-param-arguments-plugin', workinRequestParamObject);
... ... @@ -140,25 +139,47 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
140 139 this.constructionField.setValue(expression);
141 140 },
142 141  
143   - /**
144   - * Parameter compilation
145   - */
146   - compilParam : function($action)
147   - {
148   - var obj = {
149   - paramId : 'ws_'+this.object.get('name')
150   - };
151   - AmdaAction.compilParam(obj, function (result, e) {
152   - if (!result || !result.success)
153   - {
154   - if (result.message)
155   - myDesktopApp.warningMsg(result.message);
156   - else
157   - myDesktopApp.warningMsg('Unknown error during parameter compilation');
158   - return;
159   - }
160   - });
161   - },
  142 +
  143 + /**
  144 + * Generate info for parameter desplay
  145 + */
  146 + generateParamInfo : function(onSuccess)
  147 + {
  148 + var me = this;
  149 + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
  150 +
  151 + var obj = {
  152 + paramId : 'ws_'+this.object.get('name'),
  153 + buildchain:this.object.get('buildchain'),
  154 + timestep:this.object.get('timestep')
  155 + };
  156 + loadMask.show();
  157 + AmdaAction.generateParamInfo(obj, function (result, e) {
  158 + if (!result || !result.success)
  159 + {
  160 + loadMask.hide();
  161 + if (result.message)
  162 + myDesktopApp.warningMsg(result.message);
  163 + else
  164 + myDesktopApp.warningMsg('Unknown error during parameter compilation');
  165 + return;
  166 + }
  167 + loadMask.hide();
  168 + paramModule.linkedNode.get('object').set('dim_1', parseInt(result.dimensions.dim_1));
  169 + paramModule.linkedNode.get('object').set('dim_2', parseInt(result.dimensions.dim_2));
  170 + if (onSuccess)
  171 + onSuccess();
  172 +/* paramModule.linkedNode.update({scope : me,
  173 + failure: function(record, operation) {
  174 +
  175 + },
  176 + callback: function() {
  177 + }
  178 + });
  179 + */
  180 + });
  181 + },
  182 +
162 183  
163 184 /**
164 185 * save method called by Save button
... ... @@ -187,16 +208,21 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
187 208 //synchronize objects
188 209 this.object = paramobj;
189 210 if (toRename) paramModule.linkedNode.toRename = true;
190   - }
191   - paramModule.linkedNode.create({scope : this, callback : this.compilParam});
192   - paramModule.linkedNode.set('iconCls', 'icon-scalar');
193   - paramModule.linkedNode.set('isParameter', true);
  211 + }
  212 + this.generateParamInfo(function () {
  213 + paramModule.linkedNode.set('isParameter', true);
  214 + paramModule.linkedNode.create({scope : this, callback : function() {
  215 + }});
  216 + });
194 217 } else
195 218 {
196 219 paramModule.linkedNode.set('contextNode',paramModule.contextNode);
197   - paramModule.linkedNode.update({scope : this, callback : this.compilParam});
  220 + this.generateParamInfo(function () {
  221 + paramModule.linkedNode.update({scope : this, callback : function() {
  222 + }});
  223 + });
198 224 }
199   - }
  225 + }
200 226 },
201 227  
202 228 /**
... ... @@ -320,11 +346,11 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
320 346 return this.dropNotAllowed;
321 347 },
322 348 notifyDrop : function(ddSource, e, data)
323   - {
  349 + {
324 350 if (!this.valid)
325 351 return false;
326 352 var nameToSent;
327   - var components = null;
  353 + var components = null;
328 354 switch (data.records[0].get('nodeType'))
329 355 {
330 356 case 'localParam' :
... ... @@ -374,6 +400,7 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
374 400 }
375 401 break;
376 402 default :
  403 +
377 404 return false;
378 405 }
379 406 var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
... ... @@ -512,7 +539,7 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
512 539  
513 540 me.fieldName.validFlag = true;
514 541 me.fieldName.validate();
515   - me.saveProcess(false);
  542 + me.saveProcess(false);
516 543 });
517 544 }
518 545 }
... ...
js/app/views/PlotComponents/PlotParamForm.js
... ... @@ -101,7 +101,6 @@ Ext.define(&#39;amdaPlotComp.PlotParamForm&#39;, {
101 101 drawingOptionsForm.crtTree = this.crtTree;
102 102 if (drawingOptionsForm.setObject)
103 103 drawingOptionsForm.setObject(this.object);
104   -
105 104 if (this.paramArgs && paramId)
106 105 this.paramArgs.editParameter(this.object, this, function (uiScope) {
107 106 uiScope.crtTree.refresh();
... ... @@ -125,7 +124,6 @@ Ext.define(&#39;amdaPlotComp.PlotParamForm&#39;, {
125 124 });
126 125  
127 126 //ToDoparamArgsPlug
128   -
129 127 var paramInfoFieldSet = this.addStandardFieldSet('Arguments', '', [this.paramArgs]);
130 128 paramInfoFieldSet.collapsed = false;
131 129  
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -308,25 +308,24 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
308 308 },
309 309 notifyDrop: function(ddSource, e, data) {
310 310 var selectedRecord = ddSource.dragData.records[0];
311   -
312 311 switch (selectedRecord.$className)
313 312 {
314 313 case 'amdaModel.LocalParamNode' :
315   - case 'amdaModel.RemoteParamNode' :
316   - case 'amdaModel.RemoteSimuParamNode' :
  314 + case 'amdaModel.RemoteParamNode' :
  315 + case 'amdaModel.RemoteSimuParamNode' :
317 316 if (!selectedRecord.get('isParameter') || selectedRecord.get('disable'))
318 317 return false;
319 318 if (selectedRecord.get('alias') != "" )
320 319 field.setValue("#"+selectedRecord.get('alias'));
321   - else
322   - field.setValue(selectedRecord.get('id'));
  320 + else
  321 + field.setValue(selectedRecord.get('id'));
323 322 return true;
324   - case 'amdaModel.AliasNode' :
  323 + case 'amdaModel.AliasNode' :
325 324 if (!selectedRecord.isLeaf())
326 325 return false;
327 326 field.setValue("#"+selectedRecord.get('text'));
328 327 return true;
329   - case 'amdaModel.DerivedParamNode' :
  328 + case 'amdaModel.DerivedParamNode' :
330 329 if (!selectedRecord.isLeaf())
331 330 return false;
332 331 field.setValue("ws_"+selectedRecord.get('text'));
... ... @@ -336,7 +335,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
336 335 return false;
337 336 field.setValue("wsd_"+selectedRecord.get('text'));
338 337 return true;
339   - default :
  338 + default :
340 339 return false;
341 340 }
342 341 return true;
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -549,15 +549,20 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
549 549 isValidToDrop : function(record,targetNode,position)
550 550 {
551 551 switch (record.$className)
  552 +
552 553 {
553 554 case 'amdaModel.LocalParamNode' :
554 555 case 'amdaModel.RemoteParamNode' :
555 556 case 'amdaModel.RemoteSimuParamNode' :
556 557 return record.get('isParameter') && ! record.get('disable');
557   - case 'amdaModel.AliasNode' :
558   - case 'amdaModel.DerivedParamNode' :
  558 +
  559 + case 'amdaModel.DerivedParamNode' :
  560 + case 'amdaModel.DerivedParamComponentNode':
  561 + return record.get('isParameter') ;
  562 + case 'amdaModel.AliasNode' :
559 563 case 'amdaModel.MyDataParamNode' :
560 564 return record.isLeaf();
  565 +
561 566 case 'amdaPlotObj.PlotParamTreeNode' :
562 567 var fromPanelObject = null;
563 568 if (this.tabObject.get('tree-full-view'))
... ... @@ -588,7 +593,7 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
588 593 if (toPanelObject == null)
589 594 return false;
590 595 return (fromPanelObject.get('panel-plot-type') == toPanelObject.get('panel-plot-type'));
591   - case 'amdaPlotObj.PlotPanelTreeNode' :
  596 + case 'amdaPlotObj.PlotPanelTreeNode' :
592 597 switch (position)
593 598 {
594 599 case 'append' :
... ... @@ -602,107 +607,135 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
602 607 return false;
603 608 },
604 609  
605   - dropParamToCreate : function(targetNode, position, paramId, paramComponents, isVector, is2d, plotOnly)
606   - {
607   - var panelObject = null;
608   - if (targetNode == null)
609   - {
610   - //create new panel
611   - panelObject = this.tabObject.createNewPanel();
612   - }
613   - else
614   - {
615   - switch (targetNode.$className)
616   - {
617   - case 'amdaPlotObj.PlotParamsTreeNode' :
618   - case 'amdaPlotObj.PlotPanelTreeNode' :
619   - case 'amdaPlotObj.PlotAxesTreeNode' :
620   - panelObject = targetNode.object;
621   - break;
622   - case 'amdaPlotObj.PlotTimeAxisTreeNode' :
623   - case 'amdaPlotObj.PlotEpochAxisTreeNode' :
624   - case 'amdaPlotObj.PlotXAxisTreeNode' :
625   - case 'amdaPlotObj.PlotYLeftAxisTreeNode' :
626   - case 'amdaPlotObj.PlotYRightAxisTreeNode' :
627   - case 'amdaPlotObj.PlotColorAxisTreeNode' :
628   - case 'amdaPlotObj.PlotParamTreeNode' :
629   - panelObject = targetNode.parentNode.object;
630   - break;
631   - default:
632   - //create new panel
633   - panelObject = this.tabObject.createNewPanel();
634   - }
635   - }
  610 + dropParamToCreate: function (targetNode, position, paramId, paramComponents, isVector, is2d, plotOnly)
  611 + {
  612 + var panelObject = null;
  613 + if (targetNode == null)
  614 + {
  615 + //create new panel
  616 + panelObject = this.tabObject.createNewPanel();
  617 + } else
  618 + {
  619 + switch (targetNode.$className)
  620 + {
  621 + case 'amdaPlotObj.PlotParamsTreeNode' :
  622 + case 'amdaPlotObj.PlotPanelTreeNode' :
  623 + case 'amdaPlotObj.PlotAxesTreeNode' :
  624 + panelObject = targetNode.object;
  625 + break;
  626 + case 'amdaPlotObj.PlotTimeAxisTreeNode' :
  627 + case 'amdaPlotObj.PlotEpochAxisTreeNode' :
  628 + case 'amdaPlotObj.PlotXAxisTreeNode' :
  629 + case 'amdaPlotObj.PlotYLeftAxisTreeNode' :
  630 + case 'amdaPlotObj.PlotYRightAxisTreeNode' :
  631 + case 'amdaPlotObj.PlotColorAxisTreeNode' :
  632 + case 'amdaPlotObj.PlotParamTreeNode' :
  633 + panelObject = targetNode.parentNode.object;
  634 + break;
  635 + default:
  636 + //create new panel
  637 + panelObject = this.tabObject.createNewPanel();
  638 + }
  639 + }
636 640  
637   - //Create param object
638   - var me = this;
639   - panelObject.createNewParam(paramId, paramComponents, isVector, is2d, plotOnly, function (newParamObject) {
640   - //Rebuild params node
641   - me.buildPanelsNode(newParamObject.getId());
642   - //BRE newParamObject
643   - });
644   - },
645   -
646   - dropRecord : function(record,targetNode,position)
647   - {
648   - var selModel = this.getSelectionModel();
649   -
650   - //select the target node if defined
651   - if (targetNode)
652   - selModel.select(targetNode);
653   - else
654   - selModel.deselectAll();
655   -
656   - switch (record.$className)
657   - {
658   - case 'amdaModel.LocalParamNode' :
659   - case 'amdaModel.RemoteParamNode' :
660   - case 'amdaModel.RemoteSimuParamNode' :
661   - if (!record.get('isParameter') || record.get('disable'))
662   - return false;
663   -
664   - if (record.get('alias') != "" )
665   - this.dropParamToCreate(targetNode, position, "#"+record.get('alias'));
666   - else {
667   - var isVector = record.get('iconCls') == 'icon-vector';
668   - var is2d = record.get('iconCls') == 'icon-2dspectra';
669   - var component_info = record.get('component_info');
670   - var param_id = record.get('id');
671   - var plot_only = record.get('notyet');
672   - var components = null;
673   - if (component_info && component_info.parentId) {
674   - //It's a component
675   - param_id = component_info.parentId;
676   - components = [];
677   - if (component_info.index1)
678   - components['index1'] = component_info.index1;
679   - if (component_info.index2)
680   - components['index2'] = component_info.index2;
681   - }
682   - this.dropParamToCreate(targetNode, position, param_id, components, isVector, is2d, plot_only);
683   - }
684   - return true;
685   - case 'amdaModel.AliasNode' :
686   - if (!record.isLeaf())
687   - return false;
688   - this.dropParamToCreate(targetNode, position, "#"+record.get('text'));
689   - return true;
690   - case 'amdaModel.DerivedParamNode' :
691   - if (!record.isLeaf())
692   - return false;
693   - this.dropParamToCreate(targetNode, position, "ws_"+record.get('text'));
694   - return true;
695   - case 'amdaModel.MyDataParamNode' :
696   - if (!record.isLeaf())
697   - return false;
698   - this.dropParamToCreate(targetNode, position, "wsd_"+record.get('text'));
699   - return true;
700   - case 'amdaPlotObj.PlotParamTreeNode' :
701   - return this.moveParam(record,targetNode,position);
702   - case 'amdaPlotObj.PlotPanelTreeNode' :
703   - return this.movePanel(record,targetNode,position);
704   - default :
705   - return false;
  641 + //Create param object
  642 + var me = this;
  643 + panelObject.createNewParam(paramId, paramComponents, isVector, is2d, plotOnly, function (newParamObject) {
  644 + //Rebuild params node
  645 + me.buildPanelsNode(newParamObject.getId());
  646 + //BRE newParamObject
  647 + });
  648 + },
  649 +
  650 + dropRecord: function (record, targetNode, position)
  651 + {
  652 + var selModel = this.getSelectionModel();
  653 +
  654 + //select the target node if defined
  655 + if (targetNode)
  656 + selModel.select(targetNode);
  657 + else
  658 + selModel.deselectAll();
  659 +
  660 + switch (record.$className)
  661 + {
  662 + case 'amdaModel.LocalParamNode' :
  663 + case 'amdaModel.RemoteParamNode' :
  664 + case 'amdaModel.RemoteSimuParamNode' :
  665 + if (!record.get('isParameter') || record.get('disable'))
  666 + return false;
  667 +
  668 + if (record.get('alias') != "")
  669 + this.dropParamToCreate(targetNode, position, "#" + record.get('alias'));
  670 + else {
  671 + var isVector = record.get('iconCls') == 'icon-vector';
  672 + var is2d = record.get('iconCls') == 'icon-2dspectra';
  673 + var component_info = record.get('component_info');
  674 + var param_id = record.get('id');
  675 + var plot_only = record.get('notyet');
  676 + var components = null;
  677 + if (component_info && component_info.parentId) {
  678 + //It's a component
  679 + param_id = component_info.parentId;
  680 + components = [];
  681 + if (component_info.index1)
  682 + components['index1'] = component_info.index1;
  683 + if (component_info.index2)
  684 + components['index2'] = component_info.index2;
  685 + }
  686 + this.dropParamToCreate(targetNode, position, param_id, components, isVector, is2d, plot_only);
  687 + }
  688 + return true;
  689 + case 'amdaModel.AliasNode' :
  690 + if (!record.isLeaf())
  691 + return false;
  692 + this.dropParamToCreate(targetNode, position, "#" + record.get('text'));
  693 + return true;
  694 + case 'amdaModel.DerivedParamNode' :
  695 + if (!record.get('isParameter'))
  696 + return false;
  697 + //targetNode, position, paramId, paramComponents, isVector, plotOnly
  698 + var components = null;
  699 + var dim1=record.get("dim_1");
  700 + var dim2=record.get("dim_2");
  701 + if(dim1>3 && dim2==1)
  702 + {
  703 + components = [];
  704 + components['index2'] ="0"
  705 + }else if(dim1==1 && dim2>1)
  706 + {
  707 + components = [];
  708 + components['index1'] ="0"
  709 + }
  710 + this.dropParamToCreate(targetNode, position, "ws_" + record.get('text'),components);
  711 + return true;
  712 + case 'amdaModel.DerivedParamComponentNode':
  713 + if (!record.get('isParameter'))
  714 + return false;
  715 + //targetNode, position, paramId, paramComponents, isVector, plotOnly
  716 + paramId=record.get('text');
  717 + var parentId = paramId.substr(0, paramId.length - 3);
  718 + idToSent = "ws_" + parentId;
  719 + var regExp = /\(([\d]+)\)/;
  720 + var component_index = regExp.exec(paramId);
  721 + if (component_index)
  722 + {
  723 + components = [];
  724 + components['index1'] = component_index[1];
  725 + }
  726 + this.dropParamToCreate(targetNode, position,idToSent, components);
  727 + return true;
  728 + case 'amdaModel.MyDataParamNode' :
  729 + if (!record.isLeaf())
  730 + return false;
  731 + this.dropParamToCreate(targetNode, position, "wsd_" + record.get('text'));
  732 + return true;
  733 + case 'amdaPlotObj.PlotParamTreeNode' :
  734 + return this.moveParam(record, targetNode, position);
  735 + case 'amdaPlotObj.PlotPanelTreeNode' :
  736 + return this.movePanel(record, targetNode, position);
  737 + default :
  738 + return false;
706 739 }
707 740 return false;
708 741 },
... ... @@ -756,7 +789,6 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
756 789 if (dataLength > 1)
757 790 return false;
758 791 var draggedRecord = draggedRecords[0];
759   -
760 792 return me.isValidToDrop(draggedRecord,targetNode,position);
761 793 },
762 794 onPlotContainerDrop : function(dd, e, data){
... ... @@ -922,4 +954,4 @@ Ext.define(&#39;amdaPlotComp.PlotTree&#39;, {
922 954  
923 955 Ext.apply(this,Ext.apply(arguments, myConf));
924 956 }
925   -});
926 957 \ No newline at end of file
  958 +});
... ...
js/app/views/PlotUI.js
... ... @@ -102,8 +102,9 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
102 102 if (this.object.get('last-plotted-tab') == 0) {
103 103 this.object.set('last-plotted-tab', this.plotTabs.getSelectedTabId());
104 104 }
105   - var downObject = amdaModel.DownloadNode.decodeObject(this.object);
106   - amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject));
  105 + var downObject = amdaModel.DownloadNode.decodeObject(this.object);
  106 + amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject));
  107 +
107 108 amdaModel.DownloadNode.editInModule();
108 109 },
109 110  
... ...
js/app/views/StatisticsUI.js
... ... @@ -347,8 +347,24 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
347 347 nameToSent = "#"+data.records[0].get('text');
348 348 break;
349 349 case 'derivedParam' :
350   - nameToSent = "ws_"+data.records[0].get('text');
351   - break;
  350 + if(data.records[0].modelName=='amdaModel.DerivedParamComponentNode')
  351 + {
  352 + paramId=data.records[0].get('text');
  353 + var parentId=paramId.substr(0,paramId.length-3);
  354 + nameToSent = "ws_"+parentId;
  355 + var regExp = /\(([\d]+)\)/;
  356 + var component_index = regExp.exec(paramId);
  357 + if(component_index )
  358 + {
  359 + components = [];
  360 + components['index1'] =component_index[1];
  361 + }
  362 + break;
  363 + }else
  364 + {
  365 + nameToSent = "ws_"+data.records[0].get('text');
  366 + }
  367 + break;
352 368 case 'myDataParam' :
353 369 nameToSent = "wsd_"+data.records[0].get('text');
354 370 break;
... ...
php/classes/AmdaAction.php
... ... @@ -141,6 +141,8 @@ class AmdaAction
141 141  
142 142 //TODO MAKE PROPERLY as function of nodetype !!!!
143 143 $info = '';
  144 + $dim_1 = 1;
  145 + $dim_2 = 1;
144 146 $id = $child->getAttribute('xml:id');
145 147 $name = $child->getAttribute('name');
146 148 $help = $child->getAttribute('att');
... ... @@ -206,6 +208,14 @@ class AmdaAction
206 208 break;
207 209 case 'derivedParam':
208 210 $info = $child->getAttribute('buildchain');
  211 +
  212 + if ($child->hasAttribute('dim_1')) {
  213 + $dim_1 = $child->getAttribute('dim_1');
  214 + }
  215 + if ($child->hasAttribute('dim_2')) {
  216 + $dim_2 = $child->getAttribute('dim_2');
  217 + }
  218 +
209 219 if ($isLeaf) $isParameter = true;
210 220 break;
211 221  
... ... @@ -551,7 +561,7 @@ class AmdaAction
551 561 }
552 562  
553 563 $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
554   - 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter);
  564 + 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2);
555 565 }
556 566 }
557 567 // if $childrenToReturn we have to return []
... ... @@ -771,7 +781,7 @@ class AmdaAction
771 781 if ($obj->nodeType == 'derivedParam' && $this->amdaStat->success)
772 782 $this->amdaStat->addTask($this->user, 'create', null);
773 783 $objectMgr = new DerivedParamMgr($obj->nodeType);
774   - break;
  784 + break;
775 785 case 'timeTable' :
776 786 $objectMgr = new TimeTableMgr();
777 787 break;
... ... @@ -909,12 +919,13 @@ class AmdaAction
909 919 // Check user if access to DD Server and / or possible 'space consuming' action
910 920 if ( $function == FunctionTypeEnumClass::PARAMS ||
911 921 $function == FunctionTypeEnumClass::ACTION ||
912   - $function == FunctionTypeEnumClass::PARAMSGEN )
  922 + $function == FunctionTypeEnumClass::PARAMSGEN ||
  923 + $function == FunctionTypeEnumClass::PARAMSINFOGEN )
913 924 {
914 925 $res = $this->checkUser($obj);
915 926 if (!$res['success']) return $res;
916 927 }
917   -
  928 +
918 929 $requestManager = new RequestManagerClass();
919 930 try {
920 931 $res = $requestManager->runIHMRequest($this->user, !empty($res['userHost']) ? $res['userHost'] : NULL, $function, $obj);
... ... @@ -948,9 +959,22 @@ class AmdaAction
948 959 */
949 960 public function compilParam($obj)
950 961 {
  962 +//error_log(print_r($obj,TRUE));
951 963 return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN);
952 964 }
953 965  
  966 +
  967 +/*
  968 + * Generate parameter info for display (e.g size)
  969 + */
  970 + public function generateParamInfo($obj)
  971 + {
  972 + return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSINFOGEN);
  973 + }
  974 +
  975 +
  976 +
  977 +
954 978 /*
955 979 * Delete derived parameter compilation
956 980 */
... ... @@ -1386,7 +1410,102 @@ class AmdaAction
1386 1410 );
1387 1411 return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
1388 1412 }
  1413 + public function getDerivedParamInfo($obj)
  1414 + {
  1415 + $dom = new DomDocument("1.0");
  1416 + $xmlName=USERWSDIR.$this->xmlFiles['derivedParam'];
  1417 + @$dom->load($xmlName);
  1418 + $params=$dom->getElementsByTagName("param");
  1419 + foreach($params as $param)
  1420 + {
  1421 + if($param->hasAttribute("name") && ("ws_" . ($param->getAttribute("name")))==$obj->paramId)
  1422 + {
  1423 + $dim_1=$param->getAttribute("dim_1");
  1424 + $dim_2=$param->getAttribute("dim_2");
  1425 + return $this->createDerivedParamInfo($dim_1,$dim_2,$obj->paramId);
  1426 + }
  1427 +
  1428 + }
  1429 + return array('success'=>false, 'message'=>'unkown parameter (derived parameter arguments are not handled)');
  1430 + }
  1431 +
  1432 + public function createDerivedParamInfo($dim_1,$dim_2,$paramId)
  1433 + {
  1434 + /* case of constant */
  1435 + if($dim_1*$dim_2==1)
  1436 + {
  1437 + return array('success'=>false,'msg'=>"dim1=1 dim2=1 no arguments for this parameter");
  1438 + }elseif(($dim_1==1 && $dim_2>1 && $dim_2<=3)||($dim_2==1 && $dim_1>1 && $dim_1<=3) )
  1439 + /* case of vector */
  1440 + {
  1441 +
  1442 + $dims=array(
  1443 + 'dim1'=>$dim_1,
  1444 + 'dim2'=>$dim_2
  1445 + );
1389 1446  
  1447 + $compts=array();
  1448 +
  1449 + for($i=0;$i<($dim_1*$dim_2);++$i)
  1450 + {
  1451 +
  1452 + $c=array(
  1453 +
  1454 + 'index_1'=>($dim_1>$dim_2)?(string)$i:"",
  1455 + 'index_2'=>($dim_1<$dim_2)?$i:"",
  1456 + 'name'=>$paramId.'('.$i.')'
  1457 + );
  1458 + array_push($compts,$c);
  1459 +
  1460 + }
  1461 +
  1462 + $data=array(
  1463 + 'dimensions'=>$dims,
  1464 + 'components'=>$compts
  1465 + );
  1466 +
  1467 +
  1468 + return array('success'=>true,'data'=>$data);
  1469 + }else
  1470 + /* case of spectro*/
  1471 + {
  1472 + $sizes=array($dim_1,$dim_2);
  1473 + $dims=array(
  1474 + 'dim1'=>$dim_1,
  1475 + 'dim2'=>$dim_2
  1476 + );
  1477 + $channels=array();
  1478 + $tables=array();
  1479 + for($j=0;$j<count($sizes);$j++)
  1480 + {
  1481 + $compts=array();
  1482 +
  1483 + for($i=0;$i<$sizes[$j];$i++)
  1484 + {
  1485 + $c=array('min'=>'L' . $i,'max'=>'L' . ($i+1));
  1486 + array_push($compts,$c);
  1487 + }
  1488 +
  1489 + $tab=array(
  1490 + 'relatedDim'=>'dim' . ($j+1),
  1491 + 'name'=>'component' . ($j+1),
  1492 + 'units'=>"",
  1493 + 'variable'=>"",
  1494 + 'channels'=>$compts,
  1495 + 'minmax'=>""
  1496 + );
  1497 +
  1498 + array_push($tables,$tab);
  1499 + }
  1500 +
  1501 + $data=array(
  1502 + 'dimensions'=>$dims,
  1503 + 'tables'=>$tables
  1504 + );
  1505 + return array('success'=>true,'data'=>$data);
  1506 + }
  1507 +
  1508 + }
1390 1509 public function getSharedObjectFolders($obj)
1391 1510 {
1392 1511 $mgr = new SharedObjectsMgr();
... ...
php/classes/DerivedParamMgr.php
... ... @@ -19,7 +19,7 @@ class DerivedParamMgr extends AmdaObjectMgr
19 19 $this->contentRootId = 'derivedParam-treeRootNode';
20 20 $this->contentRootTag = 'paramList';
21 21 //node attributes and object XML tags
22   - $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '');
  22 + $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '', 'dim_1' => '1', 'dim_2' => '1');
23 23 // + tags in object XML
24 24 $this->optionalAttributes = array('units' => 'undefined','description' => 'undefined', 'ytitle' => 'undefined');
25 25 $this->objTagName = 'param';
... ... @@ -143,7 +143,7 @@ class DerivedParamMgr extends AmdaObjectMgr
143 143 $this->createObjectDescription($p);
144 144 $this->addToContent($p, $folder);
145 145  
146   - return array('id' => $this->id, 'info' => $p->buildchain);
  146 + return array('id' => $this->id, 'info' => $p->buildchain, 'dim_1' => $p->dim_1, 'dim_2' => $p->dim_2);
147 147 }
148 148 // myData parameter
149 149 else
... ...
php/classes/SharedObjectMgrAbstract.php
... ... @@ -81,6 +81,30 @@ abstract class SharedObjectMgrAbstract {
81 81 return array('success' => TRUE, 'object_id' => $newId);
82 82 }
83 83  
  84 + public function delete($folder_name, $objectId) {
  85 + $dst_folder_path = $this->getFolderDirPath($folder_name);
  86 + if (!is_dir($dst_folder_path))
  87 + return array('success' => false, 'message' => 'Cannot get folder path');
  88 +
  89 + $dst_header_path = $this->getHeaderDirPath($folder_name);
  90 + if (is_dir($dst_header_path)) {
  91 + $headerFilePath = $this->getHeaderFilePath($folder_name, $objectId);
  92 + if (is_file($headerFilePath)) {
  93 + unlink($headerFilePath);
  94 + }
  95 + }
  96 +
  97 + $dst_data_path = $this->getDataDirPath($folder_name);
  98 + if (is_dir($dst_data_path)) {
  99 + $dataFilePath = $this->getDataFilePath($folder_name, $objectId);
  100 + if (is_file($dataFilePath)) {
  101 + unlink($dataFilePath);
  102 + }
  103 + }
  104 +
  105 + return array('success' => TRUE, 'object_id' => $objectId);
  106 + }
  107 +
84 108 public function createFolder($folder_name) {
85 109 $folder_path = $this->getFolderDirPath($folder_name);
86 110 if (is_dir($folder_path)) {
... ...
php/classes/SharedObjectTreeFile.php
... ... @@ -185,6 +185,34 @@ class SharedObjectTreeFile {
185 185 }
186 186 return "";
187 187 }
  188 +
  189 + public function getObjectsByName($object_type, $folder_name, $object_name) {
  190 + $folderNode = $this->getObjectFolderNode($object_type, $folder_name);
  191 +
  192 + if (!isset($folderNode))
  193 + return NULL;
  194 +
  195 + $objectNodes = $folderNode->getElementsByTagName($object_type);
  196 +
  197 + $result = array();
  198 + foreach ($objectNodes as $objectNode) {
  199 + if ($objectNode->getAttribute('name') == $object_name)
  200 + $result[] = $objectNode->getAttribute("xml:id");
  201 + }
  202 +
  203 + return $result;
  204 + }
  205 +
  206 + public function deleteObjectByObjectId($object_type, $folder_name, $object_id) {
  207 + $node = $this->getObjectNode($object_type, $folder_name, $object_id);
  208 + if (!isset($node)) {
  209 + return array('success' => FALSE, 'message' => 'Cannot retrieve object node in tree');
  210 + }
  211 + $node->parentNode->removeChild($node);
  212 + $this->doc->save($this->getFilePath());
  213 +
  214 + return array('success' => TRUE);
  215 + }
188 216  
189 217 private function init() {
190 218 if (!file_exists($this->getFilePath()))
... ... @@ -283,7 +311,7 @@ class SharedObjectTreeFile {
283 311  
284 312 return NULL;
285 313 }
286   -
  314 +
287 315 private function createObjectNode($object_type, $folder_name, $object_id) {
288 316 $listNode = $this->getObjectListNode($object_type);
289 317  
... ...
php/classes/SharedObjectsMgr.php
... ... @@ -50,6 +50,29 @@ class SharedObjectsMgr {
50 50  
51 51 return $result;
52 52 }
  53 +
  54 + public function update($object_type, $object_name, $folder_id, $src_object_path, $description, $sharedBy) {
  55 + if (!array_key_exists($object_type, $this->sharedObjectsMgr) || !isset($this->sharedObjectsMgr[$object_type]))
  56 + return array('success' => FALSE, 'message' => 'Unknown type');
  57 +
  58 + $folder_name = $this->treeFile->getFolderNameById($object_type, $folder_id);
  59 +
  60 + if (empty($folder_name))
  61 + return array('success' => FALSE, 'message' => 'Cannot retrieve folder');
  62 +
  63 + $objects = $this->treeFile->getObjectsByName($object_type, $folder_name, $object_name);
  64 +
  65 + if (!empty($objects)) {
  66 + //delete old objects
  67 + foreach ($objects as $object_id) {
  68 + $result = $this->treeFile->deleteObjectByObjectId($object_type, $folder_name, $object_id);
  69 + $result = $this->sharedObjectsMgr[$object_type]->delete($folder_name, $object_id);
  70 + }
  71 + }
  72 +
  73 + //add new object
  74 + return $this->add($object_type, $object_name, $folder_id, $src_object_path, $description, $sharedBy);
  75 + }
53 76  
54 77 public function getFolders($object_type) {
55 78 if (!array_key_exists($object_type, $this->sharedObjectsMgr) || !isset($this->sharedObjectsMgr[$object_type]))
... ...
php/classes/UserMgr.php
... ... @@ -334,18 +334,19 @@ class UserMgr
334 334  
335 335 $this->paramMgr->xmlDom->formatOutput = true;
336 336 $this->paramMgr->xmlDom->preserveWhiteSpace = false;
337   -
  337 +
338 338 $BASE = $this->paramMgr->xmlDom->createElement('dataRoot');
339 339 $BASE->setAttribute('xml:id','myRemoteData-treeRootNode');
340 340  
341 341 foreach ($this->paramMgr->Bases as $baseId)
342 342 {
343 343 $centerNode = $this->makeNewBase($baseId);
344   - $BASE->appendChild($centerNode);
  344 + if (isset($centerNode))
  345 + $BASE->appendChild($centerNode);
345 346 }
346   -
  347 +
347 348 $this->paramMgr->xmlDom->appendChild($BASE);
348   -
  349 +
349 350 return $this->paramMgr->xmlDom->save($this->paramMgr->xmlName);
350 351 }
351 352 }
... ... @@ -353,11 +354,11 @@ class UserMgr
353 354 protected function makeNewBase($baseId)
354 355 {
355 356 // no data base description ; skip this data base
356   - if (!@file_exists(RemoteData.$baseId.'/base.xml')) continue;
  357 + if (!@file_exists(RemoteData.$baseId.'/base.xml')) return NULL;
357 358  
358 359 // can't read base.xml ; skip this data base
359   - if (!@$this->baseExtXml->load(RemoteData.$baseId.'/base.xml')) continue;
360   -
  360 + if (!@$this->baseExtXml->load(RemoteData.$baseId.'/base.xml')) return NULL;
  361 +
361 362 $base = $this->paramMgr->basesDom->getElementById($baseId);
362 363  
363 364 if ($base->hasAttribute('default'))
... ...
php/config.php
... ... @@ -148,6 +148,7 @@ $API = array(
148 148 'execute'=>array('len'=>2),
149 149 //'formHandler'=>true
150 150 'compilParam'=>array('len'=>1),
  151 + 'generateParamInfo'=>array('len'=>1),
151 152 'compilParamDelete'=>array('len'=>1),
152 153 'killPlotRequest'=>array('len'=>0),
153 154 'merge'=>array('len'=>1),
... ... @@ -192,6 +193,7 @@ $API = array(
192 193 'interactivePlot'=>array('len'=>2),
193 194 'getParamPlotInit'=>array('len'=>1),
194 195 'getParamInfo'=>array('len'=>1),
  196 + 'getDerivedParamInfo'=>array('len'=>1),
195 197 'getSharedObjectFolders' => array('len'=>1),
196 198 'shareObjects' => array('len'=>1),
197 199 'isSharedObjectNameAlreadyUsed' => array('len'=>1),
... ...
update_amda/updateEnv.sh
... ... @@ -39,9 +39,9 @@ if [[ ${AMDAINTERNALDIR: -1} != &quot;/&quot; ]]; then
39 39 fi
40 40  
41 41 #SPASE Registry definitions
42   -export SPASE_REPO="http://apus.irap.omp.eu:8080/amda-registry/resolver"
  42 +export SPASE_REPO="http://amda-registry.irap.omp.eu/resolver"
43 43 #Remote SPASE Registry to get Person' Info
44 44 export SPASE_REMOTE="http://www.spase-group.org/smwg/resolver"
45 45 # for SPASE Registy MAJ
46   -export SPASE_HOST=apus.irap.omp.eu
  46 +export SPASE_HOST=amda-registry.irap.omp.eu
47 47 export SPASE_ROOT="/usr/share/tomcat/webapps/amda-registry/metadata"
... ...