Commit ed47f960889a3adfe2bcc12db695ae4953af5736

Authored by Benjamin Renard
2 parents 23450317 827bddef

Merge branch 'amdadev' into save-other-requests

.gitignore
1 1 data/
2 2 shared_data/
  3 +help/apidoc/
3 4 generic_data/EPNResources/*.xml
4 5 generic_data/LocalData/
5 6 generic_data/RemoteData/
... ... @@ -11,6 +12,7 @@ generic_data/HAPI/metadata/amda-catalog.json
11 12 js/lib/ext
12 13 help/simu
13 14 help/auto
  15 +help/amdapy
14 16 php/bin
15 17 php/my_config.php
16 18 *~
... ... @@ -20,3 +22,5 @@ _test*
20 22 *.idea
21 23 /nbproject/
22 24 nohup.out
  25 +php/rest/apidoc.json
  26 +scripts/amdapy_doc_build
... ...
desktop.php
... ... @@ -4,8 +4,9 @@
4 4 * @version $Id: desktop.php 2934 2015-06-03 13:23:22Z elena $
5 5 *
6 6 */
7   -
  7 +
8 8 require_once('php/config.php');
  9 +
9 10 // error_reporting(E_ALL);
10 11 if (!isset($_POST['username'])) {
11 12 header('Location: index.html');
... ... @@ -13,8 +14,8 @@
13 14 }
14 15  
15 16 if (!isset($_POST['username'])) die('<a href="index.html">LOGIN SVP</a>');
16   -
17 17 $usrMgr = new UserMgr();
  18 +
