Commit 735c653be8152026a0653852ff6f20cdbbf66260

Authored by Elena.Budnik
1 parent 37105924

rank at observatory level also

Showing 2 changed files with 900 additions and 877 deletions   Show diff stats
generic_data/rank.json
1 1 {"Mercury": 1, "Venus": 2, "Heliosphere.NearEarth": 3, "Heliosphere.Remote1AU": 4,
2 2 "Earth.Magnetosheath": 5, "Earth.Magnetosphere": 5, "Earth": 5, "Earth.Surface": 6,
3   -"Mars": 7, "Jupiter": 8, "Saturn": 9, "Uranus" : 91, "Neptune" : 92, "Comet" : 93,
  3 +"Mars": 7, "Jupiter": 8, "Ganymede" : 8, "Saturn": 9, "Uranus" : 91, "Neptune" : 92, "Comet" : 93,
4 4 "Heliosphere" : 99 }
5 5 \ No newline at end of file
... ...
php/classes/AmdaAction.php
... ... @@ -6,526 +6,550 @@
6 6 */
7 7  
8 8  
9   -class AmdaAction {
10   -
11   - private $xmlFiles = array('localParam' => 'LocalParams.xml', 'remoteParam' => 'RemoteParams.xml',
12   - 'remoteSimuParam' => 'RemoteParams.xml', 'derivedParam' => 'WsParams.xml', 'myDataParam' => 'WsParams.xml',
13   - 'timeTable' => 'Tt.xml', 'catalog' => 'Tt.xml', 'alias' => 'Alias.xml',
14   - 'myData' => 'Files.xml',
15   - 'request' => 'Request.xml', 'condition' => 'Request.xml',
16   - 'bkgWorks' => 'jobs.xml');
17   -
18   - private $user, $amdaStat;
19   -
20   - public function __construct()
21   - {
22   - $dd = new UserMgr();
23   - $this->user = $dd->user;
24   - if (!defined('NEWKERNEL_DEBUG') || !NEWKERNEL_DEBUG)
25   - $this->amdaStat = new AmdaStats($dd->user);
26   - }
  9 +class AmdaAction
  10 +{
  11 + private $xmlFiles = array('localParam' => 'LocalParams.xml', 'remoteParam' => 'RemoteParams.xml',
  12 + 'remoteSimuParam' => 'RemoteParams.xml', 'derivedParam' => 'WsParams.xml', 'myDataParam' => 'WsParams.xml',
  13 + 'timeTable' => 'Tt.xml', 'catalog' => 'Tt.xml', 'alias' => 'Alias.xml',
  14 + 'myData' => 'Files.xml',
  15 + 'request' => 'Request.xml', 'condition' => 'Request.xml',
  16 + 'bkgWorks' => 'jobs.xml');
  17 +
  18 + private $user, $amdaStat;
  19 +
  20 + public function __construct()
  21 + {
  22 + $dd = new UserMgr();
  23 + $this->user = $dd->user;
  24 + if (!defined('NEWKERNEL_DEBUG') || !NEWKERNEL_DEBUG)
  25 + $this->amdaStat = new AmdaStats($dd->user);
  26 + }
27 27  
28   - private function getUrlDirs($url) {
29   - //TODO replace by ftp php class methods: ftp_nlist() etc
30   - require_once "simple_html_dom.php";
31   -
32   - $url = html_entity_decode($url);
33   - $trimmed_url = trim($url);
34   - if (strrpos($trimmed_url, "/") == strlen($trimmed_url) - 1) {
35   - if (file_exists("temp.html")) unlink("temp.html");
36   - exec("wget -O temp.html ".$url);
37   -
38   - $html = file_get_html('temp.html');
39   - $dirs = $html->find('a[href]');
40   - foreach ($dirs as $dir) {
41   - $name = $dir->innertext; //$dir->href;
42   - $isLeaf = strrpos($name, "/") !== strlen($name) - 1;
43   - $childrenToReturn[] = array('text' => $name, 'id' => $trimmed_url.$name,
44   - 'nodeType' => 'url', 'leaf' => $isLeaf);
45   - }
46   -
47   - }
48   - return $childrenToReturn;
49   - }
50   -
  28 + private function getUrlDirs($url)
  29 + {
  30 + //TODO replace by ftp php class methods: ftp_nlist() etc
  31 + require_once "simple_html_dom.php";
  32 +
  33 + $url = html_entity_decode($url);
  34 + $trimmed_url = trim($url);
  35 + if (strrpos($trimmed_url, "/") == strlen($trimmed_url) - 1)
  36 + {
  37 + if (file_exists("temp.html")) unlink("temp.html");
  38 + exec("wget -O temp.html ".$url);
  39 +
  40 + $html = file_get_html('temp.html');
  41 + $dirs = $html->find('a[href]');
  42 + foreach ($dirs as $dir)
  43 + {
  44 + $name = $dir->innertext; //$dir->href;
  45 + $isLeaf = strrpos($name, "/") !== strlen($name) - 1;
  46 + $childrenToReturn[] = array('text' => $name, 'id' => $trimmed_url.$name,
  47 + 'nodeType' => 'url', 'leaf' => $isLeaf);
  48 + }
  49 +
  50 + }
  51 +
  52 + return $childrenToReturn;
  53 +
  54 + }
  55 +
51 56 /*****************************************************************
52 57 * PUBLIC FUNCTIONS
53 58 *****************************************************************/
54 59  
55   - /*
56   - * $obj = { id: node.id, nodeType: node.nodeType }
57   - */
58   - public function getTree($obj) {
59   -
60   - $node = $obj->node;
61   -
62   - // to correct 'restricted' parameters
63   - if (strpos($node, restricted) !== false) {
64   - $node = str_replace(restricted,"",$node);
65   - }
  60 + /*
  61 + * $obj = { id: node.id, nodeType: node.nodeType }
  62 + */
  63 + public function getTree($obj) {
66 64  
67   - $nodeType = $obj->nodeType;
68   - $remoteBase = false;
69   - $isRemoteDataSet = false;
  65 + $node = $obj->node;
  66 +
  67 + // to correct 'restricted' parameters
  68 + if (strpos($node, restricted) !== false)
  69 + {
  70 + $node = str_replace(restricted,"",$node);
  71 + }
70 72  
71   - if ($nodeType == 'url')
72   - {
73   - $url = $node == 'root' ? $obj->baseId : $node;
74   - return $this->getUrlDirs($url);
75   - }
  73 + $nodeType = $obj->nodeType;
  74 + $remoteBase = false;
  75 + $isRemoteDataSet = false;
76 76  
77   - if ($obj->baseId) $remoteBase = true;
  77 + if ($nodeType == 'url')
  78 + {
  79 + $url = $node == 'root' ? $obj->baseId : $node;
  80 + return $this->getUrlDirs($url);
  81 + }
78 82  
79   - if ($node == 'root' && $remoteBase) $node = $obj->baseId;
  83 + if ($obj->baseId) $remoteBase = true;
80 84  
81   - if ($node == 'root' && !$remoteBase)
82   - {
83   - $json_o = json_decode(file_get_contents(DATAPATH.$nodeType.'.json'));
84   - $childrenToReturn = $json_o->nodes;
85   - }
86   - else
87   - {
88   - $Dom = new DomDocument("1.0");
  85 + if ($node == 'root' && $remoteBase) $node = $obj->baseId;
89 86  
90   - switch ($nodeType)
91   - {
92   - case 'sharedtimeTable':
93   - case 'sharedcatalog':
94   - $xmlName = SHAREDPATH.'/SharedObjectTree.xml';
95   - break;
96   - case 'bkgWorks':
97   - $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType];
98   - break;
99   - case 'source':
100   - $xmlName = DATAPATH.'RemoteData/'.$obj->baseId.'/base.xml';
101   - break;
102   - case 'destination':
103   - $xmlName = USERWSDIR.'RemoteParams.xml';
104   - break;
105   - default:
106   - $xmlName = USERWSDIR.$this->xmlFiles[$nodeType];
107   - }
  87 + if ($node == 'root' && !$remoteBase)
  88 + {
  89 + $json_o = json_decode(file_get_contents(DATAPATH.$nodeType.'.json'));
  90 + $childrenToReturn = $json_o->nodes;
  91 + }
  92 + else
  93 + {
  94 + $Dom = new DomDocument("1.0");
  95 +
  96 + switch ($nodeType)
  97 + {
  98 + case 'sharedtimeTable':
  99 + case 'sharedcatalog':
  100 + $xmlName = SHAREDPATH.'/SharedObjectTree.xml';
  101 + break;
  102 + case 'bkgWorks':
  103 + $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType];
  104 + break;
  105 + case 'source':
  106 + $xmlName = DATAPATH.'RemoteData/'.$obj->baseId.'/base.xml';
  107 + break;
  108 + case 'destination':
  109 + $xmlName = USERWSDIR.'RemoteParams.xml';
  110 + break;
  111 + default:
  112 + $xmlName = USERWSDIR.$this->xmlFiles[$nodeType];
  113 + }
108 114  
109   - if ($remoteBase)
110   - {
111   - $nodeType = 'remoteParam';
112   - }
  115 + if ($remoteBase)
  116 + {
  117 + $nodeType = 'remoteParam';
  118 + }
113 119  
114   - $Dom->load($xmlName);
  120 + $Dom->load($xmlName);
115 121  
116   - if ($node == "myRemoteSimuData-treeRootNode")
117   - $node = "myRemoteData-treeRootNode";
  122 + if ($node == "myRemoteSimuData-treeRootNode")
  123 + $node = "myRemoteData-treeRootNode";
118 124  
119   - $nodeToOpen = $Dom->getElementById($node);
120   - $children = $nodeToOpen->childNodes;
  125 + $nodeToOpen = $Dom->getElementById($node);
  126 + $children = $nodeToOpen->childNodes;
121 127  
122   - foreach ($children as $child)
123   - if ($child->nodeType == XML_ELEMENT_NODE) {
124   - $isLeaf = true;
  128 + foreach ($children as $child)
  129 + if ($child->nodeType == XML_ELEMENT_NODE)
  130 + {
  131 + $isLeaf = true;
125 132  
126   - if ($child->hasChildNodes())
127   - foreach ($child->childNodes as $grandChild)
128   - if ($grandChild -> nodeType == XML_ELEMENT_NODE) {
129   - $isLeaf = false;
130   - break;
131   - }
132   - if ($child->tagName == 'folder') $isLeaf = false;
133   -
134   - //TODO MAKE PROPERLY as function of nodetype !!!!
135   - $info = '';
136   - $id = $child->getAttribute('xml:id');
137   - $name = $child->getAttribute('name');
138   - $help = $child->getAttribute('att');
139   - if ($child->hasAttribute('dataStart')) $dataStart = $child->getAttribute('dataStart');
140   - if ($child->hasAttribute('dataStop')) $dataStop = $child->getAttribute('dataStop');
141   -
142   - $specialNode = false;
143   - $isParameter = false;
144   - $isAddable = false;
145   - $isSimulation = false;
146   - $rank = null;
147   -
148   - switch ($nodeType)
149   - {
150   - case 'bkgWorks':
151   - $specialNode = true;
152   - $status = $child->getAttribute('status');
153   - // if ($status == 'done') continue;
154   - $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'leaf' => $isLeaf,
155   - 'pid' => $child->getAttribute('pid'), 'status' => $status,
156   - 'jobType' => $child->getAttribute('jobType'), 'info' => $child->getAttribute('info'));
157   - break;
158   -
159   - case 'condition':
160   - $objectMgr = new RequestMgr();
161   - $info = $objectMgr->getObject($id)->expression;
162   - break;
163   -
164   - case 'request':
165   -
166   - $objectMgr = new RequestMgr();
167   - $objplot = $objectMgr->getObject($id);
168   - for ($i=0; $i < count($objplot->children); $i++) {
169   - for ($j=0; $j < count($objplot->children[$i]->children); $j++) {
170   - $info = $info.' '.$objplot->children[$i]->children[$j]->name;
171   - }
172   - }
173   -
174   - break;
175   -
176   - case 'alias':
177   - $info = $id;
178   - $id = 'alias_'.$id;
179   - if ($isLeaf) $isParameter = true;
180   - break;
181   -
182   - case 'timeTable':
183   - case 'catalog':
184   - if ($isLeaf) $info = $child->getAttribute('intervals').' intervals';
185   - break;
186   - case 'sharedtimeTable':
187   - case 'sharedcatalog':
188   - if ($isLeaf) {
189   - $info = '<b>Nb intervals:</b> '.$child->getAttribute('nbIntervals').'<br/>';
190   - $info .= '<b>Shared by:</b> '.$child->getAttribute('sharedBy').' ('.$child->getAttribute('sharedDate').')<br/>';
191   - $info .= '<b>Description:</b> '.$child->getAttribute('description');
192   - }
193   - break;
194   - case 'derivedParam':
195   - $info = $child->getAttribute('buildchain');
196   - if ($isLeaf) $isParameter = true;
197   - break;
198   -
199   - case 'localParam':
200   -
201   - $globalStart = null;
202   - $globalStop = null;
203   - $timeRestriction = false;
204   - $specialNode = true;
205   - $isParameter = false;
206   - $needsArgs = false;
207   - $isSpectra = false;
208   - $isStack = false;
209   -
210   - if ($child->hasAttribute('desc')) {
211   -
212   - $info = $child->getAttribute('desc');
213   -
214   - if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop')) {
215   - $info .= "<br/>Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop');
216   - }
217   -
218   - if ($child->getAttribute('dataStart') == 'depending on mission'){
219   - $info .= "<br/>Time Range: ".$child->getAttribute('dataStart');
220   - }
221   -
222   - if ($child->getAttribute('restriction') > 1) {
223   - $restricted = $child->getAttribute('restriction');
224   - $info .= "<br/><b>Time Restriction</b>: -$restricted days";
225   - }
226   - }
227   -
228   -
229   - if ($child->hasAttribute('units')) $info = $child->getAttribute('units');
230   -
231   - if ($child->tagName == 'parameter')
232   - {
233   - $isParameter = true;
234   - $isScatter = true;
235   -
236   - if ($child->parentNode->hasAttribute('dataStart'))
237   - {
238   - $globalStart = $child->parentNode->getAttribute('dataStart');
239   - $globalStop = $child->parentNode->getAttribute('dataStop');
240   - }
241   -
242   - if ($child->parentNode->getAttribute('restriction') > 1 )
243   - {
244   - $timeRestriction = true;
245   -
246   - }
247   -
248   - /*------------------- to show not tested parameters ------*/
249   -
250   - if ($child->getAttribute('tbd'))
251   - $info .= "<br/><b>Not tested yet</b>";
252   -
253   - /*------------------- --------------------------------------*/
254   -
255   - }
  133 + if ($child->hasChildNodes())
  134 + foreach ($child->childNodes as $grandChild)
  135 + if ($grandChild -> nodeType == XML_ELEMENT_NODE)
  136 + {
  137 + $isLeaf = false;
  138 + break;
  139 + }
  140 + if ($child->tagName == 'folder') $isLeaf = false;
  141 +
  142 + //TODO MAKE PROPERLY as function of nodetype !!!!
  143 + $info = '';
  144 + $id = $child->getAttribute('xml:id');
  145 + $name = $child->getAttribute('name');
  146 + $help = $child->getAttribute('att');
  147 + if ($child->hasAttribute('dataStart')) $dataStart = $child->getAttribute('dataStart');
  148 + if ($child->hasAttribute('dataStop')) $dataStop = $child->getAttribute('dataStop');
  149 +
  150 + $specialNode = false;
  151 + $isParameter = false;
  152 + $isAddable = false;
  153 + $isSimulation = false;
  154 + $rank = null;
  155 +
  156 + switch ($nodeType)
  157 + {
  158 + case 'bkgWorks':
  159 + $specialNode = true;
  160 + $status = $child->getAttribute('status');
  161 + // if ($status == 'done') continue;
  162 + $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'leaf' => $isLeaf,
  163 + 'pid' => $child->getAttribute('pid'), 'status' => $status,
  164 + 'jobType' => $child->getAttribute('jobType'), 'info' => $child->getAttribute('info'));
  165 + break;
  166 +
  167 + case 'condition':
  168 + $objectMgr = new RequestMgr();
  169 + $info = $objectMgr->getObject($id)->expression;
  170 + break;
  171 +
  172 + case 'request':
  173 + $objectMgr = new RequestMgr();
  174 + $objplot = $objectMgr->getObject($id);
  175 + for ($i=0; $i < count($objplot->children); $i++)
  176 + {
  177 + for ($j=0; $j < count($objplot->children[$i]->children); $j++)
  178 + {
  179 + $info = $info.' '.$objplot->children[$i]->children[$j]->name;
  180 + }
  181 + }
  182 + break;
  183 +
  184 + case 'alias':
  185 + $info = $id;
  186 + $id = 'alias_'.$id;
  187 + if ($isLeaf) $isParameter = true;
  188 + break;
  189 +
  190 + case 'timeTable':
  191 + case 'catalog':
  192 + if ($isLeaf) $info = $child->getAttribute('intervals').' intervals';
  193 + break;
  194 +
  195 + case 'sharedtimeTable':
  196 + case 'sharedcatalog':
  197 + if ($isLeaf)
  198 + {
  199 + $info = '<b>Nb intervals:</b> '.$child->getAttribute('nbIntervals').'<br/>';
  200 + $info .= '<b>Shared by:</b> '.$child->getAttribute('sharedBy').' ('.$child->getAttribute('sharedDate').')<br/>';
  201 + $info .= '<b>Description:</b> '.$child->getAttribute('description');
  202 + }
  203 + break;
  204 + case 'derivedParam':
  205 + $info = $child->getAttribute('buildchain');
  206 + if ($isLeaf) $isParameter = true;
  207 + break;
  208 +
  209 + case 'localParam':
  210 +
  211 + $globalStart = null;
  212 + $globalStop = null;
  213 + $timeRestriction = false;
  214 + $specialNode = true;
  215 + $isParameter = false;
  216 + $needsArgs = false;
  217 + $isSpectra = false;
  218 + $isStack = false;
  219 +
  220 + if ($child->hasAttribute('desc'))
  221 + {
  222 + $info = $child->getAttribute('desc');
  223 +
  224 + if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop'))
  225 + {
  226 + $info .= "<br/>Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop');
  227 + }
  228 +
  229 + if ($child->getAttribute('dataStart') == 'depending on mission')
  230 + {
  231 + $info .= "<br/>Time Range: ".$child->getAttribute('dataStart');
  232 + }
  233 +
  234 + if ($child->getAttribute('restriction') > 1)
  235 + {
  236 + $restricted = $child->getAttribute('restriction');
  237 + $info .= "<br/><b>Time Restriction</b>: -$restricted days";
  238 + }
  239 + }
  240 +
  241 + if ($child->hasAttribute('units')) $info = $child->getAttribute('units');
  242 +
  243 + if ($child->tagName == 'parameter')
  244 + {
  245 + $isParameter = true;
  246 + $isScatter = true;
  247 +
  248 + if ($child->parentNode->hasAttribute('dataStart'))
  249 + {
  250 + $globalStart = $child->parentNode->getAttribute('dataStart');
  251 + $globalStop = $child->parentNode->getAttribute('dataStop');
  252 + }
  253 +
  254 + if ($child->parentNode->getAttribute('restriction') > 1 )
  255 + {
  256 + $timeRestriction = true;
  257 +
  258 + }
  259 + /*------------------- to show not tested parameters ------*/
  260 + if ($child->getAttribute('tbd'))
  261 + $info .= "<br/><b>Not tested yet</b>";
  262 + /*------------------- --------------------------------------*/
  263 + }
256 264  
257   -
258   - $component_info = array();
259   - if ($child->tagName == 'component')
260   - {
261   - $isParameter = true;
262   - $isScatter = true;
263   -
264   - if ($child->parentNode->parentNode->hasAttribute('dataStart'))
265   - {
266   - $globalStart = $child->parentNode->parentNode->getAttribute('dataStart');
267   - $globalStop = $child->parentNode->parentNode->getAttribute('dataStop');
268   - }
269   -
270   - if ($child->parentNode->parentNode->getAttribute('restriction') > 1)
271   - {
272   - $timeRestriction = true;
273   -
274   - }
275   -
276   - if ($child->hasAttribute("index1"))
277   - $component_info["index1"] = $child->getAttribute('index1');
278   - if ($child->hasAttribute("index2"))
279   - $component_info["index2"] = $child->getAttribute('index2');
280   -
281   - $component_info["parentId"] = $child->parentNode->getAttribute('xml:id');
282   - }
  265 + $component_info = array();
  266 + if ($child->tagName == 'component')
  267 + {
  268 + $isParameter = true;
  269 + $isScatter = true;
  270 +
  271 + if ($child->parentNode->parentNode->hasAttribute('dataStart'))
  272 + {
  273 + $globalStart = $child->parentNode->parentNode->getAttribute('dataStart');
  274 + $globalStop = $child->parentNode->parentNode->getAttribute('dataStop');
  275 + }
  276 +
  277 + if ($child->parentNode->parentNode->getAttribute('restriction') > 1)
  278 + {
  279 + $timeRestriction = true;
  280 + }
  281 +
  282 + if ($child->hasAttribute("index1"))
  283 + $component_info["index1"] = $child->getAttribute('index1');
  284 + if ($child->hasAttribute("index2"))
  285 + $component_info["index2"] = $child->getAttribute('index2');
  286 +
  287 + $component_info["parentId"] = $child->parentNode->getAttribute('xml:id');
  288 + }
283 289  
284   - if ($child->tagName == 'parameter' && $child->hasChildNodes()) $isScatter = false;
  290 + if ($child->tagName == 'parameter' && $child->hasChildNodes()) $isScatter = false;
285 291  
286   - if ($child->tagName == 'parameter' && $child->hasAttribute('display_type')) {
287   -
288   - if ($child->getAttribute('display_type') == 'spectrogram') {
289   - $needsArgs = true;
290   - $isSpectra = true;
291   - $isScatter = false;
292   - }
293   - else if ($child->getAttribute('display_type') == 'stackplot') {
294   - $isStack = true;
295   - $isScatter = false;
296   - }
297   - }
  292 + if ($child->tagName == 'parameter' && $child->hasAttribute('display_type'))
  293 + {
  294 + if ($child->getAttribute('display_type') == 'spectrogram')
  295 + {
  296 + $needsArgs = true;
  297 + $isSpectra = true;
  298 + $isScatter = false;
  299 + }
  300 + elseif ($child->getAttribute('display_type') == 'stackplot')
  301 + {
  302 + $isStack = true;
  303 + $isScatter = false;
  304 + }
  305 + }
298 306  
299   - if ($isParameter)
300   - {
301   - if ($child->tagName == 'parameter' && $child->childNodes->length == 1)
302   - {
303   - $needsArgs = true;
304   - }
305   - if (substr($id,0,4) == 'bt96' || substr($id,0,6) == 'ba2000'|| substr($id,0,5) == 'bcain' || substr($id,0,7) == 'bmorsch' )
306   - {
307   - $needsArgs = true;
308   - }
309   -
310   -
311   - $objectMgr = new AliasMgr();
312   - $alias = $objectMgr->getAlias($id);
313   -
314   - $childrenToReturn[] = array('text' => $name,'alias' => $alias,
315   - 'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info,
316   - 'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction,
317   - 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'isScatter' => $isScatter,
318   - 'isSpectra' => $isSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'help' => $help, 'notyet' => $not_yet);
319   - }
320   - else
321   - {
322   - if ($child->tagName == 'mission')
323   - {
324   - $disable = $child->hasAttribute('restriction');
325   - $rank = $child->getAttribute('rank');
326   - }
327   - else
328   - {
329   - $disable = $child->hasAttribute('restriction');
330   - }
331   -
332   - if ($disable)
333   - {
334   - if ($disable == 1) {
335   - $info .= "<br/><b>Restricted access</b>";
336   - }
337   - else {
338   - $disable = false;
339   - }
340   - }
341   -
342   - $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'info' => $info,
343   - 'leaf' => false, 'help' => $help, 'disable' => $disable, 'rank' => $rank);
344   - }
345   - break;
346   -
347   - case 'remoteSimuParam' :
348   -
349   - $isSimulation = true;
350   - if ($id == 'spase://IMPEX/SimulationModel/FMI/GUMICS' ) {
351   - $isLeaf = false;
352   - $isAddable = true;
353   - }
354   - if ($child->tagName == 'dataCenter') {
355   - if ($child->getAttribute('isSimulation')) break;
356   - else {
357   - $skip = true;
358   - break;
359   - }
360   - }
361   - if ($child->tagName == 'simulationRegion')
362   - {
363   - $rank = $child->getAttribute('rank');
364   - }
365   - case 'remoteParam' :
  307 + if ($isParameter)
  308 + {
  309 + if ($child->tagName == 'parameter' && $child->childNodes->length == 1)
  310 + {
  311 + $needsArgs = true;
  312 + }
  313 + if (substr($id,0,4) == 'bt96' || substr($id,0,6) == 'ba2000'|| substr($id,0,5) == 'bcain' || substr($id,0,7) == 'bmorsch' )
  314 + {
  315 + $needsArgs = true;
  316 + }
  317 +
  318 + $objectMgr = new AliasMgr();
  319 + $alias = $objectMgr->getAlias($id);
  320 +
  321 + $childrenToReturn[] = array('text' => $name,'alias' => $alias,
  322 + 'id' => $id,'nodeType' => $nodeType, 'info' => $info, "component_info" => $component_info,
  323 + 'globalStart' => $globalStart, 'globalStop' => $globalStop, 'timeRestriction' => $timeRestriction,
  324 + 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'isScatter' => $isScatter,
  325 + 'isSpectra' => $isSpectra,'isStack' => $isStack, 'needsArgs' => $needsArgs, 'help' => $help, 'notyet' => $not_yet);
  326 + }
  327 + else
  328 + {
  329 + if ($child->tagName == 'mission' || $child->tagName == 'observatory')
  330 + {
  331 + $disable = $child->hasAttribute('restriction');
  332 + $rank = $child->getAttribute('rank');
  333 + }
  334 + else
  335 + {
  336 + $disable = $child->hasAttribute('restriction');
  337 + }
  338 +
  339 + if ($disable)
  340 + {
  341 + if ($disable == 1) {
  342 + $info .= "<br/><b>Restricted access</b>";
  343 + }
  344 + else {
  345 + $disable = false;
  346 + }
  347 + }
  348 +
  349 + $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'info' => $info,
  350 + 'leaf' => false, 'help' => $help, 'disable' => $disable, 'rank' => $rank);
  351 + }
  352 + break;
  353 +
  354 + case 'remoteSimuParam' :
  355 +
  356 + $isSimulation = true;
  357 +
  358 + if ($id == 'spase://IMPEX/SimulationModel/FMI/GUMICS' )
  359 + {
  360 + $isLeaf = false;
  361 + $isAddable = true;
  362 + }
  363 +
  364 + if ($child->tagName == 'dataCenter')
  365 + {
  366 + if ($child->getAttribute('isSimulation')) break;
  367 + else
  368 + {
  369 + $skip = true;
  370 + break;
  371 + }
  372 + }
  373 +
  374 + if ($child->hasAttribute('rank'))
  375 + {
  376 + $rank = $child->getAttribute('rank');
  377 + }
  378 +
  379 + case 'remoteParam' :
366 380  
367   - if ($child->getAttribute('isSimulation') && $child->tagName == 'dataCenter') {
368   - $skip = true;
369   - break;
370   - }
371   -
372   - $isDeletable = $child->hasAttribute('isDeletable');
373   - $specialNode = true;
374   - $isParameter = false;
375   - $isSpectra = false;
376   -
377   - switch ($id)
378   - {
379   - case 'CDAWEB' :
380   - case 'OMNIWEB' :
381   - $isLeaf = false;
382   - break;
383   - case 'THEMIS' :
384   - $rank = 5;
385   - break;
386   - case 'MAPSKP' :
387   - $rank = 9;
388   - break;
389   - case 'VEXGRAZ' :
390   - $rank = 2;
391   - break;
392   - default:
393   - }
  381 + if ($child->getAttribute('isSimulation') && $child->tagName == 'dataCenter')
  382 + {
  383 + $skip = true;
  384 + break;
  385 + }
  386 +
  387 + $isDeletable = $child->hasAttribute('isDeletable');
  388 + $specialNode = true;
  389 + $isParameter = false;
  390 +
  391 + $isSpectra = false;
  392 +
  393 + switch ($id)
  394 + {
  395 + case 'CDAWEB' :
  396 + case 'OMNIWEB' :
  397 + $isLeaf = false;
  398 + break;
  399 + case 'THEMIS' :
  400 + $rank = 5;
  401 + break;
  402 + case 'MAPSKP' :
  403 + $rank = 9;
  404 + break;
  405 + default:
  406 + }
394 407  
395   - $info = $child->getAttribute('desc');
396   -
397   -// if ($info && !$isSimulation) {
398   - $info = str_replace(';', "<br/>Time Range: ", $info);
399   -// }
400   - if ($child->tagName == 'dataset') {
401   - /*if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop'))
402   - $info .= "Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop')."<br/>"; */
403   -// $info .= "Time Range: ".$dataStart"-".$dataStop."<br/>";
404   - }
405   - if (($child->tagName == 'parameter') || ($child->tagName == 'component')) {
406   - $isParameter = true;
407   - $isScatter = true;
408   - }
  408 + $info = $child->getAttribute('desc');
  409 +
  410 + if ($info && !$isSimulation)
  411 + {
  412 + $info = str_replace(';', "<br/>Time Range: ", $info);
  413 + }
  414 +
  415 + if ($child->tagName == 'dataset')
  416 + {
  417 + /*if ($child->hasAttribute('dataStart') && $child->hasAttribute('dataStop'))
  418 + $info .= "Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop')."<br/>"; */
  419 + // $info .= "Time Range: ".$dataStart"-".$dataStop."<br/>";
  420 + }
409 421  
410   - $needsArgs = $child->hasAttribute('needsArgs');
411   -
412   - if (($child->tagName == 'parameter' && $child->hasChildNodes()) || $needsArgs) $isScatter = false;
  422 + if (($child->tagName == 'parameter') || ($child->tagName == 'component'))
  423 + {
  424 + $isParameter = true;
  425 + $isScatter = true;
  426 + }
413 427  
414   - if ($remoteBase) {
415   - if ($child->tagName == 'dataset') $isRemoteDataSet = true;
416   - }
417   -
418   - if ($isParameter) {
419   - $disable = $child->parentNode->getAttribute('disabled');
420   - $objectMgr = new AliasMgr();
421   - $alias = $objectMgr->getAlias($id);
422   -
423   -
424   - if ($child->hasAttribute('display_type')
425   - && $child->getAttribute('display_type') == 'spectrogram'){
426   - $needsArgs = true;
427   - $isScatter = false;
428   - $isSpectra = true;
429   - }
430   -
431   - $childrenToReturn[] = array('text' => $name,'alias' => $alias,
432   - 'id' => $id,'nodeType' => $nodeType, 'info' => $info, 'help' => $help,
433   - 'leaf' => $isLeaf, 'disable' => $disable, 'isParameter' => $isParameter,
434   - 'isScatter' => $isScatter, 'isSpectra' => $isSpectra, 'needsArgs' => $needsArgs, "component_info" => $component_info);
435   - }
436   - else {
437   - if ($child->tagName == 'dataCenter')
438   - $restricted = ($child->getAttribute('available') != "1");
439   - else
440   - $restricted = false;
441   -
442   - if ($id == 'CDAWEB' || $id == 'THEMIS'|| $id == 'MAPSKP' || $id == 'VEXGRAZ')
443   - $restricted = FALSE;
444   - if ($restricted)
445   - $info .= "<br/><b>Open soon !</b>";
446   -
447   - if ($child->tagName == 'dataset')
448   - $nonavailable = ($child->getAttribute('disabled'));
449   - else
450   - $nonavailable = false;
451   -
452   - if ($nonavailable)
453   - $info .= "<br/><b>Not available yet</b>";
454   -
455   - if ($child->getAttribute('url'))
456   - $info .= "<br/>".$child->getAttribute('url');
457   -
458   - if ($child->hasAttribute('obsolete')) {
459   - $info = $child->getAttribute('desc');
460   - $obsolete = true;
461   - }
462   - else
463   - $obsolete = false;
464   -
465   - $disable = $restricted || $nonavailable || $obsolete;
466   -
467   - $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'isAddable' => $isAddable,
468   - 'info' => $info, 'leaf' => false, 'isRemoteDataSet' => $isRemoteDataSet, 'disable' => $disable,
469   - 'isSimulation' => $isSimulation, 'rank' => $rank, 'isDeletable' => $isDeletable, 'help' => $help);
470   - }
471   -
472   - break;
473   - case 'myData' :
474   - $info = $child->hasAttribute('info') ? $child->getAttribute('info') : $child->nodeValue;
475   - break;
476   -
477   - case 'myDataParam' :
478   -
479   - $globalStart = null;
480   - $globalStop = null;
481   - $specialNode = true;
482   - $size = $child->getAttribute('size');
483   - $isScatter = $size == 1;
484   - $mask = $child->getAttribute('mask');
485   - $isSpectra = false;
486   -
  428 + $needsArgs = $child->hasAttribute('needsArgs');
  429 +
  430 + if (($child->tagName == 'parameter' && $child->hasChildNodes()) || $needsArgs) $isScatter = false;
  431 +
  432 + if ($remoteBase)
  433 + {
  434 + if ($child->tagName == 'dataset') $isRemoteDataSet = true;
  435 + }
  436 +
  437 + if ($isParameter)
  438 + {
  439 + $disable = $child->parentNode->getAttribute('disabled');
  440 + $objectMgr = new AliasMgr();
  441 + $alias = $objectMgr->getAlias($id);
  442 +
  443 + if ($child->hasAttribute('display_type') && $child->getAttribute('display_type') == 'spectrogram')
  444 + {
  445 + $needsArgs = true;
  446 + $isScatter = false;
  447 + $isSpectra = true;
  448 + }
  449 +
  450 + $childrenToReturn[] = array('text' => $name,'alias' => $alias,
  451 + 'id' => $id,'nodeType' => $nodeType, 'info' => $info, 'help' => $help,
  452 + 'leaf' => $isLeaf, 'disable' => $disable, 'isParameter' => $isParameter,
  453 + 'isScatter' => $isScatter, 'isSpectra' => $isSpectra, 'needsArgs' => $needsArgs, "component_info" => $component_info);
  454 + }
  455 + else
  456 + {
  457 + if ($child->tagName == 'dataCenter')
  458 + $restricted = ($child->getAttribute('available') != "1");
  459 + else
  460 + $restricted = false;
  461 +
  462 + if ($id == 'CDAWEB' || $id == 'THEMIS'|| $id == 'MAPSKP' || $id == 'VEXGRAZ')
  463 + $restricted = FALSE;
  464 +
  465 + if ($restricted)
  466 + $info .= "<br/><b>Open soon !</b>";
  467 +
  468 + if ($child->tagName == 'dataset')
  469 + $nonavailable = ($child->getAttribute('disabled'));
  470 + else
  471 + $nonavailable = false;
  472 +
  473 + if ($nonavailable)
  474 + $info .= "<br/><b>Not available yet</b>";
  475 +
  476 + if ($child->getAttribute('url'))
  477 + $info .= "<br/>".$child->getAttribute('url');
  478 +
  479 + if ($child->hasAttribute('obsolete'))
  480 + {
  481 + $info = $child->getAttribute('desc');
  482 + $obsolete = true;
  483 + }
  484 + else
  485 + $obsolete = false;
  486 +
  487 + $disable = $restricted || $nonavailable || $obsolete;
  488 +
  489 + $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'isAddable' => $isAddable,
  490 + 'info' => $info, 'leaf' => false, 'isRemoteDataSet' => $isRemoteDataSet, 'disable' => $disable,
  491 + 'isSimulation' => $isSimulation, 'rank' => $rank, 'isDeletable' => $isDeletable, 'help' => $help);
  492 + }
  493 + break;
  494 +
  495 + case 'myData' :
  496 + $info = $child->hasAttribute('info') ? $child->getAttribute('info') : $child->nodeValue;
  497 + break;
  498 +
  499 + case 'myDataParam' :
  500 +
  501 + $globalStart = null;
  502 + $globalStop = null;
  503 + $specialNode = true;
  504 + $size = $child->getAttribute('size');
  505 + $isScatter = $size == 1;
  506 + $mask = $child->getAttribute('mask');
  507 + $isSpectra = false;
487 508  
488   - if ($isLeaf) {
489   - $isParameter = true;
490   - $info = "Size: ".$size."<br/>".$child->getAttribute('desc')."<br/> Mask: ".$mask;
491   - $isSpectra = $child->getAttribute('plottype') === 'Spectra';
492   - }
493   -
494   - if ($child->hasAttribute('desc')) {
495   - $globalStart = substr($child->getAttribute('desc'), 0, 19);
496   - $globalStop = substr($child->getAttribute('desc'), 20);
497   - }
498   -
499   - $childrenToReturn[] = array('text' => $name, 'size' => $size, 'id' => $id,
500   - 'globalStart' => $globalStart, 'globalStop' => $globalStop,
501   - 'nodeType' => $nodeType, 'info' => $info, 'isScatter' => $isScatter, 'leaf' => $isLeaf,
502   - 'isParameter' => $isParameter, 'linkedMask' => $mask, 'isSpectra' => $isSpectra);
503   -
504   - break;
505   - default:
506   - }
  509 + if ($isLeaf)
  510 + {
  511 + $isParameter = true;
  512 + $info = "Size: ".$size."<br/>".$child->getAttribute('desc')."<br/> Mask: ".$mask;
  513 + $isSpectra = $child->getAttribute('plottype') === 'Spectra';
  514 + }
  515 +
  516 + if ($child->hasAttribute('desc'))
  517 + {
  518 + $globalStart = substr($child->getAttribute('desc'), 0, 19);
  519 + $globalStop = substr($child->getAttribute('desc'), 20);
  520 + }
  521 +
  522 + $childrenToReturn[] = array('text' => $name, 'size' => $size, 'id' => $id,
  523 + 'globalStart' => $globalStart, 'globalStop' => $globalStop,
  524 + 'nodeType' => $nodeType, 'info' => $info, 'isScatter' => $isScatter, 'leaf' => $isLeaf,
  525 + 'isParameter' => $isParameter, 'linkedMask' => $mask, 'isSpectra' => $isSpectra);
  526 +
  527 + break;
  528 + default:
  529 + }
