public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet('Root', new Tab('Main', _t('SiteTree.TABMAIN', 'Main'), new TextField('Title', _t('UniadsObject.db_Title', 'Title')))));
     if ($this->ID) {
         $previewLink = Director::absoluteBaseURL() . 'admin/' . UniadsAdmin::config()->url_segment . '/UniadsObject/preview/' . $this->ID;
         $fields->addFieldToTab('Root.Main', new ReadonlyField('Impressions', _t('UniadsObject.db_Impressions', 'Impressions')), 'Title');
         $fields->addFieldToTab('Root.Main', new ReadonlyField('Clicks', _t('UniadsObject.db_Clicks', 'Clicks')), 'Title');
         $fields->addFieldsToTab('Root.Main', array(DropdownField::create('CampaignID', _t('UniadsObject.has_one_Campaign', 'Campaign'), DataList::create('UniadsCampaign')->map())->setEmptyString(_t('UniadsObject.Campaign_none', 'none')), DropdownField::create('ZoneID', _t('UniadsObject.has_one_Zone', 'Zone'), DataList::create('UniadsZone')->map())->setEmptyString(_t('UniadsObject.Zone_select', 'select one')), new NumericField('Weight', _t('UniadsObject.db_Weight', 'Weight (controls how often it will be shown relative to others)')), new TextField('TargetURL', _t('UniadsObject.db_TargetURL', 'Target URL')), new Treedropdownfield('InternalPageID', _t('UniadsObject.has_one_InternalPage', 'Internal Page Link'), 'Page'), new CheckboxField('NewWindow', _t('UniadsObject.db_NewWindow', 'Open in a new Window')), $file = new UploadField('File', _t('UniadsObject.has_one_File', 'Advertisement File')), $AdContent = new TextareaField('AdContent', _t('UniadsObject.db_AdContent', 'Advertisement Content')), $Starts = new DateField('Starts', _t('UniadsObject.db_Starts', 'Starts')), $Expires = new DateField('Expires', _t('UniadsObject.db_Expires', 'Expires')), new NumericField('ImpressionLimit', _t('UniadsObject.db_ImpressionLimit', 'Impression Limit')), new CheckboxField('Active', _t('UniadsObject.db_Active', 'Active')), new LiteralField('Preview', '<a href="' . $previewLink . '" target="_blank">' . _t('UniadsObject.Preview', 'Preview this advertisement') . "</a>")));
         $app_categories = File::config()->app_categories;
         $file->setFolderName($this->config()->files_dir);
         $file->getValidator()->setAllowedMaxFileSize(array('*' => $this->config()->max_file_size));
         $file->getValidator()->setAllowedExtensions(array_merge($app_categories['image'], $app_categories['flash']));
         $AdContent->setRows(10);
         $AdContent->setColumns(20);
         $Starts->setConfig('showcalendar', true);
         $Starts->setConfig('dateformat', i18n::get_date_format());
         $Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
         $Expires->setConfig('showcalendar', true);
         $Expires->setConfig('dateformat', i18n::get_date_format());
         $Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
         $Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $ImageField = new UploadField('Image', 'Image');
     $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $ImageField->setFolderName('Uploads/SlideImages');
     $ImageField->setConfig('allowedMaxFileNumber', 1);
     $ImageField->getValidator()->setAllowedMaxFileSize(FLEXSLIDER_IMAGE_FILE_SIZE_LIMIT);
     $fields->removeByName(array('ShowSlide'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Name'), TextareaField::create('Description'), TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'), $ImageField, CheckboxField::create('ShowSlide')->setTitle('Show Slide')->setDescription('Include this slide in the slider. Uncheck to hide')));
     $fields->removeByName(array('SortOrder', 'PageID'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function scaffoldFormField($title = null, $params = null)
 {
     if (empty($this->object)) {
         return null;
     }
     $relationName = substr($this->name, 0, -2);
     $hasOneClass = $this->object->hasOneComponent($relationName);
     if ($hasOneClass && singleton($hasOneClass) instanceof Image) {
         $field = new UploadField($relationName, $title);
         $field->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     } elseif ($hasOneClass && singleton($hasOneClass) instanceof File) {
         $field = new UploadField($relationName, $title);
     } else {
         $titleField = singleton($hasOneClass)->hasField('Title') ? "Title" : "Name";
         $list = DataList::create($hasOneClass);
         // Don't scaffold a dropdown for large tables, as making the list concrete
         // might exceed the available PHP memory in creating too many DataObject instances
         if ($list->count() < 100) {
             $field = new DropdownField($this->name, $title, $list->map('ID', $titleField));
             $field->setEmptyString(' ');
         } else {
             $field = new NumericField($this->name, $title);
         }
     }
     return $field;
 }
 public function getCMSFields()
 {
     $fields = new FieldList(new TabSet('Root'));
     // Details
     $thumbnailField = new UploadField('CoverImage', _t('ImageGalleryAlbum.COVERIMAGE', 'Cover Image'));
     $thumbnailField->getValidator()->setAllowedExtensions(File::config()->app_categories['image']);
     $fields->addFieldsToTab('Root.Main', array(new TextField('AlbumName', _t('ImageGalleryAlbum.ALBUMTITLE', 'Album Title'), null, 255), new TextareaField('Description', _t('ImageGalleryAlbum.DESCRIPTION', 'Description')), $thumbnailField));
     // Image listing
     $galleryConfig = GridFieldConfig_RecordEditor::create();
     // Enable bulk image loading if necessary module is installed
     // @see composer.json/suggests
     if (class_exists('GridFieldBulkManager')) {
         $galleryConfig->addComponent(new GridFieldBulkManager());
     }
     if (class_exists('GridFieldBulkImageUpload')) {
         $galleryConfig->addComponents($imageConfig = new GridFieldBulkImageUpload('ImageID'));
         $imageConfig->setConfig('fieldsClassBlacklist', array('ImageField', 'UploadField', 'FileField'));
         if ($uploadFolder = $this->Folder()) {
             // Set upload folder - Clean up 'assets' from target path
             $path = preg_replace('/(^' . ASSETS_DIR . '\\/?)|(\\/$)/i', '', $uploadFolder->RelativePath);
             $imageConfig->setConfig('folderName', $path);
         }
     }
     // Enable image sorting if necessary module is installed
     // @see composer.json/suggests
     if (class_exists('GridFieldSortableRows')) {
         $galleryConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     }
     $galleryField = new GridField('GalleryItems', 'Gallery Items', $this->GalleryItems(), $galleryConfig);
     $fields->addFieldToTab('Root.Images', $galleryField);
     return $fields;
 }
 /**
  * Get CMS fields
  *
  * @return FieldList
  */
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Title', _t('Block.TITLE', 'Title')));
     $imageField = new UploadField('Image', _t('Block.IMAGE', 'Image'));
     $imageField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
     $fields->push($imageField);
     $fields->push(new TextField('FeedURL', _t('FeedBlock.FEEDURL', 'FeedURL')));
     $fields->push(new NumericField('Results', _t('FeedBlock.RESULTS', 'Results')));
     $fields->push(new NumericField('SummaryMaxLength', _t('FeedBlock.SUMMARYMAXLENGTH', 'SummaryMaxLength')));
     $fields->push(new NumericField('CacheTime', _t('FeedBlock.CACHETIME', 'CacheTime')));
     $fields->push(new CheckboxField('Striptags', _t('FeedBlock.STRIPTAGS', 'Striptags')));
     // Add modifier field (select function to run feed item through before displaying it)
     if ($this->modifier_functions) {
         if (isset($this->modifier_functions)) {
             $options = array('' => 'None');
             foreach ($this->modifier_functions as $f) {
                 $options[$f] = $f;
             }
             $fields->push(new DropdownField('Modifier', _t('FeedBlock.MODIFIER', 'Feed item filter'), $options));
         }
     }
     $fields->push(new TextField('LinkExternal', _t('FeedBlock.LINKEXTERNAL', 'External link URL')));
     if (class_exists('OptionalTreeDropdownField')) {
         $treeField = new OptionalTreeDropdownField('LinkInternalID', _t('Block.LINKINTERNAL', 'Internal link'), 'SiteTree');
         $treeField->setEmptyString('No page');
     } else {
         $treeField = new TreeDropdownField('LinkInternalID', _t('Block.LINKINTERNAL', 'Internal link'), 'SiteTree');
     }
     $fields->push($treeField);
     return $fields;
 }
Esempio n. 6
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // mp4 upload
     $MP4Field = new UploadField('MP4Video', 'MP4 Video');
     $MP4Field->getValidator()->setAllowedExtensions(array('mp4', 'm4v'));
     $MP4Field->setFolderName('Uploads/video');
     $MP4Field->setConfig('allowedMaxFileNumber', 1);
     // ogg upload
     $OggField = new UploadField('OggVideo', 'Ogg Video');
     $OggField->getValidator()->setAllowedExtensions(array('ogv', 'ogg'));
     $OggField->setFolderName('Uploads/video');
     $OggField->setConfig('allowedMaxFileNumber', 1);
     // mp4 upload
     $WebMField = new UploadField('WebMVideo', 'WebM Video');
     $WebMField->getValidator()->setAllowedExtensions(array('webm'));
     $WebMField->setFolderName('Uploads/video');
     $WebMField->setConfig('allowedMaxFileNumber', 1);
     // poster
     $PosterField = new UploadField('Poster', 'Poster Image');
     $PosterField->allowedExtensions = array('jpg', 'gif', 'png');
     $PosterField->setFolderName('Uploads/videoposters');
     $PosterField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldsToTab('Root.Video', array($MP4Field, $OggField, $WebMField, $PosterField));
     return $fields;
 }
 public function updateSiteCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos/Icons', $favIconField = new UploadField('FavIcon', 'Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48'));
     $favIconField->getValidator()->setAllowedExtensions(array('ico'));
     $favIconField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon144 = new UploadField('AppleTouchIcon144', 'Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)'));
     $atIcon144->getValidator()->setAllowedExtensions(array('png'));
     $atIcon144->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon114 = new UploadField('AppleTouchIcon114', 'Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)'));
     $atIcon114->getValidator()->setAllowedExtensions(array('png'));
     $atIcon114->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon72 = new UploadField('AppleTouchIcon72', 'Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)'));
     $atIcon72->getValidator()->setAllowedExtensions(array('png'));
     $atIcon72->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos/Icons', $atIcon57 = new UploadField('AppleTouchIcon57', 'Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)'));
     $atIcon57->getValidator()->setAllowedExtensions(array('png'));
     $atIcon57->setConfig('allowedMaxFileNumber', 1);
 }
