diff --git a/code/ImageResource.php b/code/ImageResource.php index ad027c6..4ffc6b3 100644 --- a/code/ImageResource.php +++ b/code/ImageResource.php @@ -6,17 +6,17 @@ //Commented out due to this already being used in tabpage class ImageResource extends DataObject { - public static $db = array ( + public static $db = array( 'Title' => 'Text', 'Caption' => 'Text', - 'SortID'=>'Int' + 'SortID'=>'Int' ); public static $default_sort='SortID'; - static $has_one = array ( + public static $has_one = array( 'Attachment' => 'Image', //Needs to be an image 'SuperSizePage' => 'SuperSizePage', 'HomePage' => 'HomePage' @@ -24,20 +24,21 @@ class ImageResource extends DataObject ); public static $summary_fields = array( - 'Thumbnail'=>'Thumbnail', - 'Title' => 'Title', - 'Caption' => 'Caption' - ); - - public function getThumbnail() { - if ($Image = $this->Attachment()->ID) { - return $this->Attachment()->SetWidth(80); - } else { - return '(No Image)'; - } - } - - public function getCMSFields() + 'Thumbnail'=>'Thumbnail', + 'Title' => 'Title', + 'Caption' => 'Caption' + ); + + public function getThumbnail() + { + if ($Image = $this->Attachment()->ID) { + return $this->Attachment()->SetWidth(80); + } else { + return '(No Image)'; + } + } + + public function getCMSFields() { return new Fieldlist( new TextField('Title'), diff --git a/code/SuperSizePage.php b/code/SuperSizePage.php index 78e4689..cfbc9ab 100644 --- a/code/SuperSizePage.php +++ b/code/SuperSizePage.php @@ -1,18 +1,19 @@ 'Text', - 'Text2' => 'Text' - - - - - ); + Static $db = array( + 'Text1' => 'Text', + 'Text2' => 'Text' + + + + + ); */ @@ -20,24 +21,24 @@ class SuperSizePage extends Page { /* public static $has_one = array( - 'Photo' => 'Image', - 'Photo2' => 'Image' - ); + 'Photo' => 'Image', + 'Photo2' => 'Image' + ); */ - static $has_many = array ( + public static $has_many = array( 'Images' => 'ImageResource' ); //for CMS mod -function getCMSFields() { - - $fields = parent::getCMSFields(); +public function getCMSFields() +{ + $fields = parent::getCMSFields(); - $config = GridFieldConfig_RelationEditor::create(10); - $config->addComponent(new GridFieldSortableRows('SortID')); + $config = GridFieldConfig_RelationEditor::create(10); + $config->addComponent(new GridFieldSortableRows('SortID')); // Set the names and data for our gridfield columns /* $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array( @@ -53,51 +54,46 @@ function getCMSFields() { 'ImageResource', // Field title $this->Images(), // List of all related images $config - ); + ); // Create a tab named "gallery" and add our field to it $fields->addFieldToTab('Root.Gallery', $imagesField); - - - $fields->addFieldToTab("Root.Content.Gallery", new HeaderField("Images for the gallery","2")); - - - - - - return $fields; - - } - + + + $fields->addFieldToTab("Root.Content.Gallery", new HeaderField("Images for the gallery", "2")); + + + + + return $fields; +} } -class SuperSizePage_Controller extends Page_Controller { - public function init() { - parent::init(); +class SuperSizePage_Controller extends Page_Controller +{ + public function init() + { + parent::init(); - // Note: you should use SS template require tags inside your templates - // instead of putting Requirements calls here. However these are - // included so that our older themes still work - /* + // Note: you should use SS template require tags inside your templates + // instead of putting Requirements calls here. However these are + // included so that our older themes still work + /* Requirements::themedCSS('layout'); - Requirements::themedCSS('typography'); - Requirements::themedCSS('form'); + Requirements::themedCSS('typography'); + Requirements::themedCSS('form'); */ - //Requirements::css("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.css"); - - //Requirements::javascript("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.js"); - //Requirements::javascript("themes/nzproperty/js/fancybox/gallery.js"); - Requirements::clear(); - - //Requirements::css(MODULE_SUPERSIZE_DIR . '/css/supersized.css'); - - Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/jquery.easing.min.js'); - Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/supersized.3.2.5.min.js'); - Requirements::javascript(MODULE_SUPERSIZE_DIR . '/theme/supersized.shutter.min.js'); - - } - - - + //Requirements::css("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.css"); + + //Requirements::javascript("themes/nzproperty/js/fancybox/jquery.fancybox-1.3.4.js"); + //Requirements::javascript("themes/nzproperty/js/fancybox/gallery.js"); + Requirements::clear(); + + //Requirements::css(MODULE_SUPERSIZE_DIR . '/css/supersized.css'); + + Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/jquery.easing.min.js'); + Requirements::javascript(MODULE_SUPERSIZE_DIR . '/js/supersized.3.2.5.min.js'); + Requirements::javascript(MODULE_SUPERSIZE_DIR . '/theme/supersized.shutter.min.js'); + } }