18 19 $sessionID = $usrMgr->init();
19 20 if ($sessionID === FALSE) {
20 21 header('Location: index.html?error=1');
... ... @@ -109,7 +110,6 @@
109 110 var gatewayTimeout = '<?php if (defined('GATEWAY_TIMEOUT')) echo GATEWAY_TIMEOUT; else echo 300000; ?>'; // in msec
110 111  
111 112 var logExecTime = <?php echo (defined('LOG_EXEC_TIME') && (LOG_EXEC_TIME === TRUE) ? 'true' : 'false'); ?>;
112   -
113 113 //create mask class (LoadMask for elements has been deprecated, use Ext.dom.Element.mask & Ext.dom.Element.unmask)
114 114 var AMDAMask = new Ext.Class({
115 115 show : function(interactivePlot)
... ... @@ -118,16 +118,8 @@
118 118 if (interactivePlot)
119 119 msg += ' <br/> <p align="center"><input id="killopBtn" type="button" value="Kill process" /></p>';
120 120  
121   - var mask = Ext.getBody().mask(msg);
  121 + var mask = Ext.getBody().mask(msg, 'amda-mask');
122 122  
123   - mask.dom.style.zIndex = '99998';
124   -
125   - var maskMsg = Ext.DomQuery.select('div[class=x-mask-msg]');
126   - if (maskMsg)
127   - maskMsg = maskMsg[0];
128   -
129   - if (maskMsg)
130   - maskMsg.style.zIndex = '99999';
131 123 if (interactivePlot)
132 124 {
133 125 var killBtn = Ext.get('killopBtn');
... ... @@ -175,7 +167,7 @@
175 167  
176 168 if (response && response.statusText) {
177 169 if (response.timedout)
178   - alert('Request processing time exceeds gateway timeout.<br/>In case of parameter from Remote Bases : please re-launch the same request in 10 min,<br/>otherwise contact AMDA team');
  170 + alert('Request processing time exceeds gateway timeout\n In case of parameter from Remote Bases : please re-launch the same request in 10 min,\n otherwise select "non-screen" FileOutput or contact AMDA team');
179 171 else
180 172 alert(response.statusText);
181 173 }
... ...
generic_data/Functions/functions.xml
... ... @@ -161,17 +161,11 @@
161 161 <info_brief>Frames transformation</info_brief>
162 162 <new_kernel>#framesTransformation</new_kernel>
163 163 </function>
164   - <function name="GSE2GSM(,)" args="1" kind="frames" group="space">
165   - <prompts>
166   - <prompt type="boolean">The vector represent a position in space?</prompt>
167   - </prompts>
  164 + <function name="GSE2GSM()" kind="frames" group="space">
168 165 <info_brief>GSE to GSM frame transformation</info_brief>
169 166 <new_kernel>#GSE2GSM</new_kernel>
170 167 </function>
171   - <function name="GSM2GSE(,)" args="1" kind="frames" group="space">
172   - <prompts>
173   - <prompt type="boolean">The vector represent a position in space?</prompt>
174   - </prompts>
  168 + <function name="GSM2GSE()" kind="frames" group="space">
175 169 <info_brief>GSM to GSE frame transformation</info_brief>
176 170 <new_kernel>#GSM2GSE</new_kernel>
177 171 </function>
... ...
generic_data/rank.json
1 1 {"Sun" : 1, "Mercury": 2, "Venus": 3, "Heliosphere.NearEarth": 4, "Heliosphere.Remote1AU": 5,
2 2 "Earth.Magnetosheath": 6, "Earth.Magnetosphere": 6, "Earth": 6, "Earth.Surface": 7,
3   -"Mars": 8, "Jupiter": 9, "Ganymede" : 9, "Saturn": 91, "Uranus" : 92, "Neptune" : 93, "Comet" : 94,
4   -"Heliosphere" : 99 }
5 3 \ No newline at end of file
  4 +"Mars": 8, "Jupiter": 9, "Ganymede" : 9, "Saturn": 91, "Uranus" : 92, "Neptune" : 93, "Comet" : 94, "Pluto" : 95,
  5 +"Heliosphere" : 99 }
... ...
help/info.html
... ... @@ -18,10 +18,7 @@
18 18 <h3>AMDA DOCS</h3>
19 19 <div class="title">
20 20 <ul>
21   - <li><h4>Presentations</h4>
22   - <ul>
23   - <li><a href="http://cdpp.irap.omp.eu/index.php/ressources/presentations" target="_blank">CDPP/AMDA</a>
24   - </ul>
  21 + <li><h4><a href="https://doi.org/10.1016/j.pss.2021.105214" target="_blank">Article AMDA</h4></a></br>
25 22 <li><h4>Publications</h4>
26 23 <ul>
27 24 <li> <a href="http://cdpp.irap.omp.eu/index.php/ressources/publications/tools-and-the-vo" target="_blank">
... ... @@ -31,6 +28,15 @@
31 28 </ul>
32 29 </ul>
33 30 </div>
  31 + <h3>AMDA Tools</h3>
  32 + <div class="title">
  33 + <ul>
  34 + <li><h4>Python package</h4>
  35 + <ul>
  36 + <li><a href="amdapy" target="_blank">amdapy</a>
  37 + </ul>
  38 + </ul>
  39 + </div>
34 40 <h3>AMDA Services</h3>
35 41 <div class="title">
36 42 <ul>
... ... @@ -38,7 +44,7 @@
38 44 <ul>
39 45 <li><a href="apidoc" target="_blank">REST</a>
40 46 <li><a href="Methods_AMDA.xml" target="_blank">SOAP</a>
41   - <li><a title="TBD" target="_blank">Special WebServices</a>
  47 + <!-- <li><a title="TBD" target="_blank">Special WebServices</a> -->
42 48 </ul>
43 49 <li><h4>Access to Shared Time Tables and Catalogs</h4>
44 50 <ul>
... ...
help/policy.html
... ... @@ -18,15 +18,18 @@
18 18 <h3>Rules of the road</h3>
19 19 <div class="title">
20 20 <ul>
21   - <li><a href="licenceAction.do.html" target="_blank">CDPP</a>
22   - <li><a href="http://spdf.gsfc.nasa.gov/new_users.html" target="_blank">CDAWEB</a>
23   - <li><a href="http://ppi.pds.nasa.gov/citations_policy.jsp" target="_blank">PDS</a>
24   - <li><a href="http://themis.ssl.berkeley.edu/roadrules.shtml" target="_blank">THEMIS</a>
25   - <li><a href="http://lasp.colorado.edu/home/maven/files/2014/09/MAVEN_public-rules-of-the-road-v3.pdf" target="_blank">MAVEN</a>
26 21 <li><a href="SKR.html" target="_blank">CASSINI/RPWS/SKR</a>
  22 + <li><a href="http://spdf.gsfc.nasa.gov/new_users.html" target="_blank">CDAWEB</a>
  23 + <li><a href="licenceAction.do.html" target="_blank">CDPP</a>
27 24 <li><a href="http://www.cosmos.esa.int/web/csa/rules-of-the-road" target="_blank">CSA</a>
28   - <li><a href="STEREO.html" target="_blank">STEREO</a>
  25 + <li><a href="http://lasp.colorado.edu/home/maven/files/2014/09/MAVEN_public-rules-of-the-road-v3.pdf" target="_blank">MAVEN</a>
  26 + <li><a href="https://lasp.colorado.edu/mms/sdc/public/about" target="_blank">MMS</a>
  27 + <li><a href="http://ppi.pds.nasa.gov/citations_policy.jsp" target="_blank">PDS</a>
29 28 <li><a href="https://www.cosmos.esa.int/web/psa/psa-acknowledgement" target="_blank">PSA</a>
  29 + <li><a href="https://fields.ssl.berkeley.edu/rules/" target="_blank">PSP / FIELDS</a>
  30 + <li><a href="http://sweap.cfa.harvard.edu/Data.html" target="_blank">PSP / SWEAP</a>
  31 + <li><a href="STEREO.html" target="_blank">STEREO</a>
  32 + <li><a href="http://themis.ssl.berkeley.edu/roadrules.shtml" target="_blank">THEMIS</a>
30 33 </ul>
31 34 </div>
32 35 </div>
... ...
js/app/controllers/JobsMgr.js
... ... @@ -53,7 +53,7 @@
53 53 Ext.define('amdaDesktop.JobsMgr', {
54 54 extend: 'Ext.AbstractManager',
55 55 first: true,
56   - interval: 60000,
  56 + interval: 10000,
57 57 jobTree: null,
58 58 jobsError: 0,
59 59 jobsFinished: 0,
... ...
js/app/controllers/PlotModule.js
... ... @@ -136,9 +136,9 @@ Ext.define(&#39;amdaDesktop.PlotModule&#39;, {
136 136 //update result
137 137 winResult.getPanelResult().updateConfig(tabResult.title, tabResult.multiplot);
138 138 winResult.getPanelResult().updatePlotImage(plotTabConfig, newplot);
139   - //update window size
140   - var size = me.computeResultWindowSize(winResult.getPanelResult());
141   - winResult.setSize(size.width, size.height);
  139 + //update window size => not done see https://projects.irap.omp.eu/issues/9010
  140 + //var size = me.computeResultWindowSize(winResult.getPanelResult());
  141 + //winResult.setSize(size.width, size.height);
142 142 winResult.toFront();
143 143 }
144 144 });
... ...
js/app/controllers/VisuModule.js
... ... @@ -39,6 +39,12 @@ Ext.define(&#39;amdaDesktop.VisuModule&#39;, {
39 39 this.setLinkedNode(temporaryNode);
40 40  
41 41 this.createWindow();
42   - }
  42 + },
  43 +
  44 + addCatalog: function(catalogObject) {
  45 + var uiContent = this.getUiContent();
  46 + uiContent.addCatalog(catalogObject);
  47 + },
  48 +
43 49  
44 50 });
... ...
js/app/models/LocalParamNode.js
... ... @@ -30,7 +30,7 @@ Ext.define(&#39;amdaModel.LocalParamNode&#39;,
30 30  
31 31 icons : {'1' : 'icon-sun', '2' : 'icon-mercury','3' : 'icon-venus','4' : 'icon-sw','5' : 'icon-sw','6' : 'icon-earth','7' : 'icon-earth',
32 32 '8' : 'icon-mars','9' : 'icon-jupiter','91' : 'icon-saturn','92' : 'icon-uranus','93' : 'icon-neptune',
33   - '94' :'icon-comet', '99' :'icon-solarsystem', '999' :'icon-solarsystem'
  33 + '94' :'icon-comet', '95' : 'icon-pluto', '99' :'icon-solarsystem', '999' :'icon-solarsystem'
34 34 },
35 35  
36 36 constructor : function(config)
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -224,7 +224,7 @@ Ext.define(&#39;amdaPlotObj.PlotObjectConfig&#39;, {
224 224 ],
225 225  
226 226 availableFileOutputsForPng : [
227   - {'key' : 'INTERACTIVE', 'value' : 'Interactive mode'},
  227 + {'key' : 'INTERACTIVE', 'value' : 'screen'},
228 228 {'key' : 'TGZ', 'value' : 'tar+gzip archive'},
229 229 {'key' : 'ZIP', 'value' : 'zip archive'}
230 230 ],
... ... @@ -473,6 +473,11 @@ Ext.define(&#39;amdaPlotObj.PlotObjectConfig&#39;, {
473 473 {'key' : 'serie-constant', 'value' : 'Serie / Constant'},
474 474 {'key' : 'serie-serie', 'value' : 'Serie / Serie'}
475 475 ],
  476 + availableSpectroNormalization : [
  477 + {'key' : 'none', 'value' : 'None'},
  478 + {'key' : 'linear', 'value' : 'Linear'},
  479 + {'key' : 'log', 'value' : 'Logarithmic'}
  480 + ],
476 481  
477 482 getParamConfig : function(paramId, onParamConfigLoaded) {
478 483 AmdaAction.getParamPlotInit({"paramId" : paramId}, function (result, e) {
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -342,6 +342,8 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
342 342 if (success) {
343 343 if (emptyPanel && !me.isComponent)
344 344 me.changePlotType(data.panel.plotType);
  345 + if(data.panel.isotropic)
  346 + me.setIsotropic(data.panel.isotropic);
345 347  
346 348 if (data.draw && !me.isComponent) {
347 349 availableDrawingObjects = recs[0].getAvailableDrawingObjectByPlotType(me.get('panel-plot-type'));
... ... @@ -495,6 +497,12 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
495 497 return true;
496 498 },
497 499  
  500 + setIsotropic: function (isotropic){
  501 + if(this.get('panel-plot-type') != 'xyPlot')
  502 + return;
  503 + this.set('panel-scatter-isotropic', isotropic);
  504 + },
  505 +
498 506 changePlotType: function(plotType) {
499 507 if (plotType == this.get('panel-plot-type'))
500 508 return;
... ... @@ -597,7 +605,7 @@ Ext.define(&#39;amdaPlotObj.PlotPanelObject&#39;, {
597 605 break;
598 606 case 'xyPlot' :
599 607 if (this.get('panel-scatter-isotropic'))
600   - info += ', Isotropic';
  608 + info += ', Orthonormal';
601 609 break;
602 610 }
603 611 return info;
... ...
js/app/models/PlotObjects/PlotSpectroObject.js
... ... @@ -22,10 +22,11 @@ Ext.define(&#39;amdaPlotObj.PlotSpectroObject&#39;, {
22 22  
23 23 fields : [
24 24 {name: 'spectro-yaxis', type: 'string'},
25   - {name: 'spectro-resolution', type: 'int'},
  25 + {name: 'spectro-resolution', type: 'int'},
26 26 {name: 'spectro-value-min', type: 'float', useNull:true},
27 27 {name: 'spectro-value-max', type: 'float', useNull:true},
28   - {name: 'spectro-log0-as-min', type: 'boolean'}
  28 + {name: 'spectro-log0-as-min', type: 'boolean'},
  29 + {name: 'spectro-normalization', type: 'string'}
29 30 ],
30 31  
31 32 constructor: function(){
... ... @@ -55,7 +56,8 @@ Ext.define(&#39;amdaPlotObj.PlotSpectroObject&#39;, {
55 56 {
56 57 this.set('spectro-yaxis', amdaPlotObj.PlotObjectConfig.defaultValues.spectro.yAxis);
57 58 this.set('spectro-resolution', amdaPlotObj.PlotObjectConfig.defaultValues.spectro.resolution);
58   - this.set('spectro-log0-as-min', false);
  59 + this.set('spectro-log0-as-min', false);
  60 + this.set('spectro-normalization', "none");
59 61 },
60 62  
61 63 getJsonValues : function()
... ... @@ -66,8 +68,8 @@ Ext.define(&#39;amdaPlotObj.PlotSpectroObject&#39;, {
66 68 spectroValues['spectro-resolution'] = this.get('spectro-resolution');
67 69 spectroValues['spectro-value-min'] = this.get('spectro-value-min');
68 70 spectroValues['spectro-value-max'] = this.get('spectro-value-max');
69   - spectroValues['spectro-log0-as-min'] = this.get('spectro-log0-as-min');
70   -
  71 + spectroValues['spectro-log0-as-min'] = this.get('spectro-log0-as-min');
  72 + spectroValues['spectro-normalization'] = this.get('spectro-normalization');
71 73 return spectroValues;
72 74 }
73 75 });
... ...
js/app/models/Search.js
... ... @@ -21,7 +21,7 @@ Ext.define(&#39;amdaModel.Search&#39;, {
21 21  
22 22 fields : [
23 23 // {name: 'name', type: 'string', defaultValue: 'Search'},
24   - {name: 'sampling', type: 'int', defaultValue: '600'},
  24 + {name: 'sampling', type: 'float', defaultValue: '600'},
25 25 {name: 'gap', type: 'int', defaultValue: '5'},
26 26 {name: 'description', type: 'string'},
27 27 {name: 'expression', type: 'string'},
... ...
js/app/views/CatalogUI.js
... ... @@ -126,13 +126,18 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
126 126 Ext.Msg.confirm('Generate TT', 'Current Catalog has been modified.\nDo you want to save it to include these changes in the generated Time Table ?',
127 127 function (btn, text) {
128 128 if (btn == 'yes') {
  129 + var me = this;
129 130 // mark this.closed as true before the call to close() as that will fire the beforeclose event again
130 131 if (this.object.get('id') == "") {
131 132 // case of creation of catalog
132   - this.saveCatalog(true, true);
  133 + this.saveCatalog(function () {
  134 + me.createTT(me.object.get('id'));
  135 + }, true);
133 136 } else {
134 137 // casse existing catalog
135   - this.saveProcess(false, true, true);
  138 + this.saveProcess(false, function () {
  139 + me.createTT(me.object.get('id'));
  140 + }, true);
136 141 }
137 142 return;
138 143 }
... ... @@ -534,6 +539,13 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
534 539 me.updateCount();
535 540 //Statistical plugin
536 541 this.fireEvent("refresh");
  542 + },
  543 + prefetch: function (store, records, successful, operation, eOpts) {
  544 + if (operation && (operation.action == 'read'))
  545 + {
  546 + if (operation.response && operation.response.result && operation.response.result.success)
  547 + me.status = operation.response.result.status;
  548 + }
537 549 }
538 550 }
539 551 });
... ... @@ -546,7 +558,11 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
546 558 me.TTGrid.getSelectionModel().deselectAll();
547 559 //
548 560 // // clear filters
549   - // me.TTGrid.getStore().clearFilter(true);
  561 + if (me.TTGrid.filters) {
  562 + me.TTGrid.getStore().clearFilter(true);
  563 + me.TTGrid.filters.clearFilters();
  564 + }
  565 +
550 566 //
551 567 // clear sort
552 568 me.TTGrid.getStore().sorters.clear();
... ... @@ -622,11 +638,11 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
622 638 this.object = obj;
623 639 module.linkedNode.create({notDisplayMsg: notDisplayMsg, callback: function () {
624 640 if (onAfterSave)
625   - this.createTT(this.object.get('id'));
  641 + onAfterSave();
626 642 }, scope: this});
627 643 }
628 644 // if the name has been modified this is a creation
629   - else if (this.fclose()) {
  645 + else if (this.fclose() || this.status && (this.status.nbFiltered > 0)) {
630 646 if (this.object.isModified('name') || this.object.get('fromPlugin')) {
631 647 // if object already has an id : it's a 'rename' of an existing
632 648 if (this.object.get('id')) {
... ... @@ -648,14 +664,14 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
648 664 module.linkedNode.create({callback: function () {
649 665 module.linkedNode.update({notDisplayMsg: notDisplayMsg, callback: function () {
650 666 if (onAfterSave)
651   - this.createTT(this.object.get('id'));
  667 + onAfterSave();
652 668 }, scope: this}, "", notDisplayMsg);
653 669 }, scope: this});
654 670 } else {
655 671 //update
656 672 module.linkedNode.update({notDisplayMsg: notDisplayMsg, callback: function () {
657 673 if (onAfterSave)
658   - this.createTT(this.object.get('id'));
  674 + onAfterSave();
659 675 }, scope: this});
660 676 }
661 677 }
... ...
js/app/views/DownloadUI.js
... ... @@ -367,7 +367,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
367 367 this.object.set('timeformat', this.timeformatData[0][0]);
368 368  
369 369 if (!this.object.get('timeformatTT'))
370   - this.object.set('timeformatTT', this.timeformatTTData[0][0]);
  370 + this.object.set('timeformatTT', this.timeformatData[0][0]);
371 371  
372 372 if (!this.object.get('fileformat'))
373 373 this.object.set('fileformat', this.fileformatData[0][0]);
... ... @@ -708,7 +708,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
708 708  
709 709 this.TTGrid.on('cellclick', this.actionItem, this);
710 710  
711   - var store = new Ext.data.ArrayStore({
  711 + var storeTimeFormat = new Ext.data.ArrayStore({
712 712 fields: ['id', 'name', 'qtip'],
713 713 data: this.timeformatData
714 714 });
... ... @@ -757,7 +757,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
757 757 valueField: 'id',
758 758 displayField: 'name',
759 759 queryMode: 'local',
760   - store: store,
  760 + store: storeTimeFormat,
761 761 listConfig: {
762 762 tpl: [
763 763 '<tpl for=".">',
... ... @@ -765,7 +765,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
765 765 '</tpl>'
766 766 ]
767 767 },
768   - value: store.first()
  768 + value: storeTimeFormat.first()
769 769 },
770 770 {
771 771 fieldLabel: 'File Structure',
... ... @@ -852,8 +852,18 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
852 852 items: [{
853 853 fieldLabel: 'Time Format',
854 854 name: 'timeformatTT',
855   - store: this.timeformatTTData,
856   - value: this.timeformatTTData[0]
  855 + valueField: 'id',
  856 + store: storeTimeFormat,
  857 + displayField: 'name',
  858 + queryMode: 'local',
  859 + listConfig: {
  860 + tpl: [
  861 + '<tpl for=".">',
  862 + '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>',
  863 + '</tpl>'
  864 + ]
  865 + },
  866 + value: storeTimeFormat.first()
857 867 },
858 868 {
859 869 fieldLabel: 'File Format ',
... ...
js/app/views/MultiPlotUI.js
... ... @@ -33,10 +33,12 @@ Ext.define(&#39;amdaUI.MultiPlotUI&#39;, {
33 33 listeners: {
34 34 change: function(field, newValue, oldValue, eOpts) {
35 35 tabInfo.object.set('multi-selected', newValue);
  36 + tabInfo.tabContent.enableTimeSelection(!newValue);
36 37 }
37 38 }
38 39 }
39 40 );
  41 + tabInfo.tabContent.enableTimeSelection(!tabInfo.object.get('multi-selected'));
40 42 });
41 43 },
42 44  
... ...
js/app/views/ParamArgumentsPlug.js
... ... @@ -82,7 +82,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsPlug&#39;, {
82 82 listeners: {
83 83 scope: this,
84 84 beforeclose: function() {
85   - this.hostCmp.setDisabled(false);
  85 + //this.hostCmp.setDisabled(false);
86 86 Ext.PluginManager.unregister(this);
87 87 } ,
88 88 show: function() {
... ... @@ -112,7 +112,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsPlug&#39;, {
112 112 me.win.setHeight(me.computeHeight());
113 113 });
114 114  
115   - this.hostCmp.setDisabled(true);
  115 + //this.hostCmp.setDisabled(true);
116 116 this.win.show();
117 117 },
118 118  
... ... @@ -178,4 +178,4 @@ Ext.define(&#39;amdaUI.ParamArgumentsPlug&#39;, {
178 178 });
179 179 return this.form;
180 180 }
181   -});
182 181 \ No newline at end of file
  182 +});
... ...
js/app/views/ParamArgumentsUI.js
... ... @@ -41,7 +41,7 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
41 41 this.paramRequestObject = paramRequestObject;
42 42  
43 43 var me = this;
44   - me.mask();
  44 + me.getEl().mask();
45 45 me.resetArguments();
46 46  
47 47 var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id);
... ... @@ -76,11 +76,11 @@ Ext.define(&#39;amdaUI.ParamArgumentsUI&#39;, {
76 76 }
77 77 if (onReady)
78 78 onReady(uiScope);
79   - me.unmask();
  79 + me.getEl().unmask();