Esempio n. 8
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $imageField = new UploadField('PrimaryImage', 'Image');
     $imageField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
     $fields->addFieldToTab('Root.Main', $imageField, 'Content');
     return $fields;
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->addFieldToTab('Root.Main', new TextField('Link', 'Slide Link'));
     $f->addFieldToTab('Root.Main', $upload_field = new UploadField('Slide', 'Slide File'));
     $upload_field->setAllowedMaxFileNumber(1);
     $upload_field->getValidator()->setAllowedMaxFileSize(array('*' => 5 * 1024 * 1024));
     $upload_field->setFolderName(sprintf('summits/%s/presentations/%s/slides/', $_REQUEST['SummitID'], $_REQUEST['SummitEventID']));
     return $f;
 }
Esempio n. 10
0
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->dataFieldByName('Title')->setTitle('Video Title');
     $fields->dataFieldByName('Content')->setTitle('Video Description');
     $fields->insertBefore(TextField::create('Time', 'Video Duration')->setDescription('ex. mm:ss'), 'Content');
     // poster
     $PosterField = UploadField::create('Image', 'Poster Image')->setFolderName('Uploads/Video/Images')->setConfig('allowedMaxFileNumber', 1)->setDescription('Placeholder image until video is played.');
     $PosterField->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $PosterField->getValidator()->setAllowedMaxFileSize(VIDEO_IMAGE_FILE_SIZE_LIMIT);
     $fields->insertBefore($PosterField, 'Content');
     // mp4 upload
     if (class_exists('ChunkedUploadField')) {
         $MP4Field = ChunkedUploadField::create('MP4Video');
     } else {
         $MP4Field = new UploadField('MP4Video');
     }
     $MP4Field->setTitle('MP4 Video')->setFolderName('Uploads/Video/MP4Video')->setConfig('allowedMaxFileNumber', 1)->setDescription('Required. Format compatible with most browsers.');
     $MP4Field->getValidator()->setAllowedExtensions(array('mp4', 'm4v'));
     $MP4Field->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT);
     // ogg upload
     if (class_exists('ChunkedUploadField')) {
         $OggField = ChunkedUploadField::create('OggVideo');
     } else {
         $OggField = UploadField::create('OggVideo');
     }
     $OggField->setTitle('Ogg Video')->setFolderName('Uploads/Video/OggVideo')->setConfig('allowedMaxFileNumber', 1)->setDescription('Optional. Format compatible with FireFox.');
     $OggField->getValidator()->setAllowedExtensions(array('ogv', 'ogg'));
     $OggField->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT);
     // webm upload
     if (class_exists('ChunkedUploadField')) {
         $WebMField = ChunkedUploadField::create('WebMVideo');
     } else {
         $WebMField = UploadField::create('WebMVideo');
     }
     $WebMField->setTitle('WebM Video')->setFolderName('Uploads/Video/WebMVideo')->setConfig('allowedMaxFileNumber', 1)->setDescription('Optional. Format compatible with Chrome.');
     $WebMField->getValidator()->setAllowedExtensions(array('webm'));
     $WebMField->getValidator()->setAllowedMaxFileSize(VIDEO_FILE_SIZE_LIMIT);
     $fields->addFieldsToTab('Root.Video', array($MP4Field, $WebMField, $OggField));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->removeByName('Picture');
     $map_field = new UploadField('Picture', 'Map');
     $map_field->setAllowedMaxFileNumber(1);
     $map_field->setFolderName(sprintf('summits/%s/locations/%s/maps/', $_REQUEST['SummitID'], $_REQUEST['LocationID']));
     $map_field->getValidator()->setAllowedMaxFileSize(array('*' => 500 * 1024));
     $f->add($map_field);
     return $f;
 }
 public function getCMSFields()
 {
     $fields = new FieldList(new TabSet('Root'));
     // Details
     $fields->addFieldToTab('Root.Main', new TextareaField('Caption', _t('ImageGalleryItem.CAPTION', 'Caption')));
     // Create image
     $imageField = new UploadField('Image');
     $imageField->getValidator()->setAllowedExtensions(File::config()->app_categories['image']);
     $fields->addFieldToTab('Root.Main', $imageField);
     return $fields;
 }
