Commit feae26362c87bfa37b0aff0a6053d2b3c29fee3b
1 parent
e0f3e2e9
Exists in
master
and in
2 other branches
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,27 +223,7 @@ class WebServer | ||
223 | { | 223 | { |
224 | $param = new stdClass; | 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 | $params[] = $param; | 227 | $params[] = $param; |
248 | } | 228 | } |
249 | 229 | ||
@@ -460,6 +440,7 @@ class WebServer | @@ -460,6 +440,7 @@ class WebServer | ||
460 | $dim_1 = empty($dim_1) ? 1 : intval($dim_1); | 440 | $dim_1 = empty($dim_1) ? 1 : intval($dim_1); |
461 | $dim_2 = $paramNode->getAttribute('dim_2'); | 441 | $dim_2 = $paramNode->getAttribute('dim_2'); |
462 | $dim_2 = empty($dim_2) ? 1 : intval($dim_2); | 442 | $dim_2 = empty($dim_2) ? 1 : intval($dim_2); |
443 | + $ws_id = "ws_".$paramNode->getAttribute('name'); | ||
463 | $paramNode->setAttribute('size', $dim_1 * $dim_2); | 444 | $paramNode->setAttribute('size', $dim_1 * $dim_2); |
464 | 445 | ||
465 | $display_type = 'timeseries'; | 446 | $display_type = 'timeseries'; |
@@ -470,16 +451,21 @@ class WebServer | @@ -470,16 +451,21 @@ class WebServer | ||
470 | $display_type = 'spectrogram'; | 451 | $display_type = 'spectrogram'; |
471 | } | 452 | } |
472 | $paramNode->setAttribute('display_type', $display_type); | 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 | // => In parameters from an uploaded file | 457 | // => In parameters from an uploaded file |
475 | $paramNodes = $dom->getElementsByTagName("mydata"); | 458 | $paramNodes = $dom->getElementsByTagName("mydata"); |
476 | foreach ($paramNodes as $paramNode) { | 459 | foreach ($paramNodes as $paramNode) { |
477 | // size already exists | 460 | // size already exists |
461 | + $wsd_id = "wsd_".$paramNode->getAttribute('name'); | ||
478 | $display_type = 'timeseries'; | 462 | $display_type = 'timeseries'; |
479 | if ($paramNode->getAttribute('plottype') == 'Spectra') { | 463 | if ($paramNode->getAttribute('plottype') == 'Spectra') { |
480 | $display_type = 'spectrogram'; | 464 | $display_type = 'spectrogram'; |
481 | } | 465 | } |
482 | $paramNode->setAttribute('display_type', $display_type); | 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 | $dom->save(WSConfigClass::getWsResultDir().$wsParamDst); | 470 | $dom->save(WSConfigClass::getWsResultDir().$wsParamDst); |
485 | 471 |