Blame view

js/app/controllers/HelpModule.js 4.71 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/** 
 * Project  : AMDA-NG4
 * Name     : HelpModule.js
 * @class   amdaDesktop.HelpModule 
 * @extends amdaDesktop.AmdaModule
 * @version $Id: HelpModule.js 1935 2013-11-27 14:01:31Z elena $     
 */


Ext.define('amdaDesktop.HelpModule', {
		
	extend: 'amdaDesktop.AmdaModule',

        uses: [
         'Ext.ux.desktop.Video'
        ],
	 
	createWindow : function(file,title){
            
            var me = this;
	    var desktop = myDesktopApp.getDesktop();
	    var win = desktop.getWindow(this.id);
	 
	    if (!win) {	  
                var contentPanel = {
                        id: 'content-panel',
                        region: 'center', // this is what makes this panel into a region within the containing layout   
                        border: true,
                        autoScroll: true,
                        bodyCls : 'infoWindow',
                        bodyStyle: 'padding:15px 15px 15px 15px;',            
                        loader : {
                                         url : helpDir + 'ABC',
                                         loadMask : false,
                                         autoLoad : true // important                     
                                 }                     
                     };
                 
                var videoPanel = {
                        xtype : 'video',
                        id: 'video-player',
                        minHeight: 480,
                        region: 'center', // this is what makes this panel into a region within the containing layout   
                        border: true,
                        layout: 'fit',
                                                  
                        src: [                           
                            // browser will pick the format it likes most:
                      //      { src: helpDir + 'movies/test.webm',  type: 'video/webm' },
                      //      { src: helpDir + 'moviestest.mp4',  type: 'video/mp4' },
                            { src:  helpDir + 'movies/AMDA-NG.ogv', type: 'video/ogg' }//,
                       //     { src: helpDir + 'movies/test.mov', type: 'video/quicktime' }                     
                        ],
                     
                        autobuffer: true,
                        autoplay: true,
                        controls: true                                           
                           
                    };
   
                var store = Ext.create('Ext.data.TreeStore', {
                    root: {
                        expanded: true
                    },
                    proxy: {
                        type: 'ajax',
                        url: 'help/content.json'
                    }
                });
    
                // Go ahead and create the TreePanel now so that we can use it below
                var treePanel = Ext.create('Ext.tree.Panel', {
                    id: 'tree-panel',
                    title: 'Inside the AMDA',
                    region:'west',
                    split: true,  
                    width: 250,      
                    minSize: 150,
                    rootVisible: false,
                    autoScroll: true,
                    store: store
                });
    
                // Assign loader to be called on tree node click.
                treePanel.getSelectionModel().on('select', function(selModel, record) {
                    if (record.get('leaf')) { 
                      if (record.raw.movie) {
                       // win.remove(Ext.getCmp('content-panel'));
                       // win.add(Ext.getCmp('v'));
                    }
                      else {
                        Ext.getCmp('content-panel').loader.url = helpDir + record.getId();
                        Ext.getCmp('content-panel').loader.load();   
                      }
                    }
                });               
       
                win = desktop.createWindow({
                    id: this.id, 
                    layout: 'border',
25d64015   Elena.Budnik   css h3
101
                    width: 980,
16035364   Benjamin Renard   First commit
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
                    height: 550,
                    autoScroll : true,
                    minimizable: false,
                    maximizable: false,
    //	 	bodyStyle: 'background:#ffffff;',                    
                    title: 'Help',   
                    iconCls: this.icon,
                    animCollapse:false,
                    constrainHeader:true,
                    items: [  
                             treePanel, 
                             contentPanel
                        ]
                });  	      
                win.show();               
                }
                else 
                    win.toFront();                 
            }
	
});