Esempio n. 13
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $summarySize);
     $fields->addFieldToTab('Root.Main', $BlogImage = new UploadField('SummaryImage'));
     $folderName = 'BlogImages/' . $this->Name . '/';
     $BlogImage->setFolderName($folderName);
     $BlogImage->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $fields->addFieldToTab('Root.Main', HtmlEditorField::create('Content'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $tab = 'Root.Main';
     $tab = 'Root.Examples';
     $field = new UploadField('Image');
     $field->setAllowedMaxFileNumber(1);
     $field->getValidator()->setAllowedMaxFileSize(4 * 1024 * 1024);
     $field->setFolderName('Uploads/10-image-setwidth/');
     $fields->addFieldToTab($tab, $field);
     return $fields;
 }
 public function getCMSFields()
 {
     $f = new FieldList();
     $f->add(new TextField('Name', 'Name'));
     $f->add(new HtmlEditorField('Description', 'Description'));
     $map_field = new UploadField('Picture', 'Picture');
     $map_field->setAllowedMaxFileNumber(1);
     $map_field->setFolderName(sprintf('summits/%s/locations/%s/images/', $_REQUEST['SummitID'], $_REQUEST['LocationID']));
     $map_field->getValidator()->setAllowedMaxFileSize(array('*' => 500 * 1024));
     $f->add($map_field);
     $f->add(new HiddenField('LocationID', 'LocationID'));
     return $f;
 }
 function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->removeByName(array('SortOrder', 'Image'));
     $f->removeByName('SortOrder');
     $f->addFieldsToTab('Root.Main', HtmlEditorField::create("Description")->setRows(15));
     $f->addFieldsToTab('Root.Image', $HeroImage = new UploadField('Image', 'Please upload a Hero image <span>(max. 1 files)</span>'));
     $HeroImage->setAllowedFileCategories('image');
     $HeroImage->setAllowedMaxFileNumber(1);
     $HeroImage->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $HeroImage->setConfig('allowedMaxFileNumber', 1);
     $HeroImage->setFolderName('Uploads/Distributors/' . $this->URLSegment);
     return $f;
 }
 public function getCMSFields()
 {
     $fields = new FieldList(new TabSet('Root'));
     // Details
     $fields->addFieldToTab('Root.Main', new TextareaField('Caption', _t('MagnificGalleryItem.CAPTION', 'Caption')));
     // Create image
     $imageField = new UploadField('Image');
     $imageField->getValidator()->setAllowedExtensions(File::config()->app_categories['image']);
     $imageField->setFolderName($this->Album()->getUploadFolder());
     $fields->addFieldToTab('Root.Main', $imageField);
     // Details
     $fields->addFieldToTab('Root.Main', new TextField('VideoLink', _t('MagnificGalleryItem.VIDEOLINK', 'Video link')));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new DropdownField('Size', 'Icon size:', singleton('WebAppIcon')->dbObject('Size')->enumValues()));
     $fields->addFieldToTab('Root.Main', $uploadField = new UploadField($name = 'Image', $title = 'Upload a App Icon'));
     $uploadField->setAllowedMaxFileNumber(1);
     $uploadField->setFolderName('appicons');
     $uploadField->setAllowedExtensions(array('png'));
     $sizeMB = 1;
     $size = $sizeMB * 1024 * 1024;
     $uploadField->getValidator()->setAllowedMaxFileSize($size);
     // hide the settings field
     $fields->removeByName('WebAppConfigID');
     return $fields;
 }
