diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php
index 748b65c..5c4aeda 100644
--- a/php/classes/AmdaAction.php
+++ b/php/classes/AmdaAction.php
@@ -168,35 +168,13 @@ class AmdaAction
'info' => $child->getAttribute('info')
];
break;
+
case 'download':
- $objectMgr = new RequestMgr($nodeType);
- $objdown = $objectMgr->getObject($id);
- $info = "Empty";
- if (!empty($objdown->list)) {
- $params_list = array();
- foreach ($objdown->list as $p) {
- if (!in_array($p->paramid, $params_list))
- $params_list[] = $p->paramid;
- }
- if (!empty($params_list)) {
- $info = implode('
',$params_list);
- }
- }
- break;
case 'condition':
+ case 'request':
$objectMgr = new RequestMgr($nodeType);
- $info = $objectMgr->getObject($id)->expression;
+ $info = $objectMgr->getObjectInfo($id);
break;
- case 'request':
- $objectMgr = new RequestMgr($nodeType);
- $objplot = $objectMgr->getObject($id);
- if (isset($objplot->name)) {
- $info = $objplot->name;
- }
- else {
- $info = $id;
- }
- break;
case 'timeTable':
case 'catalog':
diff --git a/php/classes/RequestMgr.php b/php/classes/RequestMgr.php
index 8debbc4..41e7cc8 100644
--- a/php/classes/RequestMgr.php
+++ b/php/classes/RequestMgr.php
@@ -177,17 +177,14 @@ class RequestMgr extends AmdaObjectMgr
if ($this->type == 'condition')
{
$p->expression = $this->resetAlias($p->expression);
- $info = $p->expression;
}
else if ($this->type == 'request')
{
- $info = '';
for ($i=0; $i < count($p->children); $i++)
{
for ($j=0; $j < count($p->children[$i]->children); $j++)
{
$p->children[$i]->children[$j]->name = $this->resetAlias($p->children[$i]->children[$j]->name);
- $info = $info.' '.$p->children[$i]->children[$j]->name;
}
}
}
@@ -205,7 +202,7 @@ class RequestMgr extends AmdaObjectMgr
$this -> addToContent($p, $folder);
- return array('id' => $this->id, 'info' => $info, 'last_update' => $p->last_update) + $additional;
+ return array('id' => $this->id, 'info' => $this->getObjectInfo($p->id), 'last_update' => $p->last_update) + $additional;
}
public static function checkRequest($obj)
@@ -355,5 +352,87 @@ class RequestMgr extends AmdaObjectMgr
return array('success' => true);
}
+
+ public function getObjectInfo($id) {
+ $info = "Request ID: ".$id."
";
+
+ if (!file_exists(USERREQDIR.$id)) {
+ $info .= "ERROR: Cannot retrieve request definition file";
+ return $info;
+ }
+
+ $obj = json_decode(file_get_contents(USERREQDIR.$id));
+ if (empty($obj)) {
+ $info .= "ERROR: Cannot load request definition file";
+ return $info;
+ }
+
+ switch ($this->type) {
+ case 'request':
+ $info .= "Plot: ";
+ $panels_list = array();
+ if (!empty($obj->panels)) {
+ foreach ($obj->panels as $p) {
+ $panel_info = "Panel #".$p->{"panel-index"}.": ";
+ if (empty($p->params)) {
+ $panel_info .= "Empty";
+ }
+ else {
+ $params_list = array();
+ if (!empty($p->params)) {
+ foreach ($p->params as $p) {
+ if (!in_array($p->paramid, $params_list))
+ $params_list[] = $p->paramid;
+ }
+ }
+ if (!empty($params_list)) {
+ $panel_info .= implode(', ', $params_list);
+ }
+ else {
+ $panel_info .= "Empty";
+ }
+ }
+ $panels_list[] = $panel_info;
+ }
+ }
+ if (!empty($panels_list)) {
+ $info .= '
'.implode('
', $panels_list);
+ }
+ else {
+ $info .= "Empty";
+ }
+ break;
+ case 'condition':
+ $info .= "Data Mining: ".htmlspecialchars($obj->expression);
+ break;
+ case 'download':
+ $info .= "Download: ";
+ $params_list = array();
+ if (!empty($obj->list)) {
+ foreach ($obj->list as $p) {
+ if (!in_array($p->paramid, $params_list))
+ $params_list[] = $p->paramid;
+ }
+ }
+ if (!empty($params_list)) {
+ $info .= implode(', ',$params_list);
+ }
+ else {
+ $info .= "Empty";
+ }
+ break;
+ default:
+ $info .= "ERROR: Unknown request type";
+ }
+
+ return $info;
+ }
+
+ function modifyObject($p)
+ {
+ $result = parent::modifyObject($p);
+ $result["info"] = $this->getObjectInfo($p->id);
+ return $result;
+ }
}
?>
--
libgit2 0.21.2