Commit 90e31607cad2f47bde12d3f69036315a368912e3

Authored by Nathanael Jourdane
2 parents 5656c46b 7348b580

Merge branch 'master' into improve_doc_fix

help/ttTimeFormat 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +<h3>ASCII Time Table Time Format</h3>
  2 +<i>Year Month Day Hour Minute Second</i> => with different separators ("-", ":", "/", " ") used in a standard way.
  3 +<br/><i>Milliseconds</i> are not taken in to account.
  4 +<br/><br/>
  5 +Examples:
  6 + <ul>
  7 + <li> 2001-01-01T00:00:00
  8 + <li> 2001-01-01 00:00:00
  9 + <li> 2001 01 01 00 00 00
  10 + <li> 2001/01/01 00:00:00
  11 + </ul>
  12 +<br/>
  13 +If you plan to use uploaded time table to work with data note that :<br/>
  14 +<b>Valid time range: 1970-01-01 - 2038-01-19</b>
  15 +
... ...
js/app/controllers/JobsMgr.js
... ... @@ -187,6 +187,7 @@ Ext.define(&#39;amdaDesktop.JobsMgr&#39;, {
187 187 // AKKA - use processid to find job
188 188 nodeToMove = jobRootNode.findChild('id', job.id, false)
189 189 nodeToMove.set('status', job.status)
  190 + nodeToMove.set('info', job.info)
190 191  
191 192 // TODO check if really job.status
192 193  
... ...
js/app/controllers/StatisticsModule.js
... ... @@ -43,14 +43,12 @@ Ext.define(&#39;amdaDesktop.StatisticsModule&#39;, {
43 43  
44 44 saveState: function() {
45 45 var uiContent = this.getUiContent();
46   - var form = uiContent.down('form').getForm();
47   - var values = form.getValues();
48   - // Ext.state.Manager.set(this.id + '_form', values);
  46 + var form = uiContent.formPanel.items.items[1].getForm();
  47 + var values = form.getValues();
49 48 Ext.state.Manager.set('timeinterval', {'startDate' : values.startDate,'stopDate' : values.stopDate });
50 49 },
51 50  
52   - getState : function() {
53   - // return Ext.state.Manager.get(this.id + '_form');
  51 + getState : function() {
54 52 return Ext.state.Manager.get('timeinterval');
55 53 }
56 54  
... ...
js/app/models/Stats.js
... ... @@ -22,8 +22,8 @@ Ext.define(&#39;amdaModel.Stats&#39;, {
22 22 values.id = this.get('id');
23 23 }
24 24  
25   - values.timesrc = this.get('timesrc');
26   - values.name = 'test'; //this.get('name');
  25 + values.timesrc = this.get('timesrc');
  26 + values.name = this.get('name');
27 27  
28 28 // if (this.get('description').match(/[a-z,0-9]/gi) != null) {
29 29 // values.description = this.get('description');
... ...
js/app/views/PlotComponents/PlotBaseSerieForm.js
... ... @@ -90,7 +90,7 @@ Ext.define(&#39;amdaPlotComp.PlotBaseSerieForm&#39;, {
90 90 me.object.set('serie-yaxis', value);
91 91 me.crtTree.refresh();
92 92 }),
93   - this.addStandardFieldSet('Y Values range', '', this.getValuesRangeItems()),
  93 + this.addStandardFieldSet('Min/Max thresholds', '', this.getValuesRangeItems()),
94 94 this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'),
95 95 this.addStandardFieldSet('Lines', 'serie-lines-activated', this.addStandardLineItems('serie-lines')),
96 96 this.addStandardFieldSet('Symbols', 'serie-symbols-activated', this.addStandardSymbolsItems('serie-symbols')),
... ...
js/app/views/PlotComponents/PlotSpectroForm.js
... ... @@ -30,7 +30,7 @@ Ext.define(&#39;amdaPlotComp.PlotSpectroForm&#39;, {
30 30 me.object.set('spectro-yaxis', value);
31 31 me.crtTree.refresh();
32 32 }),
33   - this.addStandardFieldSet('Values range', '', this.getValuesRangeItems())
  33 + this.addStandardFieldSet('Min/Max thresholds', '', this.getValuesRangeItems())
34 34 ];
35 35 }
36 36 });
37 37 \ No newline at end of file
... ...
js/app/views/StatisticsUI.js
... ... @@ -38,8 +38,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
38 38 loadObject : function()
39 39 {
40 40 // load object into form
41   - var basicForm = this.formPanel.items.items[0].getForm();
42   -
  41 + var basicForm = this.formPanel.items.items[1].getForm();
43 42 basicForm.loadRecord(this.object);
44 43  
45 44 },
... ... @@ -101,7 +100,21 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
101 100 {
102 101 this.timeSelector.addTT(TTname, TTid); ;
103 102 },
104   -
  103 +
  104 + /**
  105 + * Set Start-Stop from parameter info (Local & MyData)
  106 + */
  107 + setTimeFromData : function(obj) {
  108 + if (!obj.start || !obj.stop)
  109 + return;
  110 +
  111 + var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
  112 + var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/'));
  113 +
  114 + this.formPanel.items.items[1].getForm().setValues({ startDate : dateStart, stopDate : dateStop });
  115 + this.timeSelector.intervalSel.updateDuration();
  116 + },
  117 +
