Blame view

js/app/controllers/CatalogModule.js 3.04 KB
f792a3de   elena   catalog ihm
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * 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: [
169f14d2   Benjamin Renard   Add shared object...
14
15
         'amdaUI.CatalogUI',
         'amdaUI.ShareObjectUI'
f792a3de   elena   catalog ihm
16
17
18
     ],
     
      contentId : 'catalogUI',
f9c8b272   elena   edit catalog
19
      isOperationOnShow : true,
f792a3de   elena   catalog ihm
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
      
    /**
     * @cfg {String} data models
     * @required
     */
	nodeDataModel : 'amdaModel.CatalogNode',
	
    /**
     * @cfg {String} window definitions
     * @required
     */
	width : 800,
	height: 700,
	uiType : 'panelCatalog',
	helpTitle : 'Help on Catalog Module',
f9c8b272   elena   edit catalog
35
	helpFile : 'catalogHelp',
f13f0bd4   Elena.Budnik   New Catalog creation
36
		
169f14d2   Benjamin Renard   Add shared object...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	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);
        
09eefb2d   Benjamin Renard   Shared TT and Cat...
82
83
84
85
86
87
88
        AmdaAction.getObject(catObj.id, 'catalog', function(result,remoteEvent) {
        	if (result) {
        		if (result.description)
        			sharePanel.setDescription(result.description);
        	} 
    	}, this.getObjectCallback, this);
        
169f14d2   Benjamin Renard   Add shared object...
89
90
91
        win.show();
	}

f792a3de   elena   catalog ihm
92
});