AboutModule.js 4.28 KB
/** 
 * Project  : AMDA-NG4
 * Name     : AboutModule.js
 * @class   amdaDesktop.AboutModule 
 * @extends amdaDesktop.AmdaModule
 * @brief   About Module controller definition
 * This Module describe new functionalities of AMDA-NG4
 * @author  CDA
 * @version $Id: AboutModule.js 2397 2014-06-03 10:21:28Z elena $
 * TODO Do we need real Module ???  
 */

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

        contentId : 'infoUI',
        file : 'releaseNotes.' + AMDAVERSION,
                        
        createWindow : function(file, title, specialInfo)
        {             
            var desktop = myDesktopApp.getDesktop();            
            var win = desktop.getWindow(this.id);
            var theTitle = title ? title : this.title;
           
            if (!AMDAVERSION) this.file = 'about';
           
            var theFile = file ? file : this.file;
            if (!win) {	     
                win = desktop.createWindow({
                    id: this.id,
                    title: theTitle,
                    file : theFile,
                    width: 650,
                    height: 570,
                    autoScroll : true,
                    minimizable: false,
                    maximizable: false,
                    bodyStyle: 'background:#ffffee; padding:15px 15px 15px 15px;',
                    bodyCls : 'infoWindow',
                    loader : {
                            url : helpDir + theFile,
                            loadMask : false,
                            autoLoad : true // important			 
                    },	            
                    iconCls: this.icon,
                    animCollapse:false,
                    constrainHeader:true
                }); 
                
              if (specialInfo) {                    
                    win.add({ xtype: 'toolbar',                               
                                items: [  { 
                                        text: 'AMDA\'s ABCs',
                                         scope  : this,
                                         handler: function() {  
                                            myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.help.id, true, function (module) {
                                            	module.createWindow();
                                            }); 
                                         }
                                        },'-',
                                        '->', '-', 
                                        {
                                         text: 'Stop showing this window on next login',
                                         scope  : this,
                                         handler: function() {                                              
                                             AmdaAction.deleteSpecialInfo(win.file);
                                             Ext.MessageBox.show({title:'Warning', 
                                                            msg: 'OK. Close the window right now?',
                                                            width: 300,   
                                                            buttons: Ext.MessageBox.OKCANCEL, 
                                                            fn : function(btn) {
                                                               if (btn == 'cancel') return;
                                                               win.close();
                                                            },
                                                            icon: Ext.MessageBox.WARNING,
                                                            scope : this
                                        });  
                                         }
                              }
                            ]});                      
                }
               
                win.show();	      	      
            }
            else if (win.file === theFile) {
                win.toFront();
            }
            else {	      
                win.loader.url = helpDir + theFile;
                win.loader.load();
                win.setTitle(theTitle);
                win.file = theFile;
                win.toFront();
            }
        }
        
});