80 80 });
81 81 }
82 82 else
83   - me.unmask();
  83 + me.getEl().unmask();
84 84 },
85 85  
86 86 initDimension: function(relatedDim, data) {
... ...
js/app/views/ParameterUI.js
... ... @@ -391,7 +391,14 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;,
391 391 }
392 392 var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
393 393 if (paramModule) {
394   - paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  394 + if (data.records[0].get('predefinedArgs')) {
  395 + paramModule.parseTemplatedParam(nameToSent, function(param_info) {
  396 + paramModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args);
  397 + });
  398 + }
  399 + else {
  400 + paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  401 + }
395 402 }
396 403 return true;
397 404 }
... ...
js/app/views/PlotComponents/PlotPanelForm.js
... ... @@ -129,10 +129,10 @@ Ext.define(&#39;amdaPlotComp.PlotPanelForm&#39;, {
129 129 me.updateOptions(value);
130 130 }
131 131 }),
132   - this.addStandardCheck('panel-scatter-isotropic', 'Isotropic', function(name, value, oldValue) {
  132 + this.addStandardCheck('panel-scatter-isotropic', 'Orthonormal scale', function(name, value, oldValue) {
133 133 me.object.set('panel-scatter-isotropic', value);
134 134 me.crtTree.refresh();
135   - }),
  135 + }, 'When this option is selected, a unit on the X-axis appears with the same size as a unit on the Y-axis'),
136 136 this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id', function(name, value, oldValue) {
137 137 me.object.set('panel-epoch-centertimeid', value);
138 138 me.crtTree.refresh();
... ...
js/app/views/PlotComponents/PlotSpectroForm.js
... ... @@ -37,7 +37,13 @@ Ext.define(&#39;amdaPlotComp.PlotSpectroForm&#39;, {
37 37 this.addStandardFieldSet('Min/Max thresholds', '', this.getValuesRangeItems()),
38 38 this.addStandardCheck('spectro-log0-as-min', 'Show 0 values as Min Values in log scale', function(name, value, oldValue) {
39 39 me.object.set('spectro-log0-as-min', value);
40   - })
  40 + }),
  41 + this.addStandardCombo('spectro-normalization', 'Normalization', amdaPlotObj.PlotObjectConfig.availableSpectroNormalization, function(name, value, oldValue) {
  42 + if (me.object.get('spectro-normalization') != value)
  43 + {
  44 + me.object.set('spectro-normalization', value);
  45 + }
  46 + })
41 47 ];
42 48 }
43 49 });
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -167,21 +167,30 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
167 167 };
168 168 },
169 169  
170   - addStandardCheck: function(name, label, onChange) {
  170 + addStandardCheck: function(name, label, onChange, tooltip) {
  171 +
171 172 return {
172   - xtype: 'checkbox',
173   - name: name,
174   - boxLabel: label,
175   - listeners: {
176   - change: function(combo, newValue, oldValue, eOpts) {
177   -
178   - this.object.set(name, newValue);
179   - if (onChange != null)
180   - onChange(name, newValue, oldValue);
181   - },
182   - scope: this
183   - }
184   - };
  173 + xtype: 'checkbox',
  174 + name: name,
  175 + boxLabel: label,
  176 + listeners: {
  177 + change: function(combo, newValue, oldValue, eOpts) {
  178 + this.object.set(name, newValue);
  179 + if (onChange != null)
  180 + onChange(name, newValue, oldValue);
  181 + },
  182 + render: function(c) {
  183 + if (tooltip) {
  184 + Ext.create('Ext.tip.ToolTip', {
  185 + target: c.getEl(),
  186 + dismissDelay: 0,
  187 + html: tooltip
  188 + });
  189 + }
  190 + },
  191 + scope: this
  192 + }
  193 + };
185 194 },
186 195  
187 196 addStandardFieldSet: function(title, checkboxName, items, onChangeCheck) {
... ...
js/app/views/PlotComponents/PlotTabPanel.js
... ... @@ -203,7 +203,8 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
203 203 tabsInfo.push({
204 204 name: plotNode.get('object').get('tab-title'),
205 205 object: plotNode.get('object'),
206   - selected: (tabItem == this.getActiveTab())
  206 + selected: (tabItem == this.getActiveTab()),
  207 + tabContent: tabContent
207 208 });
208 209 }
209 210 return tabsInfo;
... ... @@ -250,6 +251,22 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
250 251 me.tabbar_destroy = true;
251 252 }
252 253 }
  254 + },
  255 + listeners: {
  256 + tabchange: function(tabPanel, newCard, oldCard, eOpts) {
  257 + if (newCard) {
  258 + var newTree = this.getTreeFromPlotTab(newCard);
  259 + if (newTree) {
  260 + if (newTree.plotElementPanel != null) {
  261 + var selectedNode = newTree.getSelectedNode();
  262 + if (selectedNode != null) {
  263 + newTree.plotElementPanel.setElement(selectedNode.type, selectedNode.object, newTree);
  264 + }
  265 + }
  266 + }
  267 + }
  268 + },
  269 + scope: this
253 270 }
254 271 };
255 272  
... ...
js/app/views/PlotUI.js
... ... @@ -152,7 +152,9 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
152 152 var plotButton = this.queryById('single-plot-button');
153 153 plotButton.setDisabled(!enable);
154 154 plotButton.setTooltip(enable ? 'Plot request' : 'Multiplot is enabled');
155   - this.plotTabs.enableTimeSelection(enable);
  155 + if (enable) {
  156 + this.plotTabs.enableTimeSelection(true);
  157 + }
156 158 },
157 159  
158 160 init : function(config) {
... ...
js/app/views/SearchUI.js
... ... @@ -414,8 +414,16 @@ Ext.define(&#39;amdaUI.SearchUI&#39;,
414 414 }
415 415 var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
416 416  
417   - if (searchModule)
418   - searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  417 + if (searchModule) {
  418 + if (data.records[0].get('predefinedArgs')) {
  419 + searchModule.parseTemplatedParam(nameToSent, function(param_info) {
  420 + searchModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args);
  421 + });
  422 + }
  423 + else {
  424 + searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  425 + }
  426 + }
419 427 return true;
420 428 }
421 429 });
... ...
js/app/views/StatisticsUI.js
... ... @@ -232,7 +232,8 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
232 232 {
233 233 xtype: 'combo', queryMode: 'local',
234 234 //emptyText : 'please click to select function',
235   - store: ['min', 'max', 'mean', 'RMS', 'median', 'variance', 'skewness', 'kurtosis', 'count', 'countNotNan', 'countTrue'],
  235 + store: ['min', 'max', 'mean', 'RMS', 'median', 'variance', 'skewness', 'kurtosis',
  236 + 'count', 'countNotNan', 'countTrue','firstValue','middleIntervalValue','lastValue'],
236 237 triggerAction: 'all',
237 238 //lazyInit: false,
238 239 listeners: {
... ... @@ -369,7 +370,14 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
369 370 var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.statistics.id);
370 371 if (module)
371 372 {
372   - module.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  373 + if (data.records[0].get('predefinedArgs')) {
  374 + module.parseTemplatedParam(nameToSent, function(param_info) {
  375 + module.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args);
  376 + });
  377 + }
  378 + else {
  379 + module.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  380 + }
373 381 }
374 382 return true;
375 383 }
... ...
js/app/views/TimeTableOperationUI.js
... ... @@ -110,7 +110,7 @@ Ext.define(&#39;amdaUI.TimeTableOperationUI&#39;, {
110 110 },
111 111 notifyOver : function(ddSource, e, data)
112 112 {
113   - if ((data.records[0].data.nodeType == 'timeTable') && (data.records[0].data.leaf))
  113 + if ((data.records[0].data.nodeType == 'timeTable' || data.records[0].data.nodeType == 'sharedtimeTable' ) && (data.records[0].data.leaf))
114 114 {
115 115 this.valid = true;
116 116 return this.dropAllowed;
... ... @@ -303,4 +303,4 @@ Ext.define(&#39;amdaUI.TimeTableOperationUI&#39;, {
303 303 Ext.apply (this , Ext.apply (arguments, myConf));
304 304  
305 305 }
306   -});
307 306 \ No newline at end of file
  307 +});
