Commit fa5a398d4b2a141bb423f4c3bd87f21ee52ef009

Authored by Benjamin Renard
2 parents 70463115 8926327f

Merge amdadev into master

generic_data/Functions/functions.xml
@@ -327,6 +327,10 @@ @@ -327,6 +327,10 @@
327 <info_brief>Closest integer greater than or equal to its argument</info_brief> 327 <info_brief>Closest integer greater than or equal to its argument</info_brief>
328 <new_kernel>Ceil</new_kernel> 328 <new_kernel>Ceil</new_kernel>
329 </function> 329 </function>
  330 + <function name="isNaN()" kind="math" group="math">
  331 + <info_brief>Checks if there is a NaN value</info_brief>
  332 + <new_kernel>IsNaN</new_kernel>
  333 + </function>
330 <function name="cos()" kind="math" group="math"> 334 <function name="cos()" kind="math" group="math">
331 <info_brief>cosine</info_brief> 335 <info_brief>cosine</info_brief>
332 <new_kernel>cos</new_kernel> 336 <new_kernel>cos</new_kernel>
help/ttTimeFormat
1 <h3>ASCII Time Table Time Format</h3> 1 <h3>ASCII Time Table Time Format</h3>
2 -<li><i>Year Month Day Hour Minute Second</i> => with different separators ("-", ":", "/", " ") used in a standard way.  
3 -<br/><i>Milliseconds</i> are not taken in to account. 2 +<li><i>Year Month Day Hour Minute Second Millisecond</i> => with different separators ("-", ":", "/", " ") used in a standard way.
4 <br/><br/> 3 <br/><br/>
5 Examples: 4 Examples:
6 <ul> 5 <ul>
7 - <li> 2001-01-01T00:00:00  
8 - <li> 2001-01-01 00:00:00  
9 - <li> 2001 01 01 00 00 00  
10 - <li> 2001/01/01 00:00:00 6 + <li> 2001-01-01T00:00:00.000
  7 + <li> 2001-01-01 00:00:00.000
  8 + <li> 2001 01 01 00 00 00.000
  9 + <li> 2001/01/01 00:00:00.000