507 530  
508   - if (!$specialNode && !$skip) {
509   - if ($child->hasAttribute('desc'))
510   - $info = $child->getAttribute('desc');
511   - $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
512   - 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter);
513   - }
514   - }
515   - // if $childrenToReturn we have to return []
516   - if ($childrenToReturn == null) {
517   - $childrenToReturn = array('nodeType' => $nodeType, 'text' => null);
518   - }
519   - }
520   -
  531 + if (!$specialNode && !$skip)
  532 + {
  533 + if ($child->hasAttribute('desc'))
  534 + $info = $child->getAttribute('desc');
  535 + $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
  536 + 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter);
  537 + }
  538 + }
  539 + // if $childrenToReturn we have to return []
  540 + if ($childrenToReturn == null)
  541 + {
  542 + $childrenToReturn = array('nodeType' => $nodeType, 'text' => null);
  543 + }
  544 + }
521 545 return $childrenToReturn;
522   - }
  546 + }
523 547  
524   - public function saveTree($obj)
525   - {
526   - $paramMgr = new ParamMgr();
527   - return $paramMgr->saveTree($obj);
528   - }
  548 + public function saveTree($obj)
  549 + {
  550 + $paramMgr = new ParamMgr();
  551 + return $paramMgr->saveTree($obj);
  552 + }
