Changeset 10340
- Timestamp:
- 07/17/08 14:42:01 (5 years ago)
- Files:
-
- plugins/dgDojoPlugin/trunk (modified) (1 prop)
- plugins/dgDojoPlugin/trunk/lib/dojo/DojoManager.class.php (modified) (5 diffs)
- plugins/dgDojoPlugin/trunk/lib/effect (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoAnimateEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoBaseEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoChainEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoCombineEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoEffectsContainer.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoFadeEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoHightlightEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/effect/DojoWipeEffect.class.php (added)
- plugins/dgDojoPlugin/trunk/lib/helper/DojoHelper.php (modified) (1 diff)
- plugins/dgDojoPlugin/trunk/lib/helper/DojoWidgetHelper.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/dgDojoPlugin/trunk
- Property svn:ignore set to
package*.xml
- Property svn:ignore set to
plugins/dgDojoPlugin/trunk/lib/dojo/DojoManager.class.php
r10334 r10340 13 13 { 14 14 protected static 15 /** 16 * This houses the set of requires that have been mentioned to the 17 * manager. 18 */ 15 19 $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'); 17 26 18 27 /** … … 25 34 if ( !self::$dojoIncluded ) 26 35 { 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' ) ); 30 39 self::$dojoIncluded = true; 31 40 self::addRequire( 'dojo.parser' ); … … 88 97 89 98 /** 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 /** 90 121 * 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. 92 124 * 93 125 * @return string Dojo require statements put into a javascript tag … … 95 127 public static function renderRequires() 96 128 { 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 97 140 $rval = ''; 98 141 $requires = self::getRequires(); … … 105 148 } 106 149 107 return javascript_tag( $rval);150 return javascript_tag($rval); 108 151 } 109 152 plugins/dgDojoPlugin/trunk/lib/helper/DojoHelper.php
r10334 r10340 44 44 return dojo_link_to_function($name, remote_function($options), $html_options); 45 45 } 46 47 46 48 47 /** plugins/dgDojoPlugin/trunk/lib/helper/DojoWidgetHelper.php
r10334 r10340 167 167 168 168 /** 169 * Creates a button to a particular function in javascript.170 *171 * @param string $text Text for the button172 * @param string $function Javascript function for the button173 * @param mixed $options Options for the HTML tag or Dojo174 * @return DojoButton The created button for the function175 */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 /**187 169 * Create a tooltip for a particular item. 188 170 * … … 327 309 } 328 310 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 */ 329 319 function dojo_border( $options = array() ) 330 320 { … … 409 399 410 400 /** 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 */ 406 function dojo_style() 407 { 408 if (DojoManager::getStyle()) 409 echo 'class="'.DojoManager::getStyle().'"'; 410 } 411 412 /** 411 413 * Adds an item, or a list of items, to the list of dojo requires. The list is 412 414 * kept unique.