Changeset 6585
- Timestamp:
- 12/19/07 13:44:44 (6 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfExtjs2Plugin/trunk/config/config.php
r6563 r6585 1 1 <?php 2 sfConfig::set('sf_extjs2_version', 'v0.27'); 2 sfConfig::set('sf_extjs2_version', 'v0.30'); 3 sfConfig::set('sf_extjs2_comment', true); 3 4 # 4 5 # array values that don't need quotes … … 58 59 # attributes which must handled as array 59 60 # 60 sfConfig::set('sf_extjs2_list_attributes', array('items', 'tbar', 'buttons', 'plugins', ' cm', 'ds', 'view', 'tbar', 'bbar'));61 sfConfig::set('sf_extjs2_list_attributes', array('items', 'tbar', 'buttons', 'plugins', 'view', 'tbar', 'bbar')); 61 62 # 62 63 # mapping plugin method against class plugins/sfExtjs2Plugin/trunk/lib/helper/sfExtjs2Helper.php
r6563 r6585 5 5 * @description sfExtjs2Plugin is a symfony plugin that provides an easy to use wrapper for the Ext javascript library 6 6 * @author Benjamin Runnels<benjamin.r.runnels [at] citi [dot] com>, Leon van der Ree, Wolfgang Kubens<wolfgang.kubens [at] gmx [dot] net> 7 * @version 0.0.29 8 * @last modified 12.17.2007 Leon: 7 * @version 0.0.30 8 * @last modified 12.18.2007 Wolfgang 9 * - Added sf_extjs2_comment 10 * 12.17.2007 Leon: 9 11 * - handling of inner (recursive) arrays (see items => array(array(...), array(...)) 10 12 * 12.17.2007 Kubens: … … 166 168 foreach (sfConfig::get('sf_extjs2_list_attributes') as $attribute) 167 169 { 168 if (array_key_exists($attribute, $attributes['attributes']) )170 if (array_key_exists($attribute, $attributes['attributes']) && !$attributes['attributes'][$attribute] instanceof sfExtjs2Var) 169 171 { 170 172 $attributes['attributes'][$attribute] = sprintf('[%s]', sfExtjs2Plugin::_build_attributes($attributes['attributes'][$attribute])); … … 261 263 $source = sfExtjs2Plugin::LBR; 262 264 $source .= sprintf("<script type='text/javascript'>%s", sfExtjs2Plugin::LBR); 265 $source .= sfExtjs2Plugin::_comment(sprintf("%s// sfExtjs2Helper: %s%s", sfExtjs2Plugin::LBR, sfConfig::get('sf_extjs2_version'), sfExtjs2Plugin::LBR)); 263 266 $source .= sprintf("Ext.BLANK_IMAGE_URL = '%s'%s", sfConfig::get('sf_extjs2_spacer'), sfExtjs2Plugin::LBR_SM); 264 267 … … 297 300 { 298 301 $this->namespace = $namespace; 302 $source .= sfExtjs2Plugin::_comment(sprintf("%s// namespace: %s%s", sfExtjs2Plugin::LBR, $namespace, sfExtjs2Plugin::LBR)); 299 303 $source .= sprintf("Ext.namespace('%s')%s", $namespace, sfExtjs2Plugin::LBR_SM); 300 304 } 301 305 302 306 // write class tag 307 $source .= sfExtjs2Plugin::_comment(sprintf("%s// class: %s.%s%s", sfExtjs2Plugin::LBR, $namespace, $classname, sfExtjs2Plugin::LBR)); 303 308 $source .= sprintf("%s.%s = Ext.extend(%s, {%s", $namespace, $classname, $extend, sfExtjs2Plugin::LBR); 304 309 … … 317 322 { 318 323 $source = ''; 319 $source .= sprintf("})%s ", sfExtjs2Plugin::LBR_SM);324 $source .= sprintf("})%s%s", sfExtjs2Plugin::LBR_SM, sfExtjs2Plugin::LBR_SM); 320 325 321 326 echo $source; … … 351 356 352 357 // write application syntax 353 $source = ''; 354 $source = sprintf( 355 'var %s = function() { %s%sreturn {%s %s', 358 $source = ''; 359 $source .= sfExtjs2Plugin::_comment(sprintf("%s// application: %s%s", sfExtjs2Plugin::LBR, $attributes['name'], sfExtjs2Plugin::LBR)); 360 $source .= sprintf( 361 'var %s = function() { %sreturn {%s%s %s %s', 356 362 $attributes['name'], 363 sfExtjs2Plugin::LBR, 364 sfExtjs2Plugin::LBR, 357 365 $sourcePrivate, 358 366 $sourcePrivate != '' ? sfExtjs2Plugin::LBR : '', … … 372 380 { 373 381 $source = ''; 374 $source .= sprintf(" }}()%s", sfExtjs2Plugin::LBR_SM);382 $source .= sprintf("%s}}()%s", sfExtjs2Plugin::LBR, sfExtjs2Plugin::LBR_SM); 375 383 376 384 echo $source; … … 449 457 private static function _build_attributes ($custom_attributes = array(), $default_attributes = array()) 450 458 { 451 $merged_attributes = array_merge($default_attributes, $custom_attributes);452 453 459 $attributes = ''; 460 461 $merged_attributes = $default_attributes; 462 if (is_array($custom_attributes) && is_array($default_attributes)) 463 { 464 $merged_attributes = array_merge($default_attributes, $custom_attributes); 465 } 466 454 467 foreach ($merged_attributes as $key => $value) 455 468 { … … 546 559 } 547 560 561 /** 562 * @param string comment 563 * @return string comment 564 */ 565 private static function _comment($comment) 566 { 567 if (sfConfig::get('sf_extjs2_comment')) 568 { 569 return $comment; 570 } 571 else 572 { 573 return ''; 574 } 575 } 576 548 577 } 549 578