Changeset 18549
- Timestamp:
- 05/22/09 17:54:25 (4 years ago)
- Files:
-
- plugins/csDoctrineSlideshowPlugin/trunk/lib/form/doctrine/PluginSlideshowForm.class.php (modified) (2 diffs)
- plugins/csDoctrineSlideshowPlugin/trunk/lib/form/renderer/sfOptionsForm.class.php (modified) (2 diffs)
- plugins/csDoctrineSlideshowPlugin/trunk/lib/form/renderer/sfSlideshowOptionsForm.class.php (modified) (2 diffs)
- plugins/csDoctrineSlideshowPlugin/trunk/lib/renderer/BaseSlideshowRenderer.class.php (modified) (1 diff)
- plugins/csDoctrineSlideshowPlugin/trunk/lib/renderer/SlideshowGoogleSlideshow2Renderer.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/csDoctrineSlideshowPlugin/trunk/lib/form/doctrine/PluginSlideshowForm.class.php
r18546 r18549 22 22 if (class_exists($optionsClass)) 23 23 { 24 $ this->embedForm('options', $optionsForm);24 $optionsForm = new $optionsClass($this->object->options, $this->object); 25 25 } 26 else 27 { 28 $optionsForm = new sfSlideshowOptionsForm($this->object->options, $this->object); 29 } 30 $this->embedForm('options', $optionsForm); 26 31 } 27 32 else … … 42 47 { 43 48 //Do Special binding for slideshow options if options exist 44 if (array_key_exists('options', $taintedValues) )49 if (array_key_exists('options', $taintedValues) && array_key_exists('options', $this->embeddedForms)) 45 50 { 46 // Flattens the option form into a string 47 $taintedValues['options'] = $this->embeddedForms['options']->getFlattenedValues($taintedValues['options']); 51 //renderer is changed, pull in default rendering options 52 if ($taintedValues['renderer'] != $this->object->renderer) 53 { 54 $class = $taintedValues['renderer']; 55 $renderer = new $class(); 56 $taintedValues['options'] = $renderer->getDefaultOptions(); 57 } 58 else 59 { 60 // Flattens the option form into a string 61 $taintedValues['options'] = $this->embeddedForms['options']->getFlattenedValues($taintedValues['options']); 62 } 63 // replaces embedded form with a string widget 48 64 unset($this['options']); 49 65 $this->widgetSchema['options'] = new sfWidgetFormInput(); plugins/csDoctrineSlideshowPlugin/trunk/lib/form/renderer/sfOptionsForm.class.php
r18546 r18549 7 7 { 8 8 public function __construct($defaults, $object = null, $options = array(), $CSRFSecret = null) 9 // public function __construct($defaults = array(), $options = array(), $CSRFSecret = null)10 9 { 11 10 if(!is_array($defaults)) … … 15 14 $this->option_defaults = $defaults; 16 15 return parent::__construct($object, $options, $CSRFSecret); 17 // return parent::__construct($defaults, $options, $CSRFSecret);18 16 } 19 17 public function setup() plugins/csDoctrineSlideshowPlugin/trunk/lib/form/renderer/sfSlideshowOptionsForm.class.php
r18546 r18549 4 4 * Parses an options string into a form object 5 5 */ 6 abstractclass sfSlideshowOptionsForm extends sfOptionsForm6 class sfSlideshowOptionsForm extends sfOptionsForm 7 7 { 8 8 public $renderer; … … 35 35 public function getRendererClass() 36 36 { 37 // Guesses the renderer class based on the name of the options form38 // If classes follow naming conventions, this will work. Otherwise,39 37 // this method can be overridden 40 return str_replace('OptionsForm', '', get_class($this));38 return $this->object->renderer; 41 39 } 42 40 public function getModelName() plugins/csDoctrineSlideshowPlugin/trunk/lib/renderer/BaseSlideshowRenderer.class.php
r18546 r18549 71 71 return $value; 72 72 } 73 public function getDefaultOptions() 74 { 75 $opt = ''; 76 foreach ($this->options as $option => $default) 77 { 78 $opt .= "$option=$default\n"; 79 } 80 return $opt; 81 } 73 82 public function getSlide($slide) 74 83 { plugins/csDoctrineSlideshowPlugin/trunk/lib/renderer/SlideshowGoogleSlideshow2Renderer.class.php
r18546 r18549 15 15 "; 16 16 17 // public $effects = array('blindX', 'growX', 'scrollLeft', 'zoom', 'fade', 'turnLeft', 'turnDown', 'curtainX', 'scrollRight');18 // public $defaults = array('fx' => 'fade');19 20 17 public function __construct() 21 18 { … … 23 20 $this->addJavascript('/csDoctrineSlideshowPlugin/js/slideshow.min.js'); 24 21 $this->addStylesheet('/csDoctrineSlideshowPlugin/css/google-slideshow.css'); 22 $this->addOption('thumbnails', array('true', 'false'), 'true'); 23 $this->addOption('paused', array('true', 'false'), 'false'); 25 24 } 26 25 public function render($slideshow) … … 54 53 55 54 var myShow = new Slideshow('slideshow', data, {controller: false, 56 height: %s, width: %s, thumbnails: true, paused: true});55 height: %s, width: %s, thumbnails: %s, paused: %s}); 57 56 58 57 if (myShow.options.thumbnails){ … … 66 65 EOF; 67 66 68 return sprintf($js, $this->getThumbnails($slideshow), $slideshow->height, $slideshow->width); 67 return sprintf($js, 68 $this->getThumbnails($slideshow), 69 $slideshow->height, 70 $slideshow->width, 71 $this->getOption('thumbnails', $slideshow), 72 $this->getOption('paused', $slideshow) 73 ); 69 74 } 70 75 }