Commit feae26362c87bfa37b0aff0a6053d2b3c29fee3b

Authored by Benjamin Renard
1 parent e0f3e2e9

Fix derived parameter id in REST WS

Showing 1 changed file with 7 additions and 21 deletions   Show diff stats
php/WebServices/WebServer.php
... ... @@ -223,27 +223,7 @@ class WebServer
223 223 {
224 224 $param = new stdClass;
225 225  
226   - if (preg_match("#^ws_#",$paramId))
227   - {
228   - $res = $this->paramLoader->getDerivedParameterNameFromId($paramId);
229   -
230   - if (!$res["success"]) {
231   - $this->throwError("serverError", "Not available derived parameter $paramId");
232   - }
233   - $param->paramid = "ws_".$res['name'];
234   - }
235   - else if (preg_match("#^wsd_#",$paramId))
236   - {
237   - $res = $this->paramLoader->getUploadedParameterNameFromId($paramId);
238   -
239   - if (!$res["success"]){
240   - $this->throwError("serverError", "Not available parameter $paramId");
241   - }
242   - $param->paramid = "wsd_".$res['name'];
243   - }
244   - else {
245   - $param->paramid = $paramId;
246   - }
  226 + $param->paramid = $paramId;
247 227 $params[] = $param;
248 228 }
249 229  
... ... @@ -460,6 +440,7 @@ class WebServer
460 440 $dim_1 = empty($dim_1) ? 1 : intval($dim_1);
461 441 $dim_2 = $paramNode->getAttribute('dim_2');
462 442 $dim_2 = empty($dim_2) ? 1 : intval($dim_2);
  443 + $ws_id = "ws_".$paramNode->getAttribute('name');
463 444 $paramNode->setAttribute('size', $dim_1 * $dim_2);
464 445  
465 446 $display_type = 'timeseries';
... ... @@ -470,16 +451,21 @@ class WebServer
470 451 $display_type = 'spectrogram';
471 452 }
472 453 $paramNode->setAttribute('display_type', $display_type);
  454 + $paramNode->setAttribute('internal_id', $paramNode->getAttribute('xml:id'));
  455 + $paramNode->setAttribute('xml:id', $ws_id);
473 456 }
474 457 // => In parameters from an uploaded file
475 458 $paramNodes = $dom->getElementsByTagName("mydata");
476 459 foreach ($paramNodes as $paramNode) {
477 460 // size already exists
  461 + $wsd_id = "wsd_".$paramNode->getAttribute('name');
478 462 $display_type = 'timeseries';
479 463 if ($paramNode->getAttribute('plottype') == 'Spectra') {
480 464 $display_type = 'spectrogram';
481 465 }
482 466 $paramNode->setAttribute('display_type', $display_type);
  467 + $paramNode->setAttribute('internal_id', $paramNode->getAttribute('xml:id'));
  468 + $paramNode->setAttribute('xml:id', $wsd_id);
483 469 }
484 470 $dom->save(WSConfigClass::getWsResultDir().$wsParamDst);
485 471  
... ...