From 278185de86ed85255e9ae3ddeb5ce3b01cbf191e Mon Sep 17 00:00:00 2001
From: Benjamin Renard <benjamin.renard@akka.eu>
Date: Mon, 12 Aug 2019 15:33:42 +0200
Subject: [PATCH] Upload catalog from ASCII format (#6503)

---
 js/app/views/UploadPanelUI.js | 35 ++++++++++++-----------------------
 php/classes/AmdaAction.php    |  1 +
 php/classes/CatalogMgr.php    |  4 ++--
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/js/app/views/UploadPanelUI.js b/js/app/views/UploadPanelUI.js
index b5a87cf..8c30a9b 100644
--- a/js/app/views/UploadPanelUI.js
+++ b/js/app/views/UploadPanelUI.js
@@ -70,9 +70,14 @@ Ext.define('amdaUI.UploadPanelUI', {
 				}
 			}); 
 		} 
-		else {   
+		else { 
 			// EXCEPTION : parameter not found !
-			myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"+this.tmpNode.get('text')+"' found!");	     
+			if (result.error) {
+				myDesktopApp.errorMsg(result.error);
+			}
+			else {
+				myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"+this.tmpNode.get('text')+"' found!");	     
+			}
 		}
 		
 		loadMask.hide();
@@ -443,38 +448,22 @@ Ext.define('amdaUI.UploadPanelUI', {
 			this.nodeType = 'amdaModel.TimeTableNode';
 		    
 			this.store = Ext.create('Ext.data.Store', {
-				fields: ['value', 'name']/*,
-				proxy: {
-					type: 'ajax',
-					url : 'generic_data/remote_sites.json',
-					reader: {
-						type: 'json',
-						root: 'remote_sites'
-					}
-				},
-				autoLoad: true*/
+				fields: ['value', 'name']
 			});
 			
 			this.radioId =	'ttfrmt';
 		}
 		else {
 			this.formats = [
-				{ boxLabel: 'VOTable', name: 'catfrmt', inputValue: 'VOT', checked: true }];
+				{ boxLabel: 'ASCII&nbsp;<img amda_clicktip="ttTimeFormat" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', name: 'catfrmt',  inputValue: 'ASCII', checked: true},
+				{ boxLabel: 'VOTable', name: 'catfrmt', inputValue: 'VOT'}
+			];
 						
 			this.localUploadId = 'form-uploadcat';
 			this.remoteUploadId = 'form-uploadcaturl'; 
 			this.nodeType = 'amdaModel.CatalogNode';
 			this.store = Ext.create('Ext.data.Store', {
-				fields: ['value', 'name']/*,
-				proxy: {
-					type: 'ajax',
-					url : 'generic_data/remote_sites.json',
-					reader: {
-						type: 'json',
-						root: 'remote_sites'
-					}
-				},
-				autoLoad: true*/
+				fields: ['value', 'name']
 			}); 
 			
 			this.radioId = 'catfrmt';
diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php
index 95a22fd..c64bd1c 100644
--- a/php/classes/AmdaAction.php
+++ b/php/classes/AmdaAction.php
@@ -1423,6 +1423,7 @@ class AmdaAction
 	public function cleanUserWS()
 	{
 		$this->rrmdir(USERDIR.'DOWNLOAD.TEMP');
+		$this->rrmdir(USERDIR.'TEMP');
 		IHMConfigClass::setUserName($this->user);
 
 		// delete impex params and data
diff --git a/php/classes/CatalogMgr.php b/php/classes/CatalogMgr.php
index 4b4a36b..42fbe8b 100644
--- a/php/classes/CatalogMgr.php
+++ b/php/classes/CatalogMgr.php
@@ -223,14 +223,14 @@ class CatalogMgr extends TimeTableMgr
 
 			public function getUploadedObject($name, $format, $onlyDescription = false)
 			{
-				/*$result = parent::getUploadedObject($name, $format, $onlyDescription);
+				$result = parent::getUploadedObject($name, $format, $onlyDescription);
 				if (!isset($result['success']) || !$result['success']) {
 
 					return array('success' => FALSE, 'error' => 'Error to retrieve catalog info');
 				}
 
 
-					return $result + array('parameters' => $this->getCatalogParamDescription(array('folder' => $folderId, 'name' => $name));*/
+				return $result + array('parameters' => $this->getCatalogParamDescription(array('folder' => USERTEMPDIR, 'name' => $name)));
 			}
 
 			/**
--
libgit2 0.21.2