529 553  
530 554 public function doNothing($obj)
531 555 {
... ... @@ -563,115 +587,116 @@ class AmdaAction {
563 587 /*
564 588 * fill ascii file into grid
565 589 */
566   - public function getAsciiFile($obj)
567   - {
568   - $objectMgr = new FilesMgr();
569   - return $objectMgr -> getAsciiFile($obj->fileName);
570   - }
  590 + public function getAsciiFile($obj)
  591 + {
  592 + $objectMgr = new FilesMgr();
  593 + return $objectMgr -> getAsciiFile($obj->fileName);
  594 + }
571 595  
572   - public function getMyParamInfo($object)
573   - {
574   - $objectMgr = new FilesMgr();
575   - return $objectMgr -> getParamInfo($object);
576   - }
  596 + public function getMyParamInfo($object)
  597 + {
  598 + $objectMgr = new FilesMgr();
  599 + return $objectMgr -> getParamInfo($object);
  600 + }
577 601  
578 602 /*
579 603 * temporary object from Search
580 604 */
581   - public function getTmpObject($folderId, $name, $nodeType) {
582   -
583   -
584   - switch ($nodeType) {
585   - case 'timeTable' :
586   - $objectMgr = new TimeTableMgr();
587   - break;
588   - case 'catalog' :
589   - $objectMgr = new CatalogMgr();
590   - break;
591   - default:
592   - return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
593   - }
594   - return $objectMgr -> getTmpObject($folderId, $name, true);
595   -
596   - }
597   -
598   -
599   - public function getObject($id, $nodeType) {
600   -
601   - switch ($nodeType) {
602   - case 'myDataParam':
603   - case 'derivedParam' :
604   - $objectMgr = new DerivedParamMgr($nodeType);
605   - break;
606   - case 'timeTable' :
607   - case 'sharedtimeTable' :
608   - $objectMgr = new TimeTableMgr();
609   - break;
610   - case 'catalog' :
611   - case 'sharedcatalog' :
612   - $objectMgr = new CatalogMgr();
613   - break;
614   - case 'condition' :
615   - case 'request' :
616   - $objectMgr = new RequestMgr($nodeType);
  605 + public function getTmpObject($folderId, $name, $nodeType)
  606 + {
  607 + switch ($nodeType)
  608 + {
  609 + case 'timeTable' :
  610 + $objectMgr = new TimeTableMgr();
617 611 break;
618   - case 'bkgWorks' :
619   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
620   - return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO);
621   - break;
622   - case 'myData' :
623   - $objectMgr = new FilesMgr();
624   - break;
625   - default:
626   - return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
  612 + case 'catalog' :
  613 + $objectMgr = new CatalogMgr();
  614 + break;
  615 + default:
  616 + return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
  617 + }
  618 + return $objectMgr -> getTmpObject($folderId, $name, true);
627 619 }
628   - return $objectMgr -> getObject($id, $nodeType);
  620 +
  621 +
  622 + public function getObject($id, $nodeType)
  623 + {
  624 + switch ($nodeType)
  625 + {
  626 + case 'myDataParam':
  627 + case 'derivedParam' :
  628 + $objectMgr = new DerivedParamMgr($nodeType);
  629 + break;
  630 + case 'timeTable' :
  631 + case 'sharedtimeTable' :
  632 + $objectMgr = new TimeTableMgr();
  633 + break;
  634 + case 'catalog' :
  635 + case 'sharedcatalog' :
  636 + $objectMgr = new CatalogMgr();
  637 + break;
  638 + case 'condition' :
  639 + case 'request' :
  640 + $objectMgr = new RequestMgr($nodeType);
  641 + break;
  642 + case 'bkgWorks' :
  643 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  644 + return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO);
  645 + break;
  646 + case 'myData' :
  647 + $objectMgr = new FilesMgr();
  648 + break;
  649 + default:
  650 + return array("error" => $nodeType." NOT_IMPLEMENTED_YET");
  651 + }
  652 + return $objectMgr -> getObject($id, $nodeType);
629 653 }
  654 +
630 655 /*
631 656 * $obj = { id: node.id, leaf: node.leaf, nodeType: node.nodeType }
632 657 */
633   - public function deleteObject($obj) {
634   -
635   - switch ($obj->nodeType) {
636   -
637   - case 'myDataParam' :
638   - case 'derivedParam' :
639   - $objectMgr = new DerivedParamMgr($obj->nodeType);
640   - break;
641   - case 'timeTable' :
642   - $objectMgr = new TimeTableMgr();
643   - break;
644   - case 'catalog' :
645   - $objectMgr = new CatalogMgr();
646   - break;
647   - case 'condition' :
648   - case 'request' :
649   - $objectMgr = new RequestMgr($obj->nodeType);
650   - break;
651   - case 'alias' :
652   - $objectMgr = new AliasMgr();
653   - $obj->id = substr($obj->id,strlen('alias_'));
654   - break;
655   - case 'bkgWorks' :
656   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
657   - return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE);
658   -
659   - case 'myData' :
  658 + public function deleteObject($obj)
  659 + {
  660 + switch ($obj->nodeType)
  661 + {
  662 + case 'myDataParam' :
  663 + case 'derivedParam' :
  664 + $objectMgr = new DerivedParamMgr($obj->nodeType);
  665 + break;
  666 + case 'timeTable' :
  667 + $objectMgr = new TimeTableMgr();
  668 + break;
  669 + case 'catalog' :
  670 + $objectMgr = new CatalogMgr();
  671 + break;
  672 + case 'condition' :
  673 + case 'request' :
  674 + $objectMgr = new RequestMgr($obj->nodeType);
  675 + break;
  676 + case 'alias' :
  677 + $objectMgr = new AliasMgr();
  678 + $obj->id = substr($obj->id,strlen('alias_'));
  679 + break;
  680 + case 'bkgWorks' :
  681 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  682 + return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE);
  683 +
  684 + case 'myData' :
660 685 $objectMgr = new FilesMgr();
661   - break;
662   - default:
663   - return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
664   - }
665   -
666   - return $objectMgr -> deleteObject($obj);
667   - }
  686 + break;
  687 + default:
  688 + return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
  689 + }
  690 + return $objectMgr -> deleteObject($obj);
  691 + }