11 </ul> 10 </ul>
12 -<li> <i>Year Day-Of-Year Hour Minute Second</i> => with different separators ("-", ":", "/", " "). 11 +<li> <i>Year Day-Of-Year Hour Minute Second Millisecond</i> => with different separators ("-", ":", "/", " ", ".").
13 <i>Day-Of-Year</i> (three letters !!!) starts from 0, i.e. the 1st of January is 0. 12 <i>Day-Of-Year</i> (three letters !!!) starts from 0, i.e. the 1st of January is 0.
14 <br/><br/> 13 <br/><br/>
15 <li>If you plan to use uploaded time table to work with data note that :<br/> 14 <li>If you plan to use uploaded time table to work with data note that :<br/>
js/app/AmdaApp.js
@@ -440,6 +440,7 @@ Ext.define(&#39;amdaApp.AmdaApp&#39;, { @@ -440,6 +440,7 @@ Ext.define(&#39;amdaApp.AmdaApp&#39;, {
440 text : 'Reset password', 440 text : 'Reset password',
441 iconCls : 'icon-resetpwd', 441 iconCls : 'icon-resetpwd',
442 id : 'resetpwd-win-tool', 442 id : 'resetpwd-win-tool',
  443 + disabled: isGuest || (sessionID == 'impex'),
443 handler : function(obj, e) { 444 handler : function(obj, e) {
444 e.stopEvent(); 445 e.stopEvent();
445 var moduleId = obj.el.id; 446 var moduleId = obj.el.id;
js/app/models/PlotObjects/PlotPanelObject.js
@@ -52,6 +52,7 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, { @@ -52,6 +52,7 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
52 {name: 'panel-title-font-size', type: 'int'}, 52 {name: 'panel-title-font-size', type: 'int'},
53 {name: 'panel-title-font-bold', type: 'boolean'}, 53 {name: 'panel-title-font-bold', type: 'boolean'},
54 {name: 'panel-title-font-italic', type: 'boolean'}, 54 {name: 'panel-title-font-italic', type: 'boolean'},
  55 + {name: 'panel-showint-info', type: 'boolean'},
55 {name: 'panel-plot-type', type: 'string'}, 56 {name: 'panel-plot-type', type: 'string'},
56 {name: 'panel-font-activated', type: 'boolean'}, 57 {name: 'panel-font-activated', type: 'boolean'},
57 {name: 'panel-font-name', type: 'string'}, 58 {name: 'panel-font-name', type: 'string'},
@@ -571,6 +572,9 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, { @@ -571,6 +572,9 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
571 this.set('panel-title-font-bold', false); 572 this.set('panel-title-font-bold', false);
572 this.set('panel-title-font-italic', false); 573 this.set('panel-title-font-italic', false);
573 574
  575 +
  576 + this.set('panel-showint-info', false);
  577 +
574 this.set('panel-font-activated', false); 578 this.set('panel-font-activated', false);
575 this.set('panel-font-name', amdaDefaultValues.plot.panel.font.name); 579 this.set('panel-font-name', amdaDefaultValues.plot.panel.font.name);
576 this.set('panel-font-size', amdaDefaultValues.plot.panel.font.size); 580 this.set('panel-font-size', amdaDefaultValues.plot.panel.font.size);
@@ -710,6 +714,9 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, { @@ -710,6 +714,9 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
710 panelValues['panel-title-font-size'] = this.get('panel-title-font-size'); 714 panelValues['panel-title-font-size'] = this.get('panel-title-font-size');
711 panelValues['panel-title-font-bold'] = this.get('panel-title-font-bold'); 715 panelValues['panel-title-font-bold'] = this.get('panel-title-font-bold');
712 panelValues['panel-title-font-italic'] = this.get('panel-title-font-italic'); 716 panelValues['panel-title-font-italic'] = this.get('panel-title-font-italic');
  717 +
  718 + panelValues['panel-showint-info'] = this.get('panel-showint-info');
  719 +
713 panelValues['panel-plot-type'] = this.get('panel-plot-type'); 720 panelValues['panel-plot-type'] = this.get('panel-plot-type');
714 panelValues['panel-font-activated'] = this.get('panel-font-activated'); 721 panelValues['panel-font-activated'] = this.get('panel-font-activated');
715 panelValues['panel-font-name'] = this.get('panel-font-name'); 722 panelValues['panel-font-name'] = this.get('panel-font-name');
js/app/views/PlotComponents/PlotPanelForm.js
@@ -152,6 +152,12 @@ Ext.define(&#39;amdaPlotComp.PlotPanelForm&#39;, { @@ -152,6 +152,12 @@ Ext.define(&#39;amdaPlotComp.PlotPanelForm&#39;, {
152 this.addStandardFieldSet('Manual Margins', '', marginItems), 152 this.addStandardFieldSet('Manual Margins', '', marginItems),
153 this.addStandardFieldSet('Preferred Dimensions', '', preferedDimItems), 153 this.addStandardFieldSet('Preferred Dimensions', '', preferedDimItems),
154 this.addStandardFieldSet('Title', '', titleItems), 154 this.addStandardFieldSet('Title', '', titleItems),
  155 +
  156 + this.addStandardCheck('panel-showint-info', 'Show interval number', function(name, value, oldValue) {
  157 + me.object.set('panel-showint-info', value);
  158 + me.crtTree.refresh();
  159 + }, 'When this option is selected, the number of the interval on the TT/Catalog is shown on plot.'),
  160 +
155 this.addStandardFont('panel-font'), 161 this.addStandardFont('panel-font'),
156 this.addStandardFieldSet('Status Bars', '', statusItems), 162 this.addStandardFieldSet('Status Bars', '', statusItems),
157 this.addStandardFieldSet('Ticks Bars', '', tickItems) 163 this.addStandardFieldSet('Ticks Bars', '', tickItems)
js/app/views/TimeTableUI.js
@@ -197,7 +197,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, { @@ -197,7 +197,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
197 // synchronisation of objects 197 // synchronisation of objects
198 this.object = ttobj; 198 this.object = ttobj;
199 timeTableModule.linkedNode.create(); 199 timeTableModule.linkedNode.create();
200 - } else if (this.fclose() || this.status && (this.status.nbFiltered > 0)) /*TimeTable object has been modified*/ 200 + } else if (this.fclose() || this.status ) /*TimeTable object has been modified*/
201 { 201 {
202 if (this.object.isModified('name') || this.object.get('fromPlugin')) 202 if (this.object.isModified('name') || this.object.get('fromPlugin'))
203 { 203 {
js/app/views/UploadUI.js
@@ -47,7 +47,7 @@ Ext.define(&#39;amdaUI.UploadUI&#39;, { @@ -47,7 +47,7 @@ Ext.define(&#39;amdaUI.UploadUI&#39;, {
47 autoHide: false, 47 autoHide: false,
48 iconCls: 'icon-information', 48 iconCls: 'icon-information',
49 html: 'Select local or remote file (time table, catalog) to upload<br/>File size is limited to <b><i>' 49 html: 'Select local or remote file (time table, catalog) to upload<br/>File size is limited to <b><i>'
50 - + myDesktopApp.MAX_UPLOADED_FILE_SIZE/1000000+'MB</i></b><br/>Milliseconds are ignored for the moment', 50 + + myDesktopApp.MAX_UPLOADED_FILE_SIZE/1000000+'MB</i></b><br/>Milliseconds are taken into account',
51 autoScroll : true, 51 autoScroll : true,
52 loader: {} 52 loader: {}
53 }] 53 }]
php/WebServices/WebServer.php
@@ -50,7 +50,11 @@ class WebServer @@ -50,7 +50,11 @@ class WebServer
50 $this->userPWD = $vars['password']; 50 $this->userPWD = $vars['password'];
51 else 51 else
52 $this->userPWD = WSConfigClass::getAnonymousUserPwd(); 52 $this->userPWD = WSConfigClass::getAnonymousUserPwd();
53 - 53 +
  54 + if (isset($vars['referenceTime']))
  55 + $this->referenceTime = $vars['referenceTime'];
  56 + else
  57 + $this->referenceTime = NULL;
54 return array('success' => true, 'vars' => $vars); 58 return array('success' => true, 'vars' => $vars);
55 } 59 }
56 60
@@ -114,6 +118,12 @@ class WebServer @@ -114,6 +118,12 @@ class WebServer
114 118
115 return $dataSetDom; 119 return $dataSetDom;
116 } 120 }
  121 +
  122 + private function getUserInfo($data)
  123 + {
  124 + $res = $this->init($data);
  125 + $this->initUserMgr();
  126 + }
117 127
118 /* 128 /*
119 * get user TimeTables list; Shared for anonymous user ('impex') 129 * get user TimeTables list; Shared for anonymous user ('impex')
@@ -327,6 +337,42 @@ class WebServer @@ -327,6 +337,42 @@ class WebServer
327 if (!$locParamSrcDom->save(WSConfigClass::getWsResultDir().$locParamDst)) 337 if (!$locParamSrcDom->save(WSConfigClass::getWsResultDir().$locParamDst))
328 $this->throwError('workspaceError', 'Cannot save Amda Local DataBase Parameters description file'.$this->userID); 338 $this->throwError('workspaceError', 'Cannot save Amda Local DataBase Parameters description file'.$this->userID);
329 } 339 }
  340 +
  341 + private function injectTemplateInfo($locParamFile) {
  342 + $paramTemplateListFile = WSConfigClass::getParamTemplateListFilePath();
  343 +
  344 + $paramTemplateListFileDom = new DomDocument("1.0");
  345 + if (!@$paramTemplateListFileDom->load($paramTemplateListFile))
  346 + $this->throwError("getObsDataTree", "Cannot load Amda Templated Parameters description file".$this->userID);
  347 +
  348 + $paramTemplateNodes = $paramTemplateListFileDom->getElementsByTagName('paramTemplate');
  349 +
  350 + $locParamFileDom = new DomDocument("1.0");
  351 + $locParamFileDom->preserveWhiteSpace = FALSE; /// Important !!! otherwise removeChild() leaves empty text nodes
  352 +
  353 + if (!@$locParamFileDom->load(WSConfigClass::getWsResultDir().$locParamFile))
  354 + $this->throwError("getObsDataTree", "Cannot load Amda Local DataBase Parameters description file ".$this->userID);
  355 +
  356 + $xp = new domxpath($locParamFileDom);
  357 +
  358 + foreach ($paramTemplateNodes as $paramTemplateNode) {
  359 + $paramTemplateId = $paramTemplateNode->getAttribute('paramId');
  360 + $paramFileName = $paramTemplateNode->getAttribute('fileName');
  361 + $parameterNodes = $xp->query("//parameter[@template='$paramFileName']");
  362 + $argumentsNodes = $paramTemplateNode->getElementsByTagName("arguments");
  363 + if ($argumentsNodes->length < 1)
  364 + continue;
  365 + $argumentsNode = $argumentsNodes->item(0);
  366 + foreach ($parameterNodes as $parameterNode) {
  367 + $node = $locParamFileDom->importNode($argumentsNode, TRUE);
  368 + $parameterNode->appendChild($node);
  369 + }
  370 + }
  371 +
  372 +
  373 + if (!$locParamFileDom->save(WSConfigClass::getWsResultDir().$locParamFile))
  374 + $this->throwError('workspaceError', 'Cannot save Amda Local DataBase Parameters description file'.$this->userID);
  375 + }
330 376
331 private function checkInputTime($startTime, $stopTime) 377 private function checkInputTime($startTime, $stopTime)
332 { 378 {
@@ -349,19 +395,26 @@ class WebServer @@ -349,19 +395,26 @@ class WebServer
349 /* 395 /*
350 * public data only : anonymous user (impex) 396 * public data only : anonymous user (impex)
351 */ 397 */
352 - public function getObsDataTree() 398 + public function getObsDataTree($data)
353 { 399 {
354 - $res = $this->init(); 400 + $res = $this->init($data);
355 $this->initUserMgr(); 401 $this->initUserMgr();
  402 +
  403 + $injectTemplateInfo = array_key_exists('templateInfo', $data) && (!empty($data["templateInfo"]));
356 404
357 $locParamSrc = USERWSDIR.'LocalParams.xml'; 405 $locParamSrc = USERWSDIR.'LocalParams.xml';
358 406
359 - $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; 407 + $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.($injectTemplateInfo ? 'withtemplate_' : '').$this->requestTime.'_AmdaLocalDataBaseParameters.xml';
360 408
361 // if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst)) 409 // if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst))
362 // $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file'); 410 // $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file');
363 411
364 $this->excludePrivateNodes($locParamSrc,$locParamDst); 412 $this->excludePrivateNodes($locParamSrc,$locParamDst);
  413 +
  414 + if ($injectTemplateInfo) {
  415 + $this->injectTemplateInfo($locParamDst);
  416 + }
  417 +
365 return array('success' => true,'WorkSpace' => array("LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst)); 418 return array('success' => true,'WorkSpace' => array("LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst));
366 } 419 }
367 420
php/classes/AmdaAction.php
@@ -299,10 +299,10 @@ class AmdaAction @@ -299,10 +299,10 @@ class AmdaAction
299 299
300 if ($child->tagName == 'parameter') { 300 if ($child->tagName == 'parameter') {
301 $isParameter = true; 301 $isParameter = true;
302 - if ($child->hasAttribute('TemplatedParameter')) 302 + if ($child->hasAttribute('template'))
303 $needsArgs = true; 303 $needsArgs = true;
304 304
305 - if ($child->hasAttribute('PredefinedTemplatedParameter')) 305 + if ($child->hasAttribute('predefined'))
306 $predefinedArgs = true; 306 $predefinedArgs = true;
307 307
308 if ($child->parentNode->hasAttribute('dataStart')) { 308 if ($child->parentNode->hasAttribute('dataStart')) {
php/classes/AmdaClient.php
@@ -249,6 +249,9 @@ class AmdaClient { @@ -249,6 +249,9 @@ class AmdaClient {
249 } 249 }
250 250
251 public function resetUserPwd($login, $crt_pwd, $new_pwd) { 251 public function resetUserPwd($login, $crt_pwd, $new_pwd) {
  252 + if ($login == "impex" || (strpos($login, 'guest') === 0)) {
  253 + return array('success' => false, 'message' => "You are not authorised to change this password");
  254 + }
252 try { 255 try {
253 $data_array = array( 256 $data_array = array(
254 "login" => $login, 257 "login" => $login,
php/classes/UserMgr.php
@@ -23,7 +23,7 @@ class UserMgr @@ -23,7 +23,7 @@ class UserMgr
23 'USERTEMPDIR' => 'TEMP'); 23 'USERTEMPDIR' => 'TEMP');
24 protected $userGrps; 24 protected $userGrps;
25 protected $userGrpsCheckSum; //use to know if there is a modification in user groups 25 protected $userGrpsCheckSum; //use to know if there is a modification in user groups
26 - protected $amdaClient; //client to dd webservice 26 + protected $amdaClient = NULL; //client to dd webservice
27 protected $paramMgr, $baseExtXml; 27 protected $paramMgr, $baseExtXml;
28 protected $datasetsTimeRestriction; 28 protected $datasetsTimeRestriction;
29 protected $datasetsTimeRestrictionCheckSum; 29 protected $datasetsTimeRestrictionCheckSum;
@@ -75,10 +75,15 @@ class UserMgr @@ -75,10 +75,15 @@ class UserMgr
75 $this->user = $_GET['sessionID']; 75 $this->user = $_GET['sessionID'];
76 else if (isset($sessionID)) 76 else if (isset($sessionID))
77 $this->user = $sessionID; 77 $this->user = $sessionID;
78 - //TODO if AmdaClient is needed ?  
79 - $this->amdaClient = new AmdaClient();  
80 } 78 }
81 79
  80 + private function getAmdaClient() {
  81 + if (!isset($this->amdaClient)) {
  82 + $this->amdaClient = new AmdaClient();
  83 + }
  84 + return $this->amdaClient;
  85 + }
  86 +
82 //TODO if needed?? set session ID 87 //TODO if needed?? set session ID
83 protected function setID() {} 88 protected function setID() {}
84 89
@@ -119,7 +124,7 @@ class UserMgr @@ -119,7 +124,7 @@ class UserMgr
119 // "email" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("email") : "undefined", 124 // "email" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("email") : "undefined",
120 // "date" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("date") : "undefined", 125 // "date" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("date") : "undefined",
121 // "news" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("news") : "0"); 126 // "news" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("news") : "0");
122 - $info = $this->amdaClient->getUserInfo($this->user); 127 + $info = $this->getAmdaClient()->getUserInfo($this->user);
123 $wsSize = intval($this->getWsSize()/1024./1024.); 128 $wsSize = intval($this->getWsSize()/1024./1024.);
124 $quota = intval($this->getSpecialSettings()/1024./1024.); 129 $quota = intval($this->getSpecialSettings()/1024./1024.);
125 $info['total'] = $quota; 130 $info['total'] = $quota;
@@ -131,7 +136,7 @@ class UserMgr @@ -131,7 +136,7 @@ class UserMgr
131 136
132 public function resetPwd($crt_pwd, $new_pwd) 137 public function resetPwd($crt_pwd, $new_pwd)
133 { 138 {
134 - return $this->amdaClient->resetUserPwd($this->user, $crt_pwd, $new_pwd); 139 + return $this->getAmdaClient()->resetUserPwd($this->user, $crt_pwd, $new_pwd);
135 } 140 }
136 141
137 public function createDir() 142 public function createDir()
@@ -149,7 +154,7 @@ class UserMgr @@ -149,7 +154,7 @@ class UserMgr
149 if (isset($this->userGrps)) { 154 if (isset($this->userGrps)) {
150 return; 155 return;
151 } 156 }
152 - $info = $this->amdaClient->getUserInfo($this->user); 157 + $info = $this->getAmdaClient()->getUserInfo($this->user);
153 158
154 $this->userGrpsCheckSum = ''; 159 $this->userGrpsCheckSum = '';
155 if (!empty($info['group'])) { 160 if (!empty($info['group'])) {
@@ -179,7 +184,7 @@ class UserMgr @@ -179,7 +184,7 @@ class UserMgr
179 } 184 }
180 185
181 $this->datasetsTimeRestrictionCheckSum = ''; 186 $this->datasetsTimeRestrictionCheckSum = '';
182 - $this->datasetsTimeRestriction = $this->amdaClient->getDatasetsWithTimeRestriction(); 187 + $this->datasetsTimeRestriction = $this->getAmdaClient()->getDatasetsWithTimeRestriction();
183 188
184 if ($this->datasetsTimeRestriction !== FALSE) { 189 if ($this->datasetsTimeRestriction !== FALSE) {
185 foreach ($this->datasetsTimeRestriction as &$datasetTimeRestriction) { 190 foreach ($this->datasetsTimeRestriction as &$datasetTimeRestriction) {
php/rest/getObsDataTree.php
@@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
5 * @apiDescription Provides the hierarchy of public access data in AMDA. 5 * @apiDescription Provides the hierarchy of public access data in AMDA.
6 * @apiName getObsDataTree 6 * @apiName getObsDataTree
7 * @apiGroup webservices 7 * @apiGroup webservices
  8 + *
  9 + * @apiParam {String} [userID] Identifier of the user in AMDA (*mandatory for user owned data*)
  10 + * @apiParam {String} [password] Password of the user in AMDA (*mandatory for user owned data*)
  11 + * @apiParam {Boolean} [templateInfo] `1` to include info about templated parameters - Default `0`.
8 * 12 *
9 * @apiSuccess {String} success true. 13 * @apiSuccess {String} success true.
10 * @apiSuccess {String} workspace URL of the XML file containing the list of "public" parameters in AMDA. 14 * @apiSuccess {String} workspace URL of the XML file containing the list of "public" parameters in AMDA.