Esempio n. 19
0
 public function getCMSFields()
 {
     $fields = new FieldList();
     $image = new UploadField('Thumbnail', 'Thumbnail');
     $image->setFolderName('marketing');
     $image->setAllowedFileCategories('image');
     $doc = new UploadField('Doc', 'Doc');
     $doc->setFolderName('marketing');
     $doc->getValidator()->setAllowedMaxFileSize(40 * 1024 * 1024);
     $fields->push(new TextField('Label'));
     $fields->push(new TextField('SortOrder'));
     $fields->push($doc);
     $fields->push($image);
     return $fields;
 }
 /**
  * Returns a form field for uploading a file. 
  *   Attempts to use the Uploadify module if present.
  * @param string $fieldName Form Field Name
  * @param string $fieldTitle Form Field Title
  * @param array|null $fileTypes Array of allowed extensions (e.g. array('gif','jpg'))
  * @param string|null $subfolder Files will be uploaded to this subfolder of the Media Type's $media_upload_folder 
  * @return FormField
  */
 public function getUploadField($fieldName, $fieldTitle = null, $fileTypes = null, $subfolder = null)
 {
     $allowed_file_types = is_array($fileTypes) ? $fileTypes : Config::inst()->get($this->MediaType, 'allowed_file_types');
     $folder = property_exists($this, 'media_upload_folder') ? $this->media_upload_folder : Config::inst()->get($this->MediaType, 'media_upload_folder');
     $folder .= '/' . date('Y-m') . ($subfolder ? '/' . $subfolder : '');
     $field = new UploadField($name = $fieldName, $title = $fieldTitle);
     $field->setFolderName($folder);
     if ($allowed_file_types) {
         $field->getValidator()->setAllowedExtensions($allowed_file_types);
     }
     // determine if we are in admin or front-end, hide attaching existing files if in front-end.
     $admin_base = Config::inst()->get('LeftAndMain', 'url_base');
     if (!substr(Controller::curr()->getRequest()->getURL(), 0, strlen($admin_base) + 1) == $admin_base . '/') {
         $field->setConfig('canAttachExisting', false);
     }
     return $field;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new DropdownField('Device', 'Startup screen size:', singleton('WebAppStartupScreen')->dbObject('Device')->enumValues()));
     $fields->addFieldToTab('Root.Main', $uploadField = new UploadField($name = 'Image', $title = 'Upload a Splash Screen'));
     $uploadField->setAllowedMaxFileNumber(1);
     $uploadField->setFolderName('splashscreens');
     $uploadField->setAllowedExtensions(array('png'));
     $sizeMB = 5;
     $size = $sizeMB * 1024 * 1024;
     $uploadField->getValidator()->setAllowedMaxFileSize($size);
     // hide the media field, this gets written inBefore Write. See below
     $fields->addFieldToTab('Root.Main', new HiddenField('Media'));
     // hide the settings field
     $fields->removeByName('WebAppConfigID');
     return $fields;
 }
 /**
  * Get CMS fields
  *
  * @return FieldList
  */
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Title', _t('ContactBlock.NAME', 'Name')));
     $fields->push(new TextField('Role', _t('ContactBlock.ROLE', 'Role')));
     $fields->push(new EmailField('Email', _t('ContactBlock.EMAIL', 'Email')));
     $fields->push(new TextField('Phone', _t('ContactBlock.PHONE', 'Phone')));
     $fields->push(new TextField('Mobile', _t('ContactBlock.MOBILE', 'Mobile')));
     $fields->push(new TextField('Street', _t('ContactBlock.STREET', 'Street')));
     $fields->push(new TextField('Zip', _t('ContactBlock.ZIP', 'Zip')));
     $fields->push(new TextField('City', _t('ContactBlock.CITY', 'City')));
     $fields->push(new TextField('Box', _t('ContactBlock.BOX', 'Box')));
     $imageField = new UploadField('Image', _t('Block.IMAGE', 'Image'));
     $imageField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
     $fields->push($imageField);
     return $fields;
 }