... ...
js/app/views/TimeTableUI.js
... ... @@ -194,7 +194,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
194 194 // synchronisation of objects
195 195 this.object = ttobj;
196 196 timeTableModule.linkedNode.create();
197   - } else if (this.fclose()) /*TimeTable object has been modified*/
  197 + } else if (this.fclose() || this.status && (this.status.nbFiltered > 0)) /*TimeTable object has been modified*/
198 198 {
199 199 if (this.object.isModified('name') || this.object.get('fromPlugin'))
200 200 {
... ...
js/app/views/VisuUI.js
... ... @@ -8,317 +8,378 @@
8 8 */
9 9  
10 10 Ext.define('amdaUI.VisuUI', {
11   - extend: 'Ext.container.Container',
12   - alias: 'widget.panelVisu',
  11 + extend: 'Ext.container.Container',
  12 + alias: 'widget.panelVisu',
13 13  
14   - requires: [
15   - 'amdaUI.CatalogVisuScatter',
16   - 'amdaUI.CatalogVisuHistogram'
17   - ],
  14 + requires: [
  15 + 'amdaUI.CatalogVisuScatter',
  16 + 'amdaUI.CatalogVisuHistogram'
  17 + ],
18 18  
19   - visuTabContents: [],
  19 + visuTabContents: [],
20 20  
21   - parametersStore: null,
22   - catalogStore: null,
23   - emptyChartConfig: null,
  21 + parametersStore: null,
  22 + catalogStore: null,
  23 + emptyChartConfig: null,
24 24  
25   - constructor: function(config) {
26   - this.init(config);
27   - this.callParent(arguments);
28   - if (this.object)
  25 + constructor: function (config) {
  26 + this.init(config);
  27 + this.callParent(arguments);
  28 + if (this.object)
  29 + this.loadObject();
  30 + },
  31 +
  32 + setObject: function (obj) {
  33 + this.object = obj;
29 34 this.loadObject();
30   - },
31   -
32   - setObject : function (obj) {
33   - this.object = obj;
34   - this.loadObject();
35   - },
36   -
37   - updateObject : function () {
38   - return true;
39   - },
40   -
41   - reset : function() {
42   - var tabPanel = Ext.getCmp('visu-tabpanel');
43   - Ext.Array.each(tabPanel.items.items, function(item) {
44   - Ext.each(item.query('field'), function(field) {
45   - field.reset();
46   - });
47   - });
48   - this.replaceChart(null);
49   - },
50   -
51   - /**
52   - * load object catalog into this view
53   - */
54   - loadObject : function()
55   - {
56   - var me = this;
57   -
58   - var onAfterInit = function(result, e)
59   - {
60   - if (!result) {
61   - myDesktopApp.errorMsg(e.message);
62   - Ext.defer(function(){Ext.Msg.toFront()},10);
63   -
64   - return;
65   - }
66   - else if (!result.success)
67   - {
68   - if (result.message)
69   - myDesktopApp.errorMsg(result.message);
70   - else
71   - myDesktopApp.errorMsg('Unknown error during catalog cache initialisation');
72   -
73   - Ext.defer(function(){Ext.Msg.toFront()},10);
74   -
75   - return;
76   - }
77   -
78   - me.parametersStore.removeAll();
79   - Ext.Array.each(result.parameters, function(param) {
80   - if ((param.type == 0) || (param.type == 1) || (param.type == 3)) {
81   - me.parametersStore.add(param);
82   - }
83   - });
84   -
85   - var dateConvert = function (value, rec) {
86   - if (!Ext.isDate(value)) {
87   - var valueString = new String(value);
88   - return new Date(valueString+'Z');
89   - }
90   - return value;
91   - };
92   -
93   - var fieldsConfig = [];
94   - fieldsConfig.push({type: 'date', id: 'start', name : 'start', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert});
95   - fieldsConfig.push({type: 'date', id: 'stop', name : 'stop', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert});
96   - me.parametersStore.each(function (param) {
97   - switch (param.get('type')) {
98   - case 0: //double
99   - fieldsConfig.push({
100   - type: 'float',
101   - id: param.get('id'),
102   - name: param.get('id')
  35 + },
  36 +
  37 + updateObject: function () {
  38 + return true;
  39 + },
  40 + addCatalog: function (cat) {
  41 + this.setObject(cat)
  42 + },
  43 +
  44 + reset: function () {
  45 + var tabPanel = Ext.getCmp('visu-tabpanel');
  46 + Ext.Array.each(tabPanel.items.items, function (item) {
  47 + Ext.each(item.query('field'), function (field) {
  48 + field.reset();
  49 + });
  50 + });
  51 + this.replaceChart(null);
  52 + },
  53 +
  54 + /**
  55 + * load object catalog into this view
  56 + */
  57 + loadObject: function ()
  58 + {
  59 + var me = this;
  60 +
  61 + var onAfterInit = function (result, e)
  62 + {
  63 + if (!result) {
  64 + myDesktopApp.errorMsg(e.message);
  65 + Ext.defer(function () {
  66 + Ext.Msg.toFront()
  67 + }, 10);
  68 +
  69 + return;
  70 + } else if (!result.success)
  71 + {
  72 + if (result.message)
  73 + myDesktopApp.errorMsg(result.message);
  74 + else
  75 + myDesktopApp.errorMsg('Unknown error during catalog cache initialisation');
  76 +
  77 + Ext.defer(function () {
  78 + Ext.Msg.toFront()
  79 + }, 10);
  80 +
  81 + return;
  82 + }
  83 +
  84 + me.parametersStore.removeAll();
  85 + Ext.Array.each(result.parameters, function (param) {
  86 + if ((param.type == 0) || (param.type == 1) || (param.type == 3)) {
  87 + me.parametersStore.add(param);
  88 + }
103 89 });
104   - break;
105   - case 1: //dateTime
106   - fieldsConfig.push({
107   - type: 'date',
108   - id: param.get('id'),
109   - name : param.get('id'),
110   - convert: dateConvert
  90 +
  91 + var dateConvert = function (value, rec) {
  92 + if (!Ext.isDate(value)) {
  93 + var valueString = new String(value);
  94 + return new Date(valueString + 'Z');
  95 + }
  96 + return value;
  97 + };
  98 +
  99 + var fieldsConfig = [];
  100 + fieldsConfig.push({type: 'date', id: 'start', name: 'start', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert});
  101 + fieldsConfig.push({type: 'date', id: 'stop', name: 'stop', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert});
  102 + me.parametersStore.each(function (param) {
  103 + switch (param.get('type')) {
  104 + case 0: //double
  105 + fieldsConfig.push({
  106 + type: 'float',
  107 + id: param.get('id'),
  108 + name: param.get('id')
  109 + });
  110 + break;
  111 + case 1: //dateTime
  112 + fieldsConfig.push({
  113 + type: 'date',
  114 + id: param.get('id'),
  115 + name: param.get('id'),
  116 + convert: dateConvert
  117 + });
  118 + break;
  119 + case 3: //int
  120 + fieldsConfig.push({
  121 + type: 'int',
  122 + id: param.get('id'),
  123 + name: param.get('id')
  124 + });
  125 + break;
  126 + }
111 127 });
112   - break;
113   - case 3: //int
114   - fieldsConfig.push({
115   - type: 'int',
116   - id: param.get('id'),
117   - name: param.get('id')
  128 +
  129 + me.catalogStore = Ext.create('Ext.data.Store', {
  130 + fields: fieldsConfig
118 131 });
119   - break;
  132 + me.catalogStore.loadData(result.intervals);
  133 +
  134 + me.reset();
120 135 }
121   - });
122   -
123   - me.catalogStore = Ext.create('Ext.data.Store', {
124   - fields : fieldsConfig
125   - });
126   - me.catalogStore.loadData(result.intervals);
127   -
128   - me.reset();
129   - }
130   -
131   - var opt = {
132   - 'typeTT' : 'catalog', 'id' : this.object.get('id'),
133   - 'name' : this.object.get('name')
134   - };
135   -
136   - this.formPanel.getForm().loadRecord(this.object);
137   - AmdaAction.readIntervalsForChart(opt, onAfterInit);
138   - },
139   -
140   - /**
141   - * Check if changes were made before closing window
142   - * @return true if changes
143   - */
144   - fclose : function()
145   - {
146   - return false;
147   - },
148   -
149   - plotChart : function () {
150   - var tabPanel = Ext.getCmp('visu-tabpanel');
151   - var newChartConfig = tabPanel.activeTab.items.items[0].getChartConfig(this.catalogStore);
152   - this.replaceChart(newChartConfig);
153   - },
154   -
155   - replaceChart: function(newChartConfig) {
156   - if (!newChartConfig) {
157   - newChartConfig = this.emptyChartConfig;
158   - }
159   - var chart = Ext.getCmp('visu-chart');
160   - var chartPanel = chart.up();
161   - chartPanel.remove(chart);
162   - chartPanel.insert(Ext.create('Ext.chart.Chart', newChartConfig));
163   - },
164   -
165   - saveChart : function() {
166   - var chart = Ext.getCmp('visu-chart');
167   - if (chart) {
168   - chart.save({
169   - type: 'image/png',
170   - defaultUrl : window.location
171   - });
172   - }
173   - },
174   -
175   - initChartTypes: function() {
176   - var me = this;
177   -
178   - var tabPanel = Ext.getCmp('visu-tabpanel');
179   - if (!tabPanel)
180   - return;
181   -
182   - var chartTypes = [
183   - {
184   - title: 'Scatter',
185   - widget: 'widget.panelCatalogVisuScatter'
186   - },
187   - {
188   - title: 'Histogram',
189   - widget: 'widget.panelCatalogVisuHistogram'
190   - }
191   - ];
192   -
193   - var isFirst = true;
194   - Ext.Array.each(chartTypes, function(chartType) {
195   - var tabContent = Ext.create(chartType.widget, {parametersStore : me.parametersStore});
196   - var tab = tabPanel.add({
197   - title: chartType.title,
198   - items: [
199   - tabContent
200   - ],
201   - layout: 'fit'
202   - });
203   - me.visuTabContents.push(tabContent);
204   - if (isFirst) {
205   - tabPanel.setActiveTab(tab);
206   - isFirst = false;
207   - }
208   - });
209   - },
210   -
211   - init : function (config)
212   - {
213   - this.catalogStore = Ext.create('Ext.data.Store', {
214   - fields: []
215   - });
216   -
217   - this.parametersStore = Ext.create('Ext.data.Store', {
218   - fields: [
219   - {name: 'id', type: 'string'},
220   - {name: 'name', type: 'string'},
221   - {name: 'type', type: 'int'}
222   - ],
223   - data: []
224   - });
225   -
226   - this.emptyChartConfig = {
227   - xtype: 'chart',
228   - region: 'center',
229   - store: this.catalogStore,
230   - id: 'visu-chart',
231   - animate: false,
232   - mask: false,
233   - shadow: false,
234   - theme:'Blue',
235   - background: { fill : "#fff" }
236   - };
237   -
238   - this.formPanel = Ext.create('Ext.form.Panel', {
239   - region: 'center',
240   - layout: 'border',
241   - bodyStyle: {background : '#dfe8f6'},
242   - defaults: { border : false, align: 'stretch', padding: '3'},
243   - items: [
244   - {
245   - xtype : 'fieldset',
246   - region: 'north',
247   - items : [
  136 +
  137 + var opt = {
  138 + 'typeTT': 'catalog', 'id': this.object.get('id'),
  139 + 'name': this.object.get('name')
  140 + };
  141 +
  142 + this.formPanel.getForm().loadRecord(this.object);
  143 + AmdaAction.readIntervalsForChart(opt, onAfterInit);
  144 + },
  145 +
  146 + /**
  147 + * Check if changes were made before closing window
  148 + * @return true if changes
  149 + */
  150 + fclose: function ()
  151 + {
  152 + return false;
  153 + },
  154 +
  155 + plotChart: function () {
  156 + var tabPanel = Ext.getCmp('visu-tabpanel');
  157 + var newChartConfig = tabPanel.activeTab.items.items[0].getChartConfig(this.catalogStore);
  158 + this.replaceChart(newChartConfig);
  159 + },
  160 +
  161 + replaceChart: function (newChartConfig) {
  162 + if (!newChartConfig) {
  163 + newChartConfig = this.emptyChartConfig;
  164 + }
  165 + var chart = Ext.getCmp('visu-chart');
  166 + var chartPanel = chart.up();
  167 + chartPanel.remove(chart);
  168 + chartPanel.insert(Ext.create('Ext.chart.Chart', newChartConfig));
  169 + },
  170 +
  171 + saveChart: function () {
  172 + var chart = Ext.getCmp('visu-chart');
  173 + if (chart) {
  174 + chart.save({
  175 + type: 'image/png',
  176 + defaultUrl: window.location
  177 + });
  178 + }
  179 + },
  180 +
  181 + initChartTypes: function () {
  182 + var me = this;
  183 +
  184 + var tabPanel = Ext.getCmp('visu-tabpanel');
  185 + if (!tabPanel)
  186 + return;
  187 +
  188 + var chartTypes = [
248 189 {
249   - xtype: 'fieldcontainer',
250   - layout: 'hbox',
251   - fieldDefaults: { labelWidth: 80, labelAlign : 'right' },
252   - items: [
253   - { xtype:'textfield', fieldLabel: 'Catalog Name', name: 'name', readOnly: true},
254   - { xtype: 'splitter' },
255   - { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', readOnly: true}
256   - ]
257   - }
258   - ],
259   - },
260   - {
261   - xtype: 'container',
262   - region: 'center',
263   - layout: 'border',
264   - items: [
  190 + title: 'Scatter',
  191 + widget: 'widget.panelCatalogVisuScatter'
  192 + },
265 193 {
266   - xtype: 'tabpanel',
267   - region: 'west',
268   - width: 250,
  194 + title: 'Histogram',
  195 + widget: 'widget.panelCatalogVisuHistogram'
  196 + }
  197 + ];
  198 +
  199 + var isFirst = true;
  200 + Ext.Array.each(chartTypes, function (chartType) {
  201 + var tabContent = Ext.create(chartType.widget, {parametersStore: me.parametersStore});
  202 + var tab = tabPanel.add({
  203 + title: chartType.title,
  204 + items: [
  205 + tabContent
  206 + ],
  207 + layout: 'fit'
  208 + });
  209 + me.visuTabContents.push(tabContent);
  210 + if (isFirst) {
  211 + tabPanel.setActiveTab(tab);
  212 + isFirst = false;
  213 + }
  214 + });
  215 + },
  216 +
  217 + init: function (config)
  218 + {
  219 + this.catalogStore = Ext.create('Ext.data.Store', {
  220 + fields: []
  221 + });
  222 +
  223 + this.parametersStore = Ext.create('Ext.data.Store', {
  224 + fields: [
  225 + {name: 'id', type: 'string'},
  226 + {name: 'name', type: 'string'},
  227 + {name: 'type', type: 'int'}
  228 + ],
  229 + data: []
  230 + });
  231 +
  232 + this.emptyChartConfig = {
  233 + xtype: 'chart',
  234 + region: 'center',
  235 + store: this.catalogStore,
  236 + id: 'visu-chart',
  237 + animate: false,
  238 + mask: false,
  239 + shadow: false,
  240 + theme: 'Blue',
  241 + background: {fill: "#fff"}
  242 + };
  243 +
  244 + this.formPanel = Ext.create('Ext.form.Panel', {
  245 + region: 'center',
  246 + layout: 'border',
  247 + bodyStyle: {background: '#dfe8f6'},
  248 + defaults: {border: false, align: 'stretch', padding: '3'},
  249 + items: [
  250 + {
  251 + xtype: 'fieldset',
  252 + region: 'north',
  253 + items: [
  254 + {
  255 + xtype: 'fieldcontainer',
  256 + layout: 'hbox',
  257 + fieldDefaults: {labelWidth: 80, labelAlign: 'right'},
  258 + items: [
  259 + {xtype: 'textfield', fieldLabel: 'Catalog Name', name: 'name', readOnly: true},
  260 + {xtype: 'splitter'},
  261 + {xtype: 'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', readOnly: true}
  262 + ]
  263 + }
  264 + ],
  265 + },
  266 + {
  267 + xtype: 'container',
  268 + region: 'center',
  269 + layout: 'border',
  270 + items: [
  271 + {
  272 + xtype: 'tabpanel',
  273 + region: 'west',
  274 + width: 250,
269 275 // height: 400,
270   - id: 'visu-tabpanel'
271   - },
272   - this.emptyChartConfig
273   - ]
274   - }
275   - ],
276   - fbar:[
277   - {
278   - type: 'button',
279   - text: 'Plot',
280   - scope : this,
281   - handler: this.plotChart
282   - },
283   - {
284   - type: 'button',
285   - text: 'Reset',
286   - scope : this,
287   - handler: this.reset
288   - },
289   - {
290   - type: 'button',
291   - text: 'Save Chart',
292   - scope : this,
293   - handler: this.saveChart
294   - }
295   - ]
296   - });
297   -
298   - var myConf = {
299   - layout: 'border',
300   - items: [
301   - this.formPanel,
302   - {
303   - xtype: 'panel',
304   - region: 'south',
305   - title: 'Information',
306   - collapsible: true,
307   - collapseMode: 'header',
308   - height: 100,
309   - autoHide: false,
310   - bodyStyle: 'padding:5px',
311   - iconCls: 'icon-information',
312   - loader: {
313   - autoLoad: true,
314   - url: helpDir+'visuHOWTO'
315   - }
316   - }
317   - ]
318   - };
319   -
320   - this.initChartTypes();
321   -
322   - Ext.apply (this, Ext.apply(arguments, myConf));
  276 + id: 'visu-tabpanel'
  277 + },
  278 + this.emptyChartConfig
  279 + ]
  280 + }
  281 + ],
  282 + fbar: [
  283 + {
  284 + type: 'button',
  285 + text: 'Plot',
  286 + scope: this,
  287 + handler: this.plotChart
  288 + },
  289 + {
  290 + type: 'button',
  291 + text: 'Reset',
  292 + scope: this,
  293 + handler: this.reset
  294 + },
  295 + {
  296 + type: 'button',
  297 + text: 'Save Chart',
  298 + scope: this,
  299 + handler: this.saveChart
  300 + }
  301 + ],
  302 + listeners:
  303 + {
  304 + render: function (o, op)
  305 + {
  306 + var me = this;
  307 + var el = me.body.dom;
  308 + var dropTarget = Ext.create('Ext.dd.DropTarget', el, {
  309 + ddGroup: 'explorerTree',
  310 + notifyEnter: function (ddSource, e, data)
  311 + {
  312 +
  313 + },
  314 + notifyOver: function (ddSource, e, data)
  315 + {
  316 + var nodeType = data.records[0].get('nodeType');
  317 + if ((nodeType == 'catalog' || nodeType == 'sharedcatalog') &&
  318 + (data.records[0].get('leaf')))
  319 + {
  320 + this.valid = true;
  321 + return this.dropAllowed;
  322 + }
  323 + this.valid = false;
  324 + return this.dropNotAllowed;
  325 + },
  326 + notifyDrop: function (ddSource, e, data)
  327 + {
  328 + if (!this.valid)
  329 + return false;
  330 + var visuModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id);
  331 + if (visuModule) {
  332 +
  333 + var catNode = data.records[0];
  334 + AmdaAction.getObject( catNode.get('id'), catNode.get('nodeType'), function(result, remoteEvent) {
  335 + var catObj = Ext.create(catNode.get('objectDataModel'), result);
  336 + if(catObj !== null){
  337 + visuModule.addCatalog(catObj);
  338 + }else{
  339 + Ext.MessageBox.show({title: 'Warning',
  340 + msg: '<br/>Undifined Catalog '+catNode.get('text'),
  341 + width: 300,
  342 + buttons: Ext.MessageBox,
  343 + fn: me.overwriteProcess,
  344 + icon: Ext.MessageBox.WARNING,
  345 + scope: me
  346 + });
  347 + return false;
  348 + }
  349 +
  350 + }, this);
  351 + }
  352 + return true;
  353 + }
  354 + });
  355 + }
  356 + }
  357 + });
  358 +
  359 + var myConf = {
  360 + layout: 'border',
  361 + items: [
  362 + this.formPanel,
  363 + {
  364 + xtype: 'panel',
  365 + region: 'south',
  366 + title: 'Information',
  367 + collapsible: true,
  368 + collapseMode: 'header',
  369 + height: 100,
  370 + autoHide: false,
  371 + bodyStyle: 'padding:5px',
  372 + iconCls: 'icon-information',
  373 + loader: {
  374 + autoLoad: true,
  375 + url: helpDir + 'visuHOWTO'
  376 + }
  377 + }
  378 + ]
  379 + };
  380 +
  381 + this.initChartTypes();
  382 +
  383 + Ext.apply(this, Ext.apply(arguments, myConf));
323 384 }
324 385 });
... ...
js/resources/css/amda.css
... ... @@ -443,6 +443,12 @@ background-image: url(../images/16x16/error.png) !important;
443 443 background-repeat: no-repeat;
444 444 }
445 445  
  446 +.icon-pluto {
  447 + background-image:url(../images/icons/pluto.png) !important;
  448 + background-position: center;
  449 + background-repeat: no-repeat;
  450 +}
  451 +
446 452 img.centered {
447 453 display: block;
448 454 margin-left: auto;
... ... @@ -581,3 +587,15 @@ p + p {
581 587 padding: 4px;
582 588 white-space: normal;
583 589 }
  590 +
  591 +.amda-mask {
  592 + z-index: 99999;
  593 +}
  594 +
  595 +.x-mask {
  596 + filter: alpha(opacity=50);
  597 + opacity: .5;
  598 + background: #ccc;
  599 + cursor: default;
  600 + z-index: 99998;
  601 +}
... ...
js/resources/css/styles.css
... ... @@ -93,14 +93,14 @@ text-align: center;
93 93  
94 94 #right ul {
95 95 list-style: none;
96   - margin-bottom: 10px;
97   - padding-top: 10px;
  96 + margin-bottom: 4px;
  97 + padding-top: 4px;
98 98 }
99 99  
100 100 #right li {
101   - padding: 4px;
102   - padding-left: 20px;
103   - padding-right: 20px;
  101 + padding: 2px;
  102 + padding-left: 8px;
  103 + padding-right: 8px;
104 104  
105 105 }
106 106  
... ...
js/resources/images/icons/pluto.png 0 โ†’ 100644

929 Bytes

php/WebServices/Tests/Suite/TestGetParameter_34.php 0 โ†’ 100644
... ... @@ -0,0 +1,59 @@
  1 +<?php
  2 +
  3 +require_once "Base/TestDownloadBase.php";
  4 +
  5 +class TestGetParameter_34 extends TestDownloadBase
  6 +{
  7 + public function getAPI() {
  8 + return "getParameter";
  9 + }
  10 +
  11 + protected function needRESTAuth() {
  12 + return TRUE;
  13 + }
  14 +
  15 + public function getParams() {
  16 + return array(
  17 + "startTime" => "2008-01-01T00:00:00",
  18 + "stopTime" => "2008-01-01T01:00:00",
  19 + "parameterID" => "imf(0)",
  20 + "sampling" => 60,
  21 + );
  22 + }
  23 +
  24 + public function getDescription() {
  25 + return "Get first component of imf data. Sampling time 60s.";
  26 + }
  27 +
  28 + protected function checkResultInfo($info) {
  29 + if ($info['structure'] != 'all-in-one-file') {
  30 + return array(
  31 + 'success' => FALSE,
  32 + 'message' => 'Bad file structure ('.$info['structure'].')',
  33 + );
  34 + }
  35 + if (!isset($info['sampling'])) {
  36 + return array(
  37 + 'success' => FALSE,
  38 + 'message' => 'Missing sampling time',
  39 + );
  40 + }
  41 + else if ($info['sampling'] != 60) {
  42 + return array(
  43 + 'success' => FALSE,
  44 + 'message' => 'Bad sampling time ('.$info['sampling'].')',
  45 + );
  46 + }
  47 + if (!in_array('imf', $info['parameters'])) {
  48 + return array(
  49 + 'success' => FALSE,
  50 + 'message' => 'Missing imf in result file',
  51 + );
  52 + }
  53 + return array(
  54 + 'success' => TRUE,
  55 + );
  56 + }
  57 +}
  58 +
  59 +?>
... ...
php/classes/AmdaAction.php
... ... @@ -665,6 +665,7 @@ class AmdaAction
665 665 $result = $this->executeRequest((Object) array(
666 666 'compression' => 'none',
667 667 'fileformat' => 'internal',
  668 + 'timeformat' => 'YYYY-MM-DDThh:mm:ss',
668 669 'sendToSamp' => FALSE,
669 670 'list' => array(
670 671 (Object) array(
... ...
php/classes/AmdaClient.php
... ... @@ -28,6 +28,10 @@ class AmdaClient {
28 28 date_default_timezone_set('UTC');
29 29 }
30 30  
  31 + public function base64url_encode($data) {
  32 + return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
  33 + }
  34 +
31 35 /* Just copy URL to Info/Bases.xml */
32 36 public function getAvailableExternalBases() {
33 37 try {
... ... @@ -230,13 +234,40 @@ class AmdaClient {
230 234 /* Get user info from login */
231 235 public function getUserInfo($login) {
232 236 try {
233   - $info = $this->client->getUserInfo($login,md5(DDSERVICE_PRIVATEKEY.$login.'getUserInfo'));
  237 + $data_array = array(
  238 + "login" => $login,
  239 + "timestamp" => time(),
  240 + );
  241 + $data = $this->base64url_encode(json_encode($data_array));
  242 + $check = md5($data.DDSERVICE_PUBLICKEY.DDSERVICE_PRIVATEKEY);
  243 + $info = $this->client->getUserInfo($data,DDSERVICE_PUBLICKEY,$check);
234 244 }
235 245 catch (SoapFault $exception) {
236 246 return array('success' => false, 'message' => $exception->faultstring);
237 247 }
238 248 return $info;
239 249 }
  250 +
  251 + /* Create a new user */
  252 + public function createUser($login, $pwd, $first_name, $last_name, $email) {
  253 + $result = FALSE;
  254 + try {
  255 + $data_array = array(
  256 + "login" => $login,
  257 + "pwd" => $pwd,
  258 + "first_name" => $first_name,
  259 + "last_name" => $last_name,
  260 + "email" => $email,
  261 + "timestamp" => time(),
  262 + );
  263 + $data = $this->base64url_encode(json_encode($data_array));
  264 + $check = md5($data.DDSERVICE_PUBLICKEY.DDSERVICE_PRIVATEKEY);
  265 + $result = $this->client->createUser($data,DDSERVICE_PUBLICKEY,$check);
  266 + }
  267 + catch (SoapFault $exception) {
  268 + }
  269 + return $result;
  270 + }
240 271  
241 272 /* Get data set info */
242 273 // public function getInfo($viID, $infoID) {
... ...
php/classes/AmdaStats.php
... ... @@ -8,8 +8,9 @@ class AmdaStats {
8 8  
9 9 public $statXml;
10 10 public $tasks = array('plot', 'mining', 'print', 'statistics');
  11 + public $tasksWs = array('ws_print', 'ws_plot');
11 12 public $tasksAdd = array('ttoper', 'samp', 'upload', 'create', 'images');
12   - public $usersToExclude = array('bouchemit', 'impex');
  13 + public $usersToExclude = array('bouchemit');
13 14 public $success = true;
14 15 private $user = null;
15 16 private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistics'=>'statistics',
... ... @@ -61,8 +62,24 @@ class AmdaStats {
61 62 if (!$status)
62 63 $this->success = false;
63 64 }
  65 + else {
  66 + $allTasks = array_merge($this->tasks, $this->tasksAdd, $this->tasksWs);
  67 + $newTask = FALSE;
  68 + foreach ($allTasks as $task) {
  69 + $items = $this->statXml->getElementsByTagName($task);
  70 + if ($items->length == 0) {
  71 + //add missing task
  72 + $element = $this->statXml->createElement("$task");
  73 + $this->statXml->documentElement->appendChild($element);
  74 + $newTask = TRUE;
  75 + }
  76 + }
  77 + if ($newTask) {
  78 + $this->statXml->save(StatsXml);
  79 + }
  80 + }
64 81 }
65   - }
  82 + }
66 83  
67 84 /*
68 85 * Merge individual User Stats.xml into one generique Stats.xml
... ... @@ -71,27 +88,33 @@ class AmdaStats {
71 88 // long procedure
72 89 ini_set('max_execution_time', 600);
73 90  
74   - $tags = array_merge($this->tasks, $this->tasksAdd);
  91 + $allTasks = array_merge($this->tasks, $this->tasksAdd, $this->tasksWs);
75 92  
76   - $doc2 = new DomDocument("1.0");
  93 + $userDoc = new DomDocument("1.0");
77 94 if ($year == null) $year = date("Y");
78 95  
79 96 $users=glob(USERPATH."*");
80 97 foreach ($users as $user) {
81   - $name2 = $user."/Stats$year.xml";
82   -
83   - if (!file_exists($name2)) continue;
84   -
85   - $doc2->load($name2);
86   -
87   - foreach ($tags as $tag) {
88   - $tag1 = $this->statXml->getElementsByTagName($tag)->item(0);
89   - $tag2 = $doc2->getElementsByTagName($tag)->item(0);
90   - $items2 = $tag2->getElementsByTagName("item");
91   - if ($items2->length > 0) {
92   - foreach ($items2 as $item2) {
93   - $item1 = $this->statXml->importNode($item2, true);
94   - $tag1->appendChild($item1);
  98 + $userXmlPath = $user."/Stats$year.xml";
  99 +
  100 + if (!file_exists($userXmlPath)) continue;
  101 +
  102 + $userDoc->load($userXmlPath);
  103 +
  104 + foreach ($allTasks as $task) {
  105 + $globalTaskItems = $this->statXml->getElementsByTagName($task);
  106 + if ($globalTaskItems->length == 0)
  107 + continue;
  108 + $globalTaskItem = $globalTaskItems->item(0);
  109 + $userTaskItems = $userDoc->getElementsByTagName($task);
  110 + if ($userTaskItems->length == 0)
  111 + continue;
  112 + $userTaskItem = $userTaskItems->item(0);
  113 + $userItems = $userTaskItem->getElementsByTagName("item");
  114 + if ($userItems->length > 0) {
  115 + foreach ($userItems as $userItem) {
  116 + $globalItem = $this->statXml->importNode($userItem, true);
  117 + $globalTaskItem->appendChild($globalItem);
95 118 }
96 119 }
97 120 }
... ... @@ -109,7 +132,7 @@ class AmdaStats {
109 132  
110 133 $rootElement = $this->statXml->createElement('stats');
111 134  
112   - $allTasks = array_merge($this->tasks, $this->tasksAdd);
  135 + $allTasks = array_merge($this->tasks, $this->tasksAdd, $this->tasksWs);
113 136  
114 137 foreach ($allTasks as $task) {
115 138 $element = $this->statXml->createElement("$task");
... ... @@ -122,7 +145,7 @@ class AmdaStats {
122 145 }
123 146  
124 147 public function addTask($user, $task, $vars) {
125   -
  148 +
126 149 // if (!$this->user) {
127 150 // error_log('User is null', 1, email);
128 151 // return;
... ... @@ -181,14 +204,18 @@ class AmdaStats {
181 204  
182 205 $taskArray = array();
183 206  
184   - foreach (array_merge($this->tasks,$this->tasksAdd) as $task) {
185   - $theTask = $this->statXml->getElementsByTagName($task)->item(0);
  207 + foreach (array_merge($this->tasks,$this->tasksAdd, $this->tasksWs) as $task) {
  208 + $taskItems = $this->statXml->getElementsByTagName($task);
  209 + if ($taskItems->length < 1)
  210 + return;
  211 + $theTask = $taskItems->item(0);
186 212 $items = $theTask->getElementsByTagName('item');
187 213 $hints = $items->length;
188 214  
189 215 $startStop = $this->getStartStop($items, $start, $stop);
190   - $taskArray[] = array('task' => $task, 'number' => $hints,
191   - 'start' => $startStop[0], 'stop' => $startStop[1]);
  216 +
  217 + $taskArray[] = array('task' => $task, 'number' => $hints,
  218 + 'start' => $startStop[0], 'stop' => $startStop[1]);
192 219 }
193 220  
194 221 $objToReturn = json_encode(array('stats' => $taskArray));
... ... @@ -213,8 +240,13 @@ class AmdaStats {
213 240 $STOParray = array();
214 241 $usersArray = array();
215 242  
216   - foreach ($this->tasks as $task) {
217   - $theTask = $this->statXml->getElementsByTagName($task)->item(0);
  243 + $dataTasks = array_merge($this->tasks, $this->tasksWs);
  244 +
  245 + foreach ($dataTasks as $task) {
  246 + $taskItems = $this->statXml->getElementsByTagName($task);
  247 + if ($taskItems->length < 1)
  248 + continue;
  249 + $theTask = $taskItems->item(0);
218 250 $items = $theTask->getElementsByTagName('item');
219 251 $TASKarray = array();
220 252  
... ... @@ -307,12 +339,17 @@ class AmdaStats {
307 339 if (!$stop) $stop = 100000000000;
308 340  
309 341 $date = array();
310   -
311   - foreach ($items as $item) {
312   - $newDate = strtotime($item->getAttribute('date'));
313 342  
314   - if (($newDate > $start) && ($newDate < $stop))
315   - $date[] = $newDate;
  343 + if ($items->length < 1) {
  344 + return array(0, 0);
  345 + }
  346 + else {
  347 + foreach ($items as $item) {
  348 + $newDate = strtotime($item->getAttribute('date'));
  349 +
  350 + if (($newDate > $start) && ($newDate < $stop))
  351 + $date[] = $newDate;
  352 + }
316 353 }
317 354  
318 355 return array(min($date), max($date));
... ... @@ -323,7 +360,7 @@ class AmdaStats {
323 360 if (!file_exists(StatsXml)) return 0;
324 361 if (!file_exists($inXml)) return 0;
325 362  
326   - $tags = array_merge($this->tasks,$this->tasksAdd);
  363 + $tags = array_merge($this->tasks,$this->tasksAdd, $this->tasksWs);
327 364  
328 365 $doc1 = new DomDocument("1.0");
329 366 $doc2 = new DomDocument("1.0");
... ...
php/classes/Guest.php
... ... @@ -7,117 +7,156 @@
7 7  
8 8 class Guest {
9 9  
10   - private $guestXml, $guestXmlFile, $xp, $root;
  10 + private $guestXmlFile;
11 11 public $Id, $Start, $Ip, $email;
12 12  
13 13 function __construct($Ip_, $email_ = null){
14   -
15 14 if($email_) {
16   - $this->Start = getdate();
17   - $this->Ip = $Ip_;
18   - $this->email = $email_;
19   - }
20   - else {
21   - $this->Id = substr($Ip_,strlen("guest"));
22   - }
23   -
24   - $this->guestXmlFile = DATAPATH."guests.xml";
25   - $this->guestXml = new DomDocument("1.0");
26   -
27   - if (!file_exists($this->guestXmlFile)){
28   - $status = $this->generateXML();
29   - }
30   - else {
31   - $this->guestXml->load($this->guestXmlFile);
32   - $this->root = $this->guestXml->getElementsByTagName("guests")->item(0);
  15 + $this->Start = getdate();
  16 + $this->Ip = $Ip_;
  17 + $this->email = $email_;
33 18 }
34   - $this->xp = new domxpath($this->guestXml);
  19 + else {
  20 + $this->Id = substr($Ip_,strlen("guest"));
  21 + }
  22 +
  23 + $this->guestXmlFile = DATAPATH."guests.xml";
  24 + }
  25 +
  26 + public function checkGuestTimes() {
  27 + return $this->concurrentAccessGuestFile(array($this,'_checkGuestTimes'));
  28 + }
  29 +
  30 + public function deleteGuest() {
  31 + return $this->concurrentAccessGuestFile(array($this,'_deleteGuest'));
  32 + }
  33 +
  34 + public function addGuest(){
  35 + return $this->concurrentAccessGuestFile(array($this,'_addGuest'));
35 36 }
36 37  
37   - private function generateXML() {
38   - $this->root = $this->guestXml->createElement('guests');
39   - $this->guestXml->appendChild($this->root);
  38 + public function registerGuest(){
  39 + return $this->concurrentAccessGuestFile(array($this,'_registerGuest'));
  40 + }
  41 +
  42 + private function concurrentAccessGuestFile($callback) {
  43 + $lockFile = $this->guestXmlFile.".lockfile";
  44 +
  45 + $fp = fopen($lockFile, "w+");
  46 +
  47 + if ($fp === false) {
  48 + return false;
  49 + }
40 50  
41   - $status = $this->guestXml->save($this->guestXmlFile);
  51 + $res = true;
42 52  
43   - return $status;
  53 + if (flock($fp, LOCK_EX))
  54 + {
  55 + if (!file_exists($this->guestXmlFile)) {
  56 + $res = $this->_generateXML();
  57 + }
  58 +
  59 + if ($res) {
  60 + $dom = new DomDocument("1.0","UTF-8");
  61 + $dom->preserveWhiteSpace = false;
  62 + $dom->formatOutput = true;
  63 + $res = $dom->load($this->guestXmlFile);
  64 + if ($res) {
  65 + $func_res = call_user_func($callback,$dom);
  66 + }
  67 + }
  68 + }
  69 + else
  70 + $res = false;
  71 +
  72 + fclose($fp);
  73 +
  74 + if ($res)
  75 + return $func_res;
  76 +
  77 + return false;
  78 + }
  79 +
  80 + private function _generateXML() {
  81 + $dom = new DOMDocument("1.0","UTF-8");
  82 + $dom->preserveWhiteSpace = false;
  83 + $dom->formatOutput = true;
  84 + $rootNode = $dom->createElement('guests');
  85 + $dom->appendChild($rootNode);
  86 + return $dom->save($this->guestXmlFile);
44 87 }
45 88  
46   - public function GetId(){
47   -
48   - $elements = $this->xp->query("//@xml:id");
  89 + private function _getId($dom){
  90 + $xp = new DOMXpath($dom);
  91 + $elements = $xp->query("//@xml:id");
49 92 // Now find New Valid ID
50   - if ($elements->length > 0) {
51   - $idList = array();
52   - for ($i = 0; $i < $elements->length; $i++)
53   - $idList[$i] = $elements->item($i)->nodeValue;
  93 + if ($elements->length > 0) {
  94 + $idList = array();
  95 + for ($i = 0; $i < $elements->length; $i++)
  96 + $idList[$i] = $elements->item($i)->nodeValue;
54 97  
55   - sort($idList);
56   - for ($i = 0; $i < $elements->length; $i++) {
57   - if ($idList[$i] > $i) {
58   - $newID = $i;
59   - break;
60   - }
61   - $newID = $i+1;
62   - }
63   - } else { $newID = 0;}
64   -
65   - return $newID;
66   - }
67   -
68   - public function checkGuestTimes(){
69   -
70   - $Start_0 = time() - GuestSessionDuration*60; // in secs
71   - $startTimes = $this->xp->query("//guest[@start<".$Start_0."]/@xml:id");
72   -
73   - if ($startTimes->length > 0) {
  98 + sort($idList);
  99 + for ($i = 0; $i < $elements->length; $i++) {
  100 + if ($idList[$i] > $i) {
  101 + $newID = $i;
  102 + break;
  103 + }
  104 + $newID = $i+1;
  105 + }
  106 + } else { $newID = 0;}
  107 +
  108 + return $newID;
  109 + }
  110 +
  111 + private function _checkGuestTimes($dom){
  112 + $xp = new DOMXpath($dom);
  113 + $Start_0 = time() - GuestSessionDuration*60; // in secs
  114 + $startTimes = $xp->query("//guest[@start<".$Start_0."]/@xml:id");
  115 +
  116 + if ($startTimes->length > 0) {
74 117 for ($i = 0; $i < $startTimes->length; $i++) {
75   - $user = "guest".$startTimes->item($i)->value;
76   - $this->deltree(USERPATH.$user);
77   - $this->root->removeChild($startTimes->item($i)->parentNode);
  118 + $user = "guest".$startTimes->item($i)->value;
  119 + $this->_deltree(USERPATH.$user);
  120 + $dom->documentElement->removeChild($startTimes->item($i)->parentNode);
78 121 }
79   - $this->xp = new domxpath($this->guestXml);
80   - }
81 122  
  123 + return $dom->save($this->guestXmlFile);
  124 + }
  125 + return true;
82 126 }
83 127  
84   - public function deleteGuest(){
85   -
86   - $user = "guest".$this->Id;
87   - $this->deltree(USERPATH.$user);
88   - $theGuest = $this->guestXml->getElementById($this->Id);
89   - $this->root->removeChild($theGuest);
90   - $this->guestXml->save($this->guestXmlFile);
91   -
92   - }
  128 + private function _deleteGuest($dom){
  129 + $user = "guest".$this->Id;
  130 + $this->_deltree(USERPATH.$user);
  131 + $theGuest = $dom->getElementById($this->Id);
  132 + $dom->documentElement->removeChild($theGuest);
  133 + return $dom->save($this->guestXmlFile);
  134 + }
93 135  
94   - public function addGuest(){
95   -
96   - if (($this->Id = $this->GetId()) < MaxGuests) {
97   - $guest = $this->guestXml->createElement("guest");
98   - $guest->setAttribute('xml:id',$this->Id );
99   - $guest->setAttribute('start',time());
100   - $guest->appendChild($this->guestXml->createElement("IP", $this->Ip));
101   - $guest->appendChild($this->guestXml->createElement("email", $this->email));
102   - $this->root->appendChild($guest);
103   - $this->guestXml->save($this->guestXmlFile);
104   -
105   - return "guest".$this->Id;
106   - }
107   - else {
108   - return "allGuestLoginsInUse";
109   - }
110   - }
111   -
112   - public function registerGuest(){
113   -
114   - $guest_file = fopen(DATAPATH.'guest.login','a');
115   - fwrite($guest_file, $this->email." ".$this->Ip." ".$this->Start['mday']."/".$this->Start['mon']."/".$this->Start['year']."\n");
116   - fclose($guest_file);
  136 + private function _addGuest($dom){
  137 + if (($this->Id = $this->_getId($dom)) < MaxGuests) {
  138 + $guest = $dom->createElement("guest");
  139 + $guest->setAttribute('xml:id',$this->Id );
  140 + $guest->setAttribute('start',time());
  141 + $guest->appendChild($dom->createElement("IP", $this->Ip));
  142 + $guest->appendChild($dom->createElement("email", $this->email));
  143 + $dom->documentElement->appendChild($guest);
  144 + $dom->save($this->guestXmlFile);
  145 + return "guest".$this->Id;
  146 + }
  147 + else {
  148 + return "allGuestLoginsInUse";
  149 + }
  150 + }
117 151  
  152 + private function _registerGuest($dom){
  153 + $guest_file = fopen(DATAPATH.'guest.login','a');
  154 + fwrite($guest_file, $this->email." ".$this->Ip." ".$this->Start['mday']."/".$this->Start['mon']."/".$this->Start['year']."\n");
  155 + fclose($guest_file);
  156 + return true;
118 157 }
119 158  
120   - public function deltree($f) {
  159 + private function _deltree($f) {
121 160  
122 161 if (is_dir($f)) {
123 162  
... ... @@ -125,7 +164,7 @@ class Guest {
125 164  
126 165 foreach($files as $sf) {
127 166 if (is_dir("$f/$sf") && !is_link("$f/$sf")) {
128   - $this->deltree("$f/$sf");
  167 + $this->_deltree("$f/$sf");
129 168 } else {
130 169 unlink("$f/$sf");
131 170 }
... ...
php/classes/RequestMgr.php
... ... @@ -51,7 +51,6 @@ class RequestMgr extends AmdaObjectMgr
51 51  
52 52 putenv("USER_DATA_PATH=".USERDATADIR);
53 53 putenv("USER_WS_PATH=".USERWSDIR);
54   - putenv("PHP_CLASSES_PATH=".CLASSPATH);
55 54 }
56 55  
57 56 protected function setObject($obj)
... ...
php/classes/UserMgr.php
... ... @@ -704,9 +704,6 @@ class UserMgr
704 704  
705 705 protected function updateTreeForGrpsAndTimeRestrictions($file)
706 706 {
707   - if (!isset($this->userGrps))
708   - return TRUE;
709   -
710 707 $xml = new DomDocument("1.0");
711 708  
712 709 if(!$xml->load($file))
... ... @@ -714,18 +711,20 @@ class UserMgr
714 711  
715 712 $xp = new domxpath($xml);
716 713  
717   - foreach ($this->userGrps as $grp) {
718   - $nodes = $xp->query("//*[@group='".$grp."']");
  714 + if (!empty($this->userGrps)) {
  715 + foreach ($this->userGrps as $grp) {
  716 + $nodes = $xp->query("//*[@group='".$grp."']");
719 717  
720   - if ($nodes->length > 0)
721   - foreach ($nodes as $node) {
722   - $node->removeAttribute('group');
723   - if ($node->hasAttribute('restriction')) {
724   - if ($node->getAttribute('restriction') != "plotOnly") {
725   - $node->removeAttribute('restriction');
  718 + if ($nodes->length > 0)
  719 + foreach ($nodes as $node) {
  720 + $node->removeAttribute('group');
  721 + if ($node->hasAttribute('restriction')) {
  722 + if ($node->getAttribute('restriction') != "plotOnly") {
  723 + $node->removeAttribute('restriction');
  724 + }
726 725 }
727   - }
728   - }
  726 + }
  727 + }
729 728 }
730 729  
731 730 if (!empty($this->datasetsTimeRestriction)) {
... ...
php/config.php
... ... @@ -48,8 +48,6 @@ define(&quot;MaxGuestTimeInterval&quot;, 10); // days
48 48 define('DISK_QUOTA_standard', 1024*1024*200); // 200MB
49 49 // max lines of uploaded ascii file to show
50 50 define('MAX_FILE_INDEX_TO_SHOW', 100);
51   -// private key used to be considerate as a trust client for some functions of DD web service
52   -define('DDSERVICE_PRIVATEKEY', '!%p856Dc');
53 51  
54 52 // EPN-TAP services
55 53 define('EPNTAP_APIS', 'http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync');
... ...
php/epntap.php
1 1 <?php
2 2  
3 3 include(realpath(dirname(__FILE__) . "/config.php"));
4   -include(CLASSPATH . "VOTableMgr.php");
5 4  
6 5 $action = preg_replace("/[^a-zA-Z]+/", "", filter_var($_GET['action'], FILTER_SANITIZE_STRING));
7 6  
... ...
php/my_config.template.php
... ... @@ -38,6 +38,9 @@ define(&#39;AMDAINTERNALDIR&#39;, &#39;{:AMDAINTERNALDIR:}&#39;);
38 38 define('REST_API_URL', '{:REST_API_URL:}');
39 39 define('API_DOC_PATH', '{:API_DOC_PATH:}');
40 40  
  41 +define('DDSERVICE_PRIVATEKEY', '{:DDSERVICE_PRIVATEKEY:}');
  42 +define('DDSERVICE_PUBLICKEY', '{:DDSERVICE_PUBLICKEY:}');
  43 +
41 44 // Show log in browser console about execution time for a request
42 45 // define('LOG_EXEC_TIME', FALSE);
43 46 ?>
... ...
php/rest/apidoc.json renamed to php/rest/apidoc.json.template
... ... @@ -2,6 +2,6 @@
2 2 "name": "AMDA web-services Rest API",
3 3 "description": "The web-services provided by AMDA aim at giving to a user access public data as well as its private data. These data may be private or shared Time Tables, public or user-defined parameters. All these webservices are also available through a SOAP interface.",
4 4 "title": "AMDA Web-services Rest API documentation",
5   - "url": "http://amda.irap.omp.eu/php/rest/",
6   - "sampleUrl": "http://amda.irap.omp.eu/php/rest/"
  5 + "url": "{:REST_API_URL:}",
  6 + "sampleUrl": "{:REST_API_URL:}"
7 7 }
... ...
scripts/apiDoc.php
... ... @@ -2,11 +2,11 @@
2 2 require_once dirname(__FILE__) . '/../php/config.php';
3 3  
4 4 $restFolderPath = AMDA_IHM . "php/rest";
5   -$apidocConfigFile = $restFolderPath . "apidoc.json";
6   -$tempConfigFile = tempnam(sys_get_temp_dir(), 'apidoc.json');
  5 +$apidocConfigTemplateFile = $restFolderPath . "/apidoc.json.template";
  6 +$apidocConfigFile = $restFolderPath . "/apidoc.json";
7 7  
8   -$apidocConfig = str_replace("{:REST_API_URL:}", REST_API_URL, file_get_contents($apidocConfigFile));
9   -file_put_contents($tempConfigFile, $apidocConfig);
  8 +$apidocConfig = str_replace("{:REST_API_URL:}", REST_API_URL, file_get_contents($apidocConfigTemplateFile));
  9 +file_put_contents($apidocConfigFile, $apidocConfig);
10 10  
11   -echo exec("apidoc -v -c $tempConfigFile -i $restFolderPath -o " . API_DOC_PATH);
  11 +echo exec("apidoc -v -c $apidocConfigFile -i $restFolderPath -o " . API_DOC_PATH).PHP_EOL;
12 12 ?>
... ...
scripts/build_amdapy_doc.sh 0 โ†’ 100755
... ... @@ -0,0 +1,78 @@
  1 +#!/bin/bash
  2 +
  3 +SCRIPT=$(readlink -f "$0")
  4 +export SCRIPTDIR=$(dirname "$SCRIPT")
  5 +export AMDA_IHM="$SCRIPTDIR/.."
  6 +
  7 +GIT_REPOSITORY="https://github.com/cdppirap/amdapy.git"
  8 +
  9 +BUILD_DIR="$AMDA_IHM/scripts/amdapy_doc_build"
  10 +PYTHON_VENV="$BUILD_DIR/amdapy_venv"
  11 +AMDAPY_PATH="$BUILD_DIR/amdapy"
  12 +
  13 +DST_DIR="$AMDA_IHM/help"
  14 +
  15 +HOSTNAME=`hostname`
  16 +if [ "$HOSTNAME" = "cdpp3" ]
  17 +then
  18 + GIT_BRANCH="master"
  19 +else
  20 + GIT_BRANCH="dev"
  21 +fi
  22 +
  23 +mkdir -p "$BUILD_DIR"
  24 +
  25 +if [ -d "$PYTHON_VENV" ]
  26 +then
  27 + # Activate virtual env.
  28 + source "$PYTHON_VENV/bin/activate"
  29 +else
  30 + # Build & activate virtual env.
  31 + python3.6 -m venv "$PYTHON_VENV"
  32 + source "$PYTHON_VENV/bin/activate"
  33 + pip install --upgrade pip
  34 + pip install pandas numpy lxml matplotlib build sphinx nbsphinx ipython
  35 +fi
  36 +
  37 +if [ -d "$AMDAPY_PATH" ]
  38 +then
  39 + # Pull repository
  40 + cd $AMDAPY_PATH
  41 + git checkout $GIT_BRANCH
  42 + git pull -c http.sslVerify=0
  43 +else
  44 + # Clone repository
  45 + cd $BUILD_DIR
  46 + git clone -c http.sslVerify=0 $GIT_REPOSITORY
  47 + cd $AMDAPY_PATH
  48 + git checkout $GIT_BRANCH
  49 +fi
  50 +
  51 +# Package generation
  52 +cd $AMDAPY_PATH
  53 +python -m build
  54 +
  55 +# Docs generation
  56 +cd $AMDAPY_PATH/amdapy/docs
  57 +make clean
  58 +make html
  59 +
  60 +if [ ! -z "$DST_DIR" ]
  61 +then
  62 + # Export docs only if DST_DIR is not empty
  63 + if [ -d "$DST_DIR" ]
  64 + then
  65 + # Does not automatically create DST_DIR to prevent any improper handling
  66 + if [ -d "$DST_DIR/amdapy" ]
  67 + then
  68 + # Cleanup existing HTML dir
  69 + rm -Rf "$DST_DIR/amdapy"
  70 + fi
  71 + cp -R "$AMDAPY_PATH/amdapy/docs/_build/html" "$DST_DIR/amdapy"
  72 + else
  73 + echo "[WARNING] Destination directory not exists ($DST_DIR). Cannot export documentation\n"
  74 + fi
  75 +fi
  76 +
  77 +# Deactivate virtual env.
  78 +deactivate
... ...