Commit 153abcd9415b11ebdbd556bdf1d3f1820019b3ab

Authored by Benjamin Renard
2 parents 1b28b610 6a679a7f

Merge branch 'amdadev' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM into amdadev

js/app/views/CatalogUI.js
... ... @@ -160,16 +160,10 @@ Ext.define('amdaUI.CatalogUI', {
160 160 updateSurveyDates : function(res){
161 161 if (this.TTGrid.getStore().getTotalCount() <= 0)
162 162 return;
163   -
164   - if(! this.object.get('surveyStart') ){
165   - this.object.set('surveyStart', res['minStart']);
166   - this.status.isModified = true;
167   - }
168   - if(! this.object.get('surveyStop') ){
169   - this.object.set('surveyStop', res['maxStop']);
170   - this.status.isModified = true;
171   - }
172   - },
  163 + this.object.set('surveyStart', res['minStart']);
  164 + this.object.set('surveyStop', res['maxStop']);
  165 + this.status.isModified = true;
  166 + },
173 167  
174 168 createTT: function (catId) {
175 169 var ttObj = Ext.create('amdaModel.TimeTable');
... ...
js/app/views/VisuUI.js
... ... @@ -131,12 +131,19 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
131 131  
132 132 me.reset();
133 133 }
134   -
  134 + var type = "";
  135 + if(this.object.get('id').includes('sharedcatalog'))
  136 + type = 'sharedcatalog'
  137 + else if(this.object.get('id') == "")
  138 + type = 'uploaded'
  139 + else
  140 + type = 'object'
135 141 var opt = {
136 142 'typeTT': 'catalog', 'id': this.object.get('id'),
137   - 'name': this.object.get('name')
  143 + 'name': this.object.get('name'),
  144 + 'type': type,
  145 + 'format': this.object.get('objFormat')
138 146 };
139   -
140 147 this.formPanel.getForm().loadRecord(this.object);
141 148 AmdaAction.readIntervalsForChart(opt, onAfterInit);
142 149 },
... ...
php/classes/AmdaAction.php
... ... @@ -189,9 +189,13 @@ class AmdaAction
189 189 case 'catalog':
190 190 if ($isLeaf) {
191 191 $info = '<b>Nb intervals:</b> '.$child->getAttribute('intervals').'<br/>';
192   -
193 192 $objectMgr = new TimeTableMgr();
  193 +
194 194 $obj_info = $objectMgr->getObject($id, $nodeType);
  195 +
  196 + if($nodeType == "catalog")
  197 + $info .='<b>Nb columns:</b> '.$obj_info['nbParam']. '<br/>';
  198 +
195 199 if (!empty($obj_info) && !empty($obj_info['description'])) {
196 200 $info .= '<b>Description:</b> '. $obj_info['description'] . '<br/>';
197 201 }
... ... @@ -1202,7 +1206,10 @@ class AmdaAction
1202 1206 public function readIntervalsForChart($o)
1203 1207 {
1204 1208 $objMgr = new CatalogCacheMgr(TRUE);
1205   - $objMgr->initFromObject($o->id, $o->type);
  1209 + if($o->type == 'uploaded')
  1210 + $objMgr->initFromUploadedFile($o->name, $o->format);
  1211 + else
  1212 + $objMgr->initFromObject($o->id, $o->type);
1206 1213 return $objMgr->getIntervalsForChart();
1207 1214 }
1208 1215  
... ...
php/classes/TimeTableMgr.php
... ... @@ -74,8 +74,14 @@ class TimeTableMgr extends AmdaObjectMgr
74 74 $attributes = $objToGet->childNodes;
75 75  
76 76 $nbInt = 0;
  77 + $nbParam = 0;
77 78 foreach ($attributes as $attribute) {
78 79 if ($attribute->nodeType == XML_ELEMENT_NODE) {
  80 + if($attribute->tagName == 'parameters'){
  81 + foreach($attribute->childNodes as $parameter){
  82 + $nbParam++;
  83 + }
  84 + }
79 85 /*if ($attribute->tagName == 'intervals') {
80 86 $start = $attribute -> getElementsByTagName('start')->item(0) -> nodeValue;
81 87 $stop = $attribute -> getElementsByTagName('stop')->item(0) -> nodeValue;
... ... @@ -116,6 +122,7 @@ class TimeTableMgr extends AmdaObjectMgr
116 122 if($attributesToReturn['surveyStop'] == "" )
117 123 $attributesToReturn['surveyStop'] = $stop;
118 124 $attributesToReturn['nbIntervals'] = $nbInt;
  125 + $attributesToReturn['nbParam'] = $nbParam;
119 126  
120 127 return $attributesToReturn;
121 128 }
... ... @@ -541,6 +548,14 @@ class TimeTableMgr extends AmdaObjectMgr
541 548 $this->objectDom->documentElement->appendChild($newInterval);
542 549 }
543 550  
  551 + // Update SurveyStart & SurveyStop
  552 + $surveyStartNodes = $objToGet->getElementsByTagName('surveyStart');
  553 + $surveyStopNodes = $objToGet->getElementsByTagName('surveyStop');
  554 + if ($surveyStartNodes->length > 0 && $surveyStopNodes->length > 0) {
  555 + $surveyStartNodes->item(0)->nodeValue = TimeUtils::stamp2iso($minStart);
  556 + $surveyStopNodes->item(0)->nodeValue = TimeUtils::stamp2iso($maxStop);
  557 + }
  558 +
544 559 //save modifications
545 560 $this->id = $id;
546 561 $this->resFileName = USERTTDIR . $this->id . '.xml';
... ...