HelpModule.js 4.71 KB
/** 
 * 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',
                    width: 900,
                    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();                 
            }
	
});