Esempio n. 23
0
 public function updateCMSFields(FieldList $fields)
 {
     $footerLinks = new GridField('FooterLinks', 'FooterLinks', $this->owner->FooterLinks(), $conf = GridFieldConfig_RelationEditor::create());
     $conf->addComponent(new GridFieldOrderableRows('Sort'));
     $footerLinks->getConfig()->getComponentByType('GridFieldAddNewButton')->setButtonName('Add Link to Footer');
     $fields->addFieldToTab('Root.Footer', $footerLinks);
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', new TextField('LogoText', 'Logo Text'));
 }
Esempio n. 24
0
 public function updateCMSFields(FieldList $fields)
 {
     $footerBanner = new UploadField('FooterBanner', 'Footer Banner');
     $footerBanner->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $footerBanner->setConfig('allowedMaxFileNumber', 1);
     $footerBannerLink = new TreeDropdownField('FooterBannerLinkID', 'Footer Banner Link', "SiteTree");
     $fields->addFieldToTab('Root.Footer', $footerBanner);
     $fields->addFieldToTab('Root.Footer', $footerBannerLink);
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo, to appear in the top left.'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', new TextField('LogoText', 'Logo Text'));
 }
 /**
  * Get CMS fields
  *
  * @return FieldList
  */
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('LinkTitle', _t('Block.LINKTITLE', 'Link title')));
     $fields->push(new TextField('LinkExternal', _t('Block.LINKEXTERNAL', 'External link URL')));
     if (class_exists('OptionalTreeDropdownField')) {
         $treeField = new OptionalTreeDropdownField('LinkInternalID', _t('Block.LINKINTERNAL', 'Internal link'), 'SiteTree');
         $treeField->setEmptyString('No Page');
     } else {
         $treeField = new TreeDropdownField('LinkInternalID', _t('Block.LINKINTERNAL', 'Internal link'), 'SiteTree');
     }
     $fields->push($treeField);
     $fields->push(new TextField('CssClasses', _t('Block.CSSCLASSES', 'Css Classes')));
     $fields->push(new TextareaField('Attributes', _t('Block.ATTRIBUTES', 'Attributes')));
     $imageField = new UploadField('Image', _t('Block.IMAGE', 'Image'));
     $imageField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
     $fields->push($imageField);
     return $fields;
 }
