public function updateCMSFields(FieldList $fields)
 {
     $type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
     $type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
     $location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
     $location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
     $latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
     $latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
     $longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
     $longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
     $bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
     $bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
     $bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
     $bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
     $thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
     $thumbnail->setFolderName('event/thumbnail');
     $thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
     $image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
     $image->setFolderName('event/image');
     $image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
     $files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
     $files->setFolderName('event/file');
     $files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
     return $fields;
 }
 /**
  * Helper to create an upload field with the correct path, which ensures that the uploader puts files in the right place
  */
 protected function getUploadField($field, $caption)
 {
     $field = new UploadField($field, $caption);
     $path = $this->getFolderPath();
     $field->setFolderName($path);
     return $field;
 }
Beispiel #3
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName("FlexSliderID");
     // Main
     $field_Picture = new UploadField('Picture', _t("FlexSlider.Picture"));
     $field_Picture->setFolderName("FlexSlides");
     $field_Picture->setConfig('allowedMaxFileNumber', 1);
     $field_Position = new NumericField("Position", _t("FlexSlider.Position"));
     $field_Position->RightTitle(_t("FlexSlider.PositionExplain"));
     $field_SlideTitle = new TextField("SlideTitle", _t("FlexSlider.Title"));
     $field_SlideDescription = new TextField("SlideDescription", _t("FlexSlider.Description"));
     $field_HeadlineLinks = new HeaderField("HeadlineLinks", _t("FlexSlider.HeadlineLinks"));
     $field_InternalLink = new TreeDropdownField("InternalLinkID", _t('FlexSlider.InternalLink'), 'SiteTree');
     $field_removeInternalLink = new CheckboxField("doRemoveInternalLink", _t("FlexSlider.doRemoveInternalLink"));
     $field_ExternalLink = new TextField("ExternalLink", _t("FlexSlider.or") . " " . _t("FlexSlider.ExternalLink"));
     $field_HeadlineEnabled = new HeaderField("HeadlineEnabled", _t("FlexSlider.HeadlineEnabled"));
     $field_isEnabled = new CheckboxField("isEnabled", _t("FlexSlider.isEnabled"));
     $FieldsArray = array($field_Position, $field_Picture, $field_SlideTitle, $field_SlideDescription, $field_InternalLink, $field_removeInternalLink, $field_ExternalLink, $field_HeadlineEnabled, $field_isEnabled);
     $fields->addFieldToTab('Root.Main', $field_Position);
     $fields->addFieldToTab('Root.Main', $field_Picture);
     $fields->addFieldToTab('Root.Main', $field_SlideTitle);
     $fields->addFieldToTab('Root.Main', $field_SlideDescription);
     $fields->addFieldToTab('Root.Main', $field_HeadlineLinks);
     $fields->addFieldToTab('Root.Main', $field_InternalLink);
     $fields->addFieldToTab('Root.Main', $field_removeInternalLink);
     $fields->addFieldToTab('Root.Main', $field_ExternalLink);
     $fields->addFieldToTab('Root.Main', $field_HeadlineEnabled);
     $fields->addFieldToTab('Root.Main', $field_isEnabled);
     return $fields;
 }
 /**
  * Returns a FieldSet with which to create the CMS editing form.
  * You can use the extend() method of FieldSet to create customised forms for your other
  * data objects.
  *
  * @param Controller
  * @return FieldSet
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab('Root.Main', 'Content');
     $BackgroundImageField = new UploadField('BackgroundImage');
     $BackgroundImageField->setFolderName('homepage');
     $fields->addFieldToTab('Root.Header', $BackgroundImageField);
     $ForegroundImageField = new UploadField('ForegroundImage');
     $ForegroundImageField->setFolderName('homepage');
     $fields->addFieldToTab('Root.Header', $ForegroundImageField);
     $FocalImageLeftField = new UploadField('FocalImageLeft');
     $FocalImageLeftField->setFolderName('homepage');
     $fields->addFieldToTab('Root.Header', $FocalImageLeftField);
     $FocalImageCentreField = new UploadField('FocalImageCentre');
     $FocalImageCentreField->setFolderName('homepage');
     $fields->addFieldToTab('Root.Header', $FocalImageCentreField);
     $FocalImageRightField = new UploadField('FocalImageRight');
     $FocalImageRightField->setFolderName('homepage');
     $fields->addFieldToTab('Root.Header', $FocalImageRightField);
     $fields->addFieldToTab('Root.Header', new TextField('FirstTagLine', _t('ScoutDistrict.Homepage.FirstTagLine', 'First Line of Header')));
     $fields->addFieldToTab('Root.Header', new TextField('SecondTagLine', _t('ScoutDistrict.Homepage.SecondTagLine', 'Second Line of Header')));
     $fields->addFieldToTab('Root.Header', new TextField('TagLinkText', _t('ScoutDistrict.Homepage.TagLinkText', 'Text to show on Header Button')));
     $fields->addFieldToTab('Root.Header', new TreeDropdownField("TagLink", _t('ScoutDistrict.Homepage.TagLink', 'Where should Header Button link to'), "SiteTree"));
     $blogDropdown = new TreeDropdownField("BlogHolder", "Which blog/news page should we use", "SiteTree");
     $fields->addFieldToTab('Root.Main', $blogDropdown, 'Metadata');
     $calDropdown = new TreeDropdownField("Calendar", "Which calendar page should we use", "SiteTree");
     $fields->addFieldToTab('Root.Main', $calDropdown, 'Metadata');
     $fields->addFieldToTab('Root.Main', new TreeDropdownField("InfoPanelPage", "Select the page to use in the Info panel", "SiteTree"), 'Metadata');
     $infoImageField = new UploadField('InfoPanelImage');
     $fields->addFieldToTab('Root.Main', $infoImageField, 'Metadata');
     return $fields;
 }
 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;
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     $tabName = Config::inst()->get('Downloadable', 'tab_name');
     $tabFields = array();
     $upload = new UploadField('DownloadableFiles', '');
     $upload->setFolderName(Config::inst()->get('Downloadable', 'source_folder'));
     $tabFields[] = $upload;
     // For certain types of products, it makes sense to include downloads
     // from parent (ProductVariation) or child products (GroupedProduct)
     // NOTE: there could be better ways to do this that don't involve checking
     // for specific classes. The advantage here is that the fields show up
     // even if the product has not yet been saved or doesn't yet have a
     // parent or child products.
     $p = $this->owner instanceof ProductVariation ? $this->owner->Product() : $this->owner->Parent();
     if ($p && $p->exists() && $p->hasExtension('Downloadable')) {
         $tabFields[] = new CheckboxField('IncludeParentDownloads', 'Include downloads from parent product in purchase');
     } elseif (class_exists('GroupedProduct') && $this->owner instanceof GroupedProduct) {
         $tabFields[] = new CheckboxField('IncludeChildDownloads', 'Include downloads from child products in purchase');
     }
     // this will just add unnecessary queries slowing down the page load
     //$tabFields[] = new LiteralField('DownloadCount', '<p>Total Downloads: <strong>' . $this->owner->getDownloads()->count() . '</strong></p>');
     // Product variations don't have tabs, so we need to be able
     // to handle either case.
     if ($fields->first() instanceof TabSet) {
         $fields->addFieldsToTab("Root.{$tabName}", $tabFields);
     } else {
         $fields->push(new HeaderField('DownloadsHeader', $tabName));
         foreach ($tabFields as $f) {
             $fields->push($f);
         }
     }
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $cssFiles = new UploadField('CustomCSSFiles', _t('UserTemplatesExtension.CustomCSSFiles', "Custom CSS Files"));
        $jsFiles = new UploadField('CustomJSFiles', _t('UserTemplatesExtension.CustomJSFiles', "Custom JS Files"));
        $cssFiles->setFolderName(self::$css_folder);
        $jsFiles->setFolderName(self::$js_folder);
        $fields->removeByName('CustomCSSFiles');
        $fields->removeByName('CustomJSFiles');
        $templates = $this->fileBasedTemplates();
        if (count($templates)) {
            $fields->addFieldToTab('Root.Main', $dd = new DropdownField('ContentFile', _t('UserTemplatesExtension.CONTENT_FILE', 'File containing template'), $templates));
            $dd->setRightTitle('If selected, any Content set above will be ignored');
        } else {
            $fields->removeByName('ContentFile');
        }
        $fields->push($strict = CheckboxField::create('StrictActions', _t('UserTemplates.STRICT_ACTIONS', 'Require actions to be explicitly overridden')));
        $text = <<<DOC
   When applied to a page type that has sub-actions, an action template will be used ONLY if the action is listed below, and this main
\t   template will only be used for the 'index' action. If this is not checked, then this template will be used for ALL actions
\t   in the page it is applied to.
DOC;
        $strict->setRightTitle(_t('UserTemplates.STRICT_HELP', $text));
        $templates = DataList::create('UserTemplate')->filter(array('ID:not' => $this->ID));
        if ($templates->count()) {
            $templates = $templates->map();
            $fields->addFieldToTab('Root.Main', $kv = new KeyValueField('ActionTemplates', _t('UserTemplates.ACTION_TEMPLATES', 'Action specific templates'), array(), $templates));
            $kv->setRightTitle(_t('UserTemplates.ACTION_TEMPLATES_HELP', 'Specify an action name and select another user defined template to handle a specific action. Only used for Layout templates'));
        }
        $fields->addFieldToTab('Root.Main', $cssFiles);
        $fields->addFieldToTab('Root.Main', $jsFiles);
        return $fields;
    }
Beispiel #8
0
 function getCMSFields()
 {
     $_REQUEST["CompanyId"] = $this->ID;
     $large_logo = new UploadField('BigLogo', 'Large Company Logo');
     $large_logo->setFolderName('companies/main_logo');
     $large_logo->setAllowedFileCategories('image');
     $small_logo = new UploadField('Logo', 'Small Company Logo');
     $small_logo->setAllowedFileCategories('image');
     //logo validation rules
     $large_logo_validator = new Upload_Image_Validator();
     $large_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $large_logo_validator->setAllowedMaxImageWidth(500);
     $large_logo->setValidator($large_logo_validator);
     $small_logo_validator = new Upload_Image_Validator();
     $small_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $small_logo_validator->setAllowedMaxImageWidth(200);
     $small_logo->setValidator($small_logo_validator);
     $fields = new FieldList(new TabSet($name = "Root", new Tab($title = 'Company', new HeaderField("Company Data"), new TextField('Name', 'Company Name'), new TextField('URLSegment', 'Unique page name for this company profile (ie: company-name)'), new TextField('URL', 'Company Web Address (URL)'), $level = new DropDownField('MemberLevel', 'OpenStack Foundation Member Level', $this->dbObject('MemberLevel')->enumValues()), new ColorField("Color", "Company Color"), new CheckboxField('DisplayOnSite', 'List this company on openstack.org'), new CheckboxField('Featured', 'Include this company in featured companies area'), new LiteralField('Break', '<hr/>'), $this->canEditLogo() ? $large_logo : new LiteralField('Space', '<br/>'), $this->canEditLogo() ? $small_logo : new LiteralField('Space', '<br/>'), new TextField('Industry', 'Industry (<4 Words)'), new HtmlEditorField('Description', 'Company Description'), new HtmlEditorField('Contributions', 'How you are contributing to OpenStack (<150 words)'), new HtmlEditorField('Products', 'Products/Services Related to OpenStack (<100 words)'), new HtmlEditorField('Overview', 'Company Overview'), new TextField('CommitmentAuthor', 'Commitment Author (Optional)'), new HtmlEditorField('Commitment', "OpenStack Commitment"), new LiteralField('Break', '<hr/>'), new TextField('ContactEmail', 'Best Contact email address (optional)'))));
     $level->setEmptyString('-- Choose One --');
     if ($this->ID > 0) {
         $admin_list = $this->Administrators()->sort('ID');
         $query = $admin_list->dataQuery();
         $query->groupby('MemberID');
         $admin_list = $admin_list->setDataQuery($query);
         $config = GridFieldConfig_RelationEditor::create();
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('FirstName' => 'First Name', 'Surname' => 'Last Name', 'Email' => 'Email', 'DDLAdminSecurityGroup' => 'Security Group'));
         $admins = new GridField('Administrators', 'Company Administrators', $admin_list, $config);
         $contracts = new GridField("Contracts", "Contracts", $this->Contracts(), GridFieldConfig_RecordEditor::create(10));
         $fields->addFieldsToTab('Root.Administrators', array(new HeaderField("Companies Administrators"), $admins));
         $fields->addFieldsToTab('Root.Contracts', array(new HeaderField("Companies Contracts"), $contracts));
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $image = new UploadField('Image', _t('TestimonialPage.ImageLabel', 'Image')), 'Content');
     $image->setFolderName('Uploads/testimonials');
     return $fields;
 }
 /**
  * Returns the edit form for this admin.
  * 
  * @param type $id
  * @param type $fields
  * 
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $fields = new FieldList();
     $desc = _t('SilvercartProductImageAdmin.Description');
     $descriptionField = new SilvercartAlertInfoField('SilvercartProductImagesDescription', str_replace(PHP_EOL, '<br/>', $desc));
     $uploadField = new UploadField('SilvercartProductImages', _t('SilvercartProductImageAdmin.UploadProductImages', 'Upload product images'));
     $uploadField->setFolderName(SilvercartProductImageImporter::get_relative_upload_folder());
     $fields->push($uploadField);
     $fields->push($descriptionField);
     if (!SilvercartProductImageImporter::is_installed()) {
         $cronTitle = _t('SilvercartProductImageAdmin.CronNotInstalledTitle') . ':';
         $cron = _t('SilvercartProductImageAdmin.CronNotInstalledDescription');
         $cronjobInfoField = new SilvercartAlertDangerField('SilvercartProductImagesCronjobInfo', str_replace(PHP_EOL, '<br/>', $cron), $cronTitle);
         $fields->insertAfter('SilvercartProductImages', $cronjobInfoField);
     } elseif (SilvercartProductImageImporter::is_running()) {
         $cronTitle = _t('SilvercartProductImageAdmin.CronIsRunningTitle') . ':';
         $cron = _t('SilvercartProductImageAdmin.CronIsRunningDescription');
         $cronjobInfoField = new SilvercartAlertSuccessField('SilvercartProductImagesCronjobInfo', str_replace(PHP_EOL, '<br/>', $cron), $cronTitle);
         $fields->insertAfter('SilvercartProductImages', $cronjobInfoField);
     }
     $uploadedFiles = $this->getUploadedFiles();
     if (count($uploadedFiles) > 0) {
         $uploadedFilesInfo = '<br/>' . implode('<br/>', $uploadedFiles);
         $fileInfoField = new SilvercartAlertWarningField('SilvercartProductImagesFileInfo', $uploadedFilesInfo, _t('SilvercartProductImageAdmin.FileInfoTitle'));
         $fields->insertAfter('SilvercartProductImages', $fileInfoField);
     }
     $actions = new FieldList();
     $form = new Form($this, "EditForm", $fields, $actions);
     $form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
     $form->loadDataFrom($this->request->getVars());
     $this->extend('updateEditForm', $form);
     return $form;
 }
 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 updateCMSFields(FieldList $fields)
 {
     $avatar = new UploadField('Avatar', 'Avatar');
     $avatar->setFolderName('member/avatar');
     $fields->replaceField('Avatar', $avatar);
     $fields->removeByName('SortOrder');
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('VisaInformation', 'Visa Information'));
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('TravelSupport', 'Travel Support'));
     $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('CityIntro', 'City Intro'));
     $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('AboutTheCity', 'About The City'));
     $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('Locals', 'In The Words Of The Locals'));
     $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('GettingAround', 'Getting Around'));
     $fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLat', 'City Latitude (Map Center)'));
     $fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLng', 'City Longitude (Map Center)'));
     $fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('LocationsTextHeader', 'Intro Text'));
     $fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('OtherLocations', 'Other Locations'));
     if ($this->ID) {
         // Summit Question Categories
         $fields->addFieldsToTab('Root.Main', $venue_back = new UploadField('VenueBackgroundImage', 'Venue Background Image'));
         $venue_back->setFolderName('summits/locations');
         $venue_back->setAllowedMaxFileNumber(1);
         $venue_back->setAllowedFileCategories('image');
         $fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHero', 'Venue Background Image Author'));
         $fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHeroSource', 'Venue Background Image Author Url'));
         $fields->addFieldsToTab('Root.CityInfo', $about_back = new UploadField('AboutTheCityBackgroundImage', 'About The City Background Image'));
         $about_back->setFolderName('summits/location/about');
         $about_back->setAllowedMaxFileNumber(1);
         $about_back->setAllowedFileCategories('image');
         $fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHero', 'About The City Background Image Author'));
         $fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHeroSource', 'About The City Background Image Author Source Url'));
     }
     $fields->addFieldToTab('Root.Main', new TextField('VenueTitleText', 'Venue Title Text'));
     $fields->addFieldToTab('Root.Main', new TextField('AirportsTitle', 'Airports Title'));
     $fields->addFieldToTab('Root.Main', new TextField('AirportsSubTitle', 'Airports SubTitle'));
     $fields->addFieldToTab('Root.Main', new TextField('CampusGraphic', 'URL of image of campus graphic'));
     return $fields;
 }
 public function getCMSFields()
 {
     $ScrollDirectionOptions = array("up", "down", "left", "right");
     $ScrollEasingOptions = array("Elastic", "Linear");
     $ScrollFx = array("none", "scroll", "directscroll", "fade", "crossfade", "cover", "cover-fade", "uncover", "uncover-fade");
     $GenAlignment = array("Left", "Center", "Right");
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Photos', $uploadField = new UploadField($name = 'Images', $title = 'Upload one or more images (max 10 at a time)'));
     $fields->addFieldToTab('Root.Settings.General', new CheckBoxField('GenAutoStart', 'Auto Start Carousel?'));
     $fields->addFieldToTab('Root.Settings.General', new CheckBoxField('GenCarouselCircular', 'Make Carousel Circular?'));
     $fields->addFieldToTab('Root.Settings.General', new CheckBoxField('GenCarouselInfinite', 'Make Carousel Infinite?'));
     $fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemNumberToStart', 'Which item should start carousel (0 for random)'));
     $fields->addFieldToTab('Root.Settings.General', new NumericField('GenDurationBeforeStart', 'Delay before carousel scrolls for first time (millisec)'));
     $fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemsMin', 'Items Viewable Minimum'));
     $fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemsMax', 'Items Viewable Maximum'));
     $fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemWidth', 'Set image width (use 0 for no scaling)'));
     $fields->addFieldToTab('Root.Settings.General', new NumericField('GenItemHeight', 'Set image Height (use 0 for no scaling)'));
     $fields->addFieldToTab('Root.Settings.General', new DropDownField("GenAlignment", "Slide Alignment?", $GenAlignment));
     $fields->addFieldToTab('Root.Settings.Scroll', new DropDownField("ScrollDirection", "What direction to move the carousel?", $ScrollDirectionOptions));
     $fields->addFieldToTab('Root.Settings.Scroll', new DropDownField("ScrollFx", "Slide Transition type?", $ScrollFx));
     $fields->addFieldToTab('Root.Settings.Scroll', new DropDownField("ScrollEasing", "Slide Easing Option", $ScrollEasingOptions));
     $fields->addFieldToTab('Root.Settings.Scroll', new NumericField('ScrollNumItems', 'Scroll number of items (0 will scroll none)'));
     $fields->addFieldToTab('Root.Settings.Scroll', new NumericField('ScrollDuration', 'Scroll Duration Time (millisec)'));
     $fields->addFieldToTab('Root.Settings.Scroll', new CheckBoxField('ScrollPauseOnHover', 'Pause the scrolling when mouse is hovering?'));
     $fields->addFieldToTab('Root.Settings.Swipe', new CheckBoxField('SwipeOnMouse', 'scroll via dragging (on non-touch-devices only)'));
     $fields->addFieldToTab('Root.Settings.Swipe', new CheckBoxField('SwipeOnTouch', 'scroll via swiping gestures (on touch-devices only)'));
     $uploadField->setFolderName('slides');
     $uploadField->setAllowedMaxFileNumber(10);
     return $fields;
 }
 /**
  * @return array
  */
 protected function getProfileFields()
 {
     //TODO gender enum
     $postcode = new RegexTextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $postcode->setRegex($this->postcodeRegex);
     $fields = array(new HeaderField('ProfileHeader', _t('Profileable.PROFILE', 'Profile')), new OptionsetField('Gender', _t('Profileable.GENDER', 'Gender'), array('m' => _t('Profileable.MASCULINE', 'masculine'), 'f' => _t('Profileable.FEMININE', 'feminine'), 'u' => _t('Profileable.UNKNOWN', 'unknown')), 'u'), new TextField('AcademicTitle', _t('Profileable.ACADEMICTITLE', 'Name')), new TextField('ProfileName', _t('Profileable.NAME', 'Name')), new TextField('Company', _t('Profileable.COMPANY', 'Company')), new TextField('Position', _t('Profileable.POSITION', 'Position')), new TextField('Address', _t('Addressable.ADDRESS', 'Address')), new TextField('AddressAddition', _t('Profileable.ADDRESSADDITION', 'Address Addition')), $postcode, new TextField('City', _t('Profileable.CITY', 'City')), new TextField('Suburb', _t('Addressable.SUBURB', 'Suburb')));
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields[] = new DropdownField('State', $label, $this->allowedStates);
     } elseif (!is_string($this->allowedStates)) {
         $fields[] = new TextField('State', $label);
     }
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $fields[] = new DropdownField('Country', $label, $this->allowedCountries);
     } elseif (!is_string($this->allowedCountries)) {
         $fields[] = new CountryDropdownField('Country', $label);
     }
     $fields[] = new TextField('Phone', _t('Profileable.PHONE', 'Phone'));
     $fields[] = new TextField('Fax', _t('Profileable.FAX', 'Fax'));
     $fields[] = new EmailField('ProfileEmail', _t('Profileable.EMAIL', 'E-Mail'));
     $fields[] = new TextField('Www', _t('Profileable.WWW', 'Homepage'));
     $profileUpload = new UploadField('ProfilePicture', _t('Profileable.PROFILEPICTURE', 'Profile Picture'));
     $profileUpload->allowedExtensions = self::$ProfilePictureAllowedTypes;
     $profileUpload->setFolderName(self::$ProfilePictureFolder);
     $profileUpload->setConfig('allowedMaxFileNumber', 1);
     $fields[] = $profileUpload;
     $fields[] = new TextareaField('Description', _t('Profileable.DESCRIPTION', 'Description'));
     return $fields;
 }
 public static function getUploadForm($file, $parentClass, $parentId, $parentField)
 {
     if ($file instanceof File && class_exists($parentClass) && is_subclass_of($parentClass, "DataObject")) {
         $parent = $parentClass::get()->byId($parentId);
         $fields = new FieldList($uploadField = new UploadField($parentField, 'Upload', $parent));
         $uploadField->setCanAttachExisting(false);
         // Block access to Silverstripe assets library
         $uploadField->setCanPreviewFolder(false);
         // Don't show target filesystem folder on upload field
         $uploadField->relationAutoSetting = false;
         // Prevents the form thinking the GalleryPage is the underlying object
         $uploadField->setFolderName('Address Book');
         $uploadField->setAllowedMaxFileNumber(1);
         if ($file instanceof Image) {
             $uploadField->setAllowedFileCategories('image');
         }
         $actions = new FieldList(new FormAction('submit', 'Save'));
         $from = new Form(Controller::curr(), 'feFileUploadForm', $fields, $actions, null);
         $urlParams = array('feclass' => $parentClass, 'fefield' => $parentField, 'feid' => $parentId, 'filesUpload' => true, 'fefileid' => $file->ID, 'fefileclass' => $file->ClassName);
         //   feclass: parentClass,
         //                        fefield: parentField,
         //                        feid: parentId,
         //                        feisUpload: true,
         //                        value: "{feclass: " + objClass + ",feid: " + objId + "}"
         //            echo http_build_query($urlParams) . "\n";
         $from->setFormAction('home/feFileUploadForm?' . http_build_query($urlParams));
         return $from;
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $badge = new UploadField('Badge', _t('ScoutGroup.BADGE', 'Badge'));
     $badge->setFolderName('group/badge');
     $badge->setRightTitle(_t('ScoutGroup.BADGE_HELP', 'The badge/logo/emblem of the Group'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Info', $badge);
     $necker = new UploadField('Necker', _t('ScoutGroup.NECKER', 'Necker'));
     $necker->setFolderName('group/necker');
     $necker->setRightTitle(_t('ScoutGroup.NECKER_HELP', 'The neckerchief the Group'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Info', $necker);
     $fields->addFieldToTab('Root.Info', new TextField('NeckerDescription', _t('ScoutGroup.NECKERDESCRIPTION', 'Neckerchief Description')));
     $fields->addFieldToTab('Root.Social', new TextField('TwitterUser', _t('ScoutGroup.TWITTERUSER', 'Twitter User')));
     $fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('ScoutGroup.FACEBOOKPAGE', 'Facebook Page')));
     $fields->addFieldToTab('Root.Social', new TextField('GooglePage', _t('ScoutGroup.GOOGLEPAGE', 'Google Page')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address1', _t('ScoutGroup.ADDRESS1', 'Address 1')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address2', _t('ScoutGroup.ADDRESS2', 'Address 2')));
     $fields->addFieldToTab('Root.Contact', new TextField('Address3', _t('ScoutGroup.ADDRESS3', 'Address 3')));
     $fields->addFieldToTab('Root.Contact', new TextField('Town', _t('ScoutGroup.TOWN', 'Town')));
     $fields->addFieldToTab('Root.Contact', new TextField('Postcode', _t('ScoutGroup.POSTCODE', 'Post Code')));
     $fields->addFieldToTab('Root.Contact', new TextField('Phone', _t('ScoutGroup.PHONE', 'Phone #')));
     $fields->addFieldToTab('Root.Contact', new TextField('Email', _t('ScoutGroup.EMAIL', 'Email Address')));
     $fields->addFieldToTab('Root.Contact', new TextField('CharityNumber', _t('ScoutGroup.CHARITYNUMBER', 'CharityNumber')));
     $sectionGridConfig = new GridFieldConfig_RecordEditor();
     $sectionGridConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $sectionGrid = new GridField('Sections', 'Sections', $this->Sections(), $sectionGridConfig);
     $fields->addFieldToTab('Root.Sections', $sectionGrid);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
Beispiel #18
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root.Main", $uploadField = new UploadField("TestimonialImage", "Testimonial Image"));
     $uploadField->setFolderName('Testimonials');
     $uploadField->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     return $fields;
 }
Beispiel #19
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $image = new UploadField('ProductImage', 'Upload an image to use for this product (max 1 in total)'), 'Price');
     $image->setFolderName('products');
     $image->setAllowedFileCategories('image');
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Images', $images = new UploadField('Images'));
     $images->setFolderName('Galleries/' . $this->Title);
     $fields->addFieldToTab('Root.Main', new UploadField('CoverImage', 'Cover Image for Album'), 'Content');
     return $fields;
 }
Beispiel #21
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Image Upload', $uploadHeroField = new UploadField('HeroImage', 'Please upload an image to be used as your Hero Image.  Remember, this is usually the first thing your visitors will see.'));
     $uploadHeroField->setFolderName('Hero');
     $uploadHeroField->setAllowedFileCategories('image');
     return $fields;
 }
Beispiel #22
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Image Upload', $uploadHeroField = new UploadField('BackgroundImage', 'Please upload an image to be used as the Background Image for your Text Slice.'));
     $uploadHeroField->setFolderName('TextSlice');
     $uploadHeroField->setAllowedFileCategories('image');
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new TextField('Name', 'Name of this layer'));
     $fields->addFieldToTab('Root.Main', $uf = new UploadField('DefaultIcon', _t('PointsOfInterest.ICON', 'Default Icon')));
     $fields->addFieldToTab('Root.Main', new CheckboxField('ShowGuideMarkers', 'Show grey guide markers of others points in this layer'));
     $uf->setFolderName('mapicons');
     return $fields;
 }
Beispiel #24
0
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $img = new UploadField('Banner', 'Banner Image');
     $img->setFolderName('Banners');
     $f->addFieldToTab('Root.Main', $img, 'Content');
     $f->addFieldToTab('Root.Main', new HTMLEditorField('BannerText', 'Banner Text'), 'Content');
     return $f;
 }
 function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldToTab('Root.Main', $image = new UploadField('Image'));
     $image->setFolderName('Uploads/portfolio');
     $fields->addFieldToTab('Root.Main', new CheckboxField('TextRight', 'Display the content on the right hand side'));
     $fields->addFieldToTab('Root.Main', new HtmlEditorField('Content'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add($upload_0 = new UploadField('Image', 'Photo'));
     $upload_0->setFolderName('summits/overview/networking');
     $upload_0->setAllowedMaxFileNumber(1);
     $upload_0->setAllowedFileCategories('image');
     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;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('ParentID');
     $fields->removeByName('Sort');
     $fields->addFieldsToTab('Root.Main', new HtmlEditorField('Content', 'Content'));
     $fields->addFieldToTab('Root.Main', $uploadField = new UploadField($name = 'Image', $title = 'Upload a timeline image:'));
     $uploadField->setFolderName('timelineImages');
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList(new TextField("Title", "Title"), new HTMLEditorField("Description", "Description"), $mp3file = new UploadField("MP3File", "MP3 File"), $oggfile = new UploadField("OGGFile", "OGG File"));
     $mp3file->setAllowedExtensions(array('mp3'));
     $oggfile->setAllowedExtensions(array('ogg'));
     $mp3file->setFolderName('Uploads/audio');
     $oggfile->setFolderName('Uploads/audio');
     $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;
 }