105 118 generateCatalog : function()
106 119 {
107 120 var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.statistics.id);
... ... @@ -119,7 +132,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
119 132 var updateStatus = true;
120 133  
121 134 var formValues = basicForm.getValues();
122   - //this.object.set('name',formValues.name);
  135 + this.object.set('name',this.fieldName.getValue());
123 136 this.object.set('description',formValues.description);
124 137  
125 138 var recs = this.paramGrid.getStore().getNewRecords();
... ... @@ -207,7 +220,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
207 220 fields: [ 'name', 'hidden_id']
208 221 });
209 222  
210   - this.timeSelector = new amdaUI.TimeSelectorUI({id: 'statisticsTimeSelector', height : 160});
  223 + this.timeSelector = new amdaUI.TimeSelectorUI({id: 'statisticsTimeSelector', flex:1});
211 224  
212 225 var store = Ext.create('Ext.data.Store',
213 226 {
... ... @@ -218,8 +231,8 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
218 231 {
219 232 title: 'Select Parameter & Apply Function',
220 233 selType : 'rowmodel',
221   - // flex: 2,
222   - height :250,
  234 + flex: 2,
  235 + // height :250,
223 236 store : store,
224 237 columns: [
225 238 { xtype: 'rownumberer' },
... ... @@ -362,36 +375,20 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
362 375 this.formPanel = Ext.create('Ext.form.Panel',
363 376 {
364 377 region: 'center',
365   - layout: 'hbox',
  378 + layout: {
  379 + type: 'hbox',
  380 + pack: 'start',
  381 + align: 'stretch'
  382 + },
366 383 //bodyStyle: {background : '#dfe8f6'},
367 384 defaults: { bodyStyle: {background : '#dfe8f6'}, padding : '3'},
368 385 fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
369   - items: [
370   - {
  386 + items: [ {
371 387 xtype: 'form',
372 388 flex : 1,
373 389 layout: {type: 'vbox', pack: 'start', align: 'stretch'},
374   - items : [
375   - this.paramGrid,
376   - this.timeSelector
377   - ]
378   - },
379   - {
380   - xtype: 'form',
381   - title: 'Additional Information',
382   - flex : 1,
383   - layout: {type: 'vbox', pack: 'start', align: 'stretch', padding : '3'},
384   - items : [
385   - this.fieldName,
386   - {
387   - xtype: 'textarea',
388   - name: 'description',
389   - fieldLabel: 'Description',
390   - height: 200
391   - }
392   - ],
393   - fbar:[
394   - {
  390 + items : [ this.paramGrid ],
  391 + fbar:[ {
395 392 type: 'button',
396 393 text: 'Generate Catalog',
397 394 scope : this,
... ... @@ -399,8 +396,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
399 396 {
400 397 // update object with user's values
401 398 // if the return is true (object had been updated)
402   - if(this.updateObject()){
403   - this.updateObject();
  399 + if (this.updateObject()){
404 400 this.generateCatalog();
405 401 }
406 402 }
... ... @@ -409,9 +405,31 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
409 405 type: 'button',
410 406 text: 'Reset',
411 407 scope : this,
412   - handler: function() {}
  408 + handler: function() {
  409 + this.formPanel.getForm().reset();
  410 + this.paramGrid.store.removeAll();
  411 + this.timeSelector.TTGrid.store.removeAll();
  412 + }
413 413 }]
414   - }]
  414 + },
  415 + {
  416 + xtype: 'form',
  417 + title: 'Additional Information',
  418 + flex : 1,
  419 + trackResetOnLoad: true,
  420 + layout: {type: 'vbox', pack: 'start', align: 'stretch', padding : '3'},
  421 + items : [
  422 + this.fieldName,
  423 + {
  424 + xtype: 'textarea',
  425 + name: 'description',
  426 + fieldLabel: 'Description',
  427 + height: 125
  428 + },
  429 + this.timeSelector
  430 + ]
  431 + }
  432 + ]
415 433 });
416 434  
417 435 var myConf = {
... ...
js/app/views/UploadPanelUI.js
... ... @@ -19,7 +19,7 @@ Ext.define(&#39;amdaUI.UploadPanelUI&#39;, {
19 19 isFile : true,
20 20 isTimeTable : false,
21 21 tmpNode : null,
22   -
  22 +
23 23 constructor: function(config)
24 24 {
25 25 this.init(config);
... ... @@ -310,16 +310,9 @@ Ext.define(&#39;amdaUI.UploadPanelUI&#39;, {
310 310 {
311 311 var title = 'Time Table';
312 312 var items = [
313   - { boxLabel: 'ASCII', name: 'ttfrmt', inputValue: 'ASCII', checked: true,
314   - listeners: {
315   - change: function (cb, nv, ov) {
316   - if (nv) Ext.getCmp('tf_tt').show();
317   - else Ext.getCmp('tf_tt').hide();
318   - }
319   - }
320   - },
321   - { boxLabel: 'VOTable', name: 'ttfrmt', inputValue: 'VOT'}];
322   -
  313 + { boxLabel: 'ASCII&nbsp;<img amda_clicktip="ttTimeFormat" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', name: 'ttfrmt', inputValue: 'ASCII', checked: true},
  314 + { boxLabel: 'VOTable', name: 'ttfrmt', inputValue: 'VOT'}
  315 + ];
323 316 var timeFormatId = 'tf_tt';
324 317 this.formatId = 'nsf_tt';
325 318 this.localUploadId = 'form-uploadtt';
... ... @@ -467,12 +460,11 @@ Ext.define(&#39;amdaUI.UploadPanelUI&#39;, {
467 460 }
468 461 }
469 462 };
470   - var isCatalog = !(this.isFile || this.isTimeTable);
471 463  
472 464 var timeFormat = Ext.create('Ext.form.FieldSet', {
473 465 id: timeFormatId,
474 466 title: 'Time Settings',
475   - hidden : isCatalog,
  467 + hidden : !this.isFile,
476 468 items : [
477 469 {
478 470 xtype: 'radiogroup',
... ...
php/classes/AmdaAction.php
... ... @@ -58,7 +58,6 @@ class AmdaAction
58 58 * $obj = { id: node.id, nodeType: node.nodeType }
59 59 */
60 60 public function getTree($obj) {
61   -
62 61 $node = $obj->node;
63 62  
64 63 $nodeType = $obj->nodeType;
... ... @@ -102,6 +101,7 @@ class AmdaAction
102 101 $xmlName = SHAREDPATH.'/SharedObjectTree.xml';
103 102 break;
104 103 case 'bkgWorks':
  104 + // data/<user>/JOBS/jobs.xml
105 105 $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType];
106 106 break;
107 107 case 'source':
... ... @@ -144,8 +144,6 @@ class AmdaAction
144 144 $id = $child->getAttribute('xml:id');
145 145 $name = $child->getAttribute('name');
146 146 $help = $child->getAttribute('att');
147   - if ($child->hasAttribute('dataStart')) $dataStart = $child->getAttribute('dataStart');
148   - if ($child->hasAttribute('dataStop')) $dataStop = $child->getAttribute('dataStop');
149 147  
150 148 $specialNode = false;
151 149 $isParameter = false;
... ... @@ -158,12 +156,17 @@ class AmdaAction
158 156 {
159 157 case 'bkgWorks':
160 158 $specialNode = true;
161   - $status = $child->getAttribute('status');
162   - // if ($status == 'done') continue;
163   - $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'leaf' => $isLeaf,
164   - 'pid' => $child->getAttribute('pid'), 'status' => $status,
165   - 'jobType' => $child->getAttribute('jobType'), 'info' => $child->getAttribute('info'));
166   - break;
  159 + $childrenToReturn[] = [
  160 + 'text' => $name,
  161 + 'id' => $id,
  162 + 'nodeType' => $nodeType,
  163 + 'leaf' => $isLeaf,
  164 + 'pid' => $child->getAttribute('pid'),
  165 + 'status' => $child->getAttribute('status'),
  166 + 'jobType' => $child->getAttribute('jobType'),
  167 + 'info' => $child->getAttribute('info')
  168 + ];
  169 + break;
167 170  
168 171 case 'condition':
169 172 $objectMgr = new RequestMgr();
... ... @@ -175,9 +178,8 @@ class AmdaAction
175 178 $objplot = $objectMgr->getObject($id);
176 179 for ($i=0; $i < count($objplot->children); $i++)
177 180 {
178   - for ($j=0; $j < count($objplot->children[$i]->children); $j++)
179   - {
180   - $info = $info.' '.$objplot->children[$i]->children[$j]->name;
  181 + for ($j=0; $j < count($objplot->children[$i]->children); $j++) {
  182 + $info = $info.' . '.$objplot->children[$i]->children[$j]->name;
181 183 }
182 184 }
183 185 break;
... ... @@ -846,7 +848,7 @@ class AmdaAction
846 848 */
847 849 public function getJobs()
848 850 {
849   - $obj = (object) array();
  851 + $obj = (object) array();
850 852 return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO);
851 853 }
852 854  
... ... @@ -910,7 +912,6 @@ class AmdaAction
910 912 } catch (Exception $e) {
911 913 return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage());
912 914 }
913   -
914 915 return $res;
915 916 }
916 917  
... ...
php/classes/TimeTableMgr.php
... ... @@ -114,16 +114,6 @@ class TimeTableMgr extends AmdaObjectMgr
114 114 if ($key == 'created') {
115 115 $rootElement->appendChild($this->objectDom->createElement($key, $this->created));
116 116 }
117   - /*else if ($key == 'intervals') {
118   - $n_int = 0;
119   - foreach ($value as $item) {
120   - $newInterval = $this->objectDom->createElement('intervals');
121   - $newInterval->appendChild($this->objectDom->createElement('start', $item->start));
122   - $newInterval->appendChild($this->objectDom->createElement('stop', $item->stop));
123   - $rootElement->appendChild($newInterval);
124   - $n_int++;
125   - }
126   - }*/
127 117 // it is catalog
128 118 else if ($key == 'parameters') {
129 119 $paramsElement = $this->setParamDescription($value);
... ... @@ -161,28 +151,43 @@ class TimeTableMgr extends AmdaObjectMgr
161 151 $lines = file($tmp_file,FILE_SKIP_EMPTY_LINES);
162 152 $description="Uploaded Time Table".PHP_EOL;
163 153  
164   - foreach ($lines as $line){
165   - if ($line[0] == '#') $description=$description.PHP_EOL.substr($line,1,-1);
  154 + $recordsNumber = count($lines);
  155 + $descNumber = 0;
  156 +
  157 + foreach ($lines as $line)
  158 + {
  159 + if ($line[0] == '#') {
  160 + $description=$description.PHP_EOL.substr($line,1,-1);
  161 + }
166 162 else {
167   - $date = explode(' ', preg_replace('!\s+!', ' ', $line));
  163 + $date = explode(' ', trim(preg_replace('!\s+!', ' ',$line)));
  164 +
168 165 if (!strtotime(trim($date[0]))) {
169 166 $description=$description.PHP_EOL.$line;
  167 + $descNumber++;
170 168 continue;
171 169 }
172 170 // check if it is ISO format
173   - if (!isset($isIso)) $isIso = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/', trim($date[0]));
  171 + if (!isset($isIso))
  172 + $isIso = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/', trim($date[0]));
  173 +
174 174 if (!$isIso) {
175   - if (count($date) == 2) {
176   - $tempStartT = strtotime(trim($date[0]));
177   - $tempStopT = strtotime(trim($date[1]));
178   - }
179   - else { // y-m-d h:m:s for example
180   - $tempStartT = strtotime($date[0]." ".$date[1]);
181   - $tempStopT = strtotime($date[2]." ".$date[3]);
182   - }
  175 + // y-m-d h:m:s for example
  176 + $dateLength = count($date) / 2;
  177 +
  178 + $tempStart = $date[0];
  179 + $tempStop = $date[$dateLength];
183 180  
184   - $startDate = date('Y-m-d\TH:i:s',$tempStartT);
185   - $stopDate = date('Y-m-d\TH:i:s',$tempStopT);
  181 + if ($dateLength > 1) {
  182 + for ($i = 1; $i < $dateLength; $i++)
  183 + $tempStart.= $date[$i];
  184 +
  185 + for ($i = $dateLength + 1; $i < $dateLength * 2; $i++)
  186 + $tempStop .= $date[$i];
  187 + }
  188 +
  189 + $startDate = date('Y-m-d\TH:i:s',strtotime($tempStart));
  190 + $stopDate = date('Y-m-d\TH:i:s',strtotime($tempStop));
186 191  
187 192 if (!$onlyDescription)
188 193 $attributesToReturn['intervals'][] = array('start' => $startDate, 'stop' => $stopDate);
... ... @@ -193,15 +198,16 @@ class TimeTableMgr extends AmdaObjectMgr
193 198 }
194 199 }
195 200 }
196   -
  201 + if ( $recordsNumber == $descNumber )
  202 + $description = "Looks like we can not read your time format...".PHP_EOL.$description;
  203 +
197 204 $attributesToReturn['description'] = $description;
198 205 $attributesToReturn['name'] = basename($tmp_file, '.'.$suffix[1]);
199 206 $attributesToReturn['created'] = date('Y-m-d\TH:i:s');
200 207  
201 208 return $attributesToReturn;
202 209 }
203   -
204   -
  210 +
205 211 /*
206 212 * Uploaded vot TT => convert to array
207 213 */
... ...
update_amda/cp2amda
... ... @@ -61,6 +61,7 @@ if [ -d $NEWMETA/ParamInfo ]; then
61 61 mkdir $AMDAINSTALLATION/AMDA_IHM/generic_data/ParamInfo
62 62 fi
63 63 cp $NEWMETA/ParamInfo/info*.xml $AMDAINSTALLATION/AMDA_IHM/generic_data/ParamInfo
  64 + cp $AMDAINTERNALDIR/PARAM_INFO_PREDEFINED/info*.xml $AMDAINSTALLATION/AMDA_IHM/generic_data/ParamInfo
64 65 fi
65 66  
66 67 # copy LocalParams.xml created by makeTree.php to AMDA installation
... ...