1. #1
    Sencha User galdaka's Avatar
    Join Date
    Mar 2007
    Location
    Spain
    Posts
    1,166
    Vote Rating
    -1
    galdaka is an unknown quantity at this point

      0  

    Default [3.x] Theme and Language cyclebuttons

    [3.x] Theme and Language cyclebuttons


    11/08/2009: First version.
    11/08/2009: Capture http://www.jadacosta.es/contents/scr...t/capture3.swf
    11/08/2009: Added GNU and price: 20€. Included two files, Language and Cyclebutton. Contact to: galdaka@hotmail.com
    03/11/2009: License changed. Reason: People use your work for comercial purposes without your permission.
    03/11/2009: NEW LICENSE: http://creativecommons.org/licenses/by-nc/3.0/. Thanks to cparker.


    LanguageCyclebutton...


    PHP Code:
    /**
     * Ext.ux.LanguageCycleButton  
     * Copyright (c) 2009-2010, José Alfonso Dacosta Dominguez (galdaka@hotmail.com)
     *
     * Ext.ux.LanguageCycleButton is licensed http://creativecommons.org/licenses/by-nc/3.0/ license.
     *
     * Commercial use is prohibited. contact with galdaka@hotmail.com
     * if you need to obtain a commercial license.
     *
     *  Site: www.jadacosta.es
     */
    Ext.ux.LanguageCycleButton Ext.extend(Ext.CycleButton, {
     
     
    languageItemsthis.languageItems || [
      {
    language'es'text'Español 'iconClsExt.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/flags/''es')},
      {
    language'en'text'Inglés 'iconClsExt.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/flags/''fj')},
      {
    language'ch'text'Euskera 'iconClsExt.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/flags/''eu')}
     ],
     
    languageVarthis.languageVar || 'lang',
     
     
    initComponent: function() {
      if(
    Ext.state.Manager){ 
             var 
    selectedLanguage Ext.state.Manager.get(this.languageVar); 
                if(
    selectedLanguage){ 
        for(var 
    i=0i<this.languageItems.length;i++){
         if (
    this.languageItems[i].language == selectedLanguage){
          
    this.languageItems[i].checked true;
          
    Ext.state.Manager.set(this.languageVarthis.languageItems[i].language);
          break;
         }
        }
                }else{
        
    this.languageItems[0].checked true;
       }
            } 
      
    Ext.apply(this, {
          
    showTexttrue,
       
    prependText'&nbsp;',
          
    itemsthis.languageItems
      
    });
      
    Ext.ux.LanguageCycleButton.superclass.initComponent.apply(thisarguments);
     },
     
     
    changeHandler: function(oi){
            if(
    Ext.state.Manager.getProvider()) {
                
    Ext.state.Manager.set(this.languageVari.language);
            }
      var 
    aux '';
      if(
    window.location.href.split('&l=')[1]){
       if(
    window.location.href.split('&l=')[1].split('&')[1]){
        
    aux '&' window.location.href.split('&l=')[1].split('&')[1];
       }
      }
      
    window.location.href window.location.href.split('&l=')[0] + '&l=' i.language aux;
     }
     
    });
    Ext.reg('languagecyclebutton'Ext.ux.LanguageCycleButton); 
    And ThemeCyclebutton...


    PHP Code:
    /**
     *  Ext.ux.ThemeCycleButton
     * Copyright (c) 2009-2010, José Alfonso Dacosta Dominguez (galdaka@hotmail.com)
     *
     *  Ext.ux.ThemeCycleButton is licensed http://creativecommons.org/licenses/by-nc/3.0/ license.
     *
     * Commercial use is prohibited. contact with galdaka@hotmail.com
     * if you need to obtain a commercial license.
     *
     *  Site: www.jadacosta.es
     */
    Ext.ux.ThemeCycleButton Ext.extend(Ext.CycleButton, {
     
     
    cssItemsthis.cssItems || [
      {
    file'xtheme-blue.css'type'original'text'Azul&nbsp;'iconClsExt.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/''blue-theme'), head'cabecera-Azul.jpg'},
      {
    file'xtheme-gray-extend.css'type'ux'text'Gris extendido&nbsp;'iconClsExt.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/''gray-theme'), head'cabecera-Gris.jpg'}
     ],
     
    themeVarthis.themeVar || 'style',
     
    headVarthis.headVar || 'head',
     
    originalCSSPaththis.originalCSSPath || 'extjs/resources/css/',
     
    uxCSSPaththis.uxCSSPath || 'extjs/resources/css/',
     
    headsPaththis.headsPath || 'resources/img/',
     
     
    initComponent: function() {
      if(
    Ext.state.Manager){ 
             var 
    selectedTheme Ext.state.Manager.get(this.themeVar); 
                if(
    selectedTheme){ 
        for(var 
    i=0i<this.cssItems.length;i++){
         if (
    this.cssItems[i].file == selectedTheme){
          
    this.cssItems[i].checked true;
          
    this.changeHandler(thisthis.cssItems[i]);
          break;
         }
        }
                }else{
        
    this.cssItems[1].checked true;
       }
            }
      
    Ext.apply(this, {
          
    showTexttrue,
       
    prependText'&nbsp;',
          
    itemsthis.cssItems
      
    });
      
    Ext.ux.ThemeCycleButton.superclass.initComponent.apply(thisarguments);
     },
     
     
    changeHandler: function(oi){
            if(
    Ext.state.Manager.getProvider()) {
                
    Ext.state.Manager.set(this.themeVari.file);
       
    Ext.state.Manager.set(this.headVari.head);
            }
      
    i.type == 'ux' Ext.util.CSS.swapStyleSheet(this.themeVarthis.uxCSSPath i.file) : Ext.util.CSS.swapStyleSheet(this.themeVarthis.originalCSSPath i.file);
      
    Ext.util.CSS.getRule('.header .x-panel-body'true).style.background 'url(' this.headsPath i.head ')';
      if(
    Ext.getCmp('viewport')){
             
    Ext.getCmp('viewport').layout.center.panel.setSize(Ext.getCmp('viewport').layout.center.getSize().width 1);
       
    Ext.getCmp('viewport').doLayout();
       
    Ext.getCmp('viewport').layout.center.panel.setSize(Ext.getCmp('viewport').layout.center.getSize().width 1);
       
    Ext.getCmp('viewport').doLayout();
      }
     }
     
    });
    Ext.reg('themecyclebutton'Ext.ux.ThemeCycleButton); 
    Attached Images

  2. #2