'Int', 'StageHeight' => 'Int', 'BackgroundColor' => 'Varchar(8)', 'WMode' => "Enum('window, opaque, transparent')", 'AllowFullScreen' => 'Boolean' ); static $has_one = array ( 'SWFFile' => 'File' ); static $has_many = array ( 'Albums' => 'ImageGalleryAlbum' ); static $defaults = array ( 'StageWidth' => '550', 'StageHeight' => '400', 'BackgroundColor' => '#121212', 'WMode' => 'opaque', 'AllowFullScreen' => 1 ); public function getCMSFields($cms) { $f = parent::getCMSFields($cms); $f->removeFieldFromTab("Root.Content.Configuration", 'GalleryUI'); $f->removeFieldFromTab("Root.Content.Configuration", 'MediaPerPage'); $f->addFieldToTab("Root.Content.SWF", new ReadOnlyField('Path', 'xmlFilePath (Must be set in the SlideshowPro component inspector before compiling and uploading.)', $this->ImagesPath())); $f->addFieldToTab("Root.Content.SWF", new FileIFrameField('SWFFile','Upload a SlideshowPro SWF file')); $f->addFieldToTab("Root.Content.SWF", new NumericField('StageWidth','SWF Width')); $f->addFieldToTab("Root.Content.SWF", new NumericField('StageHeight','SWF Height')); $f->addFieldToTab("Root.Content.SWF", new TextField('BackgroundColor','SWF Background Color')); $f->addFieldToTab("Root.Content.SWF", new DropdownField('WMode','SWF Background Opacity', singleton('SlideshowProPage')->dbObject('WMode')->enumValues() )); $f->addFieldToTab("Root.Content.SWF", new CheckboxField('AllowFullScreen','Allow full screen')); return $f; } public function Slideshow() { return "
"; } public function ImagesPath() { return Director::absoluteURL($this->Link('xml')); } public function AllowFullScreen() { return $this->AllowFullScreen == 1 ? "true" : "false"; } } class SlideshowProPage_Controller extends Page_Controller { function init() { parent::init(); Requirements::javascript('dataobject_manager/javascript/swfobject.js'); Requirements::javascriptTemplate('slideshow_pro/javascript/slideshowpro_init.js', array( 'ParamPath' => Director::absoluteURL($this->Link('params')), 'Width' => $this->StageWidth, 'Height' => $this->StageHeight, 'SWF' => $this->SWFFile()->URL, 'BackgroundColor' => $this->BackgroundColor, 'WMode' => $this->WMode, 'ImagesPath' => $this->ImagesPath(), 'AllowFullScreen' => $this->AllowFullScreen() )); } public function xml() { header("Content-type: text/xml"); die($this->renderWith(array('SlideshowProPage_xml'))); } } ?>