public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('eventmanagement/javascript/event-ticket-cms.js');
     $fields->removeByName('EventID');
     $fields->removeByName('StartType');
     $fields->removeByName('StartDate');
     $fields->removeByName('StartDays');
     $fields->removeByName('StartHours');
     $fields->removeByName('StartMins');
     $fields->removeByName('EndType');
     $fields->removeByName('EndDate');
     $fields->removeByName('EndDays');
     $fields->removeByName('EndHours');
     $fields->removeByName('EndMins');
     if (class_exists('Payment')) {
         $fields->insertBefore(new OptionSetField('Type', 'Ticket type', array('Free' => 'Free ticket', 'Price' => 'Fixed price ticket')), 'Price');
     } else {
         $fields->removeByName('Type');
         $fields->removeByName('Price');
     }
     foreach (array('Start', 'End') as $type) {
         $fields->addFieldsToTab('Root.Main', array(new OptionSetField("{$type}Type", "{$type} sales at", array('Date' => 'A specific date and time', 'TimeBefore' => 'A time before the event starts')), $dateTime = new DatetimeField("{$type}Date", ''), $before = new FieldGroup("{$type}Offset", new NumericField("{$type}Days", 'Days'), new NumericField("{$type}Hours", 'Hours'), new NumericField("{$type}Mins", 'Minutes'))));
         $before->setName("{$type}Offset");
         $before->setTitle(' ');
         $dateTime->getDateField()->setConfig('showcalendar', true);
         $dateTime->getTimeField()->setConfig('showdropdown', true);
     }
     $fields->addFieldsToTab('Root.Advanced', array(new TextareaField('Description', 'Description'), new NumericField('MinTickets', 'Minimum tickets per order'), new NumericField('MaxTickets', 'Maximum tickets per order')));
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $options = new FieldGroup(new CheckboxField('CleanOnSave', _t('TidyContent.CLEAN_ON_SAVE', 'Clean this content whenever the page is saved')), new CheckboxField('TidyHtml', _t('TidyContent.TIDY_HTML', 'Tidy HTML')), new CheckboxField('PurifyHtml', _t('TidyContent.PURIFY_HTML', 'Purify HTML')), new CheckboxField('FixUTF8', _t('TidyContent.FIX_UTF8', 'Fix badly encoded UTF8 characters')), new CheckboxField('CheckAccessible', _t('TidyContent.CHECK_ACCESS', 'Check accessibility')), new CheckboxField('StripWordTags', _t('TidyContent.STRIP_WORD', 'Strip extraneous MS word tags')));
     $options->setTitle('Cleaning:');
     $fields->addFieldToTab('Root.Cleaning', $options);
     $conf = SiteConfig::current_site_config();
     if (strlen($this->owner->AccessibleErrors) && ($conf->ForceAccessibilityChecks || $this->owner->CheckAccessible)) {
         $fields->addFieldToTab('Root.Main', new ReadonlyField('AccessibleErrorsList', 'Possible accessibility issues', $this->owner->AccessibleErrors), 'Content');
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $group = new FieldGroup();
     $group->setTitle(_t('News.Author'));
     $group->setDescription(_t('News.AuthorHolder'));
     $fields->addFieldToTab('Root.Main', $group, 'Content');
     $field = new TextField('AuthorName', _t('News.Name'));
     $group->push($field);
     $field = new TextField('AuthorURI', _t('News.URI'));
     $group->push($field);
     $field = new TextField('AuthorEmail', _t('News.Email'));
     $group->push($field);
     return $fields;
 }
 /**
  * updates cms fields and adds widgetset gridfields
  *
  * @param FieldList $fields fields
  *
  * @return void
  *
  * @author Patrick Schneider <*****@*****.**>
  * @since 04.01.2013
  */
 public function updateCMSFields(FieldList $fields)
 {
     $inheritFromParentField = new CheckboxField('InheritFromParent', '');
     $inheritFromParentFieldGroup = new FieldGroup($inheritFromParentField);
     $inheritFromParentFieldGroup->setTitle($this->owner->fieldLabel('InheritFromParent'));
     $config = GridFieldConfig_RelationEditor::create();
     $widgetSetSidebarLabel = new HeaderField('WidgetSetSidebarLabel', $this->owner->fieldLabel('WidgetSetSidebarLabel'));
     $widgetSetSidebarField = new GridField("WidgetSetSidebar", $this->owner->fieldLabel('AssignedWidgets'), $this->owner->WidgetSetSidebar(), $config);
     $widgetSetContentlabel = new HeaderField('WidgetSetContentLabel', $this->owner->fieldLabel('WidgetSetContentLabel'));
     $widgetSetContentField = new GridField("WidgetSetContent", $this->owner->fieldLabel('AssignedWidgets'), $this->owner->WidgetSetContent(), $config);
     $fields->addFieldToTab("Root.Widgets", $inheritFromParentFieldGroup);
     $fields->addFieldToTab("Root.Widgets", $widgetSetSidebarLabel);
     $fields->addFieldToTab("Root.Widgets", $widgetSetSidebarField);
     $fields->addFieldToTab("Root.Widgets", $widgetSetContentlabel);
     $fields->addFieldToTab("Root.Widgets", $widgetSetContentField);
 }
 public function updateSettingsFields(FieldList $fields)
 {
     if (class_exists('Multisites') && $this->owner instanceof Site) {
         return;
     }
     $options = new FieldGroup(
         new CheckboxField('UseSiteSettings', _t('TidyContent.USE_SITE_SETTINGS', 'Use site settings')),
         new CheckboxField('CleanOnSave', _t('TidyContent.CLEAN_ON_SAVE', 'Clean this content whenever the page is saved')),
         new CheckboxField('TidyHtml', _t('TidyContent.TIDY_HTML', 'Tidy HTML')),
         new CheckboxField('PurifyHtml', _t('TidyContent.PURIFY_HTML', 'Purify HTML')),
         new CheckboxField('FixUTF8', _t('TidyContent.FIX_UTF8', 'Fix badly encoded UTF8 characters')),
         new CheckboxField('StripWordTags', _t('TidyContent.STRIP_WORD', 'Strip extraneous MS word tags'))
     );
     
     $options->setTitle('Cleaning:');
     $fields->addFieldToTab('Root.Cleaning', $options);
 }
 /**
  * Provides a GUI for the insert embed content popup
  * @return Form
  **/
 public function EmbedContentForm()
 {
     if (!Permission::check('CMS_ACCESS_CMSMain')) {
         return;
     }
     $contenttype = $this->request->requestVar('EmbedContentType');
     $allContentTypes = array('Container' => 'Empty Block', 'Page' => 'Pages in the Site Tree', 'DataObject' => 'Other Data Object in the site', 'External' => 'External site content');
     $headerField = CompositeField::create(LiteralField::create('Heading', sprintf('<h3 class="htmleditorfield-embedcontentform-heading insert">%s</h3>', "Insert Content")))->addExtraClass('CompositeField composite cms-content-header nolabel');
     $fields = array(DropdownField::create('EmbedContentType', 'Embed Content Type', $allContentTypes, $contenttype)->setHasEmptyDefault(true)->addExtraClass('reloadFormOnSelect'));
     if ($contenttype) {
         if ($contenttype == 'External') {
             $fields[] = TextField::create('ExternalURL', 'External URL', $this->request->requestVar('ExternalURL'));
         } elseif ($contenttype == 'DataObject' || $contenttype == 'Page') {
             $allDataObjectClasses = ClassInfo::subclassesFor($contenttype);
             $dataobjecttype = $this->request->requestVar('EmbedContentDataObjectType');
             $fields[] = DropdownField::create('EmbedContentDataObjectType', 'Data Object Type', $allDataObjectClasses, $dataobjecttype)->setHasEmptyDefault(true)->addExtraClass('reloadFormOnSelect');
             if ($dataobjecttype) {
                 $fields[] = DropdownField::create('EmbedContentDataObjectID', 'Please choose an object', Dataobject::get($dataobjecttype)->map("ID", "Title"), $this->request->requestVar('EmbedContentDataObjectID'))->setHasEmptyDefault(true);
             }
         }
         if ($contenttype != 'Container') {
             $fields[] = DropdownField::create('EmbedTemplate', 'Please choose an View', self::getTemplates($contenttype), $this->request->requestVar('EmbedTemplate'))->setHasEmptyDefault(false);
         }
         if (!self::isInlineTemplate($contenttype, $this->request->requestVar('EmbedTemplate')) || $contenttype == 'Container') {
             $widthField = new FieldGroup(TextField::create('EmbedWidth', 'Value', $this->request->requestVar('EmbedWidth')), DropdownField::create('EmbedWidthUnit', 'Unit', array('px' => 'Pixel', 'em' => 'Font Size', '%' => 'Percent'), $this->request->requestVar('EmbedWidthUnit')));
             $widthField->setTitle("Width");
             $fields[] = $widthField;
             $heightField = new FieldGroup(TextField::create('EmbedHeight', 'Value', $this->request->requestVar('EmbedHeight'))->addExtraClass('clear'), DropdownField::create('EmbedHeightUnit', 'Unit', array('px' => 'Pixel', 'em' => 'Font Size', '%' => 'Percent'), $this->request->requestVar('EmbedHeightUnit')));
             $heightField->setTitle("Height");
             $fields[] = $heightField;
             $fields[] = DropdownField::create('EmbedFloat', 'Align(Float)', array(' ' => 'None', 'left' => 'Left', 'right' => 'Right'), $this->request->requestVar('EmbedFloat'));
         }
         if (self::hasCSSClasses()) {
             $fields[] = DropdownField::create('EmbedCSSClass', 'CSS Class', self::getCSSClasses(), $this->request->requestVar('EmbedCSSClass'));
         }
     }
     // essential fields
     $fields = FieldList::create(array($headerField, CompositeField::create($fields)->addExtraClass('ss-embedcontent-fields')));
     $ActionName = "Insert/Update Content";
     // actions
     $actions = FieldList::create(array(FormAction::create('insert', _t('Embedcontent.BUTTONINSERTSHORTCODE', $ActionName))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     // form
     $form = Form::create($this, "EmbedContentForm", $fields, $actions)->loadDataFrom($this)->addExtraClass('htmleditorfield-form htmleditorfield-embedcontent cms-dialog-content');
     return $form;
 }
 public function getCMSFields()
 {
     // Get list of UI options
     $popupMap = array();
     foreach (ClassInfo::subclassesFor("ImageGalleryUI") as $ui) {
         if ($ui == "ImageGalleryUI") {
             continue;
         }
         $uiLabel = $ui::$label;
         $demoURL = $ui::$link_to_demo;
         $demoLink = !empty($demoURL) ? sprintf('<a href="%s" target="_blank">%s</a>', $demoURL, _t('ImageGalleryPage.VIEWDEMO', 'view demo')) : "";
         $popupMap[$ui] = "{$uiLabel} {$demoLink}";
     }
     $fields = parent::getCMSFields();
     // Build configuration fields
     $fields->addFieldToTab('Root', $configTab = new Tab('Configuration'));
     $configTab->setTitle(_t('ImageGalleryPage.CONFIGURATION', 'Configuration'));
     $fields->addFieldsToTab("Root.Configuration", array($coverImages = new FieldGroup(new NumericField('CoverImageWidth', _t('ImageGalleryPage.WIDTH', 'Width')), new NumericField('CoverImageHeight', _t('ImageGalleryPage.HEIGHT', 'Height'))), new NumericField('ThumbnailSize', _t('ImageGalleryPage.THUMBNAILHEIGHT', 'Thumbnail height (pixels)')), new CheckboxField('Square', _t('ImageGalleryPage.CROPTOSQUARE', 'Crop thumbnails to square')), new NumericField('MediumSize', _t('ImageGalleryPage.MEDIUMSIZE', 'Medium size (pixels)')), new NumericField('NormalSize', _t('ImageGalleryPage.NORMALSIZE', 'Normal width (pixels)')), new NumericField('NormalHeight', _t('ImageGalleryPage.NORMALHEIGHT', 'Normal height (pixels)')), new NumericField('MediaPerPage', _t('ImageGalleryPage.IMAGESPERPAGE', 'Number of images per page')), new OptionsetField('GalleryUI', _t('ImageGalleryPage.POPUPSTYLE', 'Popup style'), $popupMap), new NumericField('UploadLimit', _t('ImageGalleryPage.MAXFILES', 'Max files allowed in upload queue'))));
     $coverImages->setTitle(_t('ImageGalleryPage.ALBUMCOVERIMAGES', 'Album cover images'));
     // Build albums tab
     $fields->addFieldToTab('Root', $albumTab = new Tab('Albums'));
     $albumTab->setTitle(_t('ImageGalleryPage.ALBUMS', 'Albums'));
     if ($rootFolder = $this->RootFolder()) {
         $albumConfig = GridFieldConfig_RecordEditor::create();
         // Enable bulk image loading if necessary module is installed
         // @see composer.json/suggests
         if (class_exists('GridFieldBulkManager')) {
             $albumConfig->addComponent(new GridFieldBulkManager());
         }
         // Enable album sorting if necessary module is installed
         // @see composer.json/suggests
         if (class_exists('GridFieldSortableRows')) {
             $albumConfig->addComponent(new GridFieldSortableRows('SortOrder'));
         }
         $albumField = new GridField('Albums', 'Albums', $this->Albums(), $albumConfig);
         $fields->addFieldToTab("Root.Albums", $albumField);
     } else {
         $fields->addFieldToTab("Root.Albums", new HeaderField(_t("ImageGalleryPage.ALBUMSNOTSAVED", "You may add albums to your gallery once you have saved the page for the first time."), $headingLevel = "3"));
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $group = new FieldGroup();
     $group->setTitle(_t('News.Author'));
     $group->setDescription(_t('News.AuthorPage'));
     $fields->addFieldToTab('Root.Main', $group, 'Metadata');
     $field = new TextField('AuthorName', _t('News.Name'));
     $group->push($field);
     $field = new TextField('AuthorURI', _t('News.URI'));
     $group->push($field);
     $field = new TextField('AuthorEmail', _t('News.Email'));
     $group->push($field);
     $field = new DateField('Published', _t('News.Published'));
     $field->setDescription(_t('News.PublishedDescription'));
     $field->setLocale($this->config()->date_locale);
     $field->setConfig('dateformat', $this->config()->date_format);
     $field->setConfig('showcalendar', true);
     $fields->addFieldToTab('Root.Main', $field, 'Content');
     $field = new HtmlEditorField('Summary', _t('News.Summary'));
     $field->setRows(4);
     $fields->addFieldToTab('Root.Main', $field, 'Content');
     return $fields;
 }
 /**
  * @return \FieldList
  */
 public function getGeoFields()
 {
     $fields = new FieldList();
     $fields->push(new HeaderField('AddressHeader', _t('GeoMemberExtension.ADDRESSHEADER', 'Address')));
     $fields->push($this->getAddressFields(), 'Address');
     $fields->push(new HeaderField('GeoHeader', _t('GeoMemberExtension.GEOHEADER', 'Geo data')));
     $latitude = new TextField('Latitude', _t('GeoMemberExtension.LATITUDE', 'Latitude'), $this->owner->Latitude ? $this->owner->Latitude : null);
     $latitude->setAttribute('placeholder', _t('GeoMemberExtension.LATITUDE', 'Latitude'));
     $latitude->setTitle('');
     $longitude = new TextField('Longitude', _t('GeoMemberExtension.LONGITUDE', 'Longitude'), $this->owner->Longitude ? $this->owner->Longitude : null);
     $longitude->setAttribute('placeholder', _t('GeoMemberExtension.LONGITUDE', 'Longitude'));
     $longitude->setTitle('');
     $coords = new FieldGroup($latitude, $longitude);
     $coords->setFieldHolderTemplate('AddressFieldHolder');
     $coords->setTitle(_t('GeoMemberExtension.COORDS', 'Coordinates'));
     $fields->push($coords);
     $fields->push(new CheckboxField('GeolocateOnLocation', _t('GeoMemberExtension.GEOLOCATEONLOCATION', 'Only show location instead of full address')));
     $tz = timezone_identifiers_list();
     $timezone = $this->owner->Timezone;
     if (!$timezone) {
         $timezone = date_default_timezone_get();
     }
     $fields->push($tzdd = new DropdownField('Timezone', _t('GeoMemberExtension.TIMEZONE', 'Timezone'), array_combine($tz, $tz), $timezone));
     $tzdd->setEmptyString('');
     return $fields;
 }
Пример #10
0
 /**
  * Returns fields related to configuration aspects on this record, e.g. access control. See {@link getCMSFields()}
  * for content-related fields.
  * 
  * @return FieldList
  */
 public function getSettingsFields()
 {
     $groupsMap = array();
     foreach (Group::get() as $group) {
         // Listboxfield values are escaped, use ASCII char instead of &raquo;
         $groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
     }
     asort($groupsMap);
     $fields = new FieldList($rootTab = new TabSet("Root", $tabBehaviour = new Tab('Settings', new DropdownField("ClassName", $this->fieldLabel('ClassName'), $this->getClassDropdown()), $parentTypeSelector = new CompositeField(new OptionsetField("ParentType", _t("SiteTree.PAGELOCATION", "Page location"), array("root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page"))), $parentIDField = new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree', 'ID', 'MenuTitle')), $visibility = new FieldGroup(new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch'))), $viewersOptionsField = new OptionsetField("CanViewType", _t('SiteTree.ACCESSHEADER', "Who can view this page?")), $viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')), $editorsOptionsField = new OptionsetField("CanEditType", _t('SiteTree.EDITHEADER', "Who can edit this page?")), $editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('SiteTree.GroupPlaceholder', 'Click to select group')))));
     $visibility->setTitle($this->fieldLabel('Visibility'));
     // This filter ensures that the ParentID dropdown selection does not show this node,
     // or its descendents, as this causes vanishing bugs
     $parentIDField->setFilterFunction(create_function('$node', "return \$node->ID != {$this->ID};"));
     $parentTypeSelector->addExtraClass('parentTypeSelector');
     $tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR', "Behavior"));
     // Make page location fields read-only if the user doesn't have the appropriate permission
     if (!Permission::check("SITETREE_REORGANISE")) {
         $fields->makeFieldReadonly('ParentType');
         if ($this->ParentType == 'root') {
             $fields->removeByName('ParentID');
         } else {
             $fields->makeFieldReadonly('ParentID');
         }
     }
     $viewersOptionsSource = array();
     $viewersOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["Inherit"] = _t('SiteTree.INHERIT', "Inherit from parent page");
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     if (!Permission::check('SITETREE_GRANT_ACCESS')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         if ($this->CanViewType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($viewerGroupsField);
         } else {
             $fields->removeByName('ViewerGroups');
         }
         $fields->makeFieldReadonly($editorsOptionsField);
         if ($this->CanEditType == 'OnlyTheseUsers') {
             $fields->makeFieldReadonly($editorGroupsField);
         } else {
             $fields->removeByName('EditorGroups');
         }
     }
     if (self::$runCMSFieldsExtensions) {
         $this->extend('updateSettingsFields', $fields);
     }
     return $fields;
 }
 /**
  * Add an element to the page settings tab to set the status of this module (enabled or not enabled)
  *
  * @param \FieldList $fields
  */
 public function updateSettingsFields(\FieldList $fields)
 {
     $field = new FieldGroup(new CheckboxField('EnableViewTemplate', _t("ViewTemplate.YES", "Yes"), 0));
     $field->setTitle(_t("ViewTemplate.ViewTemplate", "Enable view template"));
     $fields->addFieldToTab("Root.Settings", $field);
 }
 /**
  * Create form fields to represent all of the properties on the {@link Omnipay\Common\CreditCard} object.
  * The form fields are split up into relevent sections to help with adding/removing fields as needed.
  *
  * @return FieldList
  */
 protected function getCreditCardFields()
 {
     $fields = new FieldList();
     $tabindex = 1;
     // Create personal detail fields
     $firstNameTextField = new TextField('FirstName', _t('OmnipayableForm.FIRSTNAME', 'First name'));
     $firstNameTextField->setAttribute('tabindex', $tabindex++);
     $lastNameTextField = new TextField('LastName', _t('OmnipayableForm.LASTNAME', 'Last name'));
     $lastNameTextField->setAttribute('tabindex', $tabindex++);
     $companyTextField = new TextField('Company', _t('OmnipayableForm.COMPANY', 'Company'));
     $companyTextField->setAttribute('tabindex', $tabindex++);
     $emailEmailField = new EmailField('Email', _t('OmnipayableForm.EMAIL', 'Email'));
     $emailEmailField->setAttribute('tabindex', $tabindex++);
     // Create personal details group
     $personalFieldGroup = new FieldGroup();
     $personalFieldGroup->setName('PersonalDetails');
     $personalFieldGroup->setTitle(_t('OmnipayableForm.PERSONALDETAILS', 'Personal Detials'));
     // Add basic fields to personal details group
     $personalFieldGroup->push($firstNameTextField);
     $personalFieldGroup->push($lastNameTextField);
     $personalFieldGroup->push($companyTextField);
     $personalFieldGroup->push($emailEmailField);
     // Add personal details group to fields
     $fields->push($personalFieldGroup);
     // Create credit card detail fields
     $numberCreditCardField = new CreditCardField('Number', _t('OmnipayableForm.NUMBER', 'Card number'));
     $numberCreditCardField->setAttribute('tabindex', $tabindex++);
     $cvvTextField = new TextField('Cvv', _t('OmnipayableForm.CVV', 'Security number'));
     $cvvTextField->setAttribute('tabindex', $tabindex += 3);
     $expiryMonthDropdownField = new DropdownField('ExpiryMonth', _t('OmnipayableForm.EXPIRYMONTH', 'Expiry month'), $this->getMonths());
     $expiryMonthDropdownField->setAttribute('tabindex', $tabindex++);
     $expiryMonthDropdownField->setHasEmptyDefault(true);
     $expiryYearDropdownField = new DropdownField('ExpiryYear', _t('OmnipayableForm.EXPIRYYEAR', 'Expiry year'), $this->getYears(20));
     $expiryYearDropdownField->setAttribute('tabindex', $tabindex++);
     $expiryYearDropdownField->setHasEmptyDefault(true);
     $startMonthDropdownField = new DropdownField('StartMonth', _t('OmnipayableForm.STARTMONTH', 'Start month'), $this->getMonths());
     $startMonthDropdownField->setAttribute('tabindex', $tabindex++);
     $startMonthDropdownField->setHasEmptyDefault(true);
     $startYearDropdownField = new DropdownField('StartYear', _t('OmnipayableForm.STARTYEAR', 'Start year'), $this->getYears(-20));
     $startYearDropdownField->setAttribute('tabindex', $tabindex++);
     $startYearDropdownField->setHasEmptyDefault(true);
     $issueNumberTextField = new TextField('IssueNumber', _t('OmnipayableForm.ISSUENUMBER', 'Issue number'));
     $issueNumberTextField->setAttribute('tabindex', $tabindex++);
     $typeDropdownField = new DropdownField('Type', _t('OmnipayableForm.TYPE', 'Card type'), $this->getCreditCardTypes());
     $typeDropdownField->setAttribute('tabindex', $tabindex++);
     $typeDropdownField->setHasEmptyDefault(true);
     $expiryDateFieldGroup = new FieldGroup();
     $expiryDateFieldGroup->push($expiryMonthDropdownField);
     $expiryDateFieldGroup->push($expiryYearDropdownField);
     $startDateFieldGroup = new FieldGroup();
     $startDateFieldGroup->push($startMonthDropdownField);
     $startDateFieldGroup->push($startYearDropdownField);
     // Create credit card details group
     $creditCardFieldGroup = new FieldGroup();
     $creditCardFieldGroup->setName('CardDetails');
     $creditCardFieldGroup->setTitle(_t('OmnipayableForm.CREDITCARDDETAILS', 'Card Detials'));
     // Add credit card fields to credit card details group
     $creditCardFieldGroup->push($numberCreditCardField);
     $creditCardFieldGroup->push($cvvTextField);
     $creditCardFieldGroup->push($expiryDateFieldGroup);
     $creditCardFieldGroup->push($startDateFieldGroup);
     $creditCardFieldGroup->push($issueNumberTextField);
     $creditCardFieldGroup->push($typeDropdownField);
     // Add credit card details group to fields
     $fields->push($creditCardFieldGroup);
     // Create billing address fields
     $billingAddress1TextField = new TextField('BillingAddress1', _t('OmnipayableForm.BILLINGADDRESS1', 'Address 1'));
     $billingAddress1TextField->setAttribute('tabindex', $tabindex++);
     $billingAddress2TextField = new TextField('BillingAddress2', _t('OmnipayableForm.BILLINGADDRESS2', 'Address 2'));
     $billingAddress2TextField->setAttribute('tabindex', $tabindex++);
     $billingCity = new TextField('BillingCity', _t('OmnipayableForm.BILLINGCITY', 'City'));
     $billingCity->setAttribute('tabindex', $tabindex++);
     $billingPostcode = new TextField('BillingPostcode', _t('OmnipayableForm.BILLINGPOSTCODE', 'Postcode'));
     $billingPostcode->setAttribute('tabindex', $tabindex++);
     $billingState = new TextField('BillingState', _t('OmnipayableForm.BILLINGSTATE', 'State'));
     $billingState->setAttribute('tabindex', $tabindex++);
     $billingCountry = new CountryDropdownField('BillingCountry', _t('OmnipayableForm.BILLINGCOUNTRY', 'Country'));
     $billingCountry->setAttribute('tabindex', $tabindex++);
     $billingPhone = new PhoneNumberField('BillingPhone', _t('OmnipayableForm.BILLINGPHONE', 'Phone'));
     $billingPhone->setAttribute('tabindex', $tabindex++);
     // Create billing details group
     $billingFieldGroup = new FieldGroup();
     $billingFieldGroup->setName('BillingAddress');
     $billingFieldGroup->setTitle(_t('OmnipayableForm.BILLING', 'Billing Address'));
     // Add billiing fields to billing group
     $billingFieldGroup->push($billingAddress1TextField);
     $billingFieldGroup->push($billingAddress2TextField);
     $billingFieldGroup->push($billingCity);
     $billingFieldGroup->push($billingPostcode);
     $billingFieldGroup->push($billingState);
     $billingFieldGroup->push($billingCountry);
     $billingFieldGroup->push($billingPhone);
     // Add billing details group to fields
     $fields->push($billingFieldGroup);
     // Create shipping address fields
     $shippingAddress1TextField = new TextField('ShippingAddress1', _t('OmnipayableForm.SHIPPINGADDRESS1', 'Address 1'));
     $shippingAddress1TextField->setAttribute('tabindex', $tabindex++);
     $shippingAddress2TextField = new TextField('ShippingAddress2', _t('OmnipayableForm.SHIPPINGADDRESS2', 'Address 2'));
     $shippingAddress2TextField->setAttribute('tabindex', $tabindex++);
     $shippingCity = new TextField('ShippingCity', _t('OmnipayableForm.SHIPPINGCITY', 'City'));
     $shippingCity->setAttribute('tabindex', $tabindex++);
     $shippingPostcode = new TextField('ShippingPostcode', _t('OmnipayableForm.SHIPPINGPOSTCODE', 'Postcode'));
     $shippingPostcode->setAttribute('tabindex', $tabindex++);
     $shippingState = new TextField('ShippingState', _t('OmnipayableForm.SHIPPINGSTATE', 'State'));
     $shippingState->setAttribute('tabindex', $tabindex++);
     $shippingCountry = new CountryDropdownField('ShippingCountry', _t('OmnipayableForm.SHIPPINGCOUNTRY', 'Country'));
     $shippingCountry->setAttribute('tabindex', $tabindex++);
     $shippingPhone = new PhoneNumberField('ShippingPhone', _t('OmnipayableForm.SHIPPINGPHONE', 'Phone'));
     $shippingPhone->setAttribute('tabindex', $tabindex++);
     // Create shipping details group
     $shippingFieldGroup = new FieldGroup();
     $shippingFieldGroup->setName('ShippingAddress');
     $shippingFieldGroup->setTitle(_t('OmnipayableForm.SHIPPING', 'Shipping Address'));
     // Add billiing fields to shipping group
     $shippingFieldGroup->push($shippingAddress1TextField);
     $shippingFieldGroup->push($shippingAddress2TextField);
     $shippingFieldGroup->push($shippingCity);
     $shippingFieldGroup->push($shippingPostcode);
     $shippingFieldGroup->push($shippingState);
     $shippingFieldGroup->push($shippingCountry);
     $shippingFieldGroup->push($shippingPhone);
     // Add shipping details group to fields
     $fields->push($shippingFieldGroup);
     return $fields;
 }
 function updateCMSFields(\FieldList $fields)
 {
     // Rotate magic
     $f1 = new CheckboxField('RotateClockwise', 'Rotate Clockwise');
     $f2 = new CheckboxField('RotateCounterClockwise', 'Rotate Counter Clockwise');
     $f3 = new CheckboxField('RotateAuto', 'Rotate Auto');
     $fields->addFieldToTab("Root.Main", $g = new FieldGroup(array($f1, $f2, $f3)));
     $g->setTitle('Rotate on save');
 }
 public static function assetsFolderField($obj, $dirExists)
 {
     $field = null;
     $msg = null;
     if ($dirExists) {
         //Message
         $defaultMsg = '<em>Files uploaded via the content area will be uploaded to</em>' . '<br /> <strong>' . Upload::config()->uploads_folder . '</strong>';
         if (method_exists($obj, 'getMessageUploadDirectory')) {
             $msg = $obj->getMessageUploadDirectory();
         }
         if (!$msg) {
             $msg = $defaultMsg;
         }
         //TODO these could also be global settings
         $manageAble = true;
         $editable = true;
         //As this is happening from the subsites administration, when editing a subsite
         //you'd probably be on another site, and hence can't access the site's files anyway
         if ($obj->ClassName == 'Subsite') {
             $manageAble = false;
             $editable = false;
         }
         if ($editable) {
             //Asset folder is editable
             $field1 = new TreeDropdownField('AssetsFolderID', 'Change Directory:', 'Folder');
             $field1->setRightTitle('Directory changes take place after saving.');
             //Dropdown field style adjustments
             //TODO move this to an external stylesheet as these styles don't kick in on AJAX loads
             Requirements::customCSS('
                 #Form_EditForm_UploadDirRulesNotes .ui-accordion-content {
                     overflow: visible;
                 }
                 #TreeDropdownField_Form_EditForm_AssetsFolderID {
                     min-width: 260px;
                 }
                 .UploadDirectoryFields .fieldgroup label {
                     padding: 0 0 4px;
                 }
             ');
             $dir = $obj->AssetsFolder();
             $filescount = File::get()->filter(array('ParentID' => $dir->ID))->count();
             $manageButton = null;
             if ($manageAble) {
                 $manageButton = "<a href='/admin/assets/show/" . $dir->ID . "' class='ss-ui-button ss-ui-button-small ui-button'>\n                        Manage Files (" . $filescount . ')</a>';
             }
             $field2 = new LiteralField('UploadDirRulesNote', "<div style='margin-bottom:10px;margin-right:16px;'>{$msg}</div>" . $manageButton);
             $field = new FieldGroup(array($field2, $field1));
             $field->setTitle('Upload Directory');
             $field->addExtraClass('UploadDirectoryFields');
             $field->setName('UploadDirectoryFields');
         } else {
             //Asset folder is not editable
             $field = new LiteralField('UploadDirRulesNote', '
                 <div class="field text" id="UploadDirRulesNote">
                     <label class="left">Upload Directory</label>
                     <div class="middleColumn">
                         <p style="margin-bottom: 0; padding-top: 0px;">
                             ' . $msg . '
                             <br />
                             <em>If you need to edit or change this folder, please contact your administrator.</em>
                         </p>
                     </div>
                 </div>
                 ');
         }
     } else {
         //Message
         $defaultMsg = 'Please <strong>choose a name and save</strong> for adding content.';
         if (method_exists($obj, 'getMessageSaveFirst')) {
             $msg = $obj->getMessageSaveFirst();
         }
         if (!$msg) {
             $msg = $defaultMsg;
         }
         //preview calculated assets folder
         //$msg = $msg . ' (' . $this->owner->getCalcAssetsFolderDirectory() . ')';
         $field = new LiteralField('UploadDirRulesNote', '
             <p class="message notice" >' . $msg . '</p>
         ');
     }
     return $field;
 }