Blame view

js/app/controllers/CatalogModule.js 2.99 KB
f792a3de   elena   catalog ihm
1
2
3
4
5
/**
 * Project   AMDA-NG
 * Name      CatalogModule.js
 * @class    amdaDesktop.CatalogModule
 * @extends  amdaDesktop.InteractiveModule
b0720b91   Benjamin Renard   Finalize catalog ...
6
 * @brief    Catalog Module controller definition
f792a3de   elena   catalog ihm
7
8
9
10
11
 * @author   elena
 */

Ext.define('amdaDesktop.CatalogModule', {
	extend: 'amdaDesktop.InteractiveModule',
b0720b91   Benjamin Renard   Finalize catalog ...
12

f792a3de   elena   catalog ihm
13
	 requires: [
169f14d2   Benjamin Renard   Add shared object...
14
15
         'amdaUI.CatalogUI',
         'amdaUI.ShareObjectUI'
f792a3de   elena   catalog ihm
16
     ],
b0720b91   Benjamin Renard   Finalize catalog ...
17

f792a3de   elena   catalog ihm
18
      contentId : 'catalogUI',
f9c8b272   elena   edit catalog
19
      isOperationOnShow : true,
b0720b91   Benjamin Renard   Finalize catalog ...
20

f792a3de   elena   catalog ihm
21
22
23
24
25
    /**
     * @cfg {String} data models
     * @required
     */
	nodeDataModel : 'amdaModel.CatalogNode',
b0720b91   Benjamin Renard   Finalize catalog ...
26

f792a3de   elena   catalog ihm
27
28
29
30
31
32
33
34
    /**
     * @cfg {String} window definitions
     * @required
     */
	width : 800,
	height: 700,
	uiType : 'panelCatalog',
	helpTitle : 'Help on Catalog Module',
f9c8b272   elena   edit catalog
35
	helpFile : 'catalogHelp',
b0720b91   Benjamin Renard   Finalize catalog ...
36

169f14d2   Benjamin Renard   Add shared object...
37
	shareCatalog : function(catObj) {
b0720b91   Benjamin Renard   Finalize catalog ...
38
		var win = myDesktopApp.desktop.getWindow('sharecat-win');
169f14d2   Benjamin Renard   Add shared object...
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
        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();
b0720b91   Benjamin Renard   Finalize catalog ...
57
                        		 var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
169f14d2   Benjamin Renard   Add shared object...
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
                        		 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);
                            		 });
                        		 });
                        	 }
                         }
                ]
b0720b91   Benjamin Renard   Finalize catalog ...
75
            });
169f14d2   Benjamin Renard   Add shared object...
76
        }
b0720b91   Benjamin Renard   Finalize catalog ...
77

169f14d2   Benjamin Renard   Add shared object...
78
79
80
        var sharePanel = win.down('#shareCatUI');
        if (sharePanel)
        	sharePanel.setProperties('catalog', catObj);
b0720b91   Benjamin Renard   Finalize catalog ...
81

09eefb2d   Benjamin Renard   Shared TT and Cat...
82
83
84
85
        AmdaAction.getObject(catObj.id, 'catalog', function(result,remoteEvent) {
        	if (result) {
        		if (result.description)
        			sharePanel.setDescription(result.description);
b0720b91   Benjamin Renard   Finalize catalog ...
86
        	}
09eefb2d   Benjamin Renard   Shared TT and Cat...
87
    	}, this.getObjectCallback, this);
b0720b91   Benjamin Renard   Finalize catalog ...
88

169f14d2   Benjamin Renard   Add shared object...
89
90
91
        win.show();
	}

f792a3de   elena   catalog ihm
92
});