/** * Project  AMDA-NG * Name CatalogModule.js * @class amdaDesktop.CatalogModule * @extends amdaDesktop.InteractiveModule * @brief Catalog Module controller definition * @author elena */ Ext.define('amdaDesktop.CatalogModule', { extend: 'amdaDesktop.InteractiveModule', requires: [ 'amdaUI.CatalogUI', 'amdaUI.ShareObjectUI' ], contentId : 'catalogUI', isOperationOnShow : true, /** * @cfg {String} data models * @required */ nodeDataModel : 'amdaModel.CatalogNode', /** * @cfg {String} window definitions * @required */ width : 800, height: 700, uiType : 'panelCatalog', helpTitle : 'Help on Catalog Module', helpFile : 'catalogHelp', operationOnShow: function() { var obj = this.linkedNode.get('object'); if (obj && obj.get('id') == '' && !obj.get('fromPlugin')) { Ext.Msg.prompt('Define Parameters', 'Please enter parameters number:', function(btn, text){ if (btn == 'ok'){ AmdaAction.initTTCache(this.getUiContent().isCatalog, text, this.getUiContent().onAfterInit, this.getUiContent()); } }, this); } }, shareCatalog : function(catObj) { var win = myDesktopApp.desktop.getWindow('sharecat-win'); if(!win) { var me = this; var win = myDesktopApp.desktop.createWindow( { border: false, id : 'sharecat-win', title : 'Share Catalog', width : 400, height : 300, layout : 'fit', maximizable : false, items : [ { xtype : 'shareobject', id : 'shareCatUI', onAfterShareObject : function(folder_id, object_id) { win.close(); var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); var sharedCatRootNode = explorerTree.getRootNode().findChild('id','sharedcatalog-treeRootNode',true); amdaModel.InteractiveNode.preloadNodes(sharedCatRootNode, function() { sharedCatRootNode.expand(); var folderNode = explorerTree.getRootNode().findChild('id', folder_id, true); if (!folderNode) return; folderNode.removeAll(); folderNode.set('loaded',false); amdaModel.InteractiveNode.preloadNodes(folderNode, function() { folderNode.expand(); var objectNode = explorerTree.getRootNode().findChild('id',object_id,true); sharedCatRootNode.myGetOwnerTree().getSelectionModel().select(objectNode); }); }); } } ] }); } var sharePanel = win.down('#shareCatUI'); if (sharePanel) sharePanel.setProperties('catalog', catObj); AmdaAction.getObject(catObj.id, 'catalog', function(result,remoteEvent) { if (result) { if (result.description) sharePanel.setDescription(result.description); } }, this.getObjectCallback, this); win.show(); } });