diff --git a/js/app/views/CatalogUI.js b/js/app/views/CatalogUI.js index ce7eece..ed31863 100644 --- a/js/app/views/CatalogUI.js +++ b/js/app/views/CatalogUI.js @@ -530,10 +530,12 @@ Ext.define('amdaUI.CatalogUI', { var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id).linkedNode.data.nodeType; if (this.object.get('id') == '' && this.object.get('relatedTimeTableId') == '') { + // creating new catalog AmdaAction.initObjectCache(this.isCatalog, this.object.get('nbParameters'), this.onAfterInit,this); } else if(this.object.get('relatedTimeTableId') != ''){ - AmdaAction.initObjectCacheFromTimeTable(this.object.get('relatedTimeTableId'), this.object.get('nbParameters')); + // Generate Catalog from Time Table + AmdaAction.initObjectCacheFromTimeTable(this.object.get('relatedTimeTableId'), typeTT, this.object.get('nbParameters'),this.onAfterInit, this); } else { //From existing TT file diff --git a/js/app/views/TimeTableUI.js b/js/app/views/TimeTableUI.js index a4bafd5..ce7f53f 100755 --- a/js/app/views/TimeTableUI.js +++ b/js/app/views/TimeTableUI.js @@ -291,7 +291,7 @@ Ext.define('amdaUI.TimeTableUI', { if (btn == 'ok'){ var catObj=Ext.create('amdaModel.Catalog'); var catNode=Ext.create('amdaModel.CatalogNode',{leaf : true}); - catObj.set('relatedTimeTable', id); + catObj.set('relatedTimeTableId', id); creatDate=new Date(this.object.get('created')); date=Ext.Date.format(creatDate,'Y-m-d\\TH:i:s'); descr='Generated by CDPP/Amda Time Table Module \n'+ 'From Time Table: '+this.object.get('name')+'\nOn: '+date+'\n'; diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index 622d25a..a4bc798 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -1125,6 +1125,13 @@ class AmdaAction return $cacheMgr->initFromCatalog($id, $type); } + public function initObjectCacheFromTimeTable($id, $type, $nparams) + { + $cacheMgr = new CatalogCacheMgr(); + + return $cacheMgr->initFromTimeTable($id, $nparams); + } + public function initForChart($id, $folderId, $name, $isTmpObject, $type) { diff --git a/php/classes/CatalogCacheMgr.php b/php/classes/CatalogCacheMgr.php index ad8e6b7..883f788 100644 --- a/php/classes/CatalogCacheMgr.php +++ b/php/classes/CatalogCacheMgr.php @@ -1,4 +1,4 @@ - $info['parameters']); } - + public function initFromTimeTable($id, $nbParams) { - $info = this ->resetCache(array('nparams' => $nbParams)); + + $params = $this->resetCache(array('nparams' => $nbParams)); $ttMgr= new TimeTableMgr(); $intervals_res = $ttMgr->loadIntervalsFromObject($id); + if (!$intervals_res['success']) return $intervals_res; @@ -86,10 +88,12 @@ class CatalogCacheMgr extends TimeTableCacheMgr $this->cache->updateIndexes(); //Save cache file - return array('success' => $this->saveToFile(), 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus()); + return array('success' => $this->saveToFile(), 'token' => $this->cache->getToken(), 'status' => $this->cache->getStatus(), 'parameters' => $this->cache->getParametersInfo()); + } + } ?> diff --git a/php/config.php b/php/config.php index f6c6508..c36f8ae 100644 --- a/php/config.php +++ b/php/config.php @@ -161,6 +161,7 @@ $API = array( 'initObjectCacheFromTmpObject'=>array('len'=>3), 'initObjectCacheFromUploadedFile'=>array('len'=>3), 'initObjectCacheFromCatalog'=>array('len'=>2), + 'initObjectCacheFromTimeTable'=>array('len'=>3), 'readCacheIntervals'=>array('len'=>1), 'readIntervalsForChart'=>array('len'=>1), 'addCacheInterval'=>array('len'=>1), -- libgit2 0.21.2