Commit 02abc7804275592ec163be49df4bb28d68d9e240

Authored by Benjamin Renard
1 parent 05da1b4d

Support request from WS + Add some new test parameters

install/testParams/newKernelDDBase/asy.xml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<param xml:id="asy">
  3 + <get>
  4 + <vi name="ground:based:asy">
  5 + <baseParam name="ASY"/>
  6 + </vi>
  7 + </get>
  8 + <process/>
  9 + <output/>
  10 +</param>
install/testParams/newKernelDDBase/sw_n.xml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?xml version="1.0"?>
  2 +<param xml:id='sw_n'>
  3 + <get>
  4 + <vi name='ace:swe:all'>
  5 + <baseParam name='Np'/>
  6 + </vi>
  7 + </get>
  8 + <process/>
  9 + <output/>
  10 +</param>
install/testParams/newKernelDDBase/sw_t.xml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?xml version="1.0"?>
  2 +<param xml:id='sw_t'>
  3 + <get>
  4 + <vi name='ace:swp:all'>
  5 + <baseParam name='Tp'/>
  6 + </vi>
  7 + </get>
  8 + <process/>
  9 + <output/>
  10 +</param>
install/testParams/newKernelDDBase/sw_vb.xml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?xml version="1.0"?>
  2 +<param xml:id='sw_vb'>
  3 + <get>
  4 + <vi name='ace:swe:all'>
  5 + <baseParam name='Vp'/>
  6 + </vi>
  7 + </get>
  8 + <process/>
  9 + <output/>
  10 +</param>
install/testParams/newKernelDDBase/sym.xml 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<param xml:id="sym">
  3 + <get>
  4 + <vi name="ground:based:asy">
  5 + <baseParam name="SYM"/>
  6 + </vi>
  7 + </get>
  8 + <process/>
  9 + <output/>
  10 +</param>
src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php
@@ -50,15 +50,19 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas @@ -50,15 +50,19 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas
50 { 50 {
51 case "ASCII" : 51 case "ASCII" :
52 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::ASCII); 52 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::ASCII);
  53 + $formatExtension = ".txt";
53 break; 54 break;
54 case "vot" : 55 case "vot" :
55 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::VOTABLE); 56 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::VOTABLE);
  57 + $formatExtension = ".vot";
56 break; 58 break;
57 case "cdf" : 59 case "cdf" :
58 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::CDF); 60 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::CDF);
  61 + $formatExtension = ".cdf";
59 break; 62 break;
60 case "json" : 63 case "json" :
61 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::JSON); 64 $downloadNode->setFileFormat(RequestOutputDownloadFileFormatEnum::JSON);
  65 + $formatExtension = ".json";
62 break; 66 break;
63 default : 67 default :
64 throw new Exception('File format not implemented.'); 68 throw new Exception('File format not implemented.');
@@ -105,16 +109,34 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas @@ -105,16 +109,34 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas
105 109
106 //filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']], 110 //filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']],
107 $extension = ""; 111 $extension = "";
  112 + $resultFilePrefix = "";
108 switch ($input->compression) 113 switch ($input->compression)
109 { 114 {
110 case "zip" : 115 case "zip" :
111 $extension = ".zip"; 116 $extension = ".zip";
112 $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP); 117 $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP);
  118 + $resultFilePrefix = "download_";
113 break; 119 break;
114 case "tar+gzip" : 120 case "tar+gzip" :
115 $extension = ".tar.gz"; 121 $extension = ".tar.gz";
116 $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR); 122 $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR);
117 $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP); 123 $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP);
  124 + $resultFilePrefix = "download_";
  125 + break;
  126 + case "gzip" :
  127 + $extension = $formatExtension.".gz";
  128 + $downloadNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP);
  129 + if ($input->fileprefix)
  130 + $resultFilePrefix = $input->fileprefix;
  131 + else
  132 + $resultFilePrefix = "output-";
  133 + break;
  134 + case "" :
  135 + $extension = $formatExtension;
  136 + if ($input->fileprefix)
  137 + $resultFilePrefix = $input->fileprefix;
  138 + else
  139 + $resultFilePrefix = "output-";
118 break; 140 break;
119 default : 141 default :
120 throw new Exception('Compression type not implemented.'); 142 throw new Exception('Compression type not implemented.');
@@ -123,11 +145,15 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas @@ -123,11 +145,15 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas
123 $resultFile = "result_".$this->requestID; 145 $resultFile = "result_".$this->requestID;
124 $this->paramsData->addWaitingResult(DOWNLOAD_RESULT_FILE_KEY, $resultFile); 146 $this->paramsData->addWaitingResult(DOWNLOAD_RESULT_FILE_KEY, $resultFile);
125 147
126 - $postProcessCmd = "mv download_*"; 148 + $postProcessCmd = "mv ".$resultFilePrefix."*";
  149 +