Esempio n. 26
0
 public function getCMSFields()
 {
     //declare $fields var
     $fields = parent::getCMSFields();
     //create read-only fields
     $fields->addFieldToTab('Root.Metadata', new ReadonlyField('URLSegment', 'URL'));
     $fields->removeFieldFromTab('Root.Content.Metadata', 'MenuTitle');
     $fields->addFieldToTab("Root.Content.Metadata", new ReadonlyField('MenuTitle', 'URL'));
     /*--- remove the default HTML editor section from CMS ---*/
     $fields->removeFieldFromTab("Root.Main", "Content");
     //temporarily remove MetaData field
     $fields->removeByName('Metadata');
     //create page header input fields
     $fields->addFieldToTab('Root.Main', HeaderField::create('Page Header Information'));
     $fields->addFieldToTab('Root.Main', TextField::create('PageHeader', 'Page Heading'));
     $fields->addFieldToTab('Root.Main', TextareaField::create('PageSubHeader', 'Page Sub Heading'));
     $fields->addFieldToTab('Root.Main', HeaderField::create('Service 1 Information'));
     //add image upload fields
     $fields->addFieldToTab('Root.Main', $ServiceImage1 = new UploadField('ServiceImage1', 'Service 1 Image'));
     $fields->addFieldToTab('Root.Main', TextField::create('ServiceHead1', 'Service 1 Title'));
     $fields->addFieldToTab('Root.Main', TextareaField::create('ServiceDesc1', 'Service 1 Description'));
     $fields->addFieldToTab('Root.Main', HeaderField::create('Service 2 Information'));
     //add image upload fields
     $fields->addFieldToTab('Root.Main', $ServiceImage2 = new UploadField('ServiceImage2', 'Service 2 Image'));
     $fields->addFieldToTab('Root.Main', TextField::create('ServiceHead2', 'Service 2 Title'));
     $fields->addFieldToTab('Root.Main', TextareaField::create('ServiceDesc2', 'Service 2 Description'));
     $fields->addFieldToTab('Root.Main', HeaderField::create('Service 3 Information'));
     //add image upload fields
     $fields->addFieldToTab('Root.Main', $ServiceImage3 = new UploadField('ServiceImage3', 'Service 3 Image'));
     $fields->addFieldToTab('Root.Main', TextField::create('ServiceHead3', 'Service 3 Title'));
     $fields->addFieldToTab('Root.Main', TextareaField::create('ServiceDesc3', 'Service 3 Description'));
     //validate image types
     $ServiceImage1->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
     $ServiceImage2->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
     $ServiceImage3->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpg', 'jpeg'));
     //set image upload folder
     $ServiceImage1->setFolderName('Service Page Images');
     $ServiceImage2->setFolderName('Service Page Images');
     $ServiceImage3->setFolderName('Service Page Images');
     //return the fields
     return $fields;
 }
 function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account'));
     $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $facebookURL = new TextField('FacebookURL', 'Facebook UID or username'));
     $facebookURL->setRightTitle('Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $twitterUsername = new TextField('TwitterUsername', 'Twitter username'));
     $twitterUsername->setRightTitle('Twitter username (eg, http://twitter.com/<strong>username</strong>)');
     $fields->addFieldToTab('Root.SocialMedia', $addThisID = new TextField('AddThisProfileID', 'AddThis Profile ID'));
     $addThisID->setRightTitle('Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)');
     $fields->addFieldToTab('Root.Logos', $logoField = new UploadField('Logo', 'Logo, to appear in the top left.'));
     $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Logos', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link'));
     $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.');
     $fields->addFieldToTab('Root.Logos', new TextField('FooterLogoDescription', 'Footer Logo description'));
 }
 public function getCMSFields()
 {
     $f = new FieldList();
     $f->add(new TextField('Name', 'Name'));
     $f->add(new TextareaField('Description', 'Description'));
     $f->add(new NumericField('Number', 'Number'));
     $f->add($upload_field = new UploadField('Image', 'Map'));
     $f->add(new HiddenField('VenueID', 'VenueID'));
     $upload_field->setAllowedMaxFileNumber(1);
     $upload_field->getValidator()->setAllowedMaxFileSize(array('*' => 512 * 1024));
     $upload_field->setFolderName(sprintf('summits/%s/locations/%s/floors/', $_REQUEST['SummitID'], $_REQUEST['LocationID']));
     if ($this->ID) {
         $f->add(new LiteralField('br', '<br>'));
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchList($this->Venue()->Rooms());
         $gridField = new GridField('Rooms', 'Rooms', $this->Rooms(), $config);
         $f->add($gridField);
     }
     return $f;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new TextField('Author', _t('NewsArticle.AUTHOR', 'Author')), 'Content');
     $fields->addFieldToTab('Root.Main', $dp = new DateField('OriginalPublishedDate', _t('NewsArticle.PUBLISHED_DATE', 'When was this article first published?')), 'Content');
     $dp->setConfig('showcalendar', true);
     $fields->addFieldToTab('Root.Main', new TextField('ExternalURL', _t('NewsArticle.EXTERNAL_URL', 'External URL to article (will automatically redirect to this URL if no article content set)')), 'Content');
     $fields->addFieldToTab('Root.Main', new TextField('Source', _t('NewsArticle.SOURCE', 'News Source')), 'Content');
     $fields->addFieldToTab('Root.Main', $if = new UploadField('Thumbnail', _t('NewsArticle.THUMB', 'Thumbnail')), 'Content');
     $if->setConfig('allowedMaxFileNumber', 1)->setFolderName('news-articles/thumbnails');
     $if->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     if (!$this->OriginalPublishedDate) {
         // @TODO Fix this to be correctly localized!!
         $this->OriginalPublishedDate = date('Y-m-d');
     }
     $fields->addFieldToTab('Root.Main', UploadField::create('InternalFile', _t('NewsArticle.INTERNAL_FILE', 'Select a file containing this news article, if any'))->setFolderName('news'), 'Content');
     $fields->addFieldToTab('Root.Main', $summary = new HtmlEditorField('Summary', _t('NewsArticle.SUMMARY', 'Article Summary (displayed in listings)')), 'Content');
     $summary->addExtraClass('stacked');
     $this->extend('updateArticleCMSFields', $fields);
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     //$fields->addFieldToTab(HeaderImageBanner::$hibCMSTab, new DropDownField('hibHeaderImagesType', 'If no header image, select from', $this->dbObject('hibHeaderImagesType')->enumValues()));
     if (HeaderImageBanner::$hibCMSUserEdit) {
         if (isset(HeaderImageBanner::$hibCMSTabs[$this->owner->ClassName])) {
             $tabs = HeaderImageBanner::$hibCMSTabs[$this->owner->ClassName];
         } else {
             if (isset(HeaderImageBanner::$hibCMSTabs["default"])) {
                 $tabs = HeaderImageBanner::$hibCMSTabs["default"];
             } else {
                 $tabs = "Root.HeaderImageBanners";
             }
         }
         $upload = new UploadField('hibImages', HeaderImageBanner::hibGetCMSCaption());
         $upload->setConfig('allowedMaxFileNumber', 25);
         $upload->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
         $fields->addFieldToTab($tabs, $upload);
         //	  	$fields->addFieldToTab($tabs, $upload = new UploadField('hibImages', HeaderImageBanner::hibGetCMSCaption()));
         //			$uf->setConfig('allowedMaxFileNumber', 10);
     }
 }