public function __construct($name, $title = null, $value = null, $form = null) { $allowed_types = $this->stat('allowed_types'); $field_types = $this->stat('field_types'); if (empty($allowed_types)) { $allowed_types = array_keys($field_types); } $field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types)); $field->setEmptyString('Please choose the Link Type'); $this->composite_fields['Type'] = $field; foreach ($allowed_types as $type) { $def = $field_types[$type]; $field_name = "{$name}[{$type}]"; switch ($def['field']) { case 'TreeDropdownField': $field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title'); break; default: $field = new TextField($field_name, ''); break; } $field->setDescription($def['description']); $field->addExtraClass('FlexiLinkCompositeField'); $this->composite_fields[$type] = $field; } $this->setForm($form); parent::__construct($name, $title, $value, $form); }
public function index() { $language = OW::getLanguage(); $billingService = BOL_BillingService::getInstance(); $adminForm = new Form('adminForm'); $element = new TextField('creditValue'); $element->setRequired(true); $element->setLabel($language->text('billingcredits', 'admin_usd_credit_value')); $element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc')); $element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue')); $validator = new FloatValidator(0.1); $validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format')); $element->addValidator($validator); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue($language->text('billingcredits', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']); OW::getFeedback()->info($language->text('billingcredits', 'user_save_success')); } } $this->addForm($adminForm); $this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading')); $this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading')); $this->setPageHeadingIconClass('ow_ic_app'); }
/** * Class constructor * */ public function __construct() { parent::__construct('configSaveForm'); $language = OW::getLanguage(); $field = new TextField('public_key'); $field->addValidator(new ConfigRequireValidator()); $this->addElement($field); $field = new CheckboxField('billing_enabled'); $this->addElement($field); // submit $submit = new Submit('save'); $submit->setValue($language->text('admin', 'save_btn_label')); $this->addElement($submit); $promoUrl = new TextField('app_url'); $promoUrl->setRequired(); $promoUrl->addValidator(new UrlValidator()); $promoUrl->setLabel($language->text('skandroid', 'app_url_label')); $promoUrl->setDescription($language->text('skandroid', 'app_url_desc')); $promoUrl->setValue(OW::getConfig()->getValue('skandroid', 'app_url')); $this->addElement($promoUrl); $smartBanner = new CheckboxField('smart_banner'); $smartBanner->setLabel($language->text('skandroid', 'smart_banner_label')); $smartBanner->setDescription($language->text('skandroid', 'smart_banner_desc')); $smartBanner->setValue(OW::getConfig()->getValue('skandroid', 'smart_banner')); $this->addElement($smartBanner); }
/** * Class constructor * */ public function __construct($configs) { parent::__construct('configSaveForm'); $language = OW::getLanguage(); $field = new RadioField('itunes_mode'); $field->setOptions(array("test" => $language->text("skadateios", "itunes_mode_test"), "live" => $language->text("skadateios", "itunes_mode_live"))); $field->setValue($configs["itunes_mode"]); $this->addElement($field); $field = new CheckboxField('billing_enabled'); $field->setValue($configs["billing_enabled"]); $this->addElement($field); $field = new TextField('itunes_secret'); $field->addValidator(new ConfigRequireValidator()); $field->setValue($configs["itunes_secret"]); $this->addElement($field); $promoUrl = new TextField('app_url'); $promoUrl->setRequired(); $promoUrl->addValidator(new UrlValidator()); $promoUrl->setLabel($language->text('skadateios', 'app_url_label')); $promoUrl->setDescription($language->text('skadateios', 'app_url_desc')); $promoUrl->setValue($configs['app_url']); $this->addElement($promoUrl); $smartBanner = new CheckboxField('smart_banner'); $smartBanner->setLabel($language->text('skadateios', 'smart_banner_label')); $smartBanner->setDescription($language->text('skadateios', 'smart_banner_desc')); $smartBanner->setValue($configs['smart_banner']); $this->addElement($smartBanner); // submit $submit = new Submit('save'); $submit->setValue($language->text('admin', 'save_btn_label')); $this->addElement($submit); }
public function getCMSFields() { $fields = parent::getCMSFields(); // Contact Form settings $recipient_field = new EmailField('DefaultRecipient', 'Email recipient'); $recipient_field->setDescription('Default email address to send submissions to.'); $subject_field = new TextField('Subject', 'Email subject'); $subject_field->setDescription('Subject for the email.'); $default_from_field = new EmailField('DefaultFrom', 'Email from'); $default_from_field->setDescription('Default from email address.'); $fields->addFieldToTab('Root.ContactForm.Settings', $recipient_field); $fields->addFieldToTab('Root.ContactForm.Settings', $subject_field); $fields->addFieldToTab('Root.ContactForm.Settings', $default_from_field); // Contact Form fields $conf = GridFieldConfig_RelationEditor::create(10); $conf->addComponent(new GridFieldSortableRows('SortOrder')); $data_columns = $conf->getComponentByType('GridFieldDataColumns'); $data_columns->setDisplayFields(array('Name' => 'Name', 'Type' => 'Type', 'requiredText' => 'Required')); $contact_form_fields = new GridField('Fields', 'Field', $this->ContactFields(), $conf); $fields->addFieldToTab('Root.ContactForm.Fields', $contact_form_fields); // Recipient map $contact_fields = array(); foreach ($this->ContactFields() as $contact_field) { $contact_fields[$contact_field->Name] = $contact_field->Name; } $recipient_map_field_field = new DropdownField('RecipientMapField', 'Recipient Map Field', $contact_fields); $recipient_map_field_field->setDescription('Field used to map recipients.'); $recipient_map_field = new TextareaField('RecipientMap', 'Recipient Map'); $recipient_map_field->setDescription('Map field values to an email address (format: value:email address) one per line.'); $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field_field); $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field); return $fields; }
public function updateCMSFields(\FieldList $fields) { $tabTitle = _t('SiteConfigExtension.TABSITEINFO', "Site Infos"); // add a Logo to whole sites $fields->addFieldToTab('Root.' . $tabTitle, new UploadField('Logo', _t('SiteConfigExtension.LOGO', 'Logo'))); $latField = new TextField('Lat', _t('SiteConfigExtension.LATITUDE', 'Latitude')); $lngField = new TextField('Lng', _t('SiteConfigExtension.LONGITUDE', 'Longitude')); $lngField->setDescription(_t('SiteConfigExtension.GEOINFO', 'Get latitude & longitude values here: <a href="http://itouchmap.com/latlong.html" target="_blank">itouchmap.com</a>.')); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Company', _t('SiteConfigExtension.COMPANY', 'Company'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('SiteOwner', _t('SiteConfigExtension.SITEOWNER', 'Owner'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Street', _t('SiteConfigExtension.STREET', 'Street'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('HouseNumber', _t('SiteConfigExtension.HOUSENUMBER', 'Housenumber'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Zipcode', _t('SiteConfigExtension.ZIPCODE', 'Zipcode'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Destination', _t('SiteConfigExtension.DESTINATION', 'City'))); $fields->addFieldToTab('Root.' . $tabTitle, $latField); $fields->addFieldToTab('Root.' . $tabTitle, $lngField); $fields->addFieldToTab('Root.' . $tabTitle, new EmailField('Email', _t('SiteConfigExtension.EMAIL', 'Email'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Phone', _t('SiteConfigExtension.PHONE', 'Phone'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Mobile', _t('SiteConfigExtension.MOBILE', 'Mobile'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Fax', _t('SiteConfigExtension.FAX', 'Fax'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Twitter', _t('SiteConfigExtension.TWITTER', 'Twitter'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Facebook', _t('SiteConfigExtension.FACEBOOK', 'Facebook'))); $fields->addFieldToTab('Root.' . $tabTitle, new TextField('Google', _t('SiteConfigExtension.GOOGLE', 'Google+'))); $fields->addFieldToTab('Root.' . $tabTitle, new HtmlEditorField('Message', _t('SiteConfigExtension.MESSAGE', 'Message'))); }
public function updateCMSFields(FieldList $fields) { // Add back metatitle $fields->fieldByName('Root.Main.Metadata')->insertBefore($metaTitle = new TextField('MetaTitle', 'Meta Title'), 'MetaDescription'); $metaTitle->setDescription('Browsers will display this in the title bar and search engines use this for displaying search results (although it may not influence their ranking).'); // Record current CMS page, quite useful for sorting etc self::$current_cms_page = $this->owner->ID; }
public function getSettingsFields() { $fields = parent::getSettingsFields(); Requirements::javascript('eventmanagement/javascript/cms.js'); $fields->addFieldsToTab('Root.Registration', array(new CheckboxField('OneRegPerEmail', _t('EventManagement.ONE_REG_PER_EMAIL', 'Limit to one registration per email address?')), new CheckboxField('RequireLoggedIn', _t('EventManagement.REQUIRE_LOGGED_IN', 'Require users to be logged in to register?')), $limit = new NumericField('RegistrationTimeLimit', _t('EventManagement.REG_TIME_LIMIT', 'Registration time limit')))); $limit->setDescription(_t('EventManagement.REG_TIME_LIMIT_NOTE', 'The time limit to complete registration, in seconds. Set to 0 to disable place holding.')); $fields->addFieldsToTab('Root.Email', array(new EmailField('EventManagerEmail', _t('EventManagement.EMAIL_EVENT_MANAGER', 'Event manager email to receive registration notifications?')), new CheckboxField('RegEmailConfirm', _t('EventManagement.REQ_EMAIL_CONFIRM', 'Require email confirmation to complete free registrations?')), $info = new TextField('EmailConfirmMessage', _t('EventManagement.EMAIL_CONFIRM_INFO', 'Email confirmation information')), $limit = new NumericField('ConfirmTimeLimit', _t('EventManagement.EMAIL_CONFIRM_TIME_LIMIT', 'Email confirmation time limit')), new CheckboxField('UnRegEmailConfirm', _t('EventManagement.REQ_UN_REG_EMAIL_CONFIRM', 'Require email confirmation to un-register?')), new CheckboxField('EmailNotifyChanges', _t('EventManagement.EMAIL_NOTIFY_CHANGES', 'Notify registered users of event changes via email?')), new CheckboxSetField('NotifyChangeFields', _t('EventManagement.NOTIFY_CHANGE_IN', 'Notify of changes in'), singleton('RegistrableDateTime')->fieldLabels(false)))); $info->setDescription(_t('EventManagement.EMAIL_CONFIRM_INFO_NOTE', 'This message is displayed to users to let them know they need to confirm their registration.')); $limit->setDescription(_t('EventManagement.CONFIRM_TIME_LIMIT_NOTE', 'The time limit to conform registration, in seconds. Set to 0 for no limit.')); return $fields; }
public function __construct($name, $title = null, $value = null, $form = null) { $choices = $this->stat('choices'); $field = new DropdownField("{$name}[Select]", '', array_combine($choices, $choices)); $field->setEmptyString(_t('FlexiChoiceField.USE_OPTIONAL', "None - use provided text")); $this->composite_fields['Select'] = $field; $field = new TextField("{$name}[Text]", ''); $field->setDescription(_t('FlexiChoiceField.TEXT_DESCRIPTION', 'Use this text in place of a selection.')); $this->composite_fields['Text'] = $field; $this->setForm($form); parent::__construct($name, $title, $value, $form); }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new TextField('Title')); $externalLink = new TextField('ExternalLink'); $externalLink->setDescription('e.g. http://www.mydomain.com'); $fields->addFieldToTab('Root.Main', $externalLink); $fields->addFieldToTab('Root.Main', new TreeDropdownField('RelatedPageID', 'Choose Page', 'SiteTree')); $fields->addFieldToTab('Root.Main', new CheckboxField('OpenInNewWindow', 'Open link in new window')); $fields->addFieldToTab('Root.Main', new CheckboxField('ShowInWidget', 'Show news in News Widget')); return $fields; }
/** * Updates the form fields for address'es to use a dropdown for the state and an additional field for the other state * @param {FieldList} $fields Fields to modify */ public function updateFormFields(FieldList $fields) { $stateField = $fields->dataFieldByName('State'); if ($stateField) { $newStateField = new GroupedDropdownField('State', $stateField->Title, array(_t('FedExStateProvinceExtension.UNITED_STATES', '_United States') => array('AL' => _t('FedExStateProvinceExtension.US_AL', '_Alabama'), 'LA' => _t('FedExStateProvinceExtension.US_LA', '_Louisiana'), 'OK' => _t('FedExStateProvinceExtension.US_OK', '_Oklahoma'), 'AK' => _t('FedExStateProvinceExtension.US_AK', '_Alaska'), 'ME' => _t('FedExStateProvinceExtension.US_ME', '_Maine'), 'OR' => _t('FedExStateProvinceExtension.US_OR', '_Oregon'), 'AZ' => _t('FedExStateProvinceExtension.US_AZ', '_Arizona'), 'MD' => _t('FedExStateProvinceExtension.US_MD', '_Maryland'), 'PA' => _t('FedExStateProvinceExtension.US_PA', '_Pennsylvania'), 'AR' => _t('FedExStateProvinceExtension.US_AR', '_Arkansas'), 'MA' => _t('FedExStateProvinceExtension.US_MA', '_Massachusetts'), 'RI' => _t('FedExStateProvinceExtension.US_RI', '_Rhode Island'), 'CA' => _t('FedExStateProvinceExtension.US_CA', '_California'), 'MI' => _t('FedExStateProvinceExtension.US_MI', '_Michigan'), 'SC' => _t('FedExStateProvinceExtension.US_SC', '_South Carolina'), 'CO' => _t('FedExStateProvinceExtension.US_CO', '_Colorado'), 'MN' => _t('FedExStateProvinceExtension.US_MN', '_Minnesota'), 'SD' => _t('FedExStateProvinceExtension.US_SD', '_South Dakota'), 'CT' => _t('FedExStateProvinceExtension.US_CT', '_Connecticut'), 'MS' => _t('FedExStateProvinceExtension.US_MS', '_Mississippi'), 'TN' => _t('FedExStateProvinceExtension.US_TN', '_Tennessee'), 'DE' => _t('FedExStateProvinceExtension.US_DE', '_Delaware'), 'MO' => _t('FedExStateProvinceExtension.US_MO', '_Missouri'), 'TX' => _t('FedExStateProvinceExtension.US_TX', '_Texas'), 'DC' => _t('FedExStateProvinceExtension.US_DC', '_District of Columbia'), 'MT' => _t('FedExStateProvinceExtension.US_MT', '_Montana'), 'UT' => _t('FedExStateProvinceExtension.US_UT', '_Utah'), 'FL' => _t('FedExStateProvinceExtension.US_FL', '_Florida'), 'NE' => _t('FedExStateProvinceExtension.US_NE', '_Nebraska'), 'VT' => _t('FedExStateProvinceExtension.US_VT', '_Vermont'), 'GA' => _t('FedExStateProvinceExtension.US_GA', '_Georgia'), 'NV' => _t('FedExStateProvinceExtension.US_NV', '_Nevada'), 'VA' => _t('FedExStateProvinceExtension.US_VA', '_Virginia'), 'HI' => _t('FedExStateProvinceExtension.US_HI', '_Hawaii'), 'NH' => _t('FedExStateProvinceExtension.US_NH', '_New Hampshire'), 'WA' => _t('FedExStateProvinceExtension.US_WA', '_Washington State'), 'ID' => _t('FedExStateProvinceExtension.US_ID', '_Idaho'), 'NJ' => _t('FedExStateProvinceExtension.US_NJ', '_New Jersey'), 'WV' => _t('FedExStateProvinceExtension.US_WV', '_West Virginia'), 'IL' => _t('FedExStateProvinceExtension.US_IL', '_Illinois'), 'NM' => _t('FedExStateProvinceExtension.US_NM', '_New Mexico'), 'WI' => _t('FedExStateProvinceExtension.US_WI', '_Wisconsin'), 'IN' => _t('FedExStateProvinceExtension.US_IN', '_Indiana'), 'NY' => _t('FedExStateProvinceExtension.US_NY', '_New York'), 'WY' => _t('FedExStateProvinceExtension.US_WY', '_Wyoming'), 'IA' => _t('FedExStateProvinceExtension.US_IA', '_Iowa'), 'NC' => _t('FedExStateProvinceExtension.US_NC', '_North Carolina'), 'PR' => _t('FedExStateProvinceExtension.US_PR', '_Puerto Rico'), 'KS' => _t('FedExStateProvinceExtension.US_KS', '_Kansas'), 'ND' => _t('FedExStateProvinceExtension.US_ND', '_North Dakota'), 'KY' => _t('FedExStateProvinceExtension.US_KY', '_Kentucky'), 'OH' => _t('FedExStateProvinceExtension.US_OH', '_Ohio')), _t('FedExStateProvinceExtension.CANADA', '_Canada') => array('AB' => _t('FedExStateProvinceExtension.CA_AB', '_Alberta'), 'BC' => _t('FedExStateProvinceExtension.CA_BC', '_British Columbia'), 'MB' => _t('FedExStateProvinceExtension.CA_MB', '_Manitoba'), 'NB' => _t('FedExStateProvinceExtension.CA_NB', '_New Brunswick'), 'NL' => _t('FedExStateProvinceExtension.CA_NL', '_Newfoundland'), 'NT' => _t('FedExStateProvinceExtension.CA_NT', '_Northwest Territories and Labrador'), 'NS' => _t('FedExStateProvinceExtension.CA_NS', '_Nova Scotia'), 'NU' => _t('FedExStateProvinceExtension.CA_NU', '_Nunavut'), 'ON' => _t('FedExStateProvinceExtension.CA_ON', '_Ontario'), 'PE' => _t('FedExStateProvinceExtension.CA_PE', '_Prince Edward Island'), 'QC' => _t('FedExStateProvinceExtension.CA_QC', '_Quebec'), 'SK' => _t('FedExStateProvinceExtension.CA_SK', '_Saskatchewan'), 'YT' => _t('FedExStateProvinceExtension.CA_YT', '_Yukon')), '' => _t('FedExStateProvinceExtension.OTHER', '_Other'))); $newStateField->setDescription = $stateField->getDescription(); $newStateField->setForm($stateField->getForm()); $fields->replaceField('State', $newStateField); $fields->insertAfter($otherState = new TextField('OtherState', _t('FedExStateProvinceExtension.OTHER_STATE', '_Other State'), null, 200), 'State'); $otherState->setDescription(_t('FedExStateProvinceExtension.OTHER_DESC', '_If you chose other as your state please place it here')); $otherState->setForm($stateField->getForm()); } }
public function updateCMSFields(FieldList $fields) { $fields->removeByName('Theme'); if (Config::inst()->get('SiteConfig', 'can_select_theme')) { $themeDropdownField = new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemesExtended()); $themeDropdownField->setEmptyString(_t('SiteConfig.DEFAULTTHEME', '(Use default theme)')); $fields->addFieldToTab('Root.Theme', $themeDropdownField); } // Colors $fields->addFieldToTab('Root.Theme', new HeaderField('ColorH', _t('ThemeSiteConfigExtension.ColorH', 'Colors'))); $fields->addFieldToTab('Root.Theme', $BaseColor = new MiniColorsField('BaseColor', _t('ThemeSiteConfigExtension.BaseColor', 'Base Color'))); $BaseColor->setDescription(_t('ThemeSiteConfigExtension.BaseColorDesc', "The background color of your website")); $fields->addFieldToTab('Root.Theme', new MiniColorsField('PrimaryColor', _t('ThemeSiteConfigExtension.PrimaryColor', 'Primary Color'))); $fields->addFieldToTab('Root.Theme', new MiniColorsField('HoverColor', _t('ThemeSiteConfigExtension.HoverColor', 'Hover Color'))); $fields->addFieldToTab('Root.Theme', new MiniColorsField('SecondaryColor', _t('ThemeSiteConfigExtension.SecondaryColor', 'Secondary Color'))); $fields->addFieldToTab('Root.Theme', new MiniColorsField('CtaColor', _t('ThemeSiteConfigExtension.CtaColor', 'Call To Action Color'))); // Fonts $fields->addFieldToTab('Root.Theme', new HeaderField('FontsH', _t('ThemeSiteConfigExtension.FontsH', 'Fonts'))); $fields->addFieldToTab('Root.Theme', $hf = new TextField('HeaderFont', _t('ThemeSiteConfigExtension.HeaderFont', 'Header Font'))); $fields->addFieldToTab('Root.Theme', $hfw = new TextField('HeaderFontWeight', _t('ThemeSiteConfigExtension.HeaderFontWeight', 'Header Font Weight'))); $fields->addFieldToTab('Root.Theme', $bf = new TextField('BodyFont', _t('ThemeSiteConfigExtension.BodyFont', 'Body Font'))); $fields->addFieldToTab('Root.Theme', $bfw = new TextField('BodyFontWeight', _t('ThemeSiteConfigExtension.BodyFontWeight', 'Body Font Weight'))); $fields->addFieldToTab('Root.Theme', $gf = new TextField('GoogleFonts', _t('ThemeSiteConfigExtension.GoogleFonts', 'Google Fonts'))); $hf->setAttribute('placeholder', 'Arial, Helvetica, sans-serif'); $bf->setAttribute('placeholder', 'Arial, Helvetica, sans-serif'); $gf->setDescription('family=Open+Sans:400italic,400,600&subset=latin,latin-ext'); // Images $fields->addFieldToTab('Root.Theme', new HeaderField('ImagesH', _t('ThemeSiteConfigExtension.ImagesH', 'Images'))); $fields->addFieldToTab('Root.Theme', ImageUploadField::createForClass($this, 'Logo', _t('ThemeSiteConfigExtension.Logo', 'Logo'))); $fields->addFieldToTab('Root.Theme', $icon = ImageUploadField::createForClass($this, 'Icon', _t('ThemeSiteConfigExtension.Icon', 'Icon'))); $fields->addFieldToTab('Root.Theme', ImageUploadField::createForClass($this, 'FooterImage', _t('ThemeSiteConfigExtension.FooterImage', 'Footer Image'))); if (is_file(Director::baseFolder() . $this->FaviconPath())) { $icon->setDescription(_t('ThemeSiteConfigExtension.FaviconPreview', 'Favicon preview') . ' <img src="' . $this->FaviconPath() . '" alt="Favicon" />'); } else { $icon->setDescription(_t('ThemeSiteConfigExtension.NoFavicon', 'No favicon created for this site')); } $fields->addFieldToTab('Root.Theme', ImageUploadField::createForClass($this, 'BackgroundImages', _t('ThemeSiteConfigExtension.BackgroundImages', 'Background Images'))); $fields->addFieldToTab('Root.Theme', new DropdownField('BackgroundRepeat', _t('ThemeSiteConfigExtension.BackgroundRepeat', 'Background Repeat'), array(self::BACKGROUND_NO_REPEAT => 'no repeat', self::BACKGROUND_REPEAT => 'repeat', self::BACKGROUND_REPEAT_X => 'repeat x', self::BACKGROUND_REPEAT_Y => 'repeat y'))); if (Director::isDev() || Permission::check('ADMIN')) { $fields->addFieldToTab('Root.Theme', new HeaderField('ThemeDevHeader', 'Dev tools')); $fields->addFieldToTab('Root.Theme', new CheckboxField('RefreshTheme')); $fields->addFieldToTab('Root.Theme', new CheckboxField('RefreshIcon')); } // Simple Google Analytics helper, disable if other extension are found if (!$this->owner->hasExtension('GoogleConfig') && !$this->owner->hasExtension('ZenGoogleAnalytics')) { $fields->addFieldToTab('Root.Main', $ga = new TextField('GoogleAnalyticsCode')); $ga->setAttribute('placeholder', 'UA-0000000-00'); } return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $description = 'This is <strong>bold</strong> help text'; $fields->addFieldsToTab('Root.Text', array(Object::create('TextField', 'Required', 'Required field'), Object::create('TextField', 'Validated', 'Validated field (checks range between 1 and 3)'), Object::create('ReadonlyField', 'Readonly', 'ReadonlyField'), Object::create('TextareaField', 'Textarea', 'TextareaField - 8 rows')->setRows(8), Object::create('TextField', 'Text', 'TextField'), Object::create('HtmlEditorField', 'HTMLField', 'HtmlEditorField'), Object::create('EmailField', 'Email', 'EmailField'), Object::create('PasswordField', 'Password', 'PasswordField'))); $fields->addFieldsToTab('Root.Numeric', array(Object::create('NumericField', 'Number', 'NumericField'), Object::create('CurrencyField', 'Price', 'CurrencyField'), Object::create('MoneyField', 'Money', 'MoneyField', array('Amount' => 99.98999999999999, 'Currency' => 'EUR')), Object::create('PhoneNumberField', 'PhoneNumber', 'PhoneNumberField'), Object::create('CreditCardField', 'CreditCard', 'CreditCardField'))); $fields->addFieldsToTab('Root.Option', array(Object::create('CheckboxField', 'Checkbox', 'CheckboxField'), Object::create('CheckboxSetField', 'CheckboxSet', 'CheckboxSetField', TestCategory::map()), Object::create('DropdownField', 'DropdownID', 'DropdownField', TestCategory::map())->setHasEmptyDefault(true), Object::create('GroupedDropdownField', 'GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), Object::create('ListboxField', 'ListboxFieldID', 'ListboxField', TestCategory::map())->setSize(3), Object::create('ListboxField', 'MultipleListboxFieldID', 'ListboxField (multiple)', TestCategory::map())->setMultiple(true)->setSize(3), Object::create('OptionsetField', 'OptionSet', 'OptionSetField', TestCategory::map()), Object::create('ToggleCompositeField', 'ToggleCompositeField', 'ToggleCompositeField', new FieldList(Object::create('TextField', 'ToggleCompositeTextField1'), Object::create('TextField', 'ToggleCompositeTextField2'), Object::create('DropdownField', 'ToggleCompositeDropdownField', 'ToggleCompositeDropdownField', TestCategory::map()), Object::create('TextField', 'ToggleCompositeTextField3'))))); // All these date/time fields generally have issues saving directly in the CMS $fields->addFieldsToTab('Root.DateTime', array($calendarDateField = Object::create('DateField', 'CalendarDate', 'DateField with calendar'), Object::create('DateField', 'Date', 'DateField'), $dmyDateField = Object::create('DateField', 'DMYDate', 'DateField with separate fields'), Object::create('TimeField', 'Time', 'TimeField'), $timeFieldDropdown = Object::create('TimeField', 'TimeWithDropdown', 'TimeField with dropdown'), Object::create('DatetimeField', 'DateTime', 'DateTime'), $dateTimeShowCalendar = Object::create('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($bla = UploadField::create('File', 'FileUploadField')->setDescription($description)->setConfig('allowedMaxFileNumber', 1)->setConfig('canPreviewFolder', false), UploadField::create('AttachedFile', 'UploadField with canUpload=false')->setDescription($description)->setConfig('canUpload', false), UploadField::create('Image', 'UploadField for image')->setDescription($description), UploadField::create('HasManyFiles', 'UploadField for has_many')->setDescription($description), UploadField::create('ManyManyFiles', 'UploadField for many_many')->setDescription($description))); $data = $this->getDefaultData(); foreach ($fields->dataFields() as $field) { $name = $field->getName(); if (isset($data[$name])) { $field->setValue($data[$name]); } } $blacklist = array('DMYDate', 'Required', 'Validated', 'ToggleCompositeField'); $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) { $field->setDescription($description); // ->addExtraClass('cms-description-tooltip'); if (in_array($field->getName(), $blacklist)) { continue; } $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()); } } $noLabelField = new TextField('Text_NoLabel', false, 'TextField without label'); $noLabelField->setDescription($description); $fields->addFieldToTab('Root.Text', $noLabelField, 'Text_disabled'); $fields->addFieldToTab('Root.Text', FieldGroup::create(TextField::create('MyFieldGroup1'), TextField::create('MyFieldGroup2'), DropdownField::create('MyFieldGroup3', false, TestCategory::map()))); $fields->addFieldToTab('Root.Text', FieldGroup::create('MyLabelledFieldGroup', array(TextField::create('MyLabelledFieldGroup1'), TextField::create('MyLabelledFieldGroup2'), DropdownField::create('MyLabelledFieldGroup3', null, TestCategory::map())))->setTitle('My Labelled Field Group')); return $fields; }
/** * @return FieldList */ public function getCMSFields() { if (!$this->exists()) { // The new module state Requirements::css(MODULATOR_PATH . '/css/PageModule.css'); Requirements::javascript(MODULATOR_PATH . '/javascript/PageModule.js'); $allowedModules = array(); // Determine the type of the parent page $currentPageID = Session::get('CMSMain.currentPage'); if ($currentPageID) { $currentPage = SiteTree::get_by_id('SiteTree', $currentPageID); if ($currentPage) { $currentPageClass = $currentPage->ClassName; // Get the list of allowed modules for this page type if (class_exists($currentPageClass) && method_exists($currentPageClass, 'getAllowedModules')) { $allowedModules = $currentPageClass::getAllowedModules(); } } } $classList = array(); foreach ($allowedModules as $class) { $instance = new $class(); $classList[$class] = '<img src="' . $instance::$icon . '"><strong>' . $class::$label . '</strong><p>' . $class::$description . '</p>'; } $fields = new FieldList(); if (!count($allowedModules)) { $typeField = new LiteralField('Type', '<span class="message required">There are no module types defined, please create some.</span>'); $fields->push($typeField); } else { $labelField = new TextField('Title', 'Label'); $labelField->setDescription('A reference name for this block, not displayed on the website'); $fields->push($labelField); $typeField = new OptionSetField('NewClassName', 'Type', $classList); $typeField->setDescription('The type of module determines what content and functionality it will provide'); $fields->push($typeField); } $this->extend('updateCMSFields', $fields); } else { // Existing module state $fields = parent::getCMSFields(); // Don't expose Order to the CMS $fields->removeFieldFromTab('Root.Main', 'Order'); $fields->removeFieldFromTab('Root.Main', 'PageID'); // Helps us keep track of preview focus $fields->addFieldToTab('Root.Main', new HiddenField('ModulatorID', 'ModulatorID', $this->ID)); } return $fields; }
/** * Constructor. * * @param array $itemsList */ public function __construct($langId) { parent::__construct(); $this->service = BOL_LanguageService::getInstance(); if (empty($langId)) { $this->setVisible(false); return; } $languageDto = $this->service->findById($langId); if ($languageDto === null) { $this->setVisible(false); return; } $language = OW::getLanguage(); $form = new Form('lang_edit'); $form->setAjax(); $form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder')); $form->setAjaxResetOnSuccess(false); $labelTextField = new TextField('label'); $labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label')); $labelTextField->setDescription($language->text('admin', 'clone_form_descr_label')); $labelTextField->setRequired(); $labelTextField->setValue($languageDto->getLabel()); $form->addElement($labelTextField); $tagTextField = new TextField('tag'); $tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag')); $tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag')); $tagTextField->setRequired(); $tagTextField->setValue($languageDto->getTag()); if ($languageDto->getTag() == 'en') { $tagTextField->addAttribute('disabled', 'disabled'); } $form->addElement($tagTextField); $rtl = new CheckboxField('rtl'); $rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label')); $rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc')); $rtl->setValue((bool) $languageDto->getRtl()); $form->addElement($rtl); $hiddenField = new HiddenField('langId'); $hiddenField->setValue($languageDto->getId()); $form->addElement($hiddenField); $submit = new Submit('submit'); $submit->setValue($language->text('admin', 'btn_label_edit')); $form->addElement($submit); $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}"); $this->addForm($form); }
public function index() { $language = OW::getLanguage(); $config = OW::getConfig(); $adminForm = new Form('adminForm'); $element = new TextField('photofeature_per_page'); $element->setRequired(true); $element->setLabel($language->text('advancedphoto', 'admin_photofeature_per_page')); $element->setDescription($language->text('advancedphoto', 'admin_photofeature_per_page_desc')); $element->setValue($config->getValue('advancedphoto', 'photofeature_per_page')); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue(OW::getLanguage()->text('photo', 'btn_edit')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { $values = $adminForm->getValues(); if ($adminForm->isValid($_POST)) { $config->saveConfig('advancedphoto', 'photofeature_per_page', $_POST['photofeature_per_page']); OW::getFeedback()->info($language->text('advancedphoto', 'user_save_success')); } } $this->addForm($adminForm); }
/** * CMS FIELDS */ public function getCMSFields() { $fields = parent::getCMSFields(); /** * MAIN TAB */ $tab = 'Root.Main'; $field = new TextField('Name'); $fields->addFieldToTab($tab, $field); $html = ViewableData::renderWith('Icon_CMS_Instructions'); $field = new LiteralField('Reference', $html); $fields->addFieldToTab($tab, $field); $field = new TextField('FontAwesomeClass'); $field->setDescription('This class is used for the icon'); $fields->addFieldToTab($tab, $field); $field = new TextField('FontAwesomeAnimation'); $field->setDescription('This class is used for animating the icon'); $fields->addFieldToTab($tab, $field); $html = ViewableData::renderWith('Icon_CMS_Preview'); $field = new LiteralField('Reference', $html); $fields->addFieldToTab($tab, $field); return $fields; }
public function updateCMSFields(FieldList $fields) { $fieldURL = new TextField("TenonURL", "Tenon API URL"); $fieldURL->setDescription('The full URL to the Tenon URL'); $fields->addFieldToTab("Root.Tenon", $fieldURL); $fieldAPIKey = new TextField("TenonAPIKey", "Tenon API Key"); $fieldAPIKey->setDescription('Get your API key from www.tenon.io'); $fields->addFieldToTab("Root.Tenon", $fieldAPIKey); $fieldCertainty = DropdownField::create('TenonCertainty', 'Tenon Certainty Threshold', array(0 => '0 - Report everything', 20 => '20', 40 => '40', 60 => '60', 80 => '80', 100 => '100 - Report only the most certain'), 60); $fieldCertainty->setDescription('Set the certainty threshold for your results'); $fields->addFieldToTab("Root.Tenon", $fieldCertainty); $fieldWCAG = DropdownField::create('TenonWCAGLevel', 'Tenon WCAG Level', array('AAA' => 'AAA - Run all tests', 'AA' => 'AA - Run only AA and A tests', 'A' => 'A - Run A tests only'), 'AAA'); $fieldWCAG->setDescription('Web Content Accessibility Guidelines level'); $fields->addFieldToTab("Root.Tenon", $fieldWCAG); $fieldPriority = DropdownField::create('TenonPriority', 'Tenon Priority Cut-off', array(0 => '0 - Report all issues regardless of priority', 20 => '20', 40 => '40', 60 => '60', 80 => '80', 100 => '100 - Report only the highest priority issues'), 20); $fieldPriority->setDescription('The priority cut-off for Tenon analysis'); $fields->addFieldToTab("Root.Tenon", $fieldPriority); $fieldSource = DropdownField::create('TenonSource', 'Tenon Source', array('Source' => 'Send the page source to Tenon', 'URL' => 'Send Tenon the page URL'), 'Source'); $fieldSource->setDescription('Tenon can either be provided with HTML/CSS/JS to parse, or be given a link to visit'); $fields->addFieldToTab("Root.Tenon", $fieldSource); $fieldResponse = DropdownField::create('TenonJSONResponse', 'Tenon JSON Response', array(0 => 'Empty array', 1 => 'Success value indicating whether or not new Tenon responses were saved', 2 => 'Debug log'), 1); $fieldResponse->setDescription('The debug log is useful for diagnosis but should normally be turned off'); $fields->addFieldToTab("Root.Tenon", $fieldResponse); }
public function sitemap() { $language = OW::getLanguage(); $config = OW::getConfig(); $form = new Form('sitemap_form'); $sitemapUrl = new TextField('sitemap_url'); $sitemapUrl->setLabel($language->text('oaseo', 'sitemap_url_label')); $sitemapUrl->setDescription($language->text('oaseo', 'sitemap_url_desc')); $sitemapUrl->setValue(OW_URL_HOME . $config->getValue('oaseo', 'sitemap_url')); $form->addElement($sitemapUrl); // $rorUrl = new TextField('ror_url'); // $rorUrl->setLabel($language->text('oaseo', 'ror_url_label')); // $rorUrl->setDescription($language->text('oaseo', 'ror_url_desc')); // $rorUrl->setValue(OW_URL_HOME . $config->getValue('oaseo', 'ror_url')); // $form->addElement($rorUrl); $imageUrl = new TextField('imagemap_url'); $imageUrl->setLabel($language->text('oaseo', 'imagemap_url_label')); $imageUrl->setDescription($language->text('oaseo', 'imagemap_url_desc')); $imageUrl->setValue(OW_URL_HOME . $config->getValue('oaseo', 'imagemap_url')); $form->addElement($imageUrl); $undateFreq = new Selectbox('update_freq'); $options = array('86400' => 'Daily', '604800' => 'Weekly', '2419200' => 'Monthly'); $undateFreq->setHasInvitation(false); $undateFreq->addOptions($options); $undateFreq->setLabel($language->text('oaseo', 'update_freq_label')); $undateFreq->setDescription($language->text('oaseo', 'update_freq_desc')); $form->addElement($undateFreq); $undateFreq->setValue($config->getValue('oaseo', 'update_freq')); // $prio = new CheckboxField('prio'); // $prio->setLabel($language->text('oaseo', 'prio_label')); // $prio->setDescription($language->text('oaseo', 'prio_desc')); // $form->addElement($prio); // $email = new TextField('email'); // $email->setLabel($language->text('oaseo', 'email_label')); // $email->setDescription($language->text('oaseo', 'email_desc')); // $form->addElement($email); $inform = new CheckboxGroup('inform'); $inform->setLabel($language->text('oaseo', 'inform_label')); $inform->setDescription($language->text('oaseo', 'inform_desc')); $inform->setOptions(array('google' => 'Google', 'bing' => 'Bing', 'yahoo' => 'Yahoo', 'ask' => 'Ask')); $form->addElement($inform); $inform->setValue(json_decode($config->getValue('oaseo', 'inform'))); // $extlink = new CheckboxField('extlink'); // $extlink->setLabel($language->text('oaseo', 'extlink_label')); // $extlink->setDescription($language->text('oaseo', 'extlink_desc')); // $form->addElement($extlink); // // $brock = new CheckboxField('brock_link'); // $brock->setLabel($language->text('oaseo', 'brock_link_label')); // $brock->setDescription($language->text('oaseo', 'brock_link_desc')); // $form->addElement($brock); $submit = new Submit('submit'); $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label')); $form->addElement($submit); $this->addForm($form); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { $data = $form->getValues(); $config->saveConfig('oaseo', 'sitemap_url', str_replace(OW_URL_HOME, '', $data['sitemap_url'])); $config->saveConfig('oaseo', 'imagemap_url', str_replace(OW_URL_HOME, '', $data['imagemap_url'])); $config->saveConfig('oaseo', 'update_freq', (int) $data['update_freq']); $config->saveConfig('oaseo', 'inform', json_encode($data['inform'] ? $data['inform'] : array())); } }
public function index() { $language = OW::getLanguage(); $config = OW::getConfig(); $adminForm = new Form('adminForm'); $element = new TextField('minimumPayment'); $element->setRequired(true); $element->setValue($config->getValue('sponsors', 'minimumPayment')); $validator = new FloatValidator(0); $validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format')); $element->addValidator($validator); $element->setLabel($language->text('sponsors', 'minimum_payment_required')); $element->setDescription($language->text('sponsors', 'minimum_payment_required_desc')); $adminForm->addElement($element); $element = new TextField('topSponsorsCount'); $element->setRequired(true); $element->setValue($config->getValue('sponsors', 'topSponsorsCount')); $validator = new IntValidator(1); $validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format')); $element->addValidator($validator); $element->setLabel($language->text('sponsors', 'sponsors_count_displayed')); $element->setDescription($language->text('sponsors', 'sponsors_count_displayed_desc')); $adminForm->addElement($element); $element = new TextField('sponsorValidity'); $element->setRequired(true); $element->setValue($config->getValue('sponsors', 'sponsorValidity')); $validator = new IntValidator(1); $validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format')); $element->addValidator($validator); $element->setLabel($language->text('sponsors', 'sponsorship_validatity')); $element->setDescription($language->text('sponsors', 'sponsorship_validatity_desc')); $adminForm->addElement($element); $element = new CheckboxField('alwaysSingleFlip'); $element->setLabel($language->text('sponsors', 'always_single_flip')); $element->setDescription($language->text('sponsors', 'always_single_flip_desc')); $element->setValue($config->getValue('sponsors', 'alwaysSingleFlip')); $adminForm->addElement($element); $element = new CheckboxField('autoApprove'); $element->setLabel($language->text('sponsors', 'auto_approve')); $element->setDescription($language->text('sponsors', 'auto_approve_desc')); $element->setValue($config->getValue('sponsors', 'autoApprove')); $adminForm->addElement($element); $element = new CheckboxField('newSponsorLinkAtLast'); $element->setLabel($language->text('sponsors', 'show_new_sponsor_link_last')); $element->setDescription($language->text('sponsors', 'show_new_sponsor_link_last_desc')); $element->setValue($config->getValue('sponsors', 'newSponsorLinkAtLast')); $adminForm->addElement($element); $element = new CheckboxField('onlyAdminCanAdd'); $element->setLabel($language->text('sponsors', 'only_admin_add_sponsors')); $element->setDescription($language->text('sponsors', 'only_admin_add_sponsors_desc')); $element->setValue($config->getValue('sponsors', 'onlyAdminCanAdd')); $adminForm->addElement($element); $element = new TextField('cutoffDay'); $element->setRequired(true); $element->setValue($config->getValue('sponsors', 'cutoffDay')); $validator = new IntValidator(1, 20); $validator->setErrorMessage($language->text('sponsors', 'invalid_numeric_format')); $element->addValidator($validator); $element->setLabel($language->text('sponsors', 'cutoff_date_notify')); $element->setDescription($language->text('sponsors', 'cutoff_date_notify_desc')); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue(OW::getLanguage()->text('sponsors', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $config->saveConfig('sponsors', 'minimumPayment', $values['minimumPayment']); $config->saveConfig('sponsors', 'alwaysSingleFlip', $values['alwaysSingleFlip']); $config->saveConfig('sponsors', 'topSponsorsCount', $values['topSponsorsCount']); $config->saveConfig('sponsors', 'sponsorValidity', $values['sponsorValidity']); $config->saveConfig('sponsors', 'autoApprove', $values['autoApprove']); $config->saveConfig('sponsors', 'newSponsorLinkAtLast', $values['newSponsorLinkAtLast']); $config->saveConfig('sponsors', 'onlyAdminCanAdd', $values['onlyAdminCanAdd']); $config->saveConfig('sponsors', 'cutoffDay', $values['cutoffDay']); OW::getFeedback()->info($language->text('sponsors', 'user_save_success')); } } $this->addForm($adminForm); $this->setPageHeading(OW::getLanguage()->text('sponsors', 'admin_settings_title')); $this->setPageTitle(OW::getLanguage()->text('sponsors', 'admin_settings_title')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); }
public function updateCMSFields(FieldList $fields) { // Twitter setup $fields->addFieldsToTab('Root.TwitterApp', array($userNameField = new TextField('TwitterUsername', _t('TwitterSiteConfig.FIELD_TWITTER_USERNAME', 'Twitter Username'), null, 255), new TextField('TwitterAppConsumerKey', _t('TwitterSiteConfig.FIELD_CONSUMER_KEY', 'Consumer Key'), null, 255), new TextField('TwitterAppConsumerSecret', _t('TwitterSiteConfig.FIELD_CONSUMER_SECRET', 'Consumer Secret'), null, 255), new TextField('TwitterAppAccessToken', _t('TwitterSiteConfig.FIELD_ACCESS_TOKEN', 'Access Token'), null, 255), new TextField('TwitterAppAccessSecret', _t('TwitterSiteConfig.FIELD_ACCESS_SECRET', 'Access Secret'), null, 255))); $userNameField->setDescription(_t('TwitterSiteConfig.FIELD_TWITTER_USERNAME_DESCRIPTION', 'Leave blank to disable twitter')); }
public function updateCMSFields(FieldList $f) { //clear all fields $oldFields = $f->toArray(); foreach ($oldFields as $field) { $f->remove($field); } $_REQUEST['SummitID'] = $this->owner->ID; $f->add($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $summit_time_zone = null; if ($this->owner->TimeZone) { $time_zone_list = timezone_identifiers_list(); $summit_time_zone = $time_zone_list[$this->owner->TimeZone]; } if ($this->owner->RandomVotingLists()->exists()) { $f->addFieldToTab('Root.Main', HeaderField::create('The presentations in this summit have been randomised for voting', 4)); } $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', $link = new TextField('Link', 'Summit Page Link')); $link->setDescription('The link to the site page for this summit. Eg: <em>/summit/vancouver-2015/</em>'); $f->addFieldToTab('Root.Main', new CheckboxField('Active', 'This is the active summit')); $f->addFieldToTab('Root.Main', $date_label = new TextField('DateLabel', 'Date label')); $date_label->setDescription('A readable piece of text representing the date, e.g. <em>May 12-20, 2015</em> or <em>December 2016</em>'); $f->addFieldToTab('Root.Main', $registration_link = new TextField('RegistrationLink', 'Registration Link')); $registration_link->setDescription('Link to the site where tickets can be purchased.'); $f->addFieldsToTab('Root.Dates', $ddl_timezone = new DropdownField('TimeZone', 'Time Zone', DateTimeZone::listIdentifiers())); $ddl_timezone->setEmptyString('-- Select a Timezone --'); if ($summit_time_zone) { $f->addFieldToTab('Root.Dates', new HeaderField("All dates below are in <span style='color:red;'>{$summit_time_zone}</span> time.")); } else { $f->addFieldToTab('Root.Dates', new HeaderField("All dates below in the timezone of the summit's venue.")); } $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SummitBeginDate', "When does the summit begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SummitEndDate', "When does the summit end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('StartShowingVenuesDate', "When do you begin showing venues?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SubmissionBeginDate', "When do submissions begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SubmissionEndDate', "When do submissions end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('VotingBeginDate', "When does voting begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('VotingEndDate', "When does voting end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SelectionBeginDate', "When do selections begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SelectionEndDate', "When do selections end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('RegistrationBeginDate', "When does registration begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('RegistrationEndDate', "When does registration end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DateField('ScheduleDefaultStartDate', "Default Start Date to show on schedule page?")); $date->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldsToTab('Root.Main', new NumericField('MaxSubmissionAllowedPerUser', 'Max. Submission Allowed Per User')); $logo_field = new UploadField('Logo', 'Logo'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('summits/logos/'); $logo_field->getValidator()->setAllowedMaxFileSize(1024 * 1024 * 1); $f->addFieldToTab('Root.Main', $logo_field); $f->addFieldToTab('Root.Main', new TextField('ComingSoonBtnText', 'Coming Soon Btn Text')); $f->addFieldToTab('Root.Main', new TextField('ExternalEventId', 'Eventbrite Event Id')); if ($this->owner->ID > 0) { $summit_id = $this->owner->ID; // tracks $config = GridFieldConfig_RecordEditor::create(25); $categories = new GridField('Categories', 'Presentation Categories', $this->owner->getCategories(), $config); $f->addFieldToTab('Root.Presentation Categories', $categories); $config = GridFieldConfig_RelationEditor::create(25); $config->removeComponentsByType(new GridFieldDataColumns()); $config->removeComponentsByType(new GridFieldDetailForm()); $config->addComponent(new GridFieldUpdateDefaultCategoryTags()); $default_tags = new GridField('CategoryDefaultTags', 'Category Default Tags', $this->owner->CategoryDefaultTags(), $config); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setResultsFormat('$Tag'); $completer->setSearchFields(array('Tag')); $completer->setSearchList(Tag::get()); $editconf = new GridFieldDetailForm(); $editconf->setFields(FieldList::create(TextField::create('Tag', 'Tag'), DropdownField::create('ManyMany[Group]', 'Group', array('topics' => 'Topics', 'speaker' => 'Speaker', 'openstack projects mentioned' => 'OpenStack Projects Mentioned')))); $summaryfieldsconf = new GridFieldDataColumns(); $summaryfieldsconf->setDisplayFields(array('Tag' => 'Tag', 'Group' => 'Group')); $config->addComponent($editconf); $config->addComponent($summaryfieldsconf, new GridFieldFilterHeader()); $f->addFieldToTab('Root.Presentation Categories', $default_tags); // track groups $config = GridFieldConfig_RecordEditor::create(25); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('PresentationCategoryGroup' => 'Category Group', 'PrivatePresentationCategoryGroup' => 'Private Category Group')); $config->addComponent($multi_class_selector); $categories = new GridField('CategoryGroups', 'Category Groups', $this->owner->CategoryGroups(), $config); $f->addFieldToTab('Root.Category Groups', $categories); // locations $config = GridFieldConfig_RecordEditor::create(); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SummitVenue' => 'Venue', 'SummitHotel' => 'Hotel', 'SummitAirport' => 'Airport', 'SummitExternalLocation' => 'External Location')); $config->addComponent($multi_class_selector); $config->addComponent($sort = new GridFieldSortableRows('Order')); $gridField = new GridField('Locations', 'Locations', $this->owner->Locations()->where("ClassName <> 'SummitVenueRoom' "), $config); $f->addFieldToTab('Root.Locations', $gridField); // types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultSummitTypes()); $gridField = new GridField('SummitTypes', 'SummitTypes', $this->owner->Types(), $config); $f->addFieldToTab('Root.SummitTypes', $gridField); // event types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultEventTypes()); $gridField = new GridField('EventTypes', 'EventTypes', $this->owner->EventTypes(), $config); $f->addFieldToTab('Root.EventTypes', $gridField); //schedule $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->removeComponentsByType('GridFieldDeleteAction'); $gridField = new GridField('Schedule', 'Schedule', $this->owner->Events()->filter('Published', true)->sort(array('StartDate' => 'ASC', 'EndDate' => 'ASC')), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Schedule', $gridField); $config->addComponent(new GridFieldPublishSummitEventAction()); // events $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Type'); $gridField = new GridField('Events', 'Events', $this->owner->Events()->filter('ClassName', 'SummitEvent'), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Events', $gridField); //track selection list presentations $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('TrackChairsSelectionLists', 'TrackChairs Selection Lists', SummitSelectedPresentationList::get()->filter('ListType', 'Group')->where(' CategoryID IN ( SELECT ID FROM PresentationCategory WHERE SummitID = ' . $summit_id . ')'), $config); $f->addFieldToTab('Root.TrackChairs Selection Lists', $gridField); // attendees $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('Attendees', 'Attendees', $this->owner->Attendees(), $config); $f->addFieldToTab('Root.Attendees', $gridField); //tickets types $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('SummitTicketTypes', 'Ticket Types', $this->owner->SummitTicketTypes(), $config); $f->addFieldToTab('Root.TicketTypes', $gridField); // promo codes $config = GridFieldConfig_RecordEditor::create(50); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SpeakerSummitRegistrationPromoCode' => 'Speaker Promo Code')); $config->addComponent($multi_class_selector); $promo_codes = new GridField('SummitRegistrationPromoCodes', 'Registration Promo Codes', $this->owner->SummitRegistrationPromoCodes(), $config); $f->addFieldToTab('Root.RegistrationPromoCodes', $promo_codes); // speakers $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('Speakers', 'Speakers', $this->owner->Speakers(false), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Bio" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Speakers', $gridField); // presentations $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Type'); $gridField = new GridField('Presentations', 'Presentations', $this->owner->Presentations()->where(" Title IS NOT NULL AND Title <>'' "), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Presentations', $gridField); // push notifications $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Channel' => 'Channel', 'Message' => 'Message', 'Owner.FullName' => 'Owner', 'IsSent' => 'Is Sent?', 'SentDate' => 'Sent Date')); $config->getComponentByType('GridFieldDetailForm')->setItemRequestClass('GridFieldDetailFormPushNotification'); $gridField = new GridField('Notifications', 'Notifications', $this->owner->Notifications(), $config); $f->addFieldToTab('Root.PushNotifications', $gridField); //entity events $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent(new GridFieldWipeDevicesDataAction()); $config->addComponent(new GridFieldDeleteAllSummitEntityEventsAction()); $config->removeComponentsByType('GridFieldAddNewButton'); $gridField = new GridField('EntityEvents', 'EntityEvents', $this->owner->EntityEvents(), $config); $f->addFieldToTab('Root.EntityEvents', $gridField); //TrackChairs $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $gridField = new GridField('TrackChairs', 'TrackChairs', $this->owner->TrackChairs(), $config); $f->addFieldToTab('Root.TrackChairs', $gridField); //RSVP templates $config = GridFieldConfig_RecordEditor::create(40); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $gridField = new GridField('RSVPTemplates', 'RSVPTemplates', $this->owner->RSVPTemplates(), $config); $f->addFieldToTab('Root.RSVPTemplates', $gridField); } }
public function splashScreen() { $language = OW::getLanguage(); $this->setPageHeading($language->text('admin', 'splash_screen_page_heading')); $this->setPageTitle($language->text('admin', 'splash_screen_page_title')); $form = new Form('splash_screen'); $splashScreenEnable = new CheckboxField('splash_screen'); $splashScreenEnable->setLabel($language->text('admin', 'splash_enable_label')); $splashScreenEnable->setDescription($language->text('admin', 'splash_enable_desc')); $form->addElement($splashScreenEnable); $intro = new Textarea('intro'); $intro->setLabel($language->text('admin', 'splash_intro_label')); $intro->setDescription($language->text('admin', 'splash_intro_desc')); $form->addElement($intro); $buttonLabel = new TextField('button_label'); $buttonLabel->setLabel($language->text('admin', 'splash_button_label')); $buttonLabel->setDescription($language->text('admin', 'splash_button_label_desc')); $form->addElement($buttonLabel); $leaveUrl = new TextField('leave_url'); $leaveUrl->setLabel($language->text('admin', 'splash_leave_url_label')); $leaveUrl->setDescription($language->text('admin', 'splash_leave_url_desc')); $leaveUrl->addValidator(new UrlValidator()); $form->addElement($leaveUrl); $submit = new Submit('save'); $submit->setValue($language->text('admin', 'permissions_index_save')); $form->addElement($submit); $this->addForm($form); if (OW::getRequest()->isPost()) { if ($form->isValid($_POST)) { $data = $form->getValues(); $langService = BOL_LanguageService::getInstance(); $key = $langService->findKey('admin', 'splash_intro_value'); if ($key === null) { $prefix = $langService->findPrefix('admin'); $key = new BOL_LanguageKey(); $key->setKey('splash_intro_value'); $key->setPrefixId($prefix->getId()); $langService->saveKey($key); } $value = $langService->findValue($langService->getCurrent()->getId(), $key->getId()); if ($value === null) { $value = new BOL_LanguageValue(); $value->setKeyId($key->getId()); $value->setLanguageId($langService->getCurrent()->getId()); } $value->setValue($data['intro']); $langService->saveValue($value); $key = $langService->findKey('admin', 'splash_button_value'); if ($key === null) { $prefix = $langService->findPrefix('admin'); $key = new BOL_LanguageKey(); $key->setKey('splash_button_value'); $key->setPrefixId($prefix->getId()); $langService->saveKey($key); } $value = $langService->findValue($langService->getCurrent()->getId(), $key->getId()); if ($value === null) { $value = new BOL_LanguageValue(); $value->setKeyId($key->getId()); $value->setLanguageId($langService->getCurrent()->getId()); } $value->setValue($data['button_label']); $langService->saveValue($value); $url = trim($data['leave_url']); if (!empty($url) && !strstr($url, 'http')) { $url = 'http://' . $url; } OW::getConfig()->saveConfig('base', 'splash_leave_url', $url); OW::getConfig()->saveConfig('base', 'splash_screen', (bool) $data['splash_screen']); OW::getFeedback()->info($language->text('admin', 'splash_screen_submit_success_message')); $this->redirect(); } } $form->getElement('intro')->setValue($language->text('admin', 'splash_intro_value')); $form->getElement('button_label')->setValue($language->text('admin', 'splash_button_value')); $form->getElement('leave_url')->setValue(OW::getConfig()->getValue('base', 'splash_leave_url')); $form->getElement('splash_screen')->setValue((bool) OW::getConfig()->getValue('base', 'splash_screen')); }
public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab('Root.Typeform', array(new TextField('TypeformURL', 'Typeform URL'), $key = new TextField('TypeformKey', 'Typeform UID'))); $key->setDescription('The UID of a typeform is found at the end of its URL'); }
public function getCMSFields() { $fields = new FieldList(new TabSet('Root')); $typeLabel = _t('WorkflowAction.CLASS_LABEL', 'Action Class'); $fields->addFieldToTab('Root.Main', new ReadOnlyField('WorkflowActionClass', $typeLabel, $this->singular_name())); $titleField = new TextField('Title', _t('WorkflowAction.TITLE', 'Title')); $titleField->setDescription('The Title is used as the button label for this Workflow Action'); $fields->addFieldToTab('Root.Main', $titleField); $label = _t('WorkflowAction.ALLOW_EDITING', 'Allow editing during this step?'); $fields->addFieldToTab('Root.Main', new DropdownField('AllowEditing', $label, $this->dbObject('AllowEditing')->enumValues(), 'No')); $fields->addFieldToTab('Root.Main', new CheckboxField('AllowCommenting', _t('WorkflowAction.ALLOW_COMMENTING', 'Allow Commenting?'), $this->AllowCommenting)); return $fields; }
public function index() { $language = OW::getLanguage(); $config = OW::getConfig(); $adminForm = new Form('adminForm'); $element = new TextField('allowedFileSize'); $element->setRequired(true); $element->setValue($config->getValue('ivideo', 'allowedFileSize')); $element->setLabel($language->text('ivideo', 'admin_allowed_file_size')); $element->setDescription($language->text('ivideo', 'admin_allowed_file_size_desc')); $validator = new FloatValidator(1); $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error')); $element->addValidator($validator); $adminForm->addElement($element); $element = new Multiselect('allowedExtensions'); $element->setRequired(true); $element->setValue(explode(",", $config->getValue('ivideo', 'allowedExtensions'))); $element->setLabel($language->text('ivideo', 'admin_allowed_extension')); $element->setDescription($language->text('ivideo', 'admin_allowed_extension_desc')); $element->addOption('mp4', 'MP4'); $element->addOption('flv', 'FLV'); $element->addOption('avi', 'AVI'); $element->addOption('wmv', 'WMV'); $element->addOption('swf', 'SWF'); $element->addOption('mov', 'MOV'); $element->addOption('mpg', 'MPG'); $element->addOption('3g2', '3G2'); $element->addOption('ram', 'RAM'); $element->setSize(6); $adminForm->addElement($element); $element = new TextField('videosPerRow'); $element->setValue($config->getValue('ivideo', 'videosPerRow')); $element->setLabel($language->text('ivideo', 'admin_videos_per_row')); $element->setDescription($language->text('ivideo', 'admin_videos_per_row_desc')); $validator = new IntValidator(); $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error')); $element->addValidator($validator); $adminForm->addElement($element); $element = new TextField('videoPreviewWidth'); $element->setValue($config->getValue('ivideo', 'videoPreviewWidth')); $element->setLabel($language->text('ivideo', 'admin_video_preview_size')); $element->setDescription($language->text('ivideo', 'admin_video_preview_size_desc')); $validator = new IntValidator(); $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error')); $element->addValidator($validator); $adminForm->addElement($element); $element = new TextField('videoPreviewHeight'); $element->setValue($config->getValue('ivideo', 'videoPreviewHeight')); $element->setLabel($language->text('ivideo', 'admin_video_preview_height')); $validator = new IntValidator(); $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error')); $element->addValidator($validator); $adminForm->addElement($element); $element = new TextField('videoWidth'); $element->setValue($config->getValue('ivideo', 'videoWidth')); $element->setLabel($language->text('ivideo', 'admin_video_size')); $element->setDescription($language->text('ivideo', 'admin_video_size_desc')); $validator = new IntValidator(); $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error')); $element->addValidator($validator); $adminForm->addElement($element); $element = new TextField('videoHeight'); $element->setValue($config->getValue('ivideo', 'videoHeight')); $element->setLabel($language->text('ivideo', 'admin_video_height')); $validator = new IntValidator(); $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error')); $element->addValidator($validator); $adminForm->addElement($element); $element = new Selectbox('videoApproval'); $element->setRequired(true); $element->setValue($config->getValue('ivideo', 'videoApproval')); $element->setLabel($language->text('ivideo', 'admin_video_approval')); $element->addOption('auto', $language->text('ivideo', 'auto_approve')); $element->addOption('admin', $language->text('ivideo', 'admin_approve')); $element->setDescription($language->text('ivideo', 'admin_video_approval_desc')); $adminForm->addElement($element); $element = new Selectbox('theme'); $element->setRequired(true); $element->setValue($config->getValue('ivideo', 'theme')); $element->setLabel($language->text('ivideo', 'admin_video_theme')); $element->addOption('baseTheme', $language->text('ivideo', 'baseTheme')); $element->addOption('classicTheme', $language->text('ivideo', 'classicTheme')); $element->addOption('fancyTheme', $language->text('ivideo', 'fancyTheme')); $element->addOption('listTheme', $language->text('ivideo', 'listTheme')); $element->setDescription($language->text('ivideo', 'admin_video_theme_desc')); $adminForm->addElement($element); $element = new TextField('resultsPerPage'); $element->setRequired(true); $element->setLabel($language->text('ivideo', 'admin_results_per_page')); $element->setDescription($language->text('ivideo', 'admin_results_per_page_desc')); $element->setValue($config->getValue('ivideo', 'resultsPerPage')); $adminForm->addElement($element); $element = new TextField('ffmpegPath'); $element->setLabel($language->text('ivideo', 'admin_ffmpeg_path')); $element->setDescription($language->text('ivideo', 'admin_ffmpeg_path_desc')); $element->setValue($config->getValue('ivideo', 'ffmpegPath')); $adminForm->addElement($element); $element = new CheckboxField('makeUploaderMain'); $element->setLabel($language->text('ivideo', 'admin_make_uploader_main')); $element->setDescription($language->text('ivideo', 'admin_make_uploader_main_desc')); $element->setValue($config->getValue('ivideo', 'makeUploaderMain')); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue(OW::getLanguage()->text('ivideo', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $config->saveConfig('ivideo', 'allowedFileSize', $values['allowedFileSize']); $config->saveConfig('ivideo', 'allowedExtensions', implode(",", $values['allowedExtensions'])); $config->saveConfig('ivideo', 'videoWidth', $values['videoWidth']); $config->saveConfig('ivideo', 'videoHeight', $values['videoHeight']); $config->saveConfig('ivideo', 'videoPreviewWidth', $values['videoPreviewWidth']); $config->saveConfig('ivideo', 'videoPreviewHeight', $values['videoPreviewHeight']); $config->saveConfig('ivideo', 'resultsPerPage', $values['resultsPerPage']); $config->saveConfig('ivideo', 'videoApproval', $values['videoApproval']); $config->saveConfig('ivideo', 'theme', $values['theme']); $config->saveConfig('ivideo', 'videosPerRow', $values['videosPerRow']); $config->saveConfig('ivideo', 'makeUploaderMain', $values['makeUploaderMain']); $config->saveConfig('ivideo', 'ffmpegPath', $values['ffmpegPath']); OW::getFeedback()->info($language->text('ivideo', 'user_save_success')); } } $this->addForm($adminForm); }
public function getCMSFields() { $_REQUEST['SummitID'] = $this->ID; $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', $link = new TextField('Link', 'Summit Page Link')); $link->setDescription('The link to the site page for this summit. Eg: <em>/summit/vancouver-2015/</em>'); $f->addFieldToTab('Root.Main', new CheckboxField('Active', 'This is the active summit')); $f->addFieldToTab('Root.Main', $date_label = new TextField('DateLabel', 'Date label')); $date_label->setDescription('A readable piece of text representing the date, e.g. <em>May 12-20, 2015</em> or <em>December 2016</em>'); $f->addFieldToTab('Root.Main', $registration_link = new TextField('RegistrationLink', 'Registration Link')); $registration_link->setDescription('Link to the site where tickets can be purchased.'); $f->addFieldsToTab('Root.Main', $ddl_timezone = new DropdownField('TimeZone', 'Time Zone', DateTimeZone::listIdentifiers())); $ddl_timezone->setEmptyString('-- Select a Timezone --'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SummitBeginDate', 'Summit Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SummitEndDate', 'Summit End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartShowingVenuesDate', 'Start Showing Venues')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $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->addFieldToTab('Root.Main', $date = new DatetimeField('VotingBeginDate', 'Voting Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('VotingEndDate', 'Voting End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SelectionBeginDate', 'Selection Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SelectionEndDate', 'Selection End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('RegistrationBeginDate', 'Registration Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('RegistrationEndDate', 'Registration End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $logo_field = new UploadField('Logo', 'Logo'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('summits/logos/'); $logo_field->getValidator()->setAllowedMaxFileSize(1048576); $f->addFieldToTab('Root.Main', $logo_field); $f->addFieldToTab('Root.Main', new TextField('ComingSoonBtnText', 'Coming Soon Btn Text')); $f->addFieldToTab('Root.Main', new TextField('ExternalEventId', 'Eventbrite Event Id')); if ($this->ID > 0) { // tracks $config = GridFieldConfig_RecordEditor::create(10); $categories = new GridField('Categories', 'Presentation Categories', $this->Categories(), $config); $f->addFieldToTab('Root.Presentation Categories', $categories); // track groups $config = GridFieldConfig_RecordEditor::create(10); $categories = new GridField('CategoryGroups', 'Category Groups', $this->CategoryGroups(), $config); $f->addFieldToTab('Root.Category Groups', $categories); // locations $config = GridFieldConfig_RecordEditor::create(); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SummitVenue' => 'Venue', 'SummitHotel' => 'Hotel', 'SummitAirport' => 'Airport', 'SummitExternalLocation' => 'External Location')); $config->addComponent($multi_class_selector); $config->addComponent($sort = new GridFieldSortableRows('Order')); $gridField = new GridField('Locations', 'Locations', $this->Locations()->where("ClassName <> 'SummitVenueRoom' "), $config); $f->addFieldToTab('Root.Locations', $gridField); // types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultSummitTypes()); $gridField = new GridField('Types', 'Types', $this->Types(), $config); $f->addFieldToTab('Root.Types', $gridField); // event types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultEventTypes()); $gridField = new GridField('EventTypes', 'EventTypes', $this->EventTypes(), $config); $f->addFieldToTab('Root.EventTypes', $gridField); //schedule $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->removeComponentsByType('GridFieldDeleteAction'); $gridField = new GridField('Schedule', 'Schedule', $this->Events()->filter('Published', true)->sort(array('StartDate' => 'ASC', 'EndDate' => 'ASC')), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Schedule', $gridField); $config->addComponent(new GridFieldPublishSummitEventAction()); // events $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Types'); $gridField = new GridField('Events', 'Events', $this->Events()->filter('ClassName', 'SummitEvent'), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Events', $gridField); //track selection list presentations $result = DB::query("SELECT DISTINCT SummitEvent.*, Presentation.*\nFROM SummitEvent\nINNER JOIN Presentation ON Presentation.ID = SummitEvent.ID\nINNER JOIN SummitSelectedPresentation ON SummitSelectedPresentation.PresentationID = Presentation.ID\nINNER JOIN SummitSelectedPresentationList ON SummitSelectedPresentation.SummitSelectedPresentationListID = SummitSelectedPresentationList.ID\nWHERE(ListType = 'Group') AND (SummitEvent.ClassName IN ('Presentation')) AND (SummitEvent.SummitID = {$this->ID})"); $presentations = new ArrayList(); foreach ($result as $row) { $presentations->add(new Presentation($row)); } $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Types'); $config->removeComponentsByType('GridFieldAddNewButton'); $gridField = new GridField('TrackChairs', 'TrackChairs Selection Lists', $presentations, $config); $gridField->setModelClass('Presentation'); $f->addFieldToTab('Root.TrackChairs Selection Lists', $gridField); // attendees $config = GridFieldConfig_RecordEditor::create(50); $gridField = new GridField('Attendees', 'Attendees', $this->Attendees(), $config); $f->addFieldToTab('Root.Attendees', $gridField); //tickets types $config = GridFieldConfig_RecordEditor::create(50); $gridField = new GridField('SummitTicketTypes', 'Ticket Types', $this->SummitTicketTypes(), $config); $f->addFieldToTab('Root.TicketTypes', $gridField); // promo codes $config = GridFieldConfig_RecordEditor::create(50); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SpeakerSummitRegistrationPromoCode' => 'Speaker Promo Code')); $config->addComponent($multi_class_selector); $promo_codes = new GridField('SummitRegistrationPromoCodes', 'Registration Promo Codes', $this->SummitRegistrationPromoCodes(), $config); $f->addFieldToTab('Root.RegistrationPromoCodes', $promo_codes); // speakers $config = GridFieldConfig_RecordEditor::create(50); $gridField = new GridField('Speakers', 'Speakers', $this->Speakers(false), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Bio" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Speakers', $gridField); // presentations $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Types'); $gridField = new GridField('Presentations', 'Presentations', $this->Presentations()->where(" Title IS NOT NULL AND Title <>'' "), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Presentations', $gridField); // push notifications $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Channel' => 'Channel', 'Message' => 'Message', 'Owner.FullName' => 'Owner', 'IsSent' => 'Is Sent?')); $gridField = new GridField('Notifications', 'Notifications', $this->Notifications(), $config); $f->addFieldToTab('Root.Notifications', $gridField); } return $f; }
public function getCMSFields() { $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', new TextField('Location', 'Location')); $f->addFieldToTab('Root.Main', $link = new TextField('Link', 'Summit Page Link')); $link->setDescription('The link to the site page for this summit. Eg: <em>/summit/vancouver-2015/</em>'); $f->addFieldToTab('Root.Main', new CheckboxField('Active', 'This is the active summit')); $f->addFieldToTab('Root.Main', $date_label = new TextField('DateLabel', 'Date label')); $date_label->setDescription('A readable piece of text representing the date, e.g. <em>May 12-20, 2015</em> or <em>December 2016</em>'); $f->addFieldToTab('Root.Main', $registration_link = new TextField('RegistrationLink', 'Registration Link')); $registration_link->setDescription('Link to the site where tickets can be purchased.'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SummitBeginDate', 'Summit Begin Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SummitEndDate', 'Summit End Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionBeginDate', 'Submission Begin Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionEndDate', 'Submission End Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('VotingBeginDate', 'Voting Begin Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('VotingEndDate', 'Voting End Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SelectionBeginDate', 'Selection Begin Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SelectionEndDate', 'Selection End Date')); $date->setConfig('showcalendar', true); $f->addFieldToTab('Root.Main', new TextField('ComingSoonBtnText', 'Coming Soon Btn Text')); $f->addFieldToTab('Root.Main', new TextField('SchedUrl', 'Sched Main Url')); $config = new GridFieldConfig_RelationEditor(10); $categories = new GridField('Categories', 'Categories', $this->Categories(), $config); $f->addFieldToTab('Root.Categories', $categories); // promo codes $config = GridFieldConfig_RecordEditor::create(25); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SpeakerSummitRegistrationPromoCode' => 'Speaker Promo Code')); $config->addComponent($multi_class_selector); $promo_codes = new GridField('SummitRegistrationPromoCodes', 'Registration Promo Codes', $this->SummitRegistrationPromoCodes(), $config); $f->addFieldToTab('Root.RegistrationPromoCodes', $promo_codes); return $f; }
public function SearchForm() { $fields = new FieldList(); $fields->push(new DateField('DateFrom', _t('Mandrill.DATEFROM', 'From'), $this->getParam('DateFrom', date('Y-m-d', strtotime('-30 days'))))); $fields->push(new DateField('DateTo', _t('Mandrill.DATETO', 'To'), $this->getParam('DateTo', date('Y-m-d')))); $fields->push($queryField = new TextField('Query', _t('Mandrill.QUERY', 'Query'), $this->getParam('Query'))); $queryField->setAttribute('placeholder', 'full_email:joe@domain.* AND sender:me@company.com OR subject:welcome'); $queryField->setDescription(_t('Mandrill.QUERYDESC', 'For more information about query syntax, please visit <a target="_blank" href="http://help.mandrill.com/entries/22211902">Mandrill Support</a>')); $fields->push(new DropdownField('Limit', _t('Mandrill.LIMIT', 'Limit'), array(10 => 10, 50 => 50, 100 => 100, 500 => 500, 1000 => 1000), $this->getParam('Limit', 100))); $actions = new FieldList(); $actions->push(new FormAction('doSearch', _t('Mandrill.DOSEARCH', 'Search'))); $form = new Form($this, 'SearchForm', $fields, $actions); return $form; }
public function getCMSFields() { $fields = new FieldList(new TabSet('Root')); $typeLabel = _t('WorkflowAction.CLASS_LABEL', 'Action Class'); $fields->addFieldToTab('Root.Main', new ReadOnlyField('WorkflowActionClass', $typeLabel, $this->singular_name())); $titleField = new TextField('Title', $this->fieldLabel('Title')); $titleField->setDescription(_t('WorkflowAction.TitleDescription', 'The Title is used as the button label for this Workflow Action')); $fields->addFieldToTab('Root.Main', $titleField); $fields->addFieldToTab('Root.Main', new DropdownField('AllowEditing', $this->fieldLabel('AllowEditing'), array('By Assignees' => _t('AllowEditing.ByAssignees', 'By Assignees'), 'Content Settings' => _t('AllowEditing.ContentSettings', 'Content Settings'), 'No' => _t('AllowEditing.NoString', 'No')), _t('AllowEditing.NoString', 'No'))); $fields->addFieldToTab('Root.Main', new CheckboxField('AllowCommenting', $this->fieldLabel('AllowCommenting'), $this->AllowCommenting)); $this->extend('updateCMSFields', $fields); return $fields; }