127 $postProcessCmd .= $extension; 150 $postProcessCmd .= $extension;
128 $postProcessCmd .= " ".$resultFile.$extension; 151 $postProcessCmd .= " ".$resultFile.$extension;
129 152
130 $this->paramsData->setPostCmd($postProcessCmd); 153 $this->paramsData->setPostCmd($postProcessCmd);
  154 +
  155 + if (isset($input->disablebatch))
  156 + $this->paramsData->setBatchEnable(!$input->disablebatch);
131 157
132 return $this->paramsData; 158 return $this->paramsData;
133 } 159 }
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
@@ -11,6 +11,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -11,6 +11,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
11 { 11 {
12 private $isInteractiveRequest = false; 12 private $isInteractiveRequest = false;
13 13
  14 + private $isFromWS = false;
  15 +
14 private $interactiveRequestRealIndexes = array(); 16 private $interactiveRequestRealIndexes = array();
15 private $interactiveMultiPlotState = array(); 17 private $interactiveMultiPlotState = array();
16 private $interactiveTimeSelectionState = array(); 18 private $interactiveTimeSelectionState = array();
@@ -44,6 +46,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -44,6 +46,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
44 $requestIndexInParamData = 0; 46 $requestIndexInParamData = 0;
45 $tabRequestIndex = 0; 47 $tabRequestIndex = 0;
46 $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE'); 48 $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE');
  49 + $this->isFromWS = ($input->{'file-output'} == 'WS');
47 $postProcessCmd = ""; 50 $postProcessCmd = "";
48 foreach ($input->tabs as $tab) 51 foreach ($input->tabs as $tab)
49 { 52 {
@@ -119,7 +122,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -119,7 +122,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
119 $plotOutputNode->setWriteContextFile($this->isInteractiveRequest ? "true" : "false"); 122 $plotOutputNode->setWriteContextFile($this->isInteractiveRequest ? "true" : "false");
120 123
121 $compression = ""; 124 $compression = "";
122 - if (!$this->isInteractiveRequest) 125 + if (!$this->isInteractiveRequest && !$this->isFromWS)
123 { 126 {
124 switch ($input->{'file-output'}) 127 switch ($input->{'file-output'})
125 { 128 {
@@ -235,7 +238,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -235,7 +238,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
235 foreach ($tab->{'panels'} as $panelData) 238 foreach ($tab->{'panels'} as $panelData)
236 $this->unmarshallPanel($panelData, $pageNode, $paramsNode); 239 $this->unmarshallPanel($panelData, $pageNode, $paramsNode);
237 240
238 - if ($this->isInteractiveRequest) 241 + if ($this->isInteractiveRequest || $this->isFromWS)
239 { 242 {
240 $resultFile = $filePrefix."_*".$extension; 243 $resultFile = $filePrefix."_*".$extension;
241 $waitingResultFile = $filePrefix.$extension; 244 $waitingResultFile = $filePrefix.$extension;
@@ -267,8 +270,15 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -267,8 +270,15 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
267 $postProcessCmd .= " | "; 270 $postProcessCmd .= " | ";
268 $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile; 271 $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile;
269 272
270 - if ($this->isInteractiveRequest && $isPortrait) 273 + if (($this->isInteractiveRequest) && $isPortrait)
271 $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$waitingResultFile; 274 $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$waitingResultFile;
  275 + else if ($this->isFromWS)
  276 + {
  277 + if ($isPortrait)
  278 + $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$input->{"ws-result-file"};
  279 + else
  280 + $postProcessCmd .= " | mv ".$waitingResultFile." ".$input->{"ws-result-file"};
  281 + }
272 282
273 ++$tabRequestIndex; 283 ++$tabRequestIndex;
274 ++$requestIndexInParamData; 284 ++$requestIndexInParamData;
@@ -349,7 +359,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -349,7 +359,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
349 } 359 }
350 360
351 //Panel id 361 //Panel id
352 - $panelNode->setId($panelData->{'id'}); 362 + if (isset($panelData->{'id'}))
  363 + $panelNode->setId($panelData->{'id'});
353 364
354 //Panel background color 365 //Panel background color
355 if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != '')) 366 if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != ''))
@@ -535,10 +546,12 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -535,10 +546,12 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
535 $axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false"); 546 $axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false");
536 547
537 //axis color 548 //axis color
538 - $axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'})); 549 + if (isset($axisData->{'axis-color'}))
  550 + $axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'}));
539 551
540 //axis thickness 552 //axis thickness
541 - $axisNode->setThickness($axisData->{'axis-thickness'}); 553 + if (isset($axisData->{'axis-thickness'}))
  554 + $axisNode->setThickness($axisData->{'axis-thickness'});
542 555
543 //axis ticks position 556 //axis ticks position
544 switch ($axisData->{'axis-tick-position'}) 557 switch ($axisData->{'axis-tick-position'})
@@ -1273,9 +1286,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -1273,9 +1286,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1273 { 1286 {
1274 switch ($inputData->{$keyPrefix.'-style'}) 1287 switch ($inputData->{$keyPrefix.'-style'})
1275 { 1288 {
1276 - case 'plain' :  
1277 - $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::PLAIN);  
1278 - break; 1289 +
1279 case 'dot' : 1290 case 'dot' :
1280 $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::DOT); 1291 $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::DOT);
1281 break; 1292 break;
@@ -1285,13 +1296,16 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -1285,13 +1296,16 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1285 case 'long-short-dot' : 1296 case 'long-short-dot' :
1286 $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSHORTDOT); 1297 $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSHORTDOT);
1287 break; 1298 break;
1288 - default :  
1289 - throw new Exception('Curve style not implemented.'); 1299 + case 'plain' :
  1300 + default :
  1301 + $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::PLAIN);
  1302 + break;
1290 } 1303 }
1291 -  
1292 - $curveNode->setWidth($inputData->{$keyPrefix.'-width'}); 1304 +
  1305 + if (isset($inputData->{$keyPrefix.'-width'}))
  1306 + $curveNode->setWidth($inputData->{$keyPrefix.'-width'});
1293 1307
1294 - if ($inputData->{$keyPrefix.'-color'} != 'auto') 1308 + if (isset($inputData->{$keyPrefix.'-color'}) && ($inputData->{$keyPrefix.'-color'} != 'auto'))
1295 $curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); 1309 $curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'}));
1296 } 1310 }
1297 1311
src/InputOutput/IHMImpl/Tools/IHMUserParamLoaderClass.php
@@ -78,6 +78,34 @@ class IHMUserParamLoaderClass @@ -78,6 +78,34 @@ class IHMUserParamLoaderClass
78 } 78 }
79 79
80 /* 80 /*
  81 + * @brief Get derived parameter name from id
  82 + */
  83 + public function getDerivedParameterNameFromId($paramId)
  84 + {
  85 + if (!preg_match("#^ws_#",$paramId))
  86 + return array("success" => false, "message" => "Bad derived parameter id");
  87 +
  88 + //try to load user parameters definition if not already done
  89 + if (!isset($this->userParamsList))
  90 + $this->userParamsList = $this->loadUserParamManagerFile();
  91 +
  92 + if (!$this->userParamsList["success"])
  93 + return $this->userParamsList["success"];
  94 +
  95 + if (isset($this->userParamsList["params"]) && isset($this->userParamsList["params"]["derived"]))
  96 + {
  97 + //find the parameter name
  98 + foreach($this->userParamsList["params"]["derived"] as $paramInfo)
  99 + {
  100 + if ($paramInfo["id"] == $paramId)
  101 + return array("success" => true, "name" => $paramInfo["name"]);
  102 + }
  103 + }
  104 +
  105 + return array("success" => false, "message" => "Cannot find derived parameter");
  106 + }
  107 +
  108 + /*
81 * @brief Get uploaded parameter info from name ("wsd_***") 109 * @brief Get uploaded parameter info from name ("wsd_***")
82 */ 110 */
83 public function getUploadedParameterFromName($paramName) 111 public function getUploadedParameterFromName($paramName)
@@ -109,6 +137,34 @@ class IHMUserParamLoaderClass @@ -109,6 +137,34 @@ class IHMUserParamLoaderClass
109 } 137 }
110 138
111 /* 139 /*
  140 + * @brief Get uploaded parameter name from id
  141 + */
  142 + public function getUploadedParameterNameFromId($paramId)
  143 + {
  144 + if (!preg_match("#^wsd_#",$paramId))
  145 + return array("success" => false, "message" => "Bad uploaded parameter id");
  146 +
  147 + //try to load user parameters definition if not already done
  148 + if (!isset($this->userParamsList))
  149 + $this->userParamsList = $this->loadUserParamManagerFile();
  150 +
  151 + if (!$this->userParamsList["success"])
  152 + return $this->userParamsList["success"];
  153 +
  154 + if (isset($this->userParamsList["params"]) && isset($this->userParamsList["params"]["uploaded"]))
  155 + {
  156 + //find the parameter info
  157 + foreach($this->userParamsList["params"]["uploaded"] as $paramInfo)
  158 + {
  159 + if ($paramInfo["id"] == $paramId)
  160 + return array("success" => true, "name" => $paramInfo["name"]);
  161 + }
  162 + }
  163 +
  164 + return array("success" => false, "message" => "Cannot find uploaded parameter");
  165 + }
  166 +
  167 + /*
112 * @brief Load derived parameter manager file 168 * @brief Load derived parameter manager file
113 */ 169 */
114 private function loadUserParamManagerFile() 170 private function loadUserParamManagerFile()