668 692  
669 693 /*
670 694 * $obj = { id: node.id, old_name: node.text, name: value, parent : node.parentNode.id, leaf: node.leaf, nodeType: node.nodeType }
671 695 */
672   - public function renameObject($obj) {
673   -
674   - switch ($obj->nodeType) {
  696 + public function renameObject($obj)
  697 + {
  698 + switch ($obj->nodeType)
  699 + {
675 700  
676 701 case 'myDataParam' :
677 702 case 'derivedParam' :
... ... @@ -692,10 +717,10 @@ class AmdaAction {
692 717 break;
693 718 default:
694 719 return array("error" => $obj->nodeType." NOT_IMPLEMENTED_YET");
695   - }
  720 + }
696 721  
697   - return $objectMgr -> renameObject($obj);
698   - }
  722 + return $objectMgr -> renameObject($obj);
  723 + }
699 724  
700 725 /*
701 726 * $obj = { name: obj.name, obj.nodeType, obj.leaf (??), OBJ DEPENDENT ATTRIBUTES }
... ... @@ -810,22 +835,22 @@ class AmdaAction {
810 835  
811 836  
812 837 if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID))
813   - {
  838 + {
814 839 //$dd = new WSUserMgr();
815 840 //$dd->init($obj->username,$obj->password,$obj->sessionID);
816 841 return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented");
817   - }
818   - else
  842 + }
  843 + else
819 844 $dd = new UserMgr();
820 845  
821   - //TODO error handling
822   - if (($res = $dd -> ddCheckUser()) != 0)
  846 + //TODO error handling
  847 + if (($res = $dd -> ddCheckUser()) != 0)
823 848 {
824 849 if ($res == 156)
825   - return array('success' => false, 'message' => 'Your AMDA session is expired.<br/> Login please!');
  850 + return array('success' => false, 'message' => 'Your AMDA session is expired.<br/> Login please!');
826 851  
827   - return array('success' => false, 'message' => 'ddLogin error: '.$res);
828   - }
  852 + return array('success' => false, 'message' => 'ddLogin error: '.$res);
  853 + }
829 854  
830 855 if ($dd->user == 'impex')
831 856 {
... ... @@ -838,9 +863,9 @@ class AmdaAction {
838 863 // check disk space
839 864 if ($dd->getWsSize() > DISK_QUOTA)
840 865 return array('success' => false, 'message' => 'Please clean up your workspace.<br/>No more space is available');
841   - }
  866 + }
842 867  
843   - $this->user = $dd->user;
  868 + $this->user = $dd->user;
844 869  
845 870 return array('success' => true, 'userHost' => $dd -> getIPclient());
846 871 }
... ... @@ -866,8 +891,8 @@ class AmdaAction {
866 891 /*
867 892 * Main EXECUTE PROCEDURE
868 893 */
869   - public function execute($node, $obj){
870   -
  894 + public function execute($node, $obj)
  895 + {
871 896 require_once(INTEGRATION_SRC_DIR."RequestManager.php");
872 897  
873 898 // just convert TT / Catalog
... ... @@ -882,17 +907,17 @@ class AmdaAction {
882 907 /*
883 908 * Generate derived parameter compilation
884 909 */
885   - public function compilParam($obj)
886   - {
887   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
888   - return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN);
889   - }
  910 + public function compilParam($obj)
  911 + {
  912 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  913 + return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN);
  914 + }
890 915  
891 916 /*
892 917 * Delete derived parameter compilation
893 918 */
894   - public function compilParamDelete($obj){
895   -
  919 + public function compilParamDelete($obj)
  920 + {
896 921 require_once(INTEGRATION_SRC_DIR."RequestManager.php");
897 922 $res = $this->checkUser($obj);
898 923  
... ... @@ -903,283 +928,278 @@ class AmdaAction {
903 928 $libParamPath = IHMConfigClass::getCompilationPath()."lib/".$obj->paramId.".so";
904 929 if (file_exists($libParamPath))
905 930 unlink($libParamPath);
906   - return array("success" => true);
907   - }
908   -
  931 + return array("success" => true);
  932 + }
  933 +
909 934 /*
910 935 * kill plot process
911 936 */
912 937  
913   - public function killPlotRequest()
914   - {
915   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
916   - return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS);
917   - }
  938 + public function killPlotRequest()
  939 + {
  940 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  941 + return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS);
  942 + }
918 943  
919 944 /*
920 945 * merge time tables
921 946 */
922   - public function merge($obj) {
923   -
924   - if ($this->amdaStat->success)
925   - $this->amdaStat->addTask('ttoper', $this->user, null);
926   -
927   - $objectMgr = new TimeTableMgr();
928   -
929   - return $objectMgr -> merge($obj);
  947 + public function merge($obj)
  948 + {
  949 + if ($this->amdaStat->success)
  950 + $this->amdaStat->addTask('ttoper', $this->user, null);
  951 +
  952 + $objectMgr = new TimeTableMgr();
930 953  
931   - }
  954 + return $objectMgr -> merge($obj);
  955 + }
932 956  
933   -
  957 +
934 958 /*
935 959 * intersect time tables
936 960 */
937   - public function intersect($obj) {
938   -
939   - if ($this->amdaStat->success)
940   - $this->amdaStat->addTask('ttoper', $this->user, null);
  961 + public function intersect($obj)
  962 + {
  963 + if ($this->amdaStat->success)
  964 + $this->amdaStat->addTask('ttoper', $this->user, null);
941 965  
942   - $objectMgr = new TimeTableMgr();
943   - $result = $objectMgr -> intersect($obj);
  966 + $objectMgr = new TimeTableMgr();
  967 + $result = $objectMgr -> intersect($obj);
944 968  
945   - return $result;
946   - }
947   -
948   - public function initTTCache($isCatalog = false, $nparams)
949   - {
950   - if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
951   - else $cacheMgr = new CatalogCacheMgr();
952   -
953   - return $cacheMgr->initTTCache($nparams);
954   - }
955   -
  969 + return $result;
  970 + }
956 971  
957   - public function initTTCacheFromTT($id, $type)
958   - {
959   - if ($type == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
960   - else $cacheMgr = new TimeTableCacheMgr();
961   -
962   - return $cacheMgr->initFromTT($id, $type);
963   - }
  972 + public function initTTCache($isCatalog = false, $nparams)
  973 + {
  974 + if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
  975 + else $cacheMgr = new CatalogCacheMgr();
  976 +
  977 + return $cacheMgr->initTTCache($nparams);
  978 + }
964 979  
965   - public function initForChart($id, $name, $isTmpObject, $type)
966   - {
967   - if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
968   -
969   - return $objMgr->initForChart($id, $name, $isTmpObject, $type);
970   - }
971 980  
972   - public function initTTCacheFromTmpObject($folderId, $name, $isCatalog = false)
973   - {
974   - if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
975   -
976   - else $cacheMgr = new CatalogCacheMgr();
977   -
978   -
  981 + public function initTTCacheFromTT($id, $type)
  982 + {
  983 + if ($type == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
  984 + else $cacheMgr = new TimeTableCacheMgr();
979 985  
980   - return $cacheMgr->initFromTmpObject($folderId, $name);
981   - }
  986 + return $cacheMgr->initFromTT($id, $type);
  987 + }
982 988  
983   - public function initTTCacheFromUploadedFile($name, $format)
984   - {
985   - $cacheMgr = new TimeTableCacheMgr();
986   - return $cacheMgr->initFromUploadedFile($name, $format);
987   - }
  989 + public function initForChart($id, $name, $isTmpObject, $type)
  990 + {
  991 + if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
  992 +
  993 + return $objMgr->initForChart($id, $name, $isTmpObject, $type);
  994 + }
  995 +
  996 + public function initTTCacheFromTmpObject($folderId, $name, $isCatalog = false)
  997 + {
  998 + if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr();
  999 +
  1000 + else $cacheMgr = new CatalogCacheMgr();
  1001 +
  1002 + return $cacheMgr->initFromTmpObject($folderId, $name);
  1003 + }
988 1004  
989   - public function readTTCacheIntervals($o)
990   - {
991   - if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
992   - else $cacheMgr = new TimeTableCacheMgr();
993   -
994   - return $cacheMgr->getIntervals($o->start,$o->limit,$o->sort,$o->filter);
995   - }
  1005 + public function initTTCacheFromUploadedFile($name, $format)
  1006 + {
  1007 + $cacheMgr = new TimeTableCacheMgr();
  1008 + return $cacheMgr->initFromUploadedFile($name, $format);
  1009 + }
996 1010  
997   - public function readIntervalsForChart($o)
998   - {
999   - if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
1000   -
1001   -
1002   - return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
1003   - }
  1011 + public function readTTCacheIntervals($o)
  1012 + {
  1013 + if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $cacheMgr = new CatalogCacheMgr();
  1014 + else $cacheMgr = new TimeTableCacheMgr();
  1015 +
  1016 + return $cacheMgr->getIntervals($o->start,$o->limit,$o->sort,$o->filter);
  1017 + }
1004 1018  
1005   - public function saveTTCacheIntervalsInTT($o)
1006   - {
1007   - $cacheMgr = new TimeTableCacheMgr();
1008   - return $cacheMgr->saveInTT($o->ttId,$o->action,$o->cacheToken);
1009   - }
  1019 + public function readIntervalsForChart($o)
  1020 + {
  1021 + if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
  1022 +
  1023 + return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
  1024 + }
  1025 +
  1026 + public function saveTTCacheIntervalsInTT($o)
  1027 + {
  1028 + $cacheMgr = new TimeTableCacheMgr();
  1029 + return $cacheMgr->saveInTT($o->ttId,$o->action,$o->cacheToken);
  1030 + }
1010 1031  
1011   - public function addTTCacheInterval($o)
1012   - {
1013   - if ($o->isCatalog) $cacheMgr = new CatalogCacheMgr();
1014   - else $cacheMgr = new TimeTableCacheMgr();
1015   -
1016   - return $cacheMgr->addInterval($o->index, $o->start, $o->stop);
1017   - }
  1032 + public function addTTCacheInterval($o)
  1033 + {
  1034 + if ($o->isCatalog) $cacheMgr = new CatalogCacheMgr();
  1035 + else $cacheMgr = new TimeTableCacheMgr();
  1036 +
  1037 + return $cacheMgr->addInterval($o->index, $o->start, $o->stop);
  1038 + }
1018 1039  
1019   - public function removeTTCacheIntervalFromId($id, $isCatalog = false)
1020   - {
1021   - if ($isCatalog) $cacheMgr = new CatalogCacheMgr();
1022   - else $cacheMgr = new TimeTableCacheMgr();
1023   -
1024   - return $cacheMgr->removeIntervalFromId($id);
1025   - }
  1040 + public function removeTTCacheIntervalFromId($id, $isCatalog = false)
  1041 + {
  1042 + if ($isCatalog) $cacheMgr = new CatalogCacheMgr();
  1043 + else $cacheMgr = new TimeTableCacheMgr();
  1044 +
  1045 + return $cacheMgr->removeIntervalFromId($id);
  1046 + }
1026 1047  
1027   - public function modifyTTCacheInterval($o)
1028   - {
1029   - if ($o->isCatalog) {
1030   -
  1048 + public function modifyTTCacheInterval($o)
  1049 + {
  1050 + if ($o->isCatalog)
  1051 + {
1031 1052 $cacheMgr = new CatalogCacheMgr();
1032   - return $cacheMgr->modifyIntervalFromId($o);
1033   -
  1053 + return $cacheMgr->modifyIntervalFromId($o);
1034 1054 }
1035   - else $cacheMgr = new TimeTableCacheMgr();
1036   -
1037   - return $cacheMgr->modifyIntervalFromId($o->cacheId, $o->start, $o->stop);
1038   - }
1039   -
1040   - public function operationTTCacheIntervals($extendTime, $shiftTime)
1041   - {
1042   - $cacheMgr = new TimeTableCacheMgr();
1043   - return $cacheMgr->operationIntervals($extendTime, $shiftTime);
1044   - }
1045   -
1046   - public function mergeTTCacheIntervals()
1047   - {
1048   - $cacheMgr = new TimeTableCacheMgr();
1049   - return $cacheMgr->mergeIntervals();
1050   - }
1051   -
1052   - public function getTTCacheStatistics()
1053   - {
1054   - $cacheMgr = new TimeTableCacheMgr();
1055   - return $cacheMgr->getStatistics();
1056   - }
  1055 + else $cacheMgr = new TimeTableCacheMgr();
  1056 +
  1057 + return $cacheMgr->modifyIntervalFromId($o->cacheId, $o->start, $o->stop);
  1058 + }
1057 1059  
1058   - public function getTTCacheStatus()
1059   - {
1060   - $cacheMgr = new TimeTableCacheMgr();
1061   - return $cacheMgr->getStatus();
1062   - }
  1060 + public function operationTTCacheIntervals($extendTime, $shiftTime)
  1061 + {
  1062 + $cacheMgr = new TimeTableCacheMgr();
  1063 + return $cacheMgr->operationIntervals($extendTime, $shiftTime);
  1064 + }
  1065 +
  1066 + public function mergeTTCacheIntervals()
  1067 + {
  1068 + $cacheMgr = new TimeTableCacheMgr();
  1069 + return $cacheMgr->mergeIntervals();
  1070 + }
  1071 +
  1072 + public function getTTCacheStatistics()
  1073 + {
  1074 + $cacheMgr = new TimeTableCacheMgr();
  1075 + return $cacheMgr->getStatistics();
  1076 + }
  1077 +
  1078 + public function getTTCacheStatus()
  1079 + {
  1080 + $cacheMgr = new TimeTableCacheMgr();
  1081 + return $cacheMgr->getStatus();
  1082 + }
1063 1083  
1064 1084 /*
1065 1085 * Send a feedback
1066 1086 *
1067 1087 */
1068   - public function sendFeedback($feed)
1069   - {
1070   - $feedMgr = new FeedbackMgr();
1071   - return $feedMgr->addFeedback($feed->user, $feed->interface, $feed->subject, $feed->userText, $feed->userAgent, $feed->attach);
1072   - }
  1088 + public function sendFeedback($feed)
  1089 + {
  1090 + $feedMgr = new FeedbackMgr();
  1091 + return $feedMgr->addFeedback($feed->user, $feed->interface, $feed->subject, $feed->userText, $feed->userAgent, $feed->attach);
  1092 + }
1073 1093  
1074 1094 /*
1075 1095 * Save state
1076 1096 *
1077 1097 */
1078   - public function saveState($datas)
1079   - {
1080   - $myStateMgr = new StateMgr();
1081   - return $myStateMgr->saveState($datas);
1082   - }
  1098 + public function saveState($datas)
  1099 + {
  1100 + $myStateMgr = new StateMgr();
  1101 + return $myStateMgr->saveState($datas);
  1102 + }
1083 1103  
1084 1104 /*
1085 1105 * Load state
1086 1106 *
1087 1107 */
1088   - public function loadState($o)
1089   - {
1090   - $myStateMgr = new StateMgr();
1091   - return $myStateMgr->loadState();
1092   - }
  1108 + public function loadState($o)
  1109 + {
  1110 + $myStateMgr = new StateMgr();
  1111 + return $myStateMgr->loadState();
  1112 + }
1093 1113  
1094 1114 /*
1095 1115 * SAMP
1096 1116 */
1097   - public function sendToSAMP($o)
1098   - {
1099   - if ($this->amdaStat->success)
1100   - $this->amdaStat->addTask('samp', $this->user, null);
1101   -
1102   - $objectMgr = new RequestMgr();
1103   - $res = $objectMgr->generateVOTableFromDownloadResult($o->folderId, $o->downId,true,true);
1104   - if ($res['success'])
1105   - {
1106   - foreach ($res['files'] as $key => $value)
1107   - $res['files'][$key] = str_replace(BASE_PATH,"",$value);
1108   - }
1109   - return $res;
1110   - }
1111   -
  1117 + public function sendToSAMP($o)
  1118 + {
  1119 + if ($this->amdaStat->success)
  1120 + $this->amdaStat->addTask('samp', $this->user, null);
  1121 +
  1122 + $objectMgr = new RequestMgr();
  1123 + $res = $objectMgr->generateVOTableFromDownloadResult($o->folderId, $o->downId,true,true);
  1124 + if ($res['success'])
  1125 + {
  1126 + foreach ($res['files'] as $key => $value)
  1127 + $res['files'][$key] = str_replace(BASE_PATH,"",$value);
  1128 + }
  1129 + return $res;
  1130 + }
  1131 +
1112 1132 /*
1113 1133 * HST Images
1114 1134 */
1115   - public function getHstImagesUrl($o)
1116   - {
1117   - if ($this->amdaStat->success)
1118   - $this->amdaStat->addTask('images', $this->user, null);
1119   -
1120   - $myHstMgr = new HstMgr();
1121   - $res = $myHstMgr->getImagesUrl($o->startTime, $o->stopTime, $o->planet);
1122   - //if ($domRes->length <= 0)
1123   - // return array('success' => false, 'message' => 'Cannot find HST Images for this request.');
1124   - return array('success' => true, 'result' => $res);
1125   - }
  1135 + public function getHstImagesUrl($o)
  1136 + {
  1137 + if ($this->amdaStat->success)
  1138 + $this->amdaStat->addTask('images', $this->user, null);
  1139 +
  1140 + $myHstMgr = new HstMgr();
  1141 + $res = $myHstMgr->getImagesUrl($o->startTime, $o->stopTime, $o->planet);
  1142 + //if ($domRes->length <= 0)
  1143 + // return array('success' => false, 'message' => 'Cannot find HST Images for this request.');
  1144 + return array('success' => true, 'result' => $res);
  1145 + }
1126 1146  
1127   - public function getAPISImagesUrl($o)
1128   - {
1129   - if ($this->amdaStat->success)
1130   - $this->amdaStat->addTask('images', $this->user, null);
1131   -
1132   - $apisMgr = new APISMgr();
1133   - $res = $apisMgr->get($o->target, $o->startTime, $o->stopTime, $o->datasets);
1134   -
1135   - return $res;
1136   - }
  1147 + public function getAPISImagesUrl($o)
  1148 + {
  1149 + if ($this->amdaStat->success)
  1150 + $this->amdaStat->addTask('images', $this->user, null);
  1151 +
  1152 + $apisMgr = new APISMgr();
  1153 + $res = $apisMgr->get($o->target, $o->startTime, $o->stopTime, $o->datasets);
  1154 +
  1155 + return $res;
  1156 + }
1137 1157 /*
1138 1158 * Filters
1139 1159 */
1140   - public function loadFilterList($o)
1141   - {
1142   - $filtersMgr = new FiltersMgr();
1143   - $res = $filtersMgr->loadList();
1144   - return $res;
1145   - }
  1160 + public function loadFilterList($o)
  1161 + {
  1162 + $filtersMgr = new FiltersMgr();
  1163 + $res = $filtersMgr->loadList();
  1164 + return $res;
  1165 + }
1146 1166  
1147   - public function loadFilters($o)
1148   - {
1149   - $filtersMgr = new FiltersMgr();
1150   - if (isset($o->id))
1151   - $res = $filtersMgr->loadFilter($o->id);
1152   - else
1153   - $res = $filtersMgr->loadAll();
1154   - return $res;
1155   - }
1156   -
1157   - public function saveFilter($o)
1158   - {
1159   - $filtersMgr = new FiltersMgr();
1160   - return $filtersMgr->save($o);
1161   - }
  1167 + public function loadFilters($o)
  1168 + {
  1169 + $filtersMgr = new FiltersMgr();
  1170 + if (isset($o->id))
  1171 + $res = $filtersMgr->loadFilter($o->id);
  1172 + else
  1173 + $res = $filtersMgr->loadAll();
  1174 + return $res;
  1175 + }
1162 1176  
1163   - public function createFilter($o)
1164   - {
1165   - $filtersMgr = new FiltersMgr();
1166   - return $filtersMgr->create($o);
1167   - }
  1177 + public function saveFilter($o)
  1178 + {
  1179 + $filtersMgr = new FiltersMgr();
  1180 + return $filtersMgr->save($o);
  1181 + }
1168 1182  
1169   - public function destroyFilter($o)
1170   - {
1171   - $filtersMgr = new FiltersMgr();
1172   - $res = $filtersMgr->delete($o);
1173   - return;
1174   - }
  1183 + public function createFilter($o)
  1184 + {
  1185 + $filtersMgr = new FiltersMgr();
  1186 + return $filtersMgr->create($o);
  1187 + }
1175 1188  
1176   - public function getCrtFilterId()
1177   - {
1178   - $filtersMgr = new FiltersMgr();
1179   - $res = $filtersMgr->getCrtId();
1180   - return $res;
1181   - }
  1189 + public function destroyFilter($o)
  1190 + {
  1191 + $filtersMgr = new FiltersMgr();
  1192 + $res = $filtersMgr->delete($o);
  1193 + return;
  1194 + }
1182 1195  
  1196 + public function getCrtFilterId()
  1197 + {
  1198 + $filtersMgr = new FiltersMgr();
  1199 + $res = $filtersMgr->getCrtId();
  1200 + return $res;
  1201 + }
  1202 +
1183 1203 public function getCrtFilterResult()
1184 1204 {
1185 1205 $filtersMgr = new FiltersMgr();
... ... @@ -1201,11 +1221,13 @@ class AmdaAction {
1201 1221  
1202 1222 public function logout($isGuest)
1203 1223 {
1204   - if ($isGuest) {
  1224 + if ($isGuest)
  1225 + {
1205 1226 $guestMgr = new Guest($this->user);
1206 1227 $guestMgr->deleteGuest();
1207 1228 }
1208   - else {
  1229 + else
  1230 + {
1209 1231 $myBaseMgr = new BaseManager();
1210 1232 $myBaseMgr->delSimuFiles('mysimudata');
1211 1233 $myBaseMgr->delSimuFiles('mywsrdata');
... ... @@ -1300,60 +1322,61 @@ class AmdaAction {
1300 1322 return $this->executeRequest($inputobj, FunctionTypeEnumClass::ACTION);
1301 1323 }
1302 1324  
1303   - public function getParamPlotInit($obj)
1304   - {
1305   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1306   - $inputobj = (Object)array(
1307   - 'paramId' => $obj->paramId,
1308   - 'type' => 'plot_init'
1309   - );
1310   - return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
1311   - }
1312   -
1313   - public function getParamInfo($obj)
1314   - {
1315   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1316   - $inputobj = (Object)array(
1317   - 'paramId' => $obj->paramId,
1318   - 'type' => 'param_info'
1319   - );
1320   - return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
1321   - }
  1325 + public function getParamPlotInit($obj)
  1326 + {
  1327 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  1328 + $inputobj = (Object)array(
  1329 + 'paramId' => $obj->paramId,
  1330 + 'type' => 'plot_init'
  1331 + );
  1332 + return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
  1333 + }
1322 1334  
1323   - public function getSharedObjectFolders($obj)
1324   - {
1325   - $mgr = new SharedObjectsMgr();
1326   - $folders = $mgr->getFolders($obj->type);
1327   - return array('success' => true, 'folders' => $folders);
1328   - }
  1335 + public function getParamInfo($obj)
  1336 + {
  1337 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  1338 + $inputobj = (Object)array(
  1339 + 'paramId' => $obj->paramId,
  1340 + 'type' => 'param_info'
  1341 + );
  1342 + return $this->executeRequest($inputobj, FunctionTypeEnumClass::PARAMINFO);
  1343 + }
1329 1344  
1330   - public function shareObjects($obj)
1331   - {
1332   - $mgr = new SharedObjectsMgr();
1333   - switch ($obj->type) {
1334   - case 'timeTable' :
1335   - case 'catalog' :
1336   - $src_object_path = USERTTDIR.$obj->object->id.".xml";
1337   - break;
1338   -
1339   - default:
1340   - return array('success' => false, 'message' => 'Unknown object type');
1341   - }
1342   -
1343   - $result = $mgr->add($obj->type, $obj->name, $obj->folder, $src_object_path, $obj->description, $this->user);
1344   - if (!$result['success'])
1345   - return $result;
1346   -
1347   - $mgr->updateTree();
1348   - return $result;
1349   - }
  1345 + public function getSharedObjectFolders($obj)
  1346 + {
  1347 + $mgr = new SharedObjectsMgr();
  1348 + $folders = $mgr->getFolders($obj->type);
  1349 + return array('success' => true, 'folders' => $folders);
  1350 + }
1350 1351  
1351   - public function isSharedObjectNameAlreadyUsed($obj)
1352   - {
1353   - $mgr = new SharedObjectsMgr();
1354   - $alreadyUsed = $mgr->isNameAlreadyUsed($obj->type, $obj->name);
1355   - return array('success' => true, 'alreadyUsed' => $alreadyUsed);
1356   - }
  1352 + public function shareObjects($obj)
  1353 + {
  1354 + $mgr = new SharedObjectsMgr();
  1355 + switch ($obj->type)
  1356 + {
  1357 + case 'timeTable' :
  1358 + case 'catalog' :
  1359 + $src_object_path = USERTTDIR.$obj->object->id.".xml";
  1360 + break;
  1361 +
  1362 + default:
  1363 + return array('success' => false, 'message' => 'Unknown object type');
  1364 + }
  1365 +
  1366 + $result = $mgr->add($obj->type, $obj->name, $obj->folder, $src_object_path, $obj->description, $this->user);
  1367 + if (!$result['success'])
  1368 + return $result;
  1369 +
  1370 + $mgr->updateTree();
  1371 + return $result;
  1372 + }
  1373 +
  1374 + public function isSharedObjectNameAlreadyUsed($obj)
  1375 + {
  1376 + $mgr = new SharedObjectsMgr();
  1377 + $alreadyUsed = $mgr->isNameAlreadyUsed($obj->type, $obj->name);
  1378 + return array('success' => true, 'alreadyUsed' => $alreadyUsed);
  1379 + }
1357 1380  
1358 1381 }
1359 1382 ?>
... ...