function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Text', array(new ReadonlyField('Readonly', 'ReadonlyField'), new TextareaField('Textarea', 'TextareaField - 8 rows', 8), new TextField('Text', 'TextField'), new HtmlEditorField('HTMLField', 'HtmlEditorField'), new EmailField('Email', 'EmailField'), new PasswordField('Password', 'PasswordField'), new AjaxUniqueTextField('AjaxUniqueText', 'AjaxUniqueTextField', 'AjaxUniqueText', 'BasicFieldsTestPage')));
     $fields->addFieldsToTab('Root.Numeric', array(new NumericField('Number', 'NumericField'), new CurrencyField('Price', 'CurrencyField'), new PhoneNumberField('PhoneNumber', 'PhoneNumberField'), new CreditCardField('CreditCard', 'CreditCardField')));
     $fields->addFieldsToTab('Root.Option', array(new CheckboxField('Checkbox', 'CheckboxField'), new CheckboxSetField('CheckboxSet', 'CheckboxSetField', TestCategory::map()), new DropdownField('DropdownID', 'DropdownField', TestCategory::map()), new GroupedDropdownField('GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), new ListboxField('ListboxFieldID', 'ListboxField', TestCategory::map(), array(), 3), new OptionsetField('OptionSetID', 'OptionSetField', TestCategory::map())));
     // All these date/time fields generally have issues saving directly in the CMS
     $fields->addFieldsToTab('Root.DateTime', array($calendarDateField = new DateField('CalendarDate', 'DateField with calendar'), new DateField('Date', 'DateField'), $dmyDateField = new DateField('DMYDate', 'DateField with separate fields'), new TimeField('Time', 'TimeField'), $timeFieldDropdown = new TimeField('TimeDropdown', 'TimeField with dropdown'), new DatetimeField('DateTime', 'DateTime'), $dateTimeShowCalendar = new DatetimeField('DateTimeWithCalendar', 'DateTime with calendar')));
     $calendarDateField->setConfig('showcalendar', true);
     $dmyDateField->setConfig('dmyfields', true);
     $timeFieldDropdown->setConfig('showdropdown', true);
     $dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true);
     $dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
     $fields->addFieldsToTab('Root.File', array(UploadField::create('File', 'FileUploadField'), UploadField::create('Image', 'ImageUploadField'), UploadField::create('HasManyFiles', 'HasManyFilesUploadField'), UploadField::create('ManyManyFiles', 'ManyManyFilesUploadField')));
     $tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
     foreach ($tabs as $tab) {
         $tabObj = $fields->fieldByName($tab);
         foreach ($tabObj->FieldList() as $field) {
             $disabledField = $field->performDisabledTransformation();
             $disabledField->setTitle($disabledField->Title() . ' (disabled)');
             $disabledField->setName($disabledField->getName() . '_disabled');
             $tabObj->insertAfter($disabledField, $field->getName());
             $readonlyField = $field->performReadonlyTransformation();
             $readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
             $readonlyField->setName($readonlyField->getName() . '_readonly');
             $tabObj->insertAfter($readonlyField, $field->getName());
         }
     }
     $fields->addFieldToTab('Root.Text', new TextField('Text_NoLabel', false, 'TextField without label'), 'Text_disabled');
     return $fields;
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $opsMember = array();
     foreach (Group::get() as $group) {
         if ($group->Permissions()->filter("Code", "INCIDENTS.STAFF")->count()) {
             foreach ($group->Members() as $member) {
                 $opsMember[$member->ID] = $member->FirstName . ' ' . $member->Surname . ' <' . $member->Email . '>';
             }
         }
     }
     $assignable = new DropdownField('AssigneeID', 'Assigned to', $opsMember);
     $fields->replaceField('AssigneeID', $assignable);
     $startTime = new DatetimeField('StartTime', 'Start time');
     $startTime->getDateField()->setConfig('showcalendar', 1);
     $fields->replaceField('StartTime', $startTime);
     $endTime = new DatetimeField('EndTime', 'End time');
     $endTime->getDateField()->setConfig('showcalendar', 1);
     $fields->replaceField('EndTime', $endTime);
     $interimReportLink = new TextField('InterimReportLink', 'Interim report link');
     $fields->replaceField('InterimReportLink', $interimReportLink);
     $interimSent = new CheckboxField('InterimReportSent', 'Interim report sent?');
     $fields->insertAfter($interimSent, 'InterimReportLink');
     $finalReportLink = new TextField('FinalReportLink', 'Final report link');
     $fields->replaceField('FinalReportLink', $finalReportLink);
     $interimSent = new CheckboxField('FinalReportSent', 'Final report sent?');
     $fields->insertAfter($interimSent, 'FinalReportLink');
     return $fields;
 }
 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 getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Remove fields
     $fields->removeByName(array('Unique', 'Permanent', 'CanClose', 'CloseColor', 'LinkID'));
     // Add fields
     // Main tab
     $fields->addFieldToTab("Root.Main", $test = TextField::create("ButtonText")->setTitle(_t("SiteMessage.LABELBUTTONTEXT", "Button Text")));
     $fields->addFieldToTab("Root.Main", TreeDropdownField::create("PageID")->setTitle(_t("SiteMessage.LABELLINKTO", "Link to"))->setSourceObject("SiteTree"));
     $fields->addFieldToTab("Root.Main", HTMLEditorField::create("Content")->setTitle(_t("SiteMessage.LABELCONTENT", "Message content"))->setRows(15));
     // Design tab
     $fields->addFieldToTab("Root.Design", HeaderField::create("ColorSettings")->setTitle(_t("SiteMessage.HEADERCOLORSETTINGS", "Color settings")));
     $fields->addFieldToTab("Root.Design", ColorField::create("BackgroundColor")->setTitle(_t("SiteMessage.LABELBACKGROUNDCOLOR", "Background Color")));
     $fields->addFieldToTab("Root.Design", ColorField::create("TextColor")->setTitle(_t("SiteMessage.LABELTEXTCOLOR", "Text Color")));
     $fields->addFieldToTab("Root.Design", ColorField::create("ButtonColor")->setTitle(_t("SiteMessage.LABELBUTTONCOLOR", "Button Color")));
     $fields->addFieldToTab("Root.Design", ColorField::create("ButtonTextColor")->setTitle(_t("SiteMessage.LABELBUTTONTEXTCOLOR", "Button Text Color")));
     $fields->addFieldToTab("Root.Design", HeaderField::create("CloseSettings")->setTitle(_t("SiteMessage.HEADERCLOSESETTINGS", "Close button settings")));
     $fields->addFieldToTab("Root.Design", FieldGroup::create(_t("SiteMessage.LABELCANCLOSE", "Show close button?"), Checkboxfield::create("CanClose", "")));
     $fields->addFieldToTab("Root.Design", ColorField::create("CloseColor")->setTitle(_t("SiteMessage.LABELCLOSECOLOR", "Close button color")));
     // Schedule tab
     $fields->addFieldToTab("Root.Schedule", FieldGroup::create(_t("SiteMessage.LABELPERMANENT", "Is this message permanent?"), CheckboxField::create("Permanent", "")));
     $fields->addFieldToTab("Root.Schedule", $Start = new DatetimeField("Start"));
     $fields->addFieldToTab("Root.Schedule", $End = new DatetimeField("End"));
     $Start->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "Start Date"))->getDateField('Start')->setConfig('showcalendar', TRUE);
     $End->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm')->setTitle(_t("SiteMessage.LABELSTART", "End Date"))->getDateField('End')->setConfig('showcalendar', TRUE);
     return $fields;
 }
Example #5
0
 function getCMSFields()
 {
     if ($this->ID != 0) {
         $totalCount = $this->getTotalVotes();
     } else {
         $totalCount = 0;
     }
     $fields = new FieldList($rootTab = new TabSet("Root", new Tab("Main", new TextField('Title', 'Poll title (maximum 50 characters)', null, 50), new OptionsetField('MultiChoice', 'Single answer (radio buttons)/multi-choice answer (tick boxes)', array(0 => 'Single answer', 1 => 'Multi-choice answer')), new OptionsetField('IsActive', 'Poll state', array(1 => 'Active', 0 => 'Inactive')), $embargo = new DatetimeField('Embargo', 'Embargo'), $expiry = new DatetimeField('Expiry', 'Expiry'), new HTMLEditorField('Description', 'Description'))));
     $embargo->getDateField()->setConfig('showcalendar', true);
     $embargo->getTimeField()->setConfig('showdropdown', true);
     $embargo->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');
     $embargo->getTimeField()->setConfig('timeformat', 'h:m a');
     $expiry->getDateField()->setConfig('showcalendar', true);
     $expiry->getTimeField()->setConfig('showdropdown', true);
     $expiry->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');
     $expiry->getTimeField()->setConfig('timeformat', 'h:m a');
     // Add the fields that depend on the poll being already saved and having an ID
     if ($this->ID != 0) {
         $config = GridFieldConfig::create();
         $config->addComponent(new GridFieldToolbarHeader());
         $config->addComponent(new GridFieldAddNewButton('toolbar-header-right'));
         $config->addComponent(new GridFieldDataColumns());
         $config->addComponent(new GridFieldEditButton());
         $config->addComponent(new GridFieldDeleteAction());
         $config->addComponent(new GridFieldDetailForm());
         $config->addComponent(new GridFieldSortableHeader());
         $pollChoicesTable = new GridField('Choices', 'Choices', $this->Choices(), $config);
         $fields->addFieldToTab('Root.Data', $pollChoicesTable);
         $fields->addFieldToTab('Root.Data', new ReadonlyField('Total', 'Total votes', $totalCount));
     } else {
         $fields->addFieldToTab('Root.Choices', new ReadOnlyField('ChoicesPlaceholder', 'Choices', 'You will be able to add options once you have saved the poll for the first time.'));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 /**
  * Form used for displaying the currently logged items
  */
 public function LogsForm()
 {
     $fields = new FieldList(DropdownField::create('CalledMethod', _t('KapostBridgeLogViewer.CALLED_METHOD', '_Called Method'), array('blogger.getUsersBlogs' => 'blogger.getUsersBlogs', 'kapost.getPreview' => 'kapost.getPreview', 'metaWeblog.editPost' => 'metaWeblog.editPost', 'metaWeblog.getCategories' => 'metaWeblog.getCategories', 'metaWeblog.getPost' => 'metaWeblog.getPost', 'metaWeblog.newMediaObject' => 'metaWeblog.newMediaObject', 'metaWeblog.newPost' => 'metaWeblog.newPost', 'system.listMethods' => 'system.listMethods'))->setEmptyString('--- ' . _t('KapostBridgeLogViewer.FILTER_BY_METHOD', '_Filter by Method') . ' ---'), $startDate = new DatetimeField('LogStartDate', _t('KapostBridgeLogViewer.START_DATE_TIME', '_Start Date/Time')), $endDate = new DatetimeField('LogEndDate', _t('KapostBridgeLogViewer.END_DATE_TIME', '_End Date/Time')));
     $startDate->getDateField()->setConfig('showcalendar', true);
     $endDate->getDateField()->setConfig('showcalendar', true);
     $actions = new FieldList(FormAction::create('doApplyFilters', _t('KapostBridgeLogViewer.APPLY_FILTER', '_Apply Filter'))->addExtraClass('ss-ui-action-constructive')->setUseButtonTag(true), Object::create('ResetFormAction', 'clear', _t('KapostBridgeLogViewer.RESET', '_Reset'))->setUseButtonTag(true));
     $form = new Form($this, 'LogsForm', $fields, $actions);
     $form->addExtraClass('log-search-form')->setFormMethod('GET')->setFormAction($this->Link())->disableSecurityToken()->unsetValidator();
     // Load the form with previously sent search data
     $getVars = $this->request->getVars();
     //Workaround for start date field with no date or time
     if (array_key_exists('LogStartDate', $getVars)) {
         if (array_key_exists('date', $getVars['LogStartDate']) && !array_key_exists('time', $getVars['LogStartDate'])) {
             $getVars['LogStartDate']['time'] = '00:00:00';
         } else {
             if (!array_key_exists('date', $getVars['LogStartDate']) && array_key_exists('time', $getVars['LogStartDate'])) {
                 unset($getVars['LogStartDate']);
                 //Remove if there is no date present
             }
         }
     }
     //Workaround for end date field with no date or time
     if (array_key_exists('LogEndDate', $getVars)) {
         if (array_key_exists('date', $getVars['LogEndDate']) && !array_key_exists('time', $getVars['LogEndDate'])) {
             $getVars['LogEndDate']['time'] = '23:59:59';
         } else {
             if (!array_key_exists('date', $getVars['LogEndDate']) && array_key_exists('time', $getVars['LogEndDate'])) {
                 unset($getVars['LogEndDate']);
                 //Remove if there is no date present
             }
         }
     }
     $form->loadDataFrom($getVars);
     return $form;
 }
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldToTab('Root.Main', new DropdownField('Type', 'Type', $this->dbObject('Type')->enumValues()));
     $fields->addFieldToTab('Root.Main', new TextField('Name', 'Name'));
     $fields->addFieldToTab('Root.Main', new TextareaField('Description', 'Description'));
     $fields->addFieldToTab('Root.Main', new TextareaField('Address', 'Address'));
     $fields->addFieldToTab('Root.Main', new TextField('Latitude', 'Latitude'));
     $fields->addFieldToTab('Root.Main', new TextField('Longitude', 'Longitude'));
     $fields->addFieldToTab('Root.Main', new TextField('LocationMessage', 'Message to display for this location'));
     $fields->addFieldToTab('Root.Main', new TextField('Website', 'Website'));
     $fields->addFieldToTab('Root.Main', new TextField('BookingLink', 'BookingLink'));
     $start_date = new DatetimeField('BookingStartDate', 'Booking Block - Start Date');
     $start_date->getDateField()->setConfig('showcalendar', true);
     $start_date->setConfig('dateformat', 'dd/MM/yyyy');
     $fields->addFieldToTab('Root.Main', $start_date);
     $end_date = new DatetimeField('BookingEndDate', 'Booking Block - End Date');
     $end_date->getDateField()->setConfig('showcalendar', true);
     $end_date->setConfig('dateformat', 'dd/MM/yyyy');
     $fields->addFieldToTab('Root.Main', $end_date);
     $fields->addFieldToTab('Root.Main', new TextField('InRangeBookingGraphic', 'URL of graphic of an in range stay'));
     $fields->addFieldToTab('Root.Main', new TextField('OutOfRangeBookingGraphic', 'URL of graphic of an out of range stay'));
     $fields->addFieldToTab('Root.Main', new CheckboxField('IsSoldOut', 'This location is <strong>sold out</strong> (applies to hotels only)'));
     $fields->addFieldToTab('Root.Main', new CheckboxField('DisplayOnSite', 'Show this location on the website. Will be hidden if unchecked.'));
     $fields->addFieldToTab('Root.Main', new CheckboxField('DetailsPage', 'Send people to a details page first?'));
     $fields->addFieldToTab('Root.Main', new TextField('DistanceFromVenue', 'Distance From Venue'));
     $fields->addFieldToTab('Root.Main', new TextField('PublicTransitInstructions', 'Public Transit Instructions'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $fields->addFieldToTab('Root.Main', new TextField('Title', 'Title'));
     $start_date = new DatetimeField('StartDate', 'Start Date');
     $end_date = new DatetimeField('EndDate', 'End Date');
     $start_date->getDateField()->setConfig('showcalendar', true);
     $start_date->setConfig('dateformat', 'dd/MM/yyyy');
     $end_date->getDateField()->setConfig('showcalendar', true);
     $end_date->setConfig('dateformat', 'dd/MM/yyyy');
     $fields->addFieldToTab('Root.Main', $start_date);
     $fields->addFieldToTab('Root.Main', $end_date);
     $fields->addFieldToTab('Root.Main', new CheckboxField('Enabled', 'Is Enabled'));
     $fields->addFieldToTab('Root.Main', new HiddenField('CreatedByID', 'CreatedByID', Member::currentUserID()));
     //steps
     if ($this->ID > 0) {
         $_REQUEST['survey_template_id'] = $this->ID;
         // steps
         $config = GridFieldConfig_RecordEditor::create();
         $config->removeComponentsByType('GridFieldAddNewButton');
         $multi_class_selector = new GridFieldAddNewMultiClass();
         $step_types = array('SurveyRegularStepTemplate' => 'Regular Step', 'SurveyDynamicEntityStepTemplate' => 'Entities Holder Step');
         $count = $this->Steps()->filter('ClassName', 'SurveyThankYouStepTemplate')->count();
         if (intval($count) === 0) {
             $step_types['SurveyThankYouStepTemplate'] = 'Thank You (Final)';
         }
         $multi_class_selector->setClasses($step_types);
         $config->addComponent($multi_class_selector);
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $gridField = new GridField('Steps', 'Steps', $this->Steps(), $config);
         $fields->addFieldToTab('Root.Main', $gridField);
         //entities
         $config = GridFieldConfig_RecordEditor::create();
         $gridField = new GridField('EntitySurveys', 'Entities', $this->EntitySurveys(), $config);
         $fields->addFieldToTab('Root.Main', $gridField);
         // instances
         $config = GridFieldConfig_RecordEditor::create(100);
         $config->removeComponentsByType('GridFieldAddNewButton');
         $gridField = new GridField('Instances', 'Instances', $this->Instances(), $config);
         $fields->addFieldToTab('Root.Surveys', $gridField);
         //migration Mappings
         $config = GridFieldConfig_RecordEditor::create();
         $config->removeComponentsByType('GridFieldAddNewButton');
         $multi_class_selector = new GridFieldAddNewMultiClass();
         $migration_mapping_types = array('NewDataModelSurveyMigrationMapping' => 'New Migration Mapping');
         $multi_class_selector->setClasses($migration_mapping_types);
         $config->addComponent($multi_class_selector);
         $gridField = new GridField('MigrationMappings', 'Migration Mappings', $this->MigrationMappings(), $config);
         $dataColumns = $config->getComponentByType('GridFieldDataColumns');
         $migration = $this->MigrationMappings()->first();
         $dataColumns->setDisplayFields(!is_null($migration) && $migration->ClassName === 'OldDataModelSurveyMigrationMapping' ? OldDataModelSurveyMigrationMapping::getDisplayFields() : NewDataModelSurveyMigrationMapping::getDisplayFields());
         $fields->addFieldToTab('Root.Main', $gridField);
     }
     return $fields;
 }
 /**
  * @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;
 }
 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     Requirements::javascript('advancedreports/javascript/scheduled-report-settings.js');
     $first = new DatetimeField('FirstScheduled', _t('AdvancedReport.FIRST_SCHEDULED_GENERATION', 'First scheduled generation'));
     $first->getDateField()->setConfig('showcalendar', true);
     if ($this->owner->QueuedJobID) {
         $next = $this->owner->QueuedJob()->obj('StartAfter')->Nice();
     } else {
         $next = _t('AdvancedReport.NOT_CURRENTLY_SCHEDULED', 'not currently scheduled');
     }
     $fields->addFieldsToTab('Root.Scheduling', array(new CheckboxField('Scheduled', _t('AdvancedReport.SCHEDULE_REPORT_GENERATION', 'Schedule report generation?')), new TextField('ScheduledTitle', _t('AdvancedReport.SCHEDULED_REPORT_TITLE', 'Scheduled report title')), $first, new DropdownField('ScheduleEvery', _t('AdvancedReport.SCHEDULE_EVERY', 'Schedule every'), $this->owner->dbObject('ScheduleEvery')->enumValues()), TextField::create('ScheduleEveryCustom')->setTitle(_t('AdvancedReport.CUSTOM_INTERVAL', 'Custom interval'))->setDescription(_t('AdvancedReport.USING_STRTOTIME_FORMAT', 'Using relative <a href="{link}" target="_blank">strtotime</a> format', null, array('link' => 'http://php.net/strtotime'))), new TextField('EmailScheduledTo', _t('AdvancedReport.EMAIL_SCHEDULED_TO', 'Email scheduled reports to')), new ReadonlyField('NextScheduledGeneration', _t('AdvancedReport.NEXT_SCHEDULED_GENERATION', 'Next scheduled generation'), $next)));
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', $dateTimeField = new DatetimeField('Date'), 'Content');
     $dateTimeField->getDateField()->setConfig('showcalendar', true);
     $categories = NewsCategory::get()->sort('Title ASC');
     if ($categories && $categories->exists()) {
         $fields->addFieldToTab('Root.Main', new DropdownField('CategoryID', 'Category', $categories->map()), 'Content');
     }
     $fields->addFieldToTab('Root.Main', new TextareaField('Abstract'), 'Content');
     return $fields;
 }
 function getCMSFields()
 {
     $startdatefield = new DatetimeField('StartDate', 'StartDate');
     $startdatefield->getDateField()->setConfig('showcalendar', true);
     $startdatefield->setConfig('datavalueformat', 'dd.MM.YYYY HH:mm');
     $enddatefield = new DatetimeField('EndDate', 'EndDate');
     $enddatefield->getDateField()->setConfig('showcalendar', true);
     $enddatefield->setConfig('datavalueformat', 'dd.MM.YYYY HH:mm');
     $imagefield = new UploadField('Image', 'Image (optional)');
     $imagefield->allowedExtensions = array('jpg', 'gif', 'png');
     $fields = new FieldList(new TextField('Title', "Event Title"), $startdatefield, $enddatefield, new TextField('Teaser', "Teaser"), new TextareaField('Description'), new TextField('Linktitle'), new TextField('Link'), $imagefield);
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     Requirements::css(BLOGGER_DIR . '/css/cms.css');
     $self =& $this;
     $this->beforeUpdateCMSFields(function ($fields) use($self) {
         $fields->addFieldsToTab('Root.Main', array(HeaderField::create('Post Options', 3), $publishDate = DatetimeField::create("PublishDate", _t("BlogPost.PublishDate", "Publish Date")), ListboxField::create("Categories", _t("BlogPost.Categories", "Categories"), $self->Parent()->Categories()->map()->toArray())->setMultiple(true), ListboxField::create("Tags", _t("BlogPost.Tags", "Tags"), $self->Parent()->Tags()->map()->toArray())->setMultiple(true)));
         $publishDate->getDateField()->setConfig("showcalendar", true);
         // Add featured image
         $fields->insertBefore($uploadField = UploadField::create("FeaturedImage", _t("BlogPost.FeaturedImage", "Featured Image")), "Content");
         $uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     });
     $fields = parent::getCMSFields();
     // We're going to make an SEO tab and move all the usual crap there
     $menuTitle = $fields->dataFieldByName('MenuTitle');
     $urlSegment = $fields->dataFieldByName('URLSegment');
     $fields->addFieldsToTab('Root.SEO', array($menuTitle, $urlSegment));
     $metaField = $fields->fieldByName('Root.Main.Metadata');
     if ($metaField) {
         $metaFields = $metaField->getChildren();
         if ($metaFields->count() > 0) {
             $tab = $fields->findOrMakeTab('Root.SEO');
             $tab->push(HeaderField::create('Meta', 3));
             foreach ($metaFields as $field) {
                 $tab->push($field);
             }
         }
         $fields->removeByName('Metadata');
     }
     return $fields;
 }
Example #14
0
 public function __construct($controller, $name)
 {
     $fields = new FieldList(array(TextField::create('UserSubmittedGallery'), TextField::create('UserSubmittedArtistName'), DatetimeField::create('UserSubmittedStartDate'), CheckboxField::create('UserSubmittedHasFreeDrinks')));
     $actions = new FieldList();
     $validator = new RequiredFields(array('UserSubmittedGallery', 'UserSubmittedArtistName', 'UserSubmittedStartDate'));
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 public function getCMSFields()
 {
     $datetimeField = DatetimeField::create("Date")->setTitle($this->fieldLabel("Date"));
     $datetimeField->getDateField()->setConfig("dmyfields", true);
     // Check if NewsImage should be saved in a seperate folder
     if (self::config()->save_image_in_seperate_folder == false) {
         $UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news");
     } else {
         if ($this->ID == "0") {
             $UploadField = FieldGroup::create(LiteralField::create("Save", $this->fieldLabel("SaveHelp")))->setTitle($this->fieldLabel("NewsImage"));
         } else {
             $UploadField = UploadField::create("NewsImage")->setTitle($this->fieldLabel("NewsImage"))->setFolderName("news/" . $this->URLSegment);
         }
     }
     // Create direct link to NewsArticle
     if ($this->ID == "0") {
         // Little hack to hide $urlsegment when article isn't saved yet.
         $urlsegment = LiteralField::create("NoURLSegmentYet", "");
     } else {
         if ($NewsHolder = $this->NewsHolder()) {
             $baseLink = Controller::join_links(Director::absoluteBaseURL(), $NewsHolder->Link(), $this->URLSegment);
         }
         $urlsegment = Fieldgroup::create(LiteralField::create("URLSegment", "URLSegment")->setContent('<a href="' . $baseLink . '" target="_blank">' . $baseLink . '</a>'))->setTitle("URLSegment");
     }
     $fields = FieldList::create(new TabSet("Root", new Tab("Main", $urlsegment, TextField::create("Title")->setTitle($this->fieldLabel("Title")), $datetimeField, HTMLEditorField::create("Content")->setTitle($this->fieldLabel("Content")), $UploadField)));
     $this->extend("updateCMSFields", $fields);
     return $fields;
 }
 /**
  * Adds PublishDate to CMS Form.
  * @param $fields
  */
 function updateCMSFields(FieldList $fields)
 {
     $datefield = DatetimeField::create('PublishDate', _t('CMSPublishableDataExtension.PUBLISH_DATE', 'Publish date'));
     $datefield->getDateField()->setConfig('showcalendar', 1);
     // $datefield->setConfig('setLocale', en_US);
     $fields->addFieldToTab("Root.Main", $datefield, 'Content');
 }
 public function setValue($val)
 {
     if ($val == array('date' => '', 'time' => '')) {
         $val = null;
     }
     parent::setValue($val);
 }
 /**
  * 
  * @param FieldList $fields
  * @return void
  */
 public function updateCMSFields(FieldList $fields)
 {
     $controller = Controller::curr();
     if ($controller instanceof SecuredAssetAdmin || $controller instanceof CMSSecuredFileAddController) {
         Requirements::combine_files('securedassetsadmincmsfields.js', array(SECURED_FILES_MODULE_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-sliderAccess.js', SECURED_FILES_MODULE_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.min.js', SECURED_FILES_MODULE_DIR . "/javascript/SecuredFilesLeftAndMain.js"));
         Requirements::css(SECURED_FILES_MODULE_DIR . '/thirdparty/javascript/jquery-ui/timepicker/jquery-ui-timepicker-addon.min.css');
         Requirements::css(SECURED_FILES_MODULE_DIR . "/css/SecuredFilesLeftAndMain.css");
         Requirements::javascript(SECURED_FILES_MODULE_DIR . "/javascript/SecuredFilesLeftAndMain.js");
         if ($this->isFile()) {
             $buttonsSecurity = $this->showButtonsSecurity();
             $buttonsEmbargoExpiry = $this->showButtonsEmbargoExpiry();
             // Embargo field
             $embargoTypeField = new OptionSetField("EmbargoType", "", array("None" => _t('AdvancedSecuredFiles.NONENICE', "None"), "Indefinitely" => _t('AdvancedSecuredFiles.INDEFINITELYNICE', "Hide document indefinitely"), "UntilAFixedDate" => _t('AdvancedSecuredFiles.UNTILAFIXEDDATENICE', 'Hide until set date')));
             $embargoUntilDateField = DatetimeField::create('EmbargoedUntilDate', '');
             $embargoUntilDateField->getDateField()->setConfig('showcalendar', true)->setConfig('dateformat', 'dd-MM-yyyy')->setConfig('datavalueformat', 'dd-MM-yyyy')->setAttribute('readonly', true);
             $embargoUntilDateField->getTimeField()->setAttribute('readonly', true);
             // Expiry field
             $expireTypeField = new OptionSetField("ExpiryType", "", array("None" => _t('AdvancedSecuredFiles.NONENICE', "None"), "AtAFixedDate" => _t('AdvancedSecuredFiles.ATAFIXEDDATENICE', 'Set file to expire on')));
             $expiryDatetime = DatetimeField::create('ExpireAtDate', '');
             $expiryDatetime->getDateField()->setConfig('showcalendar', true)->setConfig('dateformat', 'dd-MM-yyyy')->setConfig('datavalueformat', 'dd-MM-yyyy')->setAttribute('readonly', true);
             $expiryDatetime->getTimeField()->setAttribute('readonly', true);
             $securitySettingsGroup = FieldGroup::create(FieldGroup::create($embargoTypeField, $embargoUntilDateField)->addExtraClass('embargo option-change-datetime')->setName("EmbargoGroupField"), FieldGroup::create($expireTypeField, $expiryDatetime)->addExtraClass('expiry option-change-datetime')->setName("ExpiryGroupField"));
         } else {
             $buttonsSecurity = $this->showButtonsSecurity();
             $buttonsEmbargoExpiry = '';
             $securitySettingsGroup = FieldGroup::create();
         }
         $canViewTypeField = new OptionSetField("CanViewType", "", array("Inherit" => _t('AdvancedSecuredFiles.INHERIT', "Inherit from parent folder"), "Anyone" => _t('SiteTree.ACCESSANYONE', 'Anyone'), "LoggedInUsers" => _t('SiteTree.ACCESSLOGGEDIN', 'Logged-in users'), "OnlyTheseUsers" => _t('SiteTree.ACCESSONLYTHESE', 'Only these people (choose from list)')));
         $canEditTypeField = new OptionSetField("CanEditType", "", array("Inherit" => _t('AdvancedSecuredFiles.INHERIT', "Inherit from parent folder"), "LoggedInUsers" => _t('SiteTree.ACCESSLOGGEDIN', 'Logged-in users'), "OnlyTheseUsers" => _t('SiteTree.ACCESSONLYTHESE', 'Only these people (choose from list)')));
         $groupsMap = array();
         foreach (Group::get() as $group) {
             // Listboxfield values are escaped, use ASCII char instead of &raquo;
             $groupsMap[$group->ID] = $group->getBreadcrumbs(' > ');
         }
         asort($groupsMap);
         $viewerGroupsField = ListboxField::create("ViewerGroups", _t('AdvancedSecuredFiles.VIEWERGROUPS', "Viewer Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('AdvancedSecuredFiles.GroupPlaceholder', 'Click to select group'));
         $editorGroupsField = ListBoxField::create("EditorGroups", _t('AdvancedSecuredFiles.EDITORGROUPS', "Editor Groups"))->setMultiple(true)->setSource($groupsMap)->setAttribute('data-placeholder', _t('AdvancedSecuredFiles.GroupPlaceholder', 'Click to select group'));
         $securitySettingsGroup->push(FieldGroup::create($canViewTypeField, $viewerGroupsField)->addExtraClass('whocanview option-change-listbox')->setName("CanViewGroupField"));
         $securitySettingsGroup->push(FieldGroup::create($canEditTypeField, $editorGroupsField)->addExtraClass('whocanedit option-change-listbox')->setName("CanEditGroupField"));
         $securitySettingsGroup->setName("SecuritySettingsGroupField")->addExtraClass('security-settings');
         $showAdvanced = AdvancedAssetsFilesSiteConfig::is_security_enabled() || $this->isFile() && AdvancedAssetsFilesSiteConfig::is_embargoexpiry_enabled();
         if ($showAdvanced) {
             $fields->insertAfter(LiteralField::create('BottomTaskSelection', $this->owner->renderWith('componentField', ArrayData::create(array('ComponentSecurity' => AdvancedAssetsFilesSiteConfig::component_cms_icon('security'), 'ComponentEmbargoExpiry' => AdvancedAssetsFilesSiteConfig::component_cms_icon('embargoexpiry'), 'ButtonsSecurity' => $buttonsSecurity, 'ButtonsEmbargoExpiry' => $buttonsEmbargoExpiry)))), "ParentID");
             $fields->insertAfter($securitySettingsGroup, "BottomTaskSelection");
         }
     }
     if (!is_a($this->owner, "Folder") && is_a($this->owner, "File")) {
         $parentIDField = $fields->dataFieldByName("ParentID");
         if ($controller instanceof SecuredAssetAdmin) {
             $securedRoot = FileSecured::getSecuredRoot();
             $parentIDField->setTreeBaseID($securedRoot->ID);
             $parentIDField->setFilterFunction(create_function('$node', "return \$node->Secured == 1;"));
         } else {
             $parentIDField->setFilterFunction(create_function('$node', "return \$node->Secured == 0;"));
         }
         // SilverStripe core has a bug for search function now, so disable it for now.
         $parentIDField->setShowSearch(false);
     }
 }
Example #19
0
 public function getValidators()
 {
     $validators = parent::getValidators();
     if ($this->validation === null) {
         $validators[] = new Validator\Date();
     }
     return $validators;
 }
 public function getCMSFields()
 {
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', new HiddenField('OwnerID', 'OwnerID'));
     $f->addFieldsToTab('Root.Main', new TextField('ExternalOrderId', '#Order'));
     $f->addFieldsToTab('Root.Main', new TextField('ExternalAttendeeId', '#Attendee'));
     $f->addFieldsToTab('Root.Main', $date = new DatetimeField('TicketBoughtDate', 'Bought Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $f->addFieldsToTab('Root.Main', $date = new DatetimeField('TicketChangedDate', 'Changed Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $summit_id = $_REQUEST['SummitID'];
     if (empty($summit_id)) {
         $summit_id = $this->Owner()->exists() ? $this->Owner()->SummitID : Summit::get_active()->ID;
     }
     $f->addFieldsToTab('Root.Main', $ddl = new DropdownField('TicketTypeID', 'Ticket Type', SummitTicketType::get()->filter('SummitID', $summit_id)->map("ID", "Name")));
     return $f;
 }
 public function getCMSFields()
 {
     $labels = $this->fieldLabels();
     $fields = parent::getCMSFields();
     $fields->removeByName("PortalId");
     $dateField = new DatetimeField("Date", $labels["Date"]);
     $dateField->getDateField()->setConfig('showcalendar', true);
     $fields->addFieldToTab("Root.Main", $dateField);
     $fields->addFieldToTab("Root.Main", new TextField("Name", $labels["Name"]));
     $fields->addFieldToTab("Root.Main", new EmailField("Email", $labels["Email"]));
     $fields->addFieldToTab("Root.Main", new TextField("Website", $labels["Website"]));
     $fields->addFieldToTab("Root.Main", new ReadonlyField("IpAddress", $labels["IpAddress"]));
     $fields->addFieldToTab("Root.Main", new ReadonlyField("Host", $labels["Host"]));
     $fields->addFieldToTab("Root.Main", new TextareaField("Message", $labels["Message"]));
     $fields->addFieldToTab("Root.Main", new TextareaField("Comment", $labels["Comment"]));
     return $fields;
 }
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionBeginDate', 'Submission Begin Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $date->setConfig('dateformat', 'dd/MM/yyyy');
     $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionEndDate', 'Submission End Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $date->setConfig('dateformat', 'dd/MM/yyyy');
     $f->addFieldsToTab('Root.Main', new NumericField('MaxSubmissionAllowedPerUser', 'Max. Submission Allowed Per User'));
     if ($this->ID > 0) {
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $config->addComponent(new GridFieldDeleteAction('unlinkrelation'));
         $groups = new GridField('AllowedGroups', 'Allowed Groups', $this->AllowedGroups(), $config);
         $f->addFieldToTab('Root.Main', $groups);
     }
     return $f;
 }
 /**
  *	Display the appropriate CMS media page fields and respective media type attributes.
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Display the media type as read only.
     $fields->addFieldToTab('Root.Main', ReadonlyField::create('Type', 'Type', $this->MediaType()->Title), 'Title');
     // Display a notification that the parent holder contains mixed children.
     $parent = $this->getParent();
     if ($parent && $parent->getMediaHolderChildren()->exists()) {
         Requirements::css(MEDIAWESOME_PATH . '/css/mediawesome.css');
         $fields->addFieldToTab('Root.Main', LiteralField::create('MediaNotification', "<p class='mediawesome notification'><strong>Mixed {$this->MediaType()->Title} Holder</strong></p>"), 'Type');
     }
     // Display the remaining media page fields.
     $fields->addFieldToTab('Root.Main', TextField::create('ExternalLink')->setRightTitle('An <strong>optional</strong> redirect URL to the media source'), 'URLSegment');
     $fields->addFieldToTab('Root.Main', $date = DatetimeField::create('Date'), 'Content');
     $date->getDateField()->setConfig('showcalendar', true);
     // Allow customisation of categories and tags respective to the current page.
     $tags = MediaTag::get()->map()->toArray();
     $fields->findOrMakeTab('Root.CategoriesTags', 'Categories and Tags');
     $fields->addFieldToTab('Root.CategoriesTags', $categoriesList = ListboxField::create('Categories', 'Categories', $tags)->setMultiple(true));
     $fields->addFieldToTab('Root.CategoriesTags', $tagsList = ListboxField::create('Tags', 'Tags', $tags)->setMultiple(true));
     if (!$tags) {
         $categoriesList->setAttribute('disabled', 'true');
         $tagsList->setAttribute('disabled', 'true');
     }
     // Allow customisation of media type attribute content respective to the current page.
     if ($this->MediaAttributes()->exists()) {
         foreach ($this->MediaAttributes() as $attribute) {
             if (strripos($attribute->Title, 'Time') || strripos($attribute->Title, 'Date') || stripos($attribute->Title, 'When')) {
                 // Display an attribute as a date time field where appropriate.
                 $fields->addFieldToTab('Root.Main', $custom = DatetimeField::create("{$attribute->ID}_MediaAttribute", $attribute->Title, $attribute->Content), 'Content');
                 $custom->getDateField()->setConfig('showcalendar', true);
             } else {
                 $fields->addFieldToTab('Root.Main', $custom = TextField::create("{$attribute->ID}_MediaAttribute", $attribute->Title, $attribute->Content), 'Content');
             }
             $custom->setRightTitle('Custom <strong>' . strtolower($this->MediaType()->Title) . '</strong> attribute');
         }
     }
     // Display an abstract field for content summarisation.
     $fields->addfieldToTab('Root.Main', $abstract = TextareaField::create('Abstract'), 'Content');
     $abstract->setRightTitle('A concise summary of the content');
     $abstract->setRows(6);
     // Allow customisation of images and attachments.
     $type = strtolower($this->MediaType()->Title);
     $fields->findOrMakeTab('Root.ImagesAttachments', 'Images and Attachments');
     $fields->addFieldToTab('Root.ImagesAttachments', $images = UploadField::create('Images'));
     $images->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif', 'bmp'));
     $images->setFolderName("media-{$type}/{$this->ID}/images");
     $fields->addFieldToTab('Root.ImagesAttachments', $attachments = UploadField::create('Attachments'));
     $attachments->setFolderName("media-{$type}/{$this->ID}/attachments");
     // Allow extension customisation.
     $this->extend('updateMediaPageCMSFields', $fields);
     return $fields;
 }
 public function getFormField()
 {
     switch ($this->Type) {
         case 'datetime':
             $field = new DatetimeField($this->getFormFieldName(), $this->Title);
             $field->getDateField()->setConfig('showcalendar', true);
             $field->getTimeField()->setConfig('showdropdown', true);
             break;
         case 'date':
             $field = new DateField($this->getFormFieldName(), $this->Title);
             $field->setConfig('showcalendar', true);
             break;
         case 'time':
             $field = new TimeField($this->getFormFieldName(), $this->Title);
             $field->setConfig('showdropdown', true);
             break;
     }
     if ($this->DefaultType == 'created') {
         $field->setRightTitle('The value will default to the time this record was created.');
     }
     return $field;
 }
Example #25
0
 function getCMSFields()
 {
     Requirements::javascript('blog/javascript/bbcodehelp.js');
     Requirements::themedCSS('bbcodehelp');
     $firstName = Member::currentUser() ? Member::currentUser()->FirstName : '';
     $codeparser = new BBCodeParser();
     SiteTree::disableCMSFieldsExtensions();
     $fields = parent::getCMSFields();
     SiteTree::enableCMSFieldsExtensions();
     if (!self::$allow_wysiwyg_editing) {
         $fields->removeFieldFromTab("Root.Content.Main", "Content");
         $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20));
     }
     $fields->addFieldToTab("Root.Content.Main", $dateField = new DatetimeField("Date", _t("BlogEntry.DT", "Date")), "Content");
     $dateField->getDateField()->setConfig('showcalendar', true);
     $dateField->getTimeField()->setConfig('showdropdown', true);
     $fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName), "Content");
     if (!self::$allow_wysiwyg_editing) {
         $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "<div id='BBCode' class='field'>" . "<a  id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH", "BBCode help") . "</a>" . "<div id='BBTagsHolder' style='display:none;'>" . $codeparser->useable_tagsHTML() . "</div></div>"));
     }
     $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")), "Content");
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $eventTypeSource = EventType::get()->map()->toArray();
     $countrySource = Country::get()->map()->toArray();
     $fields->addFieldsToTab('Root.Main', array(TextField::create('LocationName', 'Location Name'), TextareaField::create('LocationAddress', 'Location Address'), $startDate = DatetimeField::create('StartTime', 'Start'), $endDate = DatetimeField::create('EndTime', 'End'), TextareaField::create('Price', 'Price'), DropdownField::create('EventTypeID', 'Type', $eventTypeSource), DropdownField::create('CountryID', 'Country', $countrySource), UploadField::create('Image', 'Image')));
     $date = Date('Y-m-d', time());
     $time = Date('H:i:s', time());
     $startDate->getDateField()->setConfig('showcalendar', true);
     $startDate->getDateField()->setValue($date);
     $startDate->getTimeField()->setValue($time);
     $endDate->getDateField()->setConfig('showcalendar', true);
     $endDate->getDateField()->setValue($date);
     $endDate->getTimeField()->setValue($time);
     return $fields;
 }
Example #27
0
 public function getCmsFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('ParentID');
     // Set today's date if empty
     if (!$this->Date) {
         $this->Date = date('Y-m-d H:i:s');
     }
     $fields->dataFieldByName('Title')->setTitle('Article Title');
     $fields->addFieldToTab('Root.Main', LiteralField::create('DateInfo', '<p>Dates set in the future will not be visible until that day/time.</p>'), 'Date');
     $fields->addFieldToTab('Root.Main', $datetime = DatetimeField::create('Date', 'Article Date / Time (24h)'), 'Content');
     $datetime->getDateField()->setConfig('showcalendar', 1);
     $datetime->getTimeField()->setConfig('timeformat', 'HH:mm');
     $fields->addFieldToTab('Root.Main', $ul = UploadField::create('Thumbnail', 'Article Image'), 'Content');
     $ul->setFolderName('NewsArticles');
     $ul->setAllowedFileCategories('image');
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if (!Config::inst()->get('NewsPost', 'pages_admin')) {
         $arrTypes = NewsPost::GetNewsTypes();
         if (count($arrTypes) > 1) {
             $arrDropDownSource = array();
             foreach ($arrTypes as $strType) {
                 $arrDropDownSource[$strType] = $strType;
             }
             $fields->addFieldToTab('Root.Main', DropdownField::create('ClassName')->setSource($arrDropDownSource)->setTitle('Type'), 'Content');
         }
     }
     $fields->addFieldsToTab('Root.Main', array(DropdownField::create('ParentID')->setSource(NewsIndex::get()->map()->toArray())->setTitle('Parent Page'), DatetimeField::create('DateTime'), TextField::create('Tags'), TextField::create('Author'), HtmlEditorField::create('Summary')->setRows(5)), 'Content');
     if ($this->ID) {
         $fields->addFieldToTab('Root.Main', CheckboxSetField::create('Categories')->setSource(NewsCategory::get()->map('ID', 'Title')->toArray()), 'Content');
         $fields->addFieldToTab('Root.RelatedArticles', GridField::create('RelatedArticles', 'Related Articles')->setList($this->RelatedArticles())->setConfig($relatedArticlesConfig = new GridFieldConfig_RelationEditor()));
     }
     $this->extend('updateNewsPostCMSFields', $fields);
     return $fields;
 }
 /**
  * @param int $id
  * @param FieldList $fields
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $filter = $this->jobQueue->getJobListFilter(null, 300);
     $list = DataList::create('QueuedJobDescriptor');
     $list = $list->where($filter)->sort('Created', 'DESC');
     $gridFieldConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldQueuedJobExecute('execute'))->addComponent(new GridFieldQueuedJobExecute('pause', function ($record) {
         return $record->JobStatus == QueuedJob::STATUS_WAIT || $record->JobStatus == QueuedJob::STATUS_RUN;
     }))->addComponent(new GridFieldQueuedJobExecute('resume', function ($record) {
         return $record->JobStatus == QueuedJob::STATUS_PAUSED || $record->JobStatus == QueuedJob::STATUS_BROKEN;
     }))->removeComponentsByType('GridFieldAddNewButton');
     // Set messages to HTML display format
     $formatting = array('Messages' => function ($val, $obj) {
         return "<div style='max-width: 300px; max-height: 200px; overflow: auto;'>{$obj->Messages}</div>";
     });
     $gridFieldConfig->getComponentByType('GridFieldDataColumns')->setFieldFormatting($formatting);
     // Replace gridfield
     $grid = new GridField('QueuedJobDescriptor', _t('QueuedJobs.JobsFieldTitle', 'Jobs'), $list, $gridFieldConfig);
     $grid->setForm($form);
     $form->Fields()->replaceField('QueuedJobDescriptor', $grid);
     if (Permission::check('ADMIN')) {
         $types = ClassInfo::subclassesFor('AbstractQueuedJob');
         $types = array_combine($types, $types);
         unset($types['AbstractQueuedJob']);
         $jobType = DropdownField::create('JobType', _t('QueuedJobs.CREATE_JOB_TYPE', 'Create job of type'), $types);
         $jobType->setEmptyString('(select job to create)');
         $form->Fields()->push($jobType);
         $jobParams = MultiValueTextField::create('JobParams', _t('QueuedJobs.JOB_TYPE_PARAMS', 'Constructor parameters for job creation'));
         $form->Fields()->push($jobParams);
         $form->Fields()->push($dt = DatetimeField::create('JobStart', _t('QueuedJobs.START_JOB_TIME', 'Start job at')));
         $dt->getDateField()->setConfig('showcalendar', true);
         $actions = $form->Actions();
         $actions->push(FormAction::create('createjob', _t('QueuedJobs.CREATE_NEW_JOB', 'Create new job')));
     }
     $this->extend('updateEditForm', $form);
     return $form;
 }
 /**
  * Adds EmbargoExpiry time fields to the CMS
  *
  * @param FieldSet $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     Requirements::css(SCHEDULER_DIR . "/css/cms.css");
     //		$fields->insertBefore(
     $publishDate = DatetimeField::create("Embargo", _t("Scheduler.Embargo", "Page available from"));
     //			"Content"
     //		);
     $publishDate->getDateField()->setConfig('dateformat', 'dd-MM-yyyy');
     $publishDate->getDateField()->setConfig("showcalendar", true);
     $publishDate->getTimeField()->setConfig('timeformat', 'HH:mm');
     $publishDate->getTimeField()->setAttribute('placeholder', '00:00');
     //$publishDate->getTimeField()->setValue("13:00");
     $publishDate->setRightTitle(_t("Scheduler.LeaveEmptyEmbargo", "Leave empty to have page available right away (after publishing)"));
     //		$fields->insertAfter(
     $unpublishDate = DatetimeField::create("Expiry", _t("Scheduler.Expiry", "Page expires on"));
     //			"Embargo"
     //		);
     $unpublishDate->getDateField()->setConfig('dateformat', 'dd-MM-yyyy');
     $unpublishDate->getDateField()->setConfig("showcalendar", true);
     $unpublishDate->getTimeField()->setConfig('timeformat', 'HH:mm');
     $unpublishDate->getTimeField()->setAttribute('placeholder', '00:00');
     $unpublishDate->setRightTitle(_t("Scheduler.LeaveEmptyExpire", "Leave empty to leave page published indefinitely"));
     $fields->insertBefore(ToggleCompositeField::create('SoftScheduler', _t('SoftScheduler.Schedule', 'Schedule publishing & unpublishing of this page'), array($publishDate, $unpublishDate))->setHeadingLevel(4), 'Content');
     //$fields->findOrMakeTab($tabName);
     //$fields->insertAfter(TextField::create('Test'),'Header');
     //		Debug::dump($fields->fieldByName('Root.Main.Options'));
     //		$optionspanel = $fields->fieldByName('Root.Main.Options');
     //		$optionspanel->push(TextField::create('Test'));
     //		$optbar = $fields->fieldByName('Root.Main.Options');
     //		if(! $optbar){
     //			$fields->addFieldsToTab('Root.Main', $optbar = RightSidebar::create('Options'));
     //		}
     //		$optbar->push( $publishDate );
     //		$optbar->push( $unpublishDate );
     //		$fields->fieldByName('Root')->setTemplate('RightSidebarInner');
 }