Commit 9b6c0f571f20cd9f940e3a36c3dc5cafd2b58789

Authored by Benjamin Renard
2 parents 0d963218 2719c3a2

Merge branch 'amdadev'

js/app/controllers/PlotModule.js
... ... @@ -216,7 +216,6 @@ Ext.define('amdaDesktop.PlotModule', {
216 216 });
217 217 }
218 218 },
219   -
220 219 editPlot : function(plotNode) {
221 220 var me = this;
222 221 var desktop = this.app.getDesktop();
... ...
js/app/models/CatalogNode.js
... ... @@ -36,6 +36,10 @@ Ext.define('amdaModel.CatalogNode', {
36 36 text : 'Download '+ this.self.objectName,
37 37 hidden : true
38 38 },{
  39 + fnId : 'leaf-plot',
  40 + text : 'Plot '+ this.self.objectName,
  41 + hidden : true
  42 + },{
39 43 fnId : 'leaf-visu',
40 44 text : 'Visualize '+ this.self.objectName,
41 45 hidden : true
... ... @@ -43,6 +47,10 @@ Ext.define('amdaModel.CatalogNode', {
43 47 fnId : 'leaf-generateTT',
44 48 text : 'Generate Time Table ',
45 49 hidden : true
  50 + },{
  51 + fnId : 'leaf-generateTT',
  52 + text : 'Generate Time Table ',
  53 + hidden : true
46 54 }
47 55 ];
48 56  
... ... @@ -57,6 +65,9 @@ Ext.define('amdaModel.CatalogNode', {
57 65 },{
58 66 fnId : 'mult-downloadMulti',
59 67 text : 'Download selected '+this.self.objectName+'s'
  68 + },{
  69 + fnId : 'mult-plotMulti',
  70 + text : 'Plot selected '+this.self.objectName+'s'
60 71 }];
61 72  
62 73 return menuItems;
... ... @@ -114,25 +125,5 @@ Ext.define('amdaModel.CatalogNode', {
114 125 module.setLinkedNode(me);
115 126 module.createWindow();*/
116 127 //});
117   - },
118   - generateTT: function(node){
119   - var catObj = Ext.create('amdaModel.TimeTable');
120   - var timeTabNode = Ext.create('amdaModel.TimeTableNode',{leaf : true});
121   - catObj.set('relatedCatalogId', node.get('id'));
122   - desc = 'Generated by CDPP/Amda Catalog Module \n';
123   - if (node.get('description'))
124   - desc = desc + node.get('description');
125   - catObj.set('description', desc);
126   - timeTabNode.set('object',catObj);
127   - var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
128   - var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true);
129   - amdaModel.InteractiveNode.preloadNodes(ttRootNode.getRootNode(),
130   - function()
131   - {
132   - // edit newNode into Parameter Module with node as contextNode
133   - timeTabNode.editInModule();
134   - });
135   -
136   -
137   - }
  128 + }
138 129 });
... ...
js/app/models/InteractiveNode.js
... ... @@ -456,6 +456,15 @@ Ext.define('amdaModel.InteractiveNode', {
456 456 case 'downParam':
457 457 this.createDownload(this);
458 458 break;
  459 + case 'generateCatalog':
  460 + this.generateCatalog(this);
  461 + break;
  462 + case 'generateTT':
  463 + this.generateTT(this);
  464 + break;
  465 + case 'plotTT':
  466 + this.createPlot(this);
  467 + break;
459 468 default:
460 469 break;
461 470 } // switch end
... ... @@ -761,5 +770,52 @@ Ext.define('amdaModel.InteractiveNode', {
761 770 myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"
762 771 + this.get('name') + "' found!");
763 772 }
764   - }
  773 + },
  774 +
  775 + generateCatalog: function(node){
  776 + id = node.get('id');
  777 + name = node.get('text');
  778 + Ext.Msg.prompt('Create catalog', 'Enter the number of columns:', function (btn, text) {
  779 + if (btn == 'ok') {
  780 + var catObj = Ext.create('amdaModel.Catalog');
  781 + var catNode = Ext.create('amdaModel.CatalogNode', {leaf: true});
  782 + catObj.set('relatedTimeTableId', id);
  783 + //creatDate = new Date(this.object.get('created'));
  784 + //date = Ext.Date.format(creatDate, 'Y-m-d\\TH:i:s');
  785 + descr = 'Generated by CDPP/Amda Time Table Module \n' + 'From Time Table: ' + name;
  786 + catObj.set('description', descr );
  787 + var nbParam = parseInt(text);
  788 + if ((nbParam <= 0) || (nbParam > 100)) {
  789 + nbParam = 1;
  790 + }
  791 + catObj.set('nbParameters', nbParam);
  792 + catNode.set('object', catObj);
  793 + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
  794 + var catRootNode = explorerTree.getRootNode().findChild('id', 'catalog-treeRootNode', true);
  795 + amdaModel.InteractiveNode.preloadNodes(catRootNode.getRootNode(),
  796 + function ()
  797 + {
  798 + catNode.editInModule();
  799 + });
  800 + }
  801 + }, this);
  802 + },
  803 + generateTT: function(node){
  804 + var catObj = Ext.create('amdaModel.TimeTable');
  805 + var timeTabNode = Ext.create('amdaModel.TimeTableNode',{leaf : true});
  806 + catObj.set('relatedCatalogId', node.get('id'));
  807 + desc = 'Generated by CDPP/Amda Catalog Module \n';
  808 + if (node.get('description'))
  809 + desc = desc + node.get('description');
  810 + catObj.set('description', desc);
  811 + timeTabNode.set('object',catObj);
  812 + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
  813 + var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true);
  814 + amdaModel.InteractiveNode.preloadNodes(ttRootNode.getRootNode(),
  815 + function()
  816 + {
  817 + timeTabNode.editInModule();
  818 + });
  819 + },
  820 +
765 821 });
... ...
js/app/models/TimeTableNode.js
... ... @@ -38,9 +38,17 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
38 38 text : 'Download Time Table',
39 39 hidden : true
40 40 },{
  41 + fnId : 'leaf-plot',
  42 + text : 'Plot Time Table',
  43 + hidden : true
  44 + },{
41 45 fnId : 'leaf-operations',
42 46 text : 'Operations',
43 47 hidden : true
  48 + },{
  49 + fnId : 'leaf-generateCatalog',
  50 + text : 'Generate Catalog',
  51 + hidden : true
44 52 }];
45 53  
46 54 return menuItems;
... ... @@ -52,7 +60,10 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
52 60 {
53 61 fnId : 'mult-downloadMulti',
54 62 text : 'Download selected '+ this.self.objectName + 's'
55   - },{
  63 + }, {
  64 + fnId : 'mult-plotMulti',
  65 + text : 'Plot selected '+ this.self.objectName + 's'
  66 + }, {
56 67 fnId : 'mult-operationsMulti',
57 68 text : 'Operations'
58 69 }];
... ... @@ -91,11 +102,18 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
91 102 case 'download':
92 103 this.ttDownload();
93 104 break;
94   -
  105 +
  106 + case 'plot':
  107 + this.createPlot(this);
  108 + break;
95 109 case 'operations':
96 110 this.ttOperations();
97 111 break;
98 112  
  113 + case 'generateCatalog':
  114 + this.generateCatalog(this);
  115 + break;
  116 +
99 117 // case 'deleteMulti':
100 118 // this.deleteMulti();
101 119 // break;
... ... @@ -103,6 +121,10 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
103 121 case 'downloadMulti':
104 122 this.downloadMulti();
105 123 break;
  124 +
  125 + case 'plotMulti':
  126 + this.plotMulti();
  127 + break;
106 128  
107 129 case 'operationsMulti':
108 130 this.operationsMulti();
... ... @@ -111,10 +133,6 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
111 133 case 'visu':
112 134 this.visu();
113 135 break;
114   -
115   - case 'generateTT':
116   - this.generateTT(this);
117   - break;
118 136  
119 137 default:
120 138 break;
... ... @@ -129,8 +147,7 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
129 147 var uidownload = module.getUiContent();
130 148 uidownload.addTTdownload(me.get('text'), me.get('id'));
131 149 });
132   - },
133   -
  150 + },
134 151 ttOperations : function() {
135 152 var me = this;
136 153 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt_op.id, true, function (module) {
... ... @@ -158,5 +175,5 @@ Ext.define(&#39;amdaModel.TimeTableNode&#39;, {
158 175 Ext.Array.each(selection,function(item,index,allItems){
159 176 item.ttOperations();
160 177 })
161   - }
  178 + }
162 179 });
... ...
js/app/models/sharedCatalogNode.js
... ... @@ -32,7 +32,17 @@ Ext.define(&#39;amdaModel.sharedCatalogNode&#39;, {
32 32 fnId : 'leaf-editLeaf',
33 33 text : 'Edit Catalog',
34 34 hidden : true
35   - }];
  35 + },{
  36 + fnId : 'leaf-plotTT',
  37 + text : 'Plot Catalog',
  38 + hidden : true
  39 + },{
  40 + fnId : 'leaf-generateTT',
  41 + text : 'Generate Time Table ',
  42 + hidden : true
  43 + }
  44 +
  45 + ];
36 46  
37 47 return menuItems;
38 48 },
... ... @@ -40,5 +50,6 @@ Ext.define(&#39;amdaModel.sharedCatalogNode&#39;, {
40 50 getAllContextMenuItems: function(){
41 51  
42 52 return this.localMenuItems();
43   - }
  53 + }
  54 +
44 55 });
... ...
js/app/models/sharedTimeTableNode.js
... ... @@ -31,6 +31,14 @@ Ext.define(&#39;amdaModel.sharedTimeTableNode&#39;, {
31 31 fnId : 'leaf-editLeaf',
32 32 text : 'Edit Time Table',
33 33 hidden : true
  34 + },{
  35 + fnId : 'leaf-plotTT',
  36 + text : 'Plot Time Table',
  37 + hidden : true
  38 + },{
  39 + fnId : 'leaf-generateCatalog',
  40 + text : 'Generate Catalog',
  41 + hidden : true
34 42 }];
35 43  
36 44 return menuItems;
... ...
js/app/views/CatalogUI.js
... ... @@ -665,6 +665,9 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
665 665 AmdaAction.initObjectCache(this.isCatalog, this.object.get('nbParameters'), this.onAfterInit, this);
666 666 } else if (this.object.get('relatedTimeTableId') != '') {
667 667 // Generate Catalog from Time Table
  668 + var pathern = this.object.get('relatedTimeTableId').split('_')[0];
  669 + if (pathern == 'sharedtimeTable')
  670 + typeTT='sharedtimeTable';
668 671 AmdaAction.initObjectCacheFromTimeTable(this.object.get('relatedTimeTableId'), typeTT, this.object.get('nbParameters'), this.onAfterInit, this);
669 672 } else {
670 673 //From existing TT file
... ... @@ -1095,7 +1098,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
1095 1098 xtype: 'toolbar',
1096 1099 dock: 'bottom',
1097 1100 ui: 'footer',
1098   - height: 140,
  1101 + height: 120,
1099 1102  
1100 1103 items: [
1101 1104 {
... ...
js/app/views/PlotComponents/PlotTabContent.js
... ... @@ -41,6 +41,9 @@ Ext.define(&#39;amdaPlotComp.PlotTabContent&#39;, {
41 41 this.timeSelector.intervalSel.setInterval(startDate, stopDate);
42 42  
43 43 },
  44 + getTimeSelector: function(){
  45 + return this.timeSelector;
  46 + },
44 47  
45 48 updateTimeObject : function() {
46 49 var timeSource = this.timeSelector.getActiveTimeSource();
... ...
js/app/views/PlotUI.js
... ... @@ -121,9 +121,17 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
121 121 },
122 122  
123 123 addTT : function(newTTName,newTTid,timeSelectorId) {
124   - var crtTimeSelector = Ext.getCmp(timeSelectorId);
125   - if (crtTimeSelector)
126   - crtTimeSelector.addTT(newTTName,newTTid);
  124 + if(timeSelectorId){
  125 + var crtTimeSelector = Ext.getCmp(timeSelectorId);
  126 + if (crtTimeSelector)
  127 + crtTimeSelector.addTT(newTTName,newTTid);
  128 + }else{
  129 + var plotTab = this.plotTabs.getCurrentPlotTabContent();
  130 + if (plotTab)
  131 + var crtTimeSelector = plotTab.getTimeSelector();
  132 + if (crtTimeSelector)
  133 + crtTimeSelector.addTT(newTTName,newTTid);
  134 + }
127 135 },
128 136  
129 137 /**
... ...
php/WebServices/WebServer.php
... ... @@ -616,43 +616,91 @@ class WebServer
616 616  
617 617 return array('success' => true, 'status' => $res['status'], $resultTag => WSConfigClass::getUrl().$res['result']);
618 618 }
619   -
  619 +
620 620 /*
621 621 * TODO Can be done by TTCONVERT function of AMDA_Kernel - more hard !!!
622 622 * TODO Think about this if merge/union will be also done by AMDA_Kernel
623 623 *
624 624 * get Time Table : shared for anonymous user (impex) ; user' for user
625 625 */
626   - public function getTimeTable($data)
  626 + public function getTimeTable($data)
  627 + {
  628 + $res = $this->init($data);
  629 +
  630 + if (!$res['success']){
  631 + $this->throwError("requestError", "Cannot parse request");
  632 + }
  633 +
  634 + $ttID = $res['vars']['ttID'];
  635 + $format = !empty($res['vars']['outputFormat']) ? $res['vars']['outputFormat'] : 'VOTable';
  636 +
  637 + return $this->getTimeTableCatalog('timeTable', $ttID, $format);
  638 + }
  639 +
  640 +/*
  641 +* TODO Can be done by TTCONVERT function of AMDA_Kernel - more hard !!!
  642 +* TODO Think about this if merge/union will be also done by AMDA_Kernel
  643 +*
  644 +* get Time Table : shared for anonymous user (impex) ; user' for user
  645 +*/
  646 + public function getCatalog($data)
627 647 {
628 648 $res = $this->init($data);
629   -
  649 +
630 650 if (!$res['success']){
631   - $this->throwError("requestError", "Cannot parse request");
  651 + $this->throwError("requestError", "Cannot parse request");
632 652 }
633   -
  653 +
  654 + $catID = $res['vars']['catID'];
  655 + $format = !empty($res['vars']['outputFormat']) ? $res['vars']['outputFormat'] : 'VOTable';
  656 +
  657 + return $this->getTimeTableCatalog('catalog', $catID, $format);
  658 + }
  659 +
  660 +/*
  661 +* TODO Can be done by TTCONVERT function of AMDA_Kernel - more hard !!!
  662 +* TODO Think about this if merge/union will be also done by AMDA_Kernel
  663 +*
  664 +* get Time Table : shared for anonymous user (impex) ; user' for user
  665 +*/
  666 + private function getTimeTableCatalog($type, $id, $format)
  667 + {
634 668 $this->initUserMgr();
635 669  
636   - $ttID = $res['vars']['ttID'];
637   -
638 670 if ($this->userID == WSConfigClass::getAnonymousUserName()) {
639 671 $sharedObjMgr = new SharedObjectsMgr();
640   - $ttSrc = $sharedObjMgr->getDataFilePath('timeTable', $ttID);
  672 + $objSrc = $sharedObjMgr->getDataFilePath($type, $id);
641 673 }
642 674 else
643   - $ttSrc = USERTTDIR.$ttID.'.xml';
  675 + $objSrc = USERTTDIR.$id.'.xml';
644 676  
645   - if (!file_exists($ttSrc)) {
646   - $this->throwError("workspaceError", "No such table ".$ttID." for user ".$this->userID);
  677 + if (!file_exists($objSrc)) {
  678 + $this->throwError("workspaceError", "No such object ".$id." for user ".$this->userID);
647 679 }
648 680  
649   - $ttDst = substr(strtolower(__FUNCTION__), 3)."_".$this->userID."_".$this->requestTime."_$ttID.xml";
  681 + $prefix = ($type == 'catalog') ? 'catalog' : 'timetable';
  682 +
  683 + $extension = (strtolower($format) == 'votable') ? "xml" : "txt";
  684 +
  685 + $objDst = $prefix."_".$this->userID."_".$this->requestTime."_$id.$extension";
  686 +
  687 + if (!isset($this->requestManager))
  688 + $this->requestManager = new RequestManagerClass();
  689 +
  690 + try {
  691 + $obj = array(
  692 + 'inputFile' => $objSrc,
  693 + 'outputFormat' => $format,
  694 + 'outputFileName' => $objDst,
  695 + );
  696 + $res = $this->requestManager->runWSRequest($this->userID, $this->IPclient, FunctionTypeEnumClass::TTCONVERT, $this->service, $obj);
  697 + } catch (Exception $e) {
  698 + return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage());
  699 + }
650 700  
651   - //TODO can be done by
652   - // $res = $this->requestManager->runWSRequest($this->userID, $this->IPclient,FunctionTypeEnumClass::TTCONVERT, null, $ttID);
653   - $this->xsl2vot($ttSrc,$ttDst);
  701 + $resKey = ($type == 'catalog') ? 'catFileURL' : 'ttFileURL';
654 702  
655   - return array('success' => true, 'ttFileURL' => WSConfigClass::getUrl().$ttDst);
  703 + return array('success' => true, $resKey => WSConfigClass::getUrl().$objDst);
656 704 }
657 705  
658 706 /*
... ...
php/classes/AmdaAction.php
... ... @@ -197,7 +197,16 @@ class AmdaAction
197 197 }
198 198 break;
199 199 case 'derivedParam':
200   - $info = $child->getAttribute('buildchain');
  200 + $info = $child->getAttribute('buildchain').'<br/>';
  201 +
  202 + if($child->hasAttribute('units') && $child->getAttribute('units') != 'undefined' && $child->getAttribute('units') != '')
  203 + $info .= 'Units: '.$child->getAttribute('units').'<br/>';
  204 + $samplingMode = $child->getAttribute('sampling_mode');
  205 + if($samplingMode == 'timestep'){
  206 + $info .= 'Sampling Time: '.$child->getAttribute('timestep');
  207 + }else if($samplingMode == 'refparam'){
  208 + $info .= 'Reference Parameter: '.$child->getAttribute('reference_param');
  209 + }
201 210  
202 211 if ($child->hasAttribute('dim_1')) {
203 212 $dim_1 = $child->getAttribute('dim_1');
... ... @@ -1127,7 +1136,7 @@ class AmdaAction
1127 1136 {
1128 1137 $cacheMgr = new CatalogCacheMgr();
1129 1138  
1130   - return $cacheMgr->initFromTimeTable($id, $nparams);
  1139 + return $cacheMgr->initFromTimeTable($id, $nparams, $type);
1131 1140 }
1132 1141  
1133 1142 public function initObjectCacheFromTmpObject($folderId, $name, $isCatalog = false)
... ...
php/classes/CatalogCacheMgr.php
... ... @@ -70,12 +70,12 @@ class CatalogCacheMgr extends TimeTableCacheMgr
70 70 return $result+ array('parameters' => $info['parameters']);
71 71 }
72 72  
73   - public function initFromTimeTable($id, $nbParams)
  73 + public function initFromTimeTable($id, $nbParams, $type)
74 74 {
75 75  
76 76 $params = $this->resetCache(array('nparams' => $nbParams));
77 77 $ttMgr= new TimeTableMgr();
78   - $intervals_res = $ttMgr->loadIntervalsFromObject($id);
  78 + $intervals_res = $ttMgr->loadIntervalsFromObject($id, $type);
79 79  
80 80 if (!$intervals_res['success'])
81 81 return $intervals_res;
... ...
php/classes/DerivedParamMgr.php
... ... @@ -19,9 +19,9 @@ class DerivedParamMgr extends AmdaObjectMgr
19 19 $this->contentRootId = 'derivedParam-treeRootNode';
20 20 $this->contentRootTag = 'paramList';
21 21 //node attributes and object XML tags
22   - $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '', 'dim_1' => '1', 'dim_2' => '1');
  22 + $this->attributes = array('name' => '', 'buildchain' => '', 'timestep' => '', 'dim_1' => '1', 'dim_2' => '1', 'units'=>'undefined', 'sampling_mode'=>'', 'reference_param'=>'');
23 23 // + tags in object XML
24   - $this->optionalAttributes = array('units' => 'undefined','description' => 'undefined', 'ytitle' => 'undefined');
  24 + $this->optionalAttributes = array('description' => 'undefined', 'ytitle' => 'undefined');
25 25 $this->objTagName = 'param';
26 26 $this->id_prefix = 'ws_';
27 27 }
... ... @@ -143,8 +143,16 @@ class DerivedParamMgr extends AmdaObjectMgr
143 143 // switch between myData and Derived
144 144 $this->createObjectDescription($p);
145 145 $this->addToContent($p, $folder);
  146 + $info = $p->buildchain.'<br/>';
  147 + if(isset($p->units) && $p->units != "undefined")
  148 + $info .= 'Units: '.$p->units.'<br/>';
  149 + if($p->sampling_mode == 'timestep'){
  150 + $info .= 'Sampling Time: '.$p->timestep;
  151 + }else if($p->sampling_mode == 'refparam'){
  152 + $info .= 'Reference Parameter: '.$p->reference_param;
  153 + }
146 154  
147   - return array('id' => $this->id, 'info' => $p->buildchain, 'dim_1' => $p->dim_1, 'dim_2' => $p->dim_2, 'last_update' => $p->last_update);
  155 + return array('id' => $this->id, 'info' => $info, 'dim_1' => $p->dim_1, 'dim_2' => $p->dim_2, 'last_update' => $p->last_update);
148 156 }
149 157 // myData parameter
150 158 else
... ...
php/rest/getCatalog.php 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<?php
  2 +
  3 +/**
  4 + * @api {get} getCatalog.php getCatalog
  5 + * @apiDescription Provides the contents of a Time Table (TT).
  6 + * @apiName getCatalog
  7 + * @apiGroup webservices
  8 + *
  9 + * @apiParam {String} catID Identifier of the Catalog, as defined in the file returned by the « getCatalogsList » service.
  10 + * @apiParam {String} [userID] Identifier of the user in AMDA (*mandatory for user owned data*)
  11 + * @apiParam {String} [password] Password of the user in AMDA (*mandatory for user owned data*)
  12 + * @apiParam {String} [outputFormat] Format of the returned file (VOTable by default). Available options: `VOTable`, `ASCII` and `HPEvent`.
  13 + *
  14 + * @apiSuccess {String} success `true`
  15 + * @apiSuccess {String} catFileURL URL of the XML file containing the Catalog (VOTable format)
  16 + *
  17 + * @apiSuccessExample Success-Response:
  18 + * HTTP/1.1 200 OK
  19 + * [success] => 1
  20 + * [ttFileURL] => http://amda.irap.omp.eu/AMDA/data/WSRESULT/catalog_userID_20180919_cat_0.xml
  21 + *
  22 + * @apiErrorExample Error-Response:
  23 + * {"error":"No such table sharedcatalog_100 for user impex"}
  24 + */
  25 +
  26 +require_once '../config.php';
  27 +
  28 + $amda_ws = new WebServer();
  29 +
  30 + $result = $amda_ws->getCatalog($_GET);
  31 +
  32 + if ($result['success']){
  33 + echo $result['catFileURL'];
  34 + }
  35 + else {
  36 + echo $result['message'];
  37 + }
  38 +?>
  39 +
  40 +
... ...
php/rest/getCatalogsList.php 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<?php
  2 +
  3 +/**
  4 + * @api {get} getCatalogsList.php getCatalogsList
  5 + * @apiDescription Provides the private list of Catalogs owned by a user. When called without
  6 + * userID, this web-service returns the list of shared Catalogs.
  7 + *
  8 + * @apiName getCatalogsList
  9 + * @apiGroup webservices
  10 + *
  11 + * @apiParam {String} [userID] Identifier of the user in AMDA.
  12 + * @apiParam {String} [password] Password of the user in AMDA.
  13 + *
  14 + * @apiSuccess {String} success `true`
  15 + * @apiSuccess {String} CatalogsList URL of the XML file, which contains the list of Catalogs.
  16 + *
  17 + * @apiSuccessExample Success-Response:
  18 + * HTTP/1.1 200 OK
  19 + * [success] => 1
  20 + * [CatalogsList] => http://amda.irap.omp.eu/data/WSRESULT/catalogs_impex_20180905.xml
  21 + *
  22 + * @apiErrorExample Error-Response:
  23 + * {"error": "Workspace Error : Cannot load Catalogs list for userID"}
  24 + */
  25 +
  26 + require_once '../config.php';
  27 +
  28 + $amda_ws = new WebServer();
  29 +
  30 + $result = $amda_ws->getCatalogsList($_GET);
  31 +
  32 + if ($result['success'])
  33 + {
  34 + echo $result['CatalogsList'];
  35 + }
  36 + else
  37 + {
  38 + echo $result['message'];
  39 + }
  40 +?>
... ...
php/rest/getTimeTable.php
... ... @@ -9,6 +9,7 @@
9 9 * @apiParam {String} ttID Identifier of the Time Table, as defined in the file returned by the « getTimeTableList » service.
10 10 * @apiParam {String} [userID] Identifier of the user in AMDA (*mandatory for user owned data*)
11 11 * @apiParam {String} [password] Password of the user in AMDA (*mandatory for user owned data*)
  12 + * @apiParam {String} [outputFormat] Format of the returned file (VOTable by default). Available options: `VOTable`, `ASCII` and `HPEvent`.
12 13 *
13 14 * @apiSuccess {String} success `true`
14 15 * @apiSuccess {String} ttFileURL URL of the XML file containing the Time Table (VOTable format)
... ...
php/src/ncinfo_remote.c
... ... @@ -50,16 +50,17 @@ main(int argc, char **argv)
50 50 printf("Incorrect number of arguments\n");
51 51 exit(1);
52 52 }
53   -
  53 +
54 54 infoId = atoi(argv[3]);
55 55  
56   - stat = nc_open(argv[1],NC_WRITE|NC_SHARE,&ncID); check(stat);
  56 + stat = nc_open(argv[1],0,&ncID); check(stat);
57 57  
58 58 stat = nc_inq_varid(ncID, argv[2], &varID); check(stat);
  59 +
59 60 stat = nc_inq_varndims(ncID, varID, &ndims); check(stat);
60   -
  61 +
61 62 stat = nc_inq_vardimid(ncID, varID, dimids); check(stat);
62   -
  63 +
63 64 size_t len = 0;
64 65 // size
65 66 if (ndims > 1)
... ... @@ -85,7 +86,8 @@ main(int argc, char **argv)
85 86 fprintf(stdout, "-1");
86 87 exit(0);
87 88 }
88   - unsigned char *string_attr = (unsigned char *)malloc(attlen * sizeof(char*));
  89 + unsigned char *string_attr = (unsigned char *)malloc(attlen * sizeof(char*));
  90 + memset(string_attr, 0, attlen * sizeof(char*));
89 91 stat = nc_get_att(ncID, varID, "LABL_PTR_1", string_attr);
90 92 if (stat != NC_NOERR) {
91 93 fprintf(stdout, "-1");
... ... @@ -116,6 +118,7 @@ main(int argc, char **argv)
116 118 unsigned char *string_var = (unsigned char *)malloc(length * sizeof(char*));
117 119 for (i = 0; i < size; i++)
118 120 {
  121 + memset(string_var, 0, length * sizeof(char*));
119 122 stat = nc_get_vara(ncID, labelID, start, count, string_var); check(stat);
120 123 fprintf(stdout, "%s", string_var);
121 124 if (i < size -1) fprintf(stdout,",");
... ... @@ -131,6 +134,7 @@ main(int argc, char **argv)
131 134 stat = nc_inq_attlen(ncID, varID, info[infoId-2], &attlen); check(stat);
132 135  
133 136 unsigned char *string_attr = (unsigned char *)malloc(attlen * sizeof(char*));
  137 + memset(string_attr, 0, attlen * sizeof(char*));
134 138 stat = nc_get_att(ncID, varID, info[infoId-2], string_attr); check(stat);
135 139 fprintf(stdout, "%s", string_attr);
136 140 free(string_attr);
... ... @@ -169,6 +173,7 @@ main(int argc, char **argv)
169 173 }
170 174 else {
171 175 unsigned char *string_attr = (unsigned char *)malloc(attlen * sizeof(char*));
  176 + memset(string_attr, 0, attlen * sizeof(char*));
172 177 stat = nc_get_att(ncID, varID, info[infoId-1], string_attr);
173 178 if (strcasecmp(string_attr,"spectrogram") != 0)
174 179 fprintf(stdout, "0");
... ...