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;
 }
 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->Parent()->ClassName == "SectionOverviewPage") {
         $summaryfield = new TextareaField('SummaryText', 'Section Summary Text');
         $summaryfield->setRightTitle('Displayed on this page\'s section overview parent page (' . $this->owner->Parent()->MenuTitle . '), if left blank, uses first paragraph of the Content.');
         $fields->addFieldToTab("Root.Main", $summaryfield, 'Metadata');
     }
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $dateTimeField = new DatetimeField('Date', $this->fieldLabel('Date')), 'Content');
     $dateTimeField->getDateField()->setConfig('showcalendar', true);
     $fields->addfieldToTab('Root.Main', $abstractField = new TextareaField('Abstract', $this->fieldLabel('Abstract')), 'Content');
     $abstractField->setAttribute('maxlength', '160');
     $abstractField->setRightTitle(_t('DateUpdatePage.AbstractDesc', 'The abstract is used as a summary on the listing pages. It is limited to 160 characters.'));
     $abstractField->setRows(6);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('SortOrder');
     $title = new TextField('Title', _t('ScoutGroup.Section.NAME', "Name of Section"));
     $fields->addFieldToTab('Root.Main', $title);
     $type = new DropdownField('Type', 'Type of Section', array('beavers' => _t('ScoutDistrict.Enum.BEAVERS', 'Beavers'), 'cubs' => _t('ScoutDistrict.Enum.CUBS', 'Cubs'), 'scouts' => _t('ScoutDistrict.Enum.SCOUTS', 'Scouts'), 'explorer' => _t('ScoutDistrict.Enum.EXPLORER', 'Explorer'), 'network' => _t('ScoutDistrict.Enum.NETWORK', 'Network')));
     $fields->addFieldToTab('Root.Main', $type);
     $info = new TextareaField('Info', _t('ScoutGroup.Section.Info', "Info"));
     $info->setRightTitle(_t('ScoutDistrict.Section.INFO_HELP', 'Brief info about the section and meetings'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Main', $info);
     $fields->removeByName('GroupID');
     return $fields;
 }
Пример #5
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     /* =========================================
        * Settings
        =========================================*/
     /* -----------------------------------------
         * Contact Page
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Main', new HeaderField('Settings'), 'Content');
     $fields->addFieldToTab('Root.Main', $mailTo = new TextField('MailTo', _t('ContactPage.MailToLabel', 'Email')), 'Content');
     $mailTo->setRightTitle('Choose an email address for the contact page to send to');
     $fields->addFieldToTab('Root.Main', $mailCC = new TextField('MailCC', _t('ContactPage.MailCCLabel', 'CC')), 'Content');
     $mailCC->setRightTitle('Choose an email, or emails to CC (separate emails with a comma and no space e.g: email1@website.com,email2@website.com)');
     $fields->addFieldToTab('Root.Main', $submissionText = new TextareaField('SubmitText', _t('ContactPage.SubmitTextLabel', 'Submission Text')), 'Content');
     $submissionText->setRightTitle('Text for contact form submission once the email has been sent i.e "Thank you for your enquiry"');
     /* -----------------------------------------
         * Google Map
        ------------------------------------------*/
     $fields->addFieldToTab('Root.Map', new Textfield('GoogleAPI', _t('ContactPage.GoogleAPILabel', 'Maps API (Optional)')));
     $fields->addFieldToTab('Root.Map', new Textfield('Latitude', _t('ContactPage.LatitudeLabel', 'Latitude')));
     $fields->addFieldToTab('Root.Map', new Textfield('Longitude', _t('ContactPage.LongitudeLabel', 'Longitude')));
     $fields->addFieldToTab('Root.Map', $mapZoom = new Textfield('MapZoom', _t('ContactPage.MapZoomLabel', 'Zoom')));
     $mapZoom->setRightTitle(_t('ContactPage.MapZoomTitle', 'Zoom level: 0-22 - The higher the number the more zoomed in the map will be.'));
     $fields->addFieldToTab('Root.Map', new ColorField('MapColor', _t('ContactPage.MapColorLabel', 'Map Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', new ColorField('WaterColor', _t('ContactPage.WaterColorLabel', 'Water Colour (Optional)')));
     $fields->addFieldToTab('Root.Map', new CheckboxField('MapMarker', _t('ContactPage.MapMarkerLabel', 'Show map marker')));
     /* -----------------------------------------
         * Info Windows
        ------------------------------------------*/
     $config = GridFieldConfig_RelationEditor::create(10);
     $config->addComponent(new GridFieldDeleteAction());
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title'));
     $gridField = new GridField('InfoWindows', 'Markers', $this->owner->InfoWindows(), $config);
     $fields->addFieldToTab('Root.MapMarkers', $gridField);
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('Metadata');
     /* split keywords onto new lines for easy editing */
     $this->owner->setField('MetaKeywords', $this->keywordsOnNewLine());
     $advancedFields = array();
     $ExtraMetaFields = array();
     array_push($advancedFields, new HeaderField('SeoHdr', 'Search Engine Optimization', 2));
     if (!$this->owner->canCreate()) {
         $fields->removeByName('URLSegment');
         $fields->removeByName('MenuTitle');
         $fields->removeByName('Title');
         array_push($advancedFields, new LiteralField('TitleDescription', '<p class="metatitle" id="Form_EditForm_MetaTitleStats"></p>'));
         array_push($advancedFields, new TextField('MetaTitle', 'Meta Title', $this->owner->Title));
     }
     array_push($advancedFields, new LiteralField('StatsDescription', '<p class="metastats" id="Form_EditForm_MetaDescriptionStats"></p>'));
     array_push($advancedFields, $metaFieldDesc = new TextareaField('MetaDescription', 'Meta Description'));
     /* add class to prevent newlines */
     $metaFieldDesc->addExtraClass('noenter');
     $metaFieldDesc->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results."));
     array_push($ExtraMetaFields, $metaKeywordsDesc = new TextareaField('MetaKeywords', 'Meta Keywords'));
     $metaKeywordsDesc->setRightTitle(_t('SiteTree.METAKEYWHELP', "Keywords are now ignored by most of the major search engines."));
     array_push($ExtraMetaFields, $metaFieldExtra = new TextareaField("ExtraMeta", 'Custom Meta Tags'));
     $metaFieldExtra->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;"));
     $MetaStuff = ToggleCompositeField::create('MetaStuff', 'Additional Metadata', $ExtraMetaFields)->setHeadingLevel(5);
     array_push($advancedFields, $MetaStuff);
     if ($depTab = $fields->fieldByName('Root.Dependent')) {
         $dependencyArr = array();
         foreach ($depTab as $item) {
             array_push($dependencyArr, $item);
         }
         $dependencyPages = ToggleCompositeField::create('Dependencies', $depTab->Title(), $dependencyArr)->setHeadingLevel(5);
         array_push($advancedFields, $dependencyPages);
         $fields->removeByName('Dependent');
     }
     $fields->addFieldsToTab('Root.Advanced', $advancedFields);
     $seoTab = $fields->findOrMakeTab('Root.Advanced');
     $seoTab->addExtraClass('tab-to-right');
     return $fields;
 }
Пример #7
0
 /**
  * Returns a FieldList with which to create the main editing form.
  *
  * You can override this in your child classes to add extra fields - first get the parent fields using
  * parent::getCMSFields(), then use addFieldToTab() on the FieldList.
  *
  * See {@link getSettingsFields()} for a different set of fields concerned with configuration aspects on the record,
  * e.g. access control.
  *
  * @return FieldList The fields to be displayed in the CMS
  */
 public function getCMSFields()
 {
     require_once "forms/Form.php";
     // Status / message
     // Create a status message for multiple parents
     if ($this->ID && is_numeric($this->ID)) {
         $linkedPages = $this->VirtualPages();
         $parentPageLinks = array();
         if ($linkedPages->Count() > 0) {
             foreach ($linkedPages as $linkedPage) {
                 $parentPage = $linkedPage->Parent;
                 if ($parentPage) {
                     if ($parentPage->ID) {
                         $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/pages/edit/show/{$linkedPage->ID}\">{$parentPage->Title}</a>";
                     } else {
                         $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/pages/edit/show/{$linkedPage->ID}\">" . _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . "</a>";
                     }
                 }
             }
             $lastParent = array_pop($parentPageLinks);
             $parentList = "'{$lastParent}'";
             if (count($parentPageLinks) > 0) {
                 $parentList = "'" . implode("', '", $parentPageLinks) . "' and " . $parentList;
             }
             $statusMessage[] = _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the {title} sections.", array('title' => $parentList));
         }
     }
     if ($this->HasBrokenLink || $this->HasBrokenFile) {
         $statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links.");
     }
     $dependentNote = '';
     $dependentTable = new LiteralField('DependentNote', '<p></p>');
     // Create a table for showing pages linked to this one
     $dependentPages = $this->DependentPages();
     $dependentPagesCount = $dependentPages->Count();
     if ($dependentPagesCount) {
         $dependentColumns = array('Title' => $this->fieldLabel('Title'), 'AbsoluteLink' => _t('SiteTree.DependtPageColumnURL', 'URL'), 'DependentLinkType' => _t('SiteTree.DependtPageColumnLinkType', 'Link type'));
         if (class_exists('Subsite')) {
             $dependentColumns['Subsite.Title'] = singleton('Subsite')->i18n_singular_name();
         }
         $dependentNote = new LiteralField('DependentNote', '<p>' . _t('SiteTree.DEPENDENT_NOTE', 'The following pages depend on this page. This includes virtual pages, redirector pages, and pages with content links.') . '</p>');
         $dependentTable = GridField::create('DependentPages', false, $dependentPages);
         $dependentTable->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields($dependentColumns)->setFieldFormatting(array('Title' => function ($value, &$item) {
             return sprintf('<a href="admin/pages/edit/show/%d">%s</a>', (int) $item->ID, Convert::raw2xml($item->Title));
         }, 'AbsoluteLink' => function ($value, &$item) {
             return sprintf('<a href="%s" target="_blank">%s</a>', Convert::raw2xml($value), Convert::raw2xml($value));
         }));
     }
     $baseLink = Controller::join_links(Director::absoluteBaseURL(), self::config()->nested_urls && $this->ParentID ? $this->Parent()->RelativeLink(true) : null);
     $urlsegment = new SiteTreeURLSegmentField("URLSegment", $this->fieldLabel('URLSegment'));
     $urlsegment->setURLPrefix($baseLink);
     $helpText = self::config()->nested_urls && count($this->Children()) ? $this->fieldLabel('LinkChangeNote') : '';
     if (!Config::inst()->get('URLSegmentFilter', 'default_allow_multibyte')) {
         $helpText .= $helpText ? '<br />' : '';
         $helpText .= _t('SiteTreeURLSegmentField.HelpChars', ' Special characters are automatically converted or removed.');
     }
     $urlsegment->setHelpText($helpText);
     $fields = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main', new TextField("Title", $this->fieldLabel('Title')), $urlsegment, new TextField("MenuTitle", $this->fieldLabel('MenuTitle')), $htmlField = new HtmlEditorField("Content", _t('SiteTree.HTMLEDITORTITLE', "Content", 'HTML editor title')), ToggleCompositeField::create('Metadata', _t('SiteTree.MetadataToggle', 'Metadata'), array($metaFieldDesc = new TextareaField("MetaDescription", $this->fieldLabel('MetaDescription')), $metaFieldExtra = new TextareaField("ExtraMeta", $this->fieldLabel('ExtraMeta'))))->setHeadingLevel(4)), $tabDependent = new Tab('Dependent', $dependentNote, $dependentTable)));
     $htmlField->addExtraClass('stacked');
     // Help text for MetaData on page content editor
     $metaFieldDesc->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results (although it will not influence their ranking)."))->addExtraClass('help');
     $metaFieldExtra->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;"))->addExtraClass('help');
     // Conditional dependent pages tab
     if ($dependentPagesCount) {
         $tabDependent->setTitle(_t('SiteTree.TABDEPENDENT', "Dependent pages") . " ({$dependentPagesCount})");
     } else {
         $fields->removeFieldFromTab('Root', 'Dependent');
     }
     $tabMain->setTitle(_t('SiteTree.TABCONTENT', "Main Content"));
     if ($this->ObsoleteClassName) {
         $obsoleteWarning = _t('SiteTree.OBSOLETECLASS', "This page is of obsolete type {type}. Saving will reset its type and you may lose data", array('type' => $this->ObsoleteClassName));
         $fields->addFieldToTab("Root.Main", new LiteralField("ObsoleteWarningHeader", "<p class=\"message warning\">{$obsoleteWarning}</p>"), "Title");
     }
     if (file_exists(BASE_PATH . '/install.php')) {
         $fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader", "<p class=\"message warning\">" . _t("SiteTree.REMOVE_INSTALL_WARNING", "Warning: You should remove install.php from this SilverStripe install for security reasons.") . "</p>"), "Title");
     }
     // Backwards compat: Rewrite nested "Content" tabs to toplevel
     $fields->setTabPathRewrites(array('/^Root\\.Content\\.Main$/' => 'Root.Main', '/^Root\\.Content\\.([^.]+)$/' => 'Root.\\1'));
     if (self::$runCMSFieldsExtensions) {
         $this->extend('updateCMSFields', $fields);
     }
     return $fields;
 }