/**
  * 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;
 }
    function updateCMSFields(FieldList $fields)
    {
        $linkToManagerForPages = Config::inst()->get("MetaTagCMSControlPages", "url_segment") . '/';
        $linkToManagerForFiles = Config::inst()->get("MetaTagCMSControlFiles", "url_segment") . '/';
        $fields->addFieldToTab('Root.SearchEngines', new TabSet('Options', new Tab('Help', new LiteralField('HelpExplanation', '
						<h3>Search Engine - How to use ...</h3>
						<p>
							To improve your visibility with search engines, we provide a number of tools here.
							Improving your rankings with Search Engines can work as follows:
						</p>
						<ul>
							<li> - decide on a few keywords for each page - basically the words that people would search for on Google (e.g. <i>feed elderly cat</i>))</li>
							<li> - ensure that these words are seen in strategic places on this page</li>
							<li> - create links to the page from <i>third-party</i> websites</li>
						</ul>
						<p>
							<br />The tools provided here help you to achieve these goals by ensuring:
						</p>
						<ul>
							<li> - easy addition of keywords to key field (navigation label, meta description)</li>
							<li> - you can adjust the file image names and descriptions to match the keywords</li>
						</ul>
						')), new Tab('Menus', new LiteralField('MenuTitleExplanation', '<h3>Menu Title</h3><p>To improve consistency, you can set the menu title to automatically match the page title for any page on the site. </p>'), new CheckboxField('UpdateMenuTitle', 'Automatically update the Menu Title / Navigation Label to match the Page Title?')), new Tab('Meta Title', new TextField('PrependToMetaTitle', 'Prepend (add in front) of Meta Title'), new TextField('AppendToMetaTitle', 'Append (add at the end) of Meta Title')), new Tab('Meta Description', new LiteralField('MetaDescriptionExplanation', '<h3>&ldquo;Meta Description&rdquo;: Summary for Search Engines</h3><p>The Meta Description is not visible on the website itself. However, it is picked up by search engines like google.  They display it as the short blurb underneath the link to your pages. It will not get you much higher in the rankings, but it will entice people to click on your link.</p>'), new CheckboxField('UpdateMetaDescription', 'Automatically fill every meta description on every Page (using the first ' . Config::inst()->get("MetaTagsContentControllerEXT", "meta_desc_length") . ' words of the Page Content field).')), new Tab('Other Meta Data', new LiteralField('MetaOtherExplanation', '<h3>Other &ldquo;Meta Data&rdquo;: More hidden information about the page</h3><p>You can add some other <i>hidden</i> information to your pages - which can be picked up by Search Engines and other automated readers decyphering your website.</p>'), new TextField('MetaDataCountry', 'Country'), new TextField('MetaDataCopyright', 'Content Copyright'), new TextField('MetaDataDesign', 'Design provided by ...'), new TextField('MetaDataCoding', 'Website Coding carried out by ...'), new TextareaField('ExtraMeta', 'Custom Meta Tags (advanced users only)')), new Tab('Pages', new LiteralField('LinkToManagerHeaderForPages', "<p><a href=\"{$linkToManagerForPages}\" target=\"_blank\">Review and Edit</a> pages in a new window ...</p>")), new Tab('Files', new LiteralField('LinkToManagerHeaderForFiles', "<p><a href=\"{$linkToManagerForFiles}\" target=\"_blank\">Review and Edit</a> files in a new window ...</p>"))));
        $fields->addFieldToTab("Root.Icons", $uploadField = new UploadField('Favicon', 'Icon'));
        $uploadField->setAllowedExtensions(array("png"));
        $uploadField->setRightTitle("Upload a 480px wide x 480px high non-transparent PNG file. Ask your developer for help if unsure. Icons can also be loaded onto the server directly into the /themes/mytheme/icons/ folder and as a favicon.ico in the root directory.");
        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;
 }
 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 updateCMSFields(FieldList $fields)
 {
     $avatar = new UploadField('Avatar', 'Avatar');
     $avatar->setFolderName('member/avatar');
     $fields->replaceField('Avatar', $avatar);
     $fields->removeByName('SortOrder');
 }
 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;
     }
 }
 /**
  * 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 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;
 }
示例#9
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;
 }
示例#10
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;
 }
 /**
  * @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 = 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 = 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;
 }
 public function updateCMSFields(FieldList $fields)
 {
     // Main
     $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.Main', $showTitle = new CheckboxField('ShowTitleInHeader', 'Show title in header'), 'Tagline');
     /* @var $logoField UploadField */
     $logoField = new UploadField('Logo', 'Large logo, to appear in the header.');
     $logoField->setAllowedFileCategories('image');
     $logoField->setConfig('allowedMaxFileNumber', 1);
     $mobileLogoField = new UploadField('LogoMobile', 'Mobile logo, to appear in the header.');
     $mobileLogoField->setAllowedFileCategories('image');
     $mobileLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Main', $logoField);
     $fields->addFieldToTab('Root.Main', $this->getLogoOffSetField());
     $fields->addFieldToTab('Root.Main', $mobileLogoField);
     $fields->addFieldToTab('Root.Main', $this->getMobileLogoOffSetField());
     //Footer
     $fields->addFieldToTab('Root.Footer', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.'));
     $footerLogoField->setAllowedFileCategories('image');
     $footerLogoField->setConfig('allowedMaxFileNumber', 1);
     $fields->addFieldToTab('Root.Footer', $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.Footer', new TextField('FooterLogoDescription', 'Footer Logo description'));
     $fields->addFieldToTab('Root.Footer', new TreeMultiselectField('FooterLinks', 'Footer Links', 'SiteTree'));
     $fields->addFieldToTab('Root.Footer', new TextField('Copyright', 'Copyright'));
 }
示例#15
0
 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 (empty($hasOneClass)) {
         return null;
     }
     $hasOneSingleton = singleton($hasOneClass);
     if ($hasOneSingleton instanceof File) {
         $field = new UploadField($relationName, $title);
         if ($hasOneSingleton instanceof Image) {
             $field->setAllowedFileCategories('image/supported');
         }
         return $field;
     }
     // Build selector / numeric field
     $titleField = $hasOneSingleton->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 updateCMSFields(FieldList $fields)
 {
     /* -----------------------------------------
         * Color Picker
        ------------------------------------------*/
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     /* =========================================
        * Settings
        =========================================*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', new TabSet('Settings'));
     }
     /* -----------------------------------------
         * Images
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Images', 'Images');
     $fields->addFieldsToTab('Root.Settings.Images', array($logo = new UploadField('LogoImage', _t('BoilerplateConfig.LogoImageLabel', 'Logo')), $favicon = new UploadField('Favicon', _t('BoilerplateConfig.FaviconLabel', 'Favicon'))));
     $logo->setRightTitle('Choose an Image For Your Logo');
     $favicon->setRightTitle('Choose an Image For Your Favicon (16x16)');
     /* -----------------------------------------
         * Company Details
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Details', 'Details');
     $fields->addFieldsToTab('Root.Settings.Details', array(new Textfield('Phone', _t('BoilerplateConfig.PhoneLabel', 'Phone Number')), new Textfield('Email', _t('BoilerplateConfig.EmailLabel', 'Public Email Address')), $PhysicalAddress = new HtmlEditorField('PhysicalAddress', _t('BoilerplateConfig.PhysicalAddressLabel', 'Physical Address'))));
     $PhysicalAddress->setRows(3);
     /* -----------------------------------------
         * Tracking Code
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.TrackingCode', 'Tracking Code');
     $fields->addFieldsToTab('Root.Settings.TrackingCode', array($trackingCode = new TextareaField('TrackingCode', _t('BoilerplateConfig.TrackingCodeLabel', 'Tracking Code'))));
     $trackingCode->setRows(20);
 }
 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 = 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;
 }
    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;
    }
 /**
  * @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;
 }
示例#21
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;
 }
 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);
 }
 /**
  * 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;
 }
示例#25
0
 public function __construct($controller, $name)
 {
     $member = Member::currentUser();
     $requiredFields = null;
     if ($member && $member->exists()) {
         $fields = new FieldList();
         $fields->add(new HeaderField('AddressHeader', _t('Addressable.ADDRESSHEADER', 'Avatar / Description')));
         $uploadField = new UploadField('Avatar', 'Select avatar');
         $uploadField->setCanAttachExisting(false);
         $comment = new TextareaField('Description', 'Description*');
         $email = EmailField::create('Email', _t('CheckoutField.EMAIL', 'Email'));
         $fields->add($uploadField);
         $fields->add($comment);
         $fields->add($email);
         $requiredFields = $member->getValidator();
         $requiredFields->addRequiredField('Avatar', 'Description', 'Email');
     } else {
         $fields = new FieldList();
     }
     if (get_class($controller) == 'ChefAccountPage_Controller') {
         $actions = new FieldList(new FormAction('submit', _t('MemberForm.SAVE', 'Save Changes')));
     }
     parent::__construct($controller, $name, $fields, $actions, $requiredFields);
     if ($member) {
         $member->Password = "";
         //prevents password field from being populated with encrypted password data
         $this->loadDataFrom($member);
     }
     if ($record = $controller->data()) {
         $record->extend('updateChefAccountForm', $fields, $actions, $requiredFields);
     }
 }
 /**
  * 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;
 }
示例#27
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;
 }
示例#28
0
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->addFieldToTab('Root.Main', new TextField('Link', 'Slide Link'));
     $f->addFieldToTab('Root.Main', $upload = new UploadField('Slide', 'Slide File'));
     $upload->setAllowedMaxFileNumber(1);
     return $f;
 }
示例#29
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;
 }
示例#30
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;
 }