// create namespace
Ext.namespace('myNameSpace');

// reference local blank image
Ext.BLANK_IMAGE_URL = './ext_202/resources/images/default/s.gif';
// create application
myNameSpace.app = function() {
    // do NOT access DOM from here; elements don't exist yet
 
    // private variables
    var btn1;
    var privVar1 = 11;
 
    // private functions
    var btn1Handler = function(button, event) {
        popup("ismeascolarite","scolaminesismin");
    };
     var btn2Handler = function(button, event) {
        popup("itii","scolaminesisfen");
    };
    var btn3Handler = function(button, event) {
        popup("icmscolarite","scolaminesicm");
    };
    var btn4Handler = function(button, event) {
        popup("ms_tmpm","scolaminestmpm");
    };
    var ISFEN_EV_P19Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=EV&promotion=P19","planningp19");
    };
    var ISFEN_INT_P19Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=INT&promotion=P19","planningp19");
    };
    var ISFEN_1A_P19Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=1A&promotion=P19","planningp19");
    };
    var ISFEN_2A_P19Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=2A&promotion=P19","planningp19");
    };
    var ISFEN_ANC_P19Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=ANC&promotion=P19","planningp19");
    };
    var ISFEN_1A_P18Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=1A&promotion=P18","planningp18");
    };
    var ISFEN_2A_P18Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=2A&promotion=P18","planningp18");
    };
    
    
    var ISFEN_EV_P20Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=EV&promotion=P20","planningp20");
    };
      var ISFEN_INT_P20Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=INT&promotion=P20","planningp20");
    };
     var ISFEN_1A_P20Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=1A&promotion=P20","planningp20");
    };
    var ISFEN_2A_P20Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=2A&promotion=P20","planningp20");
    };
    var ISFEN_ANC_P20Handler = function(button, event) {
        popup("itii/AffichePlanningMois.php?cycle=isfen&annee=ANC&promotion=P20","planningp20");
    };
    
    var ISMIN_1AHandler = function(button, event) {
        popup("isminscolarite/AffichePlanningMois.php?cycle=ismea&annee=1A&promotion=P2013","planningismin1A");
    };
    var ISMIN_2AHandler = function(button, event) {
        popup("isminscolarite/AffichePlanningMois.php?cycle=ismea&annee=2A&promotion=P2012","planningismin2A");
    };
    var ISMIN_3AHandler = function(button, event) {
        popup("isminscolarite/AffichePlanningMois.php?cycle=ismea&annee=3A&promotion=P2011","planningismin3A");
    };
    var ICM_3AHandler = function(button, event) {
        popup("icmscolarite/AffichePlanningMois.php?cycle=icm&annee=3A&promotion=ICM2007","planningpicm3A");
    };
    var ICM_2AHandler = function(button, event) {
        popup("icmscolarite/AffichePlanningMois.php?cycle=icm&annee=2A&promotion=ICM2008","planningpicm3A");
    };
    var TMPM_MSHandler = function(button, event) {
        popup("ms_tmpm/AffichePlanningMois.php?cycle=mastere&annee=MS&promotion=TMPM2009","planningptmpmms");
    };
    // public space
    return {
        // public properties, e.g. strings to translate
        btn1Text: '<div id="portal-title3-text">SCOLARITE ISMIN</div>',
        btn2Text: '<div id="portal-title3-text">SCOLARITE ISFEN</div>',
        btn3Text: '<div id="portal-title3-text">SCOLARITE ICM</div>',
        btn4Text: '<div id="portal-title3-text">SCOLARITE MS TMPM</div>',
        
 
        // public methods
        init: function() {
            
             var SamplePanel = Ext.extend(Ext.Panel, {
        	width: 180,
        	height:100,
        	style: 'margin-top:15px',
        	bodyStyle: 'padding:10px',
        	renderTo: 'btn1-ct',
        	layout:'table',
        	autoScroll: true
    	      });
            
             new SamplePanel({
        title: '<div id="portal-title2-text">SCOLAMINES</div>',
        tbar: [{
            xtype: 'buttongroup',
            title: 'Accés Sites Scolarité',
            
            columns: 1,
            defaults: {
                
                cls:'x-btn-portail',
                
                scale: 'medium',
                width: '130'
                
            },
            layout:'column',
            items: [{
                                     
                    text: this.btn1Text,
                    handler: btn1Handler                                  
                
            },{
                
                    text: this.btn2Text,
                    handler: btn2Handler
                    
            },{
                    text: this.btn3Text,
                    handler: btn3Handler
                    
            },{
                
                    text: this.btn4Text,
                    handler: btn4Handler
                    
            }]
        
        }]
   });

               
                
               
        function renderButtons(title){

        
           
            new ButtonPanel(
            '<div id="portal-title4-text">Accés Direct Plannings</div>',
            [{
                text: 'Plannings ISFEN',
                
                scale: 'large',
                menu : {items: [{text:'P20',menu:{items: [{text:'EV',handler: ISFEN_EV_P20Handler},
                                                          {text:'INT',handler: ISFEN_INT_P20Handler}
                                                          
                                                         ]}
                                 },
                                {text:'P19',menu:{items: [{text:'EV',handler: ISFEN_EV_P19Handler},
                                                          {text:'INT',handler: ISFEN_INT_P19Handler},
                                                          {text:'1A',handler: ISFEN_1A_P19Handler} 
                                                         ]}
                                 },
                                
                                {text:'P18',menu:{items: [{text:'1A',handler: ISFEN_1A_P18Handler},
                                                          {text:'2A',handler: ISFEN_2A_P18Handler} 
                                                         ]}
                                }
                                
                                ]}
                
               
            },{
                text: 'Plannings ISMIN',
                
                scale: 'large',
                menu : {items: [{text:'P2013',handler:ISMIN_1AHandler},
                                {text:'P2012',handler:ISMIN_2AHandler},
                                {text:'P2011',handler:ISMIN_3AHandler}]}
            },{
                text: 'Plannings ICM',
                
                scale: 'large',
                menu : {items: [{text:'2A 2008',handler:ICM_2AHandler},
                                {text:'3A 2007',handler:ICM_3AHandler}]}
            },{
                text: 'Plannings MS TMPM',
                
                scale: 'large',
                menu : {items: [{text:'MS 2009',handler:TMPM_MSHandler}]}
            }]
        );
               
       }      
        
       
       renderButtons('');    
      
      }
    };
      

}(); // end of app

// Helper class for organizing the buttons
ButtonPanel = Ext.extend(Ext.Panel, {
    layout:'table',
    defaultType: 'button',
    baseCls: 'x-plain',
    cls: 'btn-panel',
    renderTo : 'zone-boutons-plannings',
    
    

    layoutConfig: {
        columns:4
    },

    constructor: function(desc, buttons){
        // apply test configs
        
        var items = [{
            xtype: 'box',
            autoEl: {tag: 'h3', html: desc, style:"padding:15px 0 3px;"},
            colspan: 4
        }].concat(buttons);

        ButtonPanel.superclass.constructor.call(this, {
            items: items
        });
    }
});
// end of file
        
        
        
        Ext.onReady(myNameSpace.app.init, myNameSpace.app);
