From d3f8a6d06df4553d544810a9d0b0d036bd64a0a3 Mon Sep 17 00:00:00 2001 From: Elena.Budnik <ebudnik@irap.omp.eu> Date: Mon, 20 Nov 2017 16:44:26 +0100 Subject: [PATCH] internal paramID --- js/app/views/ParamsMgrUI.js | 10 ++++++---- php/RemoteDataCenter/RemoteParamManager.php | 10 +++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/js/app/views/ParamsMgrUI.js b/js/app/views/ParamsMgrUI.js index 2c93ce2..9897cdc 100644 --- a/js/app/views/ParamsMgrUI.js +++ b/js/app/views/ParamsMgrUI.js @@ -155,7 +155,9 @@ Ext.define('amdaUI.ParamsMgrUI',{ var srcNode = record; var id = srcNode.get('id'); // Check if node exists already at destination - if (root.findChild('id',id, true)) { + var idToCheck = id.toLowerCase().replace(":", "_", "gi"); + // TODO check at sever side + if (root.findChild('id',idToCheck, true)) { myDesktopApp.infoMsg('This parameter exists already in your treee'); return; } @@ -184,8 +186,8 @@ Ext.define('amdaUI.ParamsMgrUI',{ } }); - // Add new node to correct location - parentNode.expand(!this.isDataSet, function(res){ + // Add new node to correct location + parentNode.expand(!this.isDataSet, function(res){ var newNode = srcNode.copy(); parentNode.appendChild(newNode); //to sync treeStore @@ -193,7 +195,7 @@ Ext.define('amdaUI.ParamsMgrUI',{ //expand the whole subtree of added node tree.selectPath(newNode.getPath( 'id', '|'), 'id', '|'); }); - return true; + return true; }, onViewRender : function(view){ diff --git a/php/RemoteDataCenter/RemoteParamManager.php b/php/RemoteDataCenter/RemoteParamManager.php index 48cf076..bb52676 100644 --- a/php/RemoteDataCenter/RemoteParamManager.php +++ b/php/RemoteDataCenter/RemoteParamManager.php @@ -77,7 +77,7 @@ class RemoteParamManager if (!$this->center->ViId) return false; if (!$this->center->ParamId) return false; - $this->paramId = strtolower($this->center->baseID."_".$this->center->ViId."_".$this->center->ParamId); + // $this->paramId = strtolower($this->center->baseID."_".$this->center->ViId."_".$this->center->ParamId); $xmlNameRemote = RemoteData."/PARAMS/".$this->paramId.".xml"; $xmlNameTemp = PARAMS_LOCALDB_DIR."/".$this->paramId.".xml"; @@ -126,7 +126,9 @@ class RemoteParamManager protected function addNode($id) { // Node exists already - if ($this->xmlDom->getElementById($id)) return true; + $this->paramId = strtr(strtolower($id),":","_"); + + if ($this->xmlDom->getElementById($this->paramId)) return true; // Node to be added $nodeRemote = $this->center->baseDom->getElementById($id); @@ -224,7 +226,8 @@ class RemoteParamManager if ($id == 'root') return array('res' => 'ok'); - $this->setBaseId($id); + $this->setBaseId($id); + $res = $this->addNode($id); if ($res === false) return array("err" => "Cannot add node : $id"); @@ -238,6 +241,7 @@ class RemoteParamManager if ($id == 'root') continue; if (!$this->baseId) $this->setBaseId($id); + $res = $this->addNode($id); if ($res === false) return array("err" => "Cannot add node : $id"); -- libgit2 0.21.2