Commit 4fe90834a7284a03b6aa5096207f6cb28374b7e7

Authored by Benjamin Renard
1 parent c76ef7b2

Fix bug with get default plot config request and templated parameters

src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php
... ... @@ -31,7 +31,12 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface
31 31  
32 32 if (!isset($input->paramId) || empty($input->paramId))
33 33 throw new Exception("Param info request need a param id as argument");
34   - $paramFilePath = IHMConfigClass::getLocalParamDBPath().$input->paramId.".xml";
  34 +
  35 + if ($this->paramTemplateMgr->isTemplatedParam($input->paramId))
  36 + //Use param template file
  37 + $paramFilePath = $this->paramTemplateMgr->getTemplatePath($input->paramId);
  38 + else
  39 + $paramFilePath = IHMConfigClass::getLocalParamDBPath().$input->paramId.".xml";
35 40  
36 41 if (!file_exists($paramFilePath))
37 42 throw new Exception("Cannot find parameter definition file");
... ... @@ -189,7 +194,13 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface
189 194 if (!isset($paramsNode))
190 195 return $result_data;
191 196  
192   - $paramNode = $paramsNode->getParamById($paramId);
  197 + if ($this->paramTemplateMgr->isTemplatedParam($paramId))
  198 + //Use templated parameter
  199 + $realParamId = $this->paramTemplateMgr->getTemplateFileName($paramId);
  200 + else
  201 + $realParamId = $paramId;
  202 +
  203 + $paramNode = $paramsNode->getParamById($realParamId);
193 204  
194 205 if (!isset($paramNode) || (count($paramNode->getChildren()) < 1))
195 206 return $result_data;
... ...
src/InputOutput/IHMImpl/Tools/IHMParamTemplateClass.php
... ... @@ -182,13 +182,22 @@ class IHMParamTemplateClass
182 182 /*
183 183 * @brief Get template file path
184 184 */
185   - private function getTemplatePath($param_id) {
  185 + public function getTemplatePath($param_id) {
186 186 if (!$this->isTemplatedParam($param_id))
187 187 return "";
188 188 return IHMConfigClass::getParamTemplateFilePath($this->paramTemplateList[$param_id]['fileName']);
189 189 }
190 190  
191 191 /*
  192 + *
  193 + */
  194 + public function getTemplateFileName($param_id) {
  195 + if (!$this->isTemplatedParam($param_id))
  196 + return "";
  197 + return $this->paramTemplateList[$param_id]['fileName'];
  198 + }
  199 +
  200 + /*
192 201 * @brief Replace args in string
193 202 */
194 203 private function replaceArgs($string, $template_args) {
... ...