Development

Changeset 10340

You must first sign up to be able to contribute.

Changeset 10340

Show
Ignore:
Timestamp:
07/17/08 14:42:01 (5 years ago)
Author:
Dean.Glazeski
Message:

Added effect pieces to the plugin. Also added functionality to the DojoManager? to handle the style of the Dojo widgets and the body of the layout. Removed some unnecessary code in the DojoWidgetHelper?.php and added some comments to the helpers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/dgDojoPlugin/trunk

    • Property svn:ignore set to
      package*.xml
  • plugins/dgDojoPlugin/trunk/lib/dojo/DojoManager.class.php

    r10334 r10340  
    1313{ 
    1414    protected static 
     15        /** 
     16         * This houses the set of requires that have been mentioned to the 
     17         * manager. 
     18         */ 
    1519        $requires     = array(), 
    16         $dojoIncluded = false; 
     20        /** Maintains if Dojo JS has been included or not. */ 
     21        $dojoIncluded = false, 
     22        /** Maintains the current page style for Dijit items. */ 
     23        $style        = 'tundra', 
     24        /** List of available styles in the default Dojo install. */ 
     25        $dojo_styles  = array('tundra', 'soria', 'nihilo'); 
    1726     
    1827    /** 
     
    2534        if ( !self::$dojoIncluded ) 
    2635        { 
    27             $dojo = sfConfig::get( 'dojo_js', '/js/dojoToolkit/dojo/dojo.js' ); 
    28             $context = sfContext::getInstance(); 
    29             $context->getResponse()->addJavascript( $dojo, '', array( 'djConfig' => 'parseOnLoad: true' ) ); 
     36            $dojo = sfConfig::get( 'dojo_js', '/js/dojoToolkit' ); 
     37            $response = sfContext::getInstance()->getResponse(); 
     38            $response->addJavascript( $dojo.'/dojo/dojo.js', '', array( 'djConfig' => 'parseOnLoad: true' ) ); 
    3039            self::$dojoIncluded = true; 
    3140            self::addRequire( 'dojo.parser' ); 
     
    8897     
    8998    /** 
     99     * Sets the style of the body.  If this is one of the base styles in Dojo, 
     100     * the needed stylesheets will also be included.  If you make your own 
     101     * style, be sure to include the right stylesheets. 
     102     * 
     103     * @param string $style New style for the Dojo widgets 
     104     */ 
     105    public static function setStyle($style) 
     106    { 
     107        self::$style = strtolower($style); 
     108    } 
     109     
     110    /** 
     111     * Gets the current style set for Dojo widgets. 
     112     * 
     113     * @return string 
     114     */ 
     115    public static function getStyle() 
     116    { 
     117        return self::$style; 
     118    } 
     119     
     120    /** 
    90121     * Generates the list of Dojo require statements that need to be made for 
    91      * the javascript functions to work. 
     122     * the javascript functions to work.  It adds the stylesheets to the 
     123     * response if they are Dojo styles. 
    92124     * 
    93125     * @return string Dojo require statements put into a javascript tag 
     
    95127    public static function renderRequires() 
    96128    { 
     129         
     130        $dojo = sfConfig::get('dojo_js', '/js/dojoToolkit'); 
     131        $response = sfContext::getInstance()->getResponse(); 
     132        $response->addStylesheet("$dojo/dojo/resources/dojo.css"); 
     133        if (in_array(self::$style, self::$dojo_styles)) 
     134        { 
     135            $style = self::$style; 
     136            $response->addStylesheet("$dojo/dijit/themes/$style/$style.css"); 
     137        } 
     138         
     139         
    97140      $rval = ''; 
    98141      $requires = self::getRequires(); 
     
    105148      } 
    106149       
    107       return javascript_tag( $rval ); 
     150      return javascript_tag($rval); 
    108151    } 
    109152     
  • plugins/dgDojoPlugin/trunk/lib/helper/DojoHelper.php

    r10334 r10340  
    4444    return dojo_link_to_function($name, remote_function($options), $html_options); 
    4545} 
    46  
    4746 
    4847/** 
  • plugins/dgDojoPlugin/trunk/lib/helper/DojoWidgetHelper.php

    r10334 r10340  
    167167 
    168168/** 
    169  * Creates a button to a particular function in javascript. 
    170  * 
    171  * @param string $text Text for the button 
    172  * @param string $function Javascript function for the button 
    173  * @param mixed $options Options for the HTML tag or Dojo 
    174  * @return DojoButton The created button for the function 
    175  */ 
    176 /*function dojo_button_to_function( $text, $function, $options = array() ) 
    177 { 
    178   if ( $options === null ) $options = array(); 
    179   $options = _parse_attributes( $options ); 
    180    
    181   $options['onclick'] = $function.'; return false;'; 
    182    
    183   return new DojoButton( $text, array(), $options ); 
    184 }*/ 
    185  
    186 /** 
    187169 * Create a tooltip for a particular item. 
    188170 * 
     
    327309} 
    328310 
     311/** 
     312 * This starts a div for a Dojo border container.  This can do tons of 
     313 * different things and you should look at the Dojo reference book to get an 
     314 * idea of what can be done. 
     315 * 
     316 * @param mixed $options Set of HTML options for the div tag 
     317 * @return string The completed HTML div tag for a Dojo border container 
     318 */ 
    329319function dojo_border( $options = array() ) 
    330320{ 
     
    409399 
    410400/** 
     401 * Prints the currently set style for Dojo including the class declaration.   
     402 * This should be placed in your body tag at the beginning of the layout.  If 
     403 * you set the style to null or '', it will not add any style to the layout. 
     404 * 
     405 */ 
     406function dojo_style() 
     407{ 
     408    if (DojoManager::getStyle()) 
     409        echo 'class="'.DojoManager::getStyle().'"'; 
     410} 
     411 
     412/** 
    411413 * Adds an item, or a list of items, to the list of dojo requires.  The list is 
    412414 * kept unique.