/**
  *
  * @param SS_Request $request
  * @return Form 
  */
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         //			return $form;
     }
     if (!Permission::check('ADMIN')) {
         return $form;
     }
     $fields = $form->Fields();
     $config = $this->searchService->localEngineConfig();
     $allow = $config ? $config->RunLocal : null;
     $fields->push(new CheckboxField('RunLocal', _t('SolrAdmin.RUN_LOCAL', 'Run local Jetty instance of Solr?'), $allow));
     if ($allow) {
         $status = $this->searchService->localEngineStatus();
         if (!$status) {
             $fields->push(new CheckboxField('Start', _t('SolrAdmin.START', 'Start Solr')));
         } else {
             $fields->push(new CheckboxField('Kill', _t('SolrAdmin.Kill', 'Kill Solr process (' . $status . ')')));
         }
         $log = $this->searchService->getLogData(100);
         $log = array_reverse($log);
         $fields->push($logtxt = new TextareaField('Log', _t('SolrAdmin.LOG', 'Log')));
         $logtxt->setColumns(20)->setRows(15)->setValue(implode($log));
     }
     $form->Actions()->push(new FormAction('saveconfig', _t('SolrAdmin.SAVE', 'Save')));
     $form->Actions()->push(new FormAction('reindex', _t('SolrAdmin.REINDEX', 'Reindex')));
     //		$actions = new FieldSet();
     //		$form = new Form($this, 'EditForm', $fields, $actions);
     return $form;
 }
 public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : Summit::ActiveSummitID();
     Requirements::javascript('summit/javascript/SummitPushNotification.js');
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', $txt = new TextareaField('Message', 'Message'));
     $txt->setAttribute('required', 'true');
     $f->addFieldToTab('Root.Main', $ddl_channel = new DropdownField('Channel', 'Channel', singleton('SummitPushNotification')->dbObject('Channel')->enumValues()));
     $f->addFieldToTab('Root.Main', $ddl_events = new DropdownField('EventID', 'Event', SummitEvent::get()->filter(['Published' => 1, 'SummitID' => $summit_id])->sort('Title', 'ASC')->Map('ID', 'FormattedTitle')));
     $f->addFieldToTab('Root.Main', $ddl_groups = new DropdownField('GroupID', 'Group', Group::get()->sort('Title', 'ASC')->Map('ID', 'Title')));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $ddl_channel->setEmptyString('--SELECT A CHANNEL--');
     $ddl_channel->setAttribute('required', 'true');
     $ddl_events->setEmptyString('--SELECT AN EVENT--');
     $ddl_events->addExtraClass('hidden');
     $ddl_groups->setEmptyString('--SELECT A GROUP--');
     $ddl_groups->addExtraClass('hidden');
     $config = GridFieldConfig_RelationEditor::create(50);
     $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $config->removeComponentsByType('GridFieldAddNewButton');
     $config->addComponent($auto_completer = new CustomGridFieldAddExistingAutocompleter('buttons-before-right'));
     $auto_completer->setResultsFormat('$Title ($Email)');
     $recipients = new GridField('Recipients', 'Member Recipients', $this->Recipients(), $config);
     $f->addFieldToTab('Root.Main', $recipients);
     return $f;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TabSet('Root', new Tab('Main', _t('SiteTree.TABMAIN', 'Main'), new TextField('Title', _t('UniadsObject.db_Title', 'Title')))));
     if ($this->ID) {
         $previewLink = Director::absoluteBaseURL() . 'admin/' . UniadsAdmin::config()->url_segment . '/UniadsObject/preview/' . $this->ID;
         $fields->addFieldToTab('Root.Main', new ReadonlyField('Impressions', _t('UniadsObject.db_Impressions', 'Impressions')), 'Title');
         $fields->addFieldToTab('Root.Main', new ReadonlyField('Clicks', _t('UniadsObject.db_Clicks', 'Clicks')), 'Title');
         $fields->addFieldsToTab('Root.Main', array(DropdownField::create('CampaignID', _t('UniadsObject.has_one_Campaign', 'Campaign'), DataList::create('UniadsCampaign')->map())->setEmptyString(_t('UniadsObject.Campaign_none', 'none')), DropdownField::create('ZoneID', _t('UniadsObject.has_one_Zone', 'Zone'), DataList::create('UniadsZone')->map())->setEmptyString(_t('UniadsObject.Zone_select', 'select one')), new NumericField('Weight', _t('UniadsObject.db_Weight', 'Weight (controls how often it will be shown relative to others)')), new TextField('TargetURL', _t('UniadsObject.db_TargetURL', 'Target URL')), new Treedropdownfield('InternalPageID', _t('UniadsObject.has_one_InternalPage', 'Internal Page Link'), 'Page'), new CheckboxField('NewWindow', _t('UniadsObject.db_NewWindow', 'Open in a new Window')), $file = new UploadField('File', _t('UniadsObject.has_one_File', 'Advertisement File')), $AdContent = new TextareaField('AdContent', _t('UniadsObject.db_AdContent', 'Advertisement Content')), $Starts = new DateField('Starts', _t('UniadsObject.db_Starts', 'Starts')), $Expires = new DateField('Expires', _t('UniadsObject.db_Expires', 'Expires')), new NumericField('ImpressionLimit', _t('UniadsObject.db_ImpressionLimit', 'Impression Limit')), new CheckboxField('Active', _t('UniadsObject.db_Active', 'Active')), new LiteralField('Preview', '<a href="' . $previewLink . '" target="_blank">' . _t('UniadsObject.Preview', 'Preview this advertisement') . "</a>")));
         $app_categories = File::config()->app_categories;
         $file->setFolderName($this->config()->files_dir);
         $file->getValidator()->setAllowedMaxFileSize(array('*' => $this->config()->max_file_size));
         $file->getValidator()->setAllowedExtensions(array_merge($app_categories['image'], $app_categories['flash']));
         $AdContent->setRows(10);
         $AdContent->setColumns(20);
         $Starts->setConfig('showcalendar', true);
         $Starts->setConfig('dateformat', i18n::get_date_format());
         $Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
         $Expires->setConfig('showcalendar', true);
         $Expires->setConfig('dateformat', i18n::get_date_format());
         $Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
         $Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 function __construct($controller, $name)
 {
     $org_field = null;
     $current_user = Member::currentUser();
     $current_affiliations = $current_user->getCurrentAffiliations();
     if (!$current_affiliations) {
         $org_field = new TextField('Organization', 'Your Organization Name');
     } else {
         if (count($current_affiliations) > 1) {
             $source = array();
             foreach ($current_affiliations as $a) {
                 $org = $a->Organization();
                 $source[$org->ID] = $org->Name;
             }
             $source['0'] = "-- New One --";
             $ddl = new DropdownField('OrgID', 'Your Organization', $source);
             $ddl->setEmptyString('-- Select Your Organization --');
             $org_field = new FieldGroup();
             $org_field->push($ddl);
             $org_field->push($txt = new TextField('Organization', ''));
             $txt->addExtraClass('new-org-name');
         } else {
             $org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
         }
     }
     $fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
     $org_it_activity->addExtraClass('hidden');
     $country->setEmptyString('-- Select One --');
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 /**
  * @return Form|SS_HTTPResponse
  */
 public function EditProfileForm()
 {
     if (!Member::currentUser()) {
         $this->setFlash(_t('EditProfilePage.LoginWarning', 'Please login to edit your profile'), 'warning');
         return $this->redirect(Director::absoluteBaseURL());
     }
     $firstName = new TextField('FirstName');
     $firstName->setAttribute('placeholder', _t('EditProfilePage.FirstNamePlaceholder', 'Enter your first name'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $surname = new TextField('Surname');
     $surname->setAttribute('placeholder', _t('EditProfilePage.SurnamePlaceholder', 'Enter your surname'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $email = new EmailField('Email');
     $email->setAttribute('placeholder', _t('EditProfilePage.EmailPlaceholder', 'Enter your email address'))->setAttribute('required', 'required')->addExtraClass('form-control');
     $jobTitle = new TextField('JobTitle');
     $jobTitle->setAttribute('placeholder', _t('EditProfilePage.JobTitlePlaceholder', 'Enter your job title'))->addExtraClass('form-control');
     $website = new TextField('Website');
     $website->setAttribute('placeholder', _t('EditProfilePage.WebsitePlaceholder', 'Enter your website'))->addExtraClass('form-control');
     $blurb = new TextareaField('Blurb');
     $blurb->setAttribute('placeholder', _t('EditProfilePage.BlurbPlaceholder', 'Enter your blurb'))->addExtraClass('form-control');
     $confirmPassword = new ConfirmedPasswordField('Password', _t('EditProfilePage.PasswordLabel', 'New Password'));
     $confirmPassword->canBeEmpty = true;
     $confirmPassword->setAttribute('placeholder', _t('EditProfilePage.PasswordPlaceholder', 'Enter your password'))->addExtraClass('form-control');
     $fields = new FieldList($firstName, $surname, $email, $jobTitle, $website, $blurb, $confirmPassword);
     $action = new FormAction('SaveProfile', _t('EditProfilePage.SaveProfileText', 'Update Profile'));
     $action->addExtraClass('btn btn-primary btn-lg');
     $actions = new FieldList($action);
     // Create action
     $validator = new RequiredFields('FirstName', 'Email');
     //Create form
     $form = new Form($this, 'EditProfileForm', $fields, $actions, $validator);
     //Populate the form with the current members data
     $Member = Member::currentUser();
     $form->loadDataFrom($Member->data());
     //Return the form
     return $form;
 }
 public function updateCMSFields(FieldList $fields)
 {
     /* -----------------------------------------
         * Color Picker
        ------------------------------------------*/
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     /* =========================================
        * Settings
        =========================================*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', new TabSet('Settings'));
     }
     /* -----------------------------------------
         * Images
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Images', 'Images');
     $fields->addFieldsToTab('Root.Settings.Images', array($logo = new UploadField('LogoImage', _t('BoilerplateConfig.LogoImageLabel', 'Logo')), $favicon = new UploadField('Favicon', _t('BoilerplateConfig.FaviconLabel', 'Favicon'))));
     $logo->setRightTitle('Choose an Image For Your Logo');
     $favicon->setRightTitle('Choose an Image For Your Favicon (16x16)');
     /* -----------------------------------------
         * Company Details
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Details', 'Details');
     $fields->addFieldsToTab('Root.Settings.Details', array(new Textfield('Phone', _t('BoilerplateConfig.PhoneLabel', 'Phone Number')), new Textfield('Email', _t('BoilerplateConfig.EmailLabel', 'Public Email Address')), $PhysicalAddress = new HtmlEditorField('PhysicalAddress', _t('BoilerplateConfig.PhysicalAddressLabel', 'Physical Address'))));
     $PhysicalAddress->setRows(3);
     /* -----------------------------------------
         * Tracking Code
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.TrackingCode', 'Tracking Code');
     $fields->addFieldsToTab('Root.Settings.TrackingCode', array($trackingCode = new TextareaField('TrackingCode', _t('BoilerplateConfig.TrackingCodeLabel', 'Tracking Code'))));
     $trackingCode->setRows(20);
 }
 public function 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 getFieldConfiguration()
 {
     $textAreaField = new TextareaField($this->getSettingName('Content'), "HTML");
     $textAreaField->setRows(4);
     $textAreaField->setColumns(20);
     return new FieldList($textAreaField, new CheckboxField($this->getSettingName('HideFromReports'), _t('EditableLiteralField.HIDEFROMREPORT', 'Hide from reports?'), $this->getSetting('HideFromReports')));
 }
    function __construct($controller, $name)
    {
        $Name = new TextField('Name', 'Your name');
        $Phone = new TextField('Phone', 'Your phone number');
        $Email = new TextField('Email', 'Your email');
        $Subject = new TextField('Subject', 'Subject');
        $Message = new TextareaField('Message', 'Your message', '10', '45');
        $Name->addExtraClass('Required');
        $Email->addExtraClass('Required');
        $Message->addExtraClass('Required');
        $messageFields = new CompositeField($Name, $Phone, $Email, $Subject, $Message);
        $fields = new FieldSet($messageFields);
        $actions = new FieldSet(new FormAction('processMessage', 'send'));
        Requirements::customScript('
			jQuery(document).ready(function() {
				
				jQuery("#ContactForm_ContactForm_Name").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#ContactForm_ContactForm_Email").addClass("validate[required,custom[email]] text-input");
				jQuery("#ContactForm_ContactForm_Message").addClass("validate[required,length[6,300]] text-input");
				
				jQuery("#ContactForm_ContactForm").validationEngine()
				
			});
		');
        parent::__construct($controller, $name, $fields, $actions);
    }
 public function getCMSFields()
 {
     $fieldBody = new TextareaField('Body', 'Inhoud');
     $fieldBody->setRows(5);
     $oFields = new FieldList(new TextField('Header', 'Title'), $fieldBody, new TextField('FieldLabelName', 'Dummy text in name field'), new TextField('FieldLabelEmail', 'Dummy text in email field'), new TextField('BtnLabel', 'Button label'));
     if (Config::inst()->get(NewsLetterWidget_Name, NewsLetterWidget_Storage_Sys) == NewsLetterWidget_Storage_Sys_Mailchimp) {
         $fldTextFieldListId = new TextField('MailChimpListID', 'Mailchimp lijst id');
         $sApiKey = Config::inst()->get(NewsLetterWidget_Name, NewsLetterWidget_Storage_Sys_Mailchimp_APIKey);
         if ($sApiKey == null || trim($sApiKey) == '') {
             $oFields->push($fldTextFieldListId);
         } else {
             // fetch lists
             $api = new MCAPI($sApiKey);
             $retval = $api->lists();
             if ($api->errorCode) {
                 //echo "Unable to load lists()!";
                 //echo "\n\tCode=".$api->errorCode;
                 //echo "\n\tMsg=".$api->errorMessage."\n";
             } else {
                 //echo "Lists that matched:".$retval['total']."\n";
                 //echo "Lists returned:".sizeof($retval['data'])."\n";
                 $aOptions = array();
                 foreach ($retval['data'] as $list) {
                     //echo "Id = ".$list['id']." - ".$list['name']."\n";
                     //echo "Web_id = ".$list['web_id']."\n";
                     $aOptions[$list['id']] = $list['name'];
                 }
                 $oFields->push(new DropdownField('MailChimpListID', 'Mailchimp lijst id', $aOptions));
             }
         }
     }
     return $oFields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
     $type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
     $location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
     $location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
     $latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
     $latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
     $longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
     $longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
     $bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
     $bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
     $bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
     $bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
     $thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
     $thumbnail->setFolderName('event/thumbnail');
     $thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
     $image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
     $image->setFolderName('event/image');
     $image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
     $files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
     $files->setFolderName('event/file');
     $files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
     return $fields;
 }
    function __construct($controller, $name)
    {
        // Define fields //////////////////////////////////////
        $fields = new FieldList(new LiteralField('paragraph', '<p>
    The questions on this page are optional, but will help us better understand the details of how you are using and interacting with OpenStack. Any information you provide on this step will be treated as private and confidential and only used in aggregate reporting.
</p>
<p>
    <strong>If you do not wish to answer these questions, you make <a href="' . $controller->Link('SkipAppDevSurvey') . '">skip to the next section</a>.</strong>
</p><hr>'), new CustomCheckboxSetField('Toolkits', 'What toolkits do you use or plan to use to interact with the OpenStack API?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$toolkits_options, null, array('Other' => 'Other Toolkits (please specify)'))), $t1 = new TextareaField('OtherToolkits', ''), new LiteralField('Container', '<div id="wrote_your_own_container" class="hidden">'), $programming_lang = new CustomCheckboxSetField('ProgrammingLanguages', 'If you wrote your own code for interacting with the OpenStack API, what programming language did you write it in?', ArrayUtils::AlphaSort(AppDevSurveyOptions::$languages_options, null, array('Other' => 'Other (please specify)'))), $other_programming_lang = new TextareaField('OtherProgrammingLanguages', ''), new CustomCheckboxSetField('APIFormats', 'If you wrote your own code for interacting with the OpenStack API, what wire format are you using?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$api_format_options, null, array('Other' => 'Other Wire Format (please specify)'))), $t3 = new TextareaField('OtherAPIFormats', ''), new LiteralField('Container', '</div>'), new CustomCheckboxSetField('OperatingSystems', 'What operating systems are you using or plan on using to develop your applications?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$opsys_options, null, array('Other' => 'Other Development OS (please specify)'))), $t4 = new TextareaField('OtherOperatingSystems', ''), new CustomCheckboxSetField('GuestOperatingSystems', 'What guest operating systems are you using or plan on using to deploy your applications to customers?<BR>Select All That Apply', ArrayUtils::AlphaSort(AppDevSurveyOptions::$opsys_options, null, array('Other' => 'Other Development OS (please specify)'))), $t5 = new TextareaField('OtherGuestOperatingSystems', ''), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Please share your thoughts with us on the state of applications on OpenStack</p>'), new TextAreaField('StruggleDevelopmentDeploying', 'What do you struggle with when developing or deploying applications on OpenStack?'), $docs = new DropdownField('DocsPriority', 'What is your top priority in evaluating API and SDK docs?', AppDevSurveyOptions::$docs_priority_options), $t6 = new TextareaField('OtherDocsPriority', ''));
        $t1->addExtraClass('hidden');
        $t3->addExtraClass('hidden');
        $t4->addExtraClass('hidden');
        $t5->addExtraClass('hidden');
        $t6->addExtraClass('hidden');
        $other_programming_lang->addExtraClass('hidden');
        $docs->setEmptyString('-- Select One --');
        // $prevButton = new CancelFormAction($controller->Link().'Login', 'Previous Step');
        $nextButton = new FormAction('SaveAppDevSurvey', '  Next Step  ');
        $actions = new FieldList($nextButton);
        // Create Validators
        $validator = new RequiredFields();
        Requirements::javascript('surveys/js/deployment_survey_appdevsurvey_form.js');
        parent::__construct($controller, $name, $fields, $actions, $validator);
        if ($AppDevSurvey = $this->controller->LoadAppDevSurvey()) {
            $this->loadDataFrom($AppDevSurvey->data());
        }
    }
 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->Parent()->ClassName == "SectionOverviewPage") {
         $summaryfield = new TextareaField('SummaryText', 'Section Summary Text');
         $summaryfield->setRightTitle('Displayed on this page\'s section overview parent page (' . $this->owner->Parent()->MenuTitle . '), if left blank, uses first paragraph of the Content.');
         $fields->addFieldToTab("Root.Main", $summaryfield, 'Metadata');
     }
 }
Example #15
0
 /**
  * Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
  */
 function testReadonlyDisplayUnicodes()
 {
     $inputText = "These are some unicodes: äöü";
     $field = new TextareaField("Test", "Test");
     $field->setValue($inputText);
     $field = $field->performReadonlyTransformation();
     $this->assertContains('These are some unicodes: äöü', $field->Field());
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->replaceField('ItemTemplate', $ta = new TextareaField('ItemTemplate', _t('ListingTemplate.ITEM_TEMPLATE', 'Item Template (use the Items variable to iterate over)')));
     $ta->setRows(20);
     $ta->setColumns(120);
     return $fields;
 }
 /**
  * HTML for the column, content of the <td> element.
  *
  * @param  GridField $gridField
  * @param  DataObject $record - Record displayed in this row
  * @param  string $columnName
  * @return string - HTML for the column. Return NULL to skip.
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     $field = new TextareaField('MetaDescription');
     $value = $gridField->getDataFieldValue($record, $columnName);
     $value = $this->formatValue($gridField, $record, $columnName, $value);
     $field->setName($this->getFieldName($field->getName(), $gridField, $record));
     $field->setValue($value);
     return $field->Field() . $this->getErrorMessages();
 }
Example #18
0
 public function getFieldConfiguration()
 {
     $customSettings = unserialize($this->CustomSettings);
     $content = isset($customSettings['Content']) ? $customSettings['Content'] : '';
     $textAreaField = new TextareaField($this->getSettingName('Content'), "HTML", $content);
     $textAreaField->setRows(4);
     $textAreaField->setColumns(20);
     return new FieldList($textAreaField, new CheckboxField($this->getSettingName('HideFromReports'), _t('EditableLiteralField.HIDEFROMREPORT', 'Hide from reports?'), $this->getSetting('HideFromReports')));
 }
 public function getFieldConfiguration()
 {
     $customSettings = unserialize($this->CustomSettings);
     $content = isset($customSettings['Content']) ? $customSettings['Content'] : '';
     $textAreaField = new TextareaField($this->getSettingName('Content'), "HTML", $content);
     $textAreaField->setRows(4);
     $textAreaField->setColumns(20);
     return new FieldList($textAreaField);
 }
 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->MediaType != __CLASS__) {
         return;
     }
     $thumbField = $this->owner->getUploadField('ThumbnailImage', 'Thumbnail (optional - will grab from YouTube)', SitePhoto::$allowed_file_types, 'images');
     $posterField = $this->owner->getUploadField('PosterImage', 'Poster Image (optional - will grab from YouTube)', SitePhoto::$allowed_file_types, 'images');
     $fields->addFieldsToTab('Root.Main', array(new TextField('YouTubeVideoID', 'YouTube Video ID'), $caption = new TextareaField('Caption'), $thumbField, $posterField));
     $caption->setRows(1);
 }
Example #21
0
 /**
  * @return TextareaField|TextField
  */
 public function getFormField()
 {
     if ($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
         $taf = new TextareaField($this->Name, $this->Title);
         $taf->setRows($this->getSetting('Rows'));
         return $taf;
     } else {
         return new TextField($this->Name, $this->Title, null, $this->getSetting('MaxLength'));
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->disableEditor) {
         $tfa = new TextareaField('HTML');
         $tfa->setRows(30);
         $tfa->setColumns(150);
         $fields->addFieldToTab('Root.Main', $tfa);
     }
     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;
 }
Example #24
0
    /**
     * Quick smoke test to ensure that text is being encoded properly.
     */
    function testTextEncoding()
    {
        $inputText = "This is my <text>\nWhat's on a new-line?\nThese are some unicodes: äöü&<>";
        $field = new TextareaField("Test", "Test", 5, 20);
        $field->setValue($inputText);
        $this->assertEquals(<<<HTML
<textarea id="Test" name="Test" rows="5" cols="20">This is my &lt;text&gt;
What's on a new-line?
These are some unicodes: &auml;&ouml;&uuml;&amp;&lt;&gt;</textarea>
HTML
, $field->Field());
    }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('SortOrder');
     $title = new TextField('Title', _t('ScoutGroup.Section.NAME', "Name of Section"));
     $fields->addFieldToTab('Root.Main', $title);
     $type = new DropdownField('Type', 'Type of Section', array('beavers' => _t('ScoutDistrict.Enum.BEAVERS', 'Beavers'), 'cubs' => _t('ScoutDistrict.Enum.CUBS', 'Cubs'), 'scouts' => _t('ScoutDistrict.Enum.SCOUTS', 'Scouts'), 'explorer' => _t('ScoutDistrict.Enum.EXPLORER', 'Explorer'), 'network' => _t('ScoutDistrict.Enum.NETWORK', 'Network')));
     $fields->addFieldToTab('Root.Main', $type);
     $info = new TextareaField('Info', _t('ScoutGroup.Section.Info', "Info"));
     $info->setRightTitle(_t('ScoutDistrict.Section.INFO_HELP', 'Brief info about the section and meetings'))->addExtraClass('help');
     $fields->addFieldToTab('Root.Main', $info);
     $fields->removeByName('GroupID');
     return $fields;
 }
Example #26
0
 private function renderFormFieldContent($renderApi, $unit)
 {
     $this->formSubmit = new \FormSubmit();
     $fieldId = 'field' . $unit->getId();
     $properties = $unit->getFormValues();
     $labelText = $properties["fieldLabel"];
     $fieldType = $properties["textType"];
     //input,list,textarea
     $postRequest = $this->getPostValue($unit);
     if ($properties['type'] === \InputType::STRING && $fieldType !== FieldType::TEXTAREA || $properties['type'] === \InputType::EMAIL || $properties['type'] === \InputType::NUMERIC) {
         $formField = new \TextField();
         $elementProperties = $formField->getElementProperties();
         $elementProperties->setId($fieldId);
         $elementProperties->addAttribute("name", $fieldId);
         $elementProperties->addAttribute('value', $postRequest);
         if (isset($properties['type'])) {
             if ($properties['type'] === \InputType::EMAIL) {
                 $elementProperties->addAttribute("type", \InputType::EMAIL);
             }
             if ($properties['type'] === \InputType::NUMERIC) {
                 $elementProperties->addAttribute("type", \InputType::NUMERIC);
             }
         }
     } elseif ($fieldType === FieldType::TEXTAREA) {
         $formField = new \TextareaField();
         $elementProperties = $formField->getElementProperties();
         $elementProperties->setId($fieldId);
         $elementProperties->addAttribute("name", $fieldId);
         $formField->setContent($postRequest);
     }
     $label = new \Label();
     $labelProperties = $label->getElementProperties();
     $labelProperties->addAttribute("for", $fieldId);
     $label->add(new \Span($labelText));
     if ($formField) {
         $wrapper = new \Container();
         $wrapper->add($label);
         $wrapper->add($formField);
         $elementProperties = $formField->getElementProperties();
         if ($this->formSubmit->isValid($renderApi, $unit) && !$this->isValidValue($unit, $postRequest)) {
             $elementProperties->addClass('vf__error');
             $wrapper->add($this->getErrorMessage($unit, $postRequest));
         }
         $this->setRequiredField($renderApi, $unit, $elementProperties);
         $this->setPlaceholderText($renderApi, $unit, $elementProperties);
         echo $wrapper->renderElement();
     }
     $renderApi->renderChildren($unit);
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab('Root.Main.Metadata', $keywordsField = new TextareaField('MetaKeywords', 'Meta Keywords'), "ExtraMeta");
     $fields->addFieldToTab('Root.Main.Metadata', new TextField('MetaTitle', 'Meta Title'), 'MetaDescription');
     foreach (array('MetaTitle', 'MetaDescription', 'MetaKeywords') as $MetaFieldName) {
         $oldField = $fields->dataFieldByName($MetaFieldName);
         $oldField->setTitle($oldField->Title() . '<span class="field_count">' . strlen($this->owner->{$MetaFieldName}) . '</span>');
     }
     $keywordsField->setRows(1);
     if (permission::check('ADMIN')) {
         $fields->addFieldToTab("Root.Main", new CheckboxField("NoFollow", "Set nav link to no-follow?"), "MetaDescription");
         $fields->addFieldToTab('Root.Main.Metadata', new TextareaField('URLRedirects', '301 Redirects'));
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $subsites = DataObject::get('Subsite');
     if (!$subsites) {
         $subsites = new ArrayList();
     } else {
         $subsites = ArrayList::create($subsites->toArray());
     }
     $subsites->push(new ArrayData(array('Title' => 'Main site', 'ID' => 0)));
     $fields->addFieldToTab('Root.Main', DropdownField::create("CopyContentFromID_SubsiteID", _t('SubsitesVirtualPage.SubsiteField', "Subsite"), $subsites->map('ID', 'Title'))->addExtraClass('subsitestreedropdownfield-chooser no-change-track'), 'CopyContentFromID');
     // Setup the linking to the original page.
     $pageSelectionField = new SubsitesTreeDropdownField("CopyContentFromID", _t('VirtualPage.CHOOSE', "Choose a page to link to"), "SiteTree", "ID", "MenuTitle");
     if (Controller::has_curr() && Controller::curr()->getRequest()) {
         $subsiteID = Controller::curr()->getRequest()->requestVar('CopyContentFromID_SubsiteID');
         $pageSelectionField->setSubsiteID($subsiteID);
     }
     $fields->replaceField('CopyContentFromID', $pageSelectionField);
     // Create links back to the original object in the CMS
     if ($this->CopyContentFromID) {
         $editLink = "admin/pages/edit/show/{$this->CopyContentFromID}/?SubsiteID=" . $this->CopyContentFrom()->SubsiteID;
         $linkToContent = "\n\t\t\t\t<a class=\"cmsEditlink\" href=\"{$editLink}\">" . _t('VirtualPage.EDITCONTENT', 'Click here to edit the content') . "</a>";
         $fields->removeByName("VirtualPageContentLinkLabel");
         $fields->addFieldToTab("Root.Main", $linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent), 'Title');
         $linkToContentLabelField->setAllowHTML(true);
     }
     $fields->addFieldToTab('Root.Main', TextField::create('CustomMetaTitle', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), 'MetaTitle');
     $fields->addFieldToTab('Root.Main', TextareaField::create('CustomMetaKeywords', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'MetaKeywords');
     $fields->addFieldToTab('Root.Main', TextareaField::create('CustomMetaDescription', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'MetaDescription');
     $fields->addFieldToTab('Root.Main', TextField::create('CustomExtraMeta', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'ExtraMeta');
     return $fields;
 }
 public function FieldHolder()
 {
     Requirements::javascript('dataobject_manager/javascript/jquery.wysiwyg.js');
     Requirements::css('dataobject_manager/css/jquery.wysiwyg.css');
     Requirements::customScript("\n\t\t\t\$(function() {\n\t\t\t\t\$('#{$this->id()}').wysiwyg({\n\t\t\t\t\t{$this->getConfig()}\n\t\t\t\t}).parents('.simplehtmleditor').removeClass('hidden');\n\t\t\t\t\n\t\t\t});\n\t\t");
     return parent::FieldHolder();
 }
Example #30
0
 public function getCMSFields()
 {
     $fields = FieldList::create(TextField::create('Title'), TextareaField::create('CaptionText'), $uploader = UploadField::create('Photo'));
     $uploader->setFolderName('home-slides');
     $uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg'));
     return $fields;
 }