Esempio n. 1
0
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Summit Video Stream
     $VideoLiveField = new OptionSetField('VideoCurrentlyPlaying', 'Is the video live streaming at the moment?', array('Yes' => 'Video is being streamed.', 'No' => 'No video playing.'));
     $fields->addFieldToTab("Root.Main", new TextField('LiveStreamURL', 'URL of Live Stream Feed'));
     $SummitModeField = new OptionSetField('SummitMode', 'Homepage mode:', array(0 => 'Normal Mode', 1 => 'Summit Mode'));
     $fields->addFieldToTab("Root.Main", new TextField('NextPresentationStartTime', 'Next Presentation Start Time'));
     $fields->addFieldToTab("Root.Main", new TextField('NextPresentationStartDate', 'Next Presentation Start Date'));
     $fields->addFieldToTab("Root.Main", $VideoLiveField, 'Content');
     $fields->addFieldToTab("Root.Main", $SummitModeField, 'Content');
     // Countdown Date
     $EventStartDate = new DateField('EventDate', 'First Day of Event (for counting down)');
     $EventStartDate->setConfig('showcalendar', true);
     $EventStartDate->setConfig('showdropdown', true);
     $fields->addFieldToTab('Root.Main', $EventStartDate, 'Content');
     // remove unneeded fields
     $fields->removeFieldFromTab("Root.Main", "Content");
     $promo_hero_image = new CustomUploadField('PromoImage', 'Promo Hero Image');
     $promo_hero_image->setFolderName('homepage');
     $promo_hero_image->setAllowedFileCategories('image');
     $fields->addFieldToTab("Root.IntroHeader", $promo_hero_image);
     $fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoIntroMessage', 'Promo Intro Message'));
     $fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoButtonText', 'Promo Button Text'));
     $fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoButtonUrl', 'Promo Button Url'));
     $fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoDatesText', 'Promo Dates Text'));
     $fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoHeroCredit', 'Hero Credit'));
     $fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoHeroCreditUrl', 'Hero Credit Url'));
     return $fields;
 }
 function getCMSFields()
 {
     $attach = new CustomUploadField('Attachment', 'File');
     $attach->setFolderName('marketing/presentations');
     $attach->setAllowedFileCategories('doc');
     return new FieldList(new TextField('Name'), $attach);
 }
Esempio n. 3
0
 public function getCMSFields()
 {
     $photo = new CustomUploadField('Photo', 'Photo');
     $photo->setFolderName('Uploads/community-photos/');
     $photo->setAllowedFileCategories('image');
     return new FieldList(new TextField('Name'), new TextareaField('Description', 'Description'), $photo);
 }
Esempio n. 4
0
 function getCMSFields()
 {
     $photo = new CustomUploadField('Photo', 'Photo');
     $photo->setAllowedFileCategories('image');
     $fields = new FieldList(new TextField('FirstName', 'First Name'), new TextField('LastName', 'Last Name'), new TextField('Email', 'Email'), new TextField('Role', 'Role / Position For This OpenStack Group (if any)'), new TextField('JobTitle', 'Job Title'), new TextField('Company', 'Company'), new HtmlEditorField('Bio', 'Brief Bio'), new CheckboxField('DisplayOnSite', 'Inlcude this bio on openstack.org'), $photo);
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $AttachmentField = new CustomUploadField('LegalDocumentFile', 'Attach a PDF or DOC file');
     $AttachmentField->setAllowedExtensions(array('doc', 'pdf'));
     $fields->addFieldToTab('Root.Main', $AttachmentField);
     return $fields;
 }
Esempio n. 6
0
 function getCMSFields()
 {
     $fields = new FieldList();
     $attach = new CustomUploadField('Attachment', 'File');
     $attach->setFolderName('marketing/event_material');
     $attach->setAllowedExtensions(array('doc', 'docx', 'txt', 'rtf', 'xls', 'xlsx', 'pages', 'ppt', 'pptx', 'pps', 'csv', 'html', 'htm', 'xhtml', 'xml', 'pdf', 'ai', 'key'));
     $fields->push(new TextField('Name'));
     $fields->push($attach);
     return $fields;
 }
 public function FeaturedEventForm()
 {
     $fields = new FieldList();
     //main info
     $events = EventPage::get('EventPage', "EventCategory = 'OpenStack Days'")->sort('EventStartDate', 'DESC');
     $options = array();
     foreach ($events as $event) {
         $options[$event->ID] = $event->Title . ' - ' . $event->formatDateRange();
     }
     $fields->push(new DropdownField('EventID', 'Event', $options));
     $ImageField = new CustomUploadField('Picture', 'Image (Max size 2Mb - Suggested size 300x250px)');
     $ImageField->setCanAttachExisting(false);
     $ImageField->setAllowedMaxFileNumber(1);
     $ImageField->setAllowedFileCategories('image');
     $ImageField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $ImageField->setFolderName('news-images');
     $ImageField->setRecordClass('BetterImage');
     $ImageField->getUpload()->setReplaceFile(false);
     $ImageField->setOverwriteWarning(false);
     $sizeMB = 2;
     // 2 MB
     $size = $sizeMB * 1024 * 1024;
     // 2 MB in bytes
     $ImageField->getValidator()->setAllowedMaxFileSize($size);
     $ImageField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     $fields->push($ImageField);
     // Create action
     $actions = new FieldList();
     $actions->push(new FormAction('saveFeaturedEvent', 'Save'));
     return new Form($this->owner, 'FeaturedEventForm', $fields, $actions);
 }
Esempio n. 8
0
 function getCMSFields()
 {
     $image = new CustomUploadField('Thumbnail', 'Thumbnail');
     //save to path marketing/case_study
     $image->setFolderName('marketing/case_study');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     return new FieldList(new TextField('Name'), new TextField('Tagline'), new TextField('Link'), $image);
 }
Esempio n. 9
0
 function getCMSFields()
 {
     $attach = new CustomUploadField('Attachment', 'File');
     $attach->setFolderName('marketing/graphics');
     $image = new CustomUploadField('Thumbnail', 'Thumbnail');
     $image->setFolderName('marketing/graphics');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     return new FieldList(new TextField('Name'), $image, $attach);
 }
Esempio n. 10
0
 function getCMSFields()
 {
     $fields = new FieldList();
     $image = new CustomUploadField('Thumbnail', 'Thumbnail');
     $image->setFolderName('marketing/youtube_vids_thumbs');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push(new TextField('Url'));
     $fields->push($image);
 }
Esempio n. 11
0
 function getCMSFields()
 {
     $fields = new FieldList();
     $image = new CustomUploadField('Image', 'Image');
     $image->setFolderName('marketing/section_link');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push(new TextField('Link'));
     $fields->push($image);
     return $fields;
 }
Esempio n. 12
0
 function getCMSFields()
 {
     $fields = new FieldList();
     $image = new CustomUploadField('Thumbnail', 'Thumbnail');
     $image->setFolderName('assets/vid_thumbs');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push(new TextField('YoutubeID', 'YouTube ID'));
     $fields->push(new TextField('Caption'));
     $fields->push($image);
     return $fields;
 }
Esempio n. 13
0
 function getCMSFields()
 {
     $fields = new FieldList();
     $files = new GridField('Files', 'Create/Edit File', $this->Files(), GridFieldConfig_RecordEditor::create(10));
     $files->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'FileName', 'SmallPreview' => 'Thumbnail'));
     $image = new CustomUploadField('Thumbnail', 'Thumbnail');
     $image->setFolderName('marketing/graphics');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push(new TextField('Name'));
     $fields->push($image);
     if ($this->ID > 0) {
         $fields->push($files);
     }
     return $fields;
 }
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Title', 'Title'));
     $fields->push($description = new HtmlEditorField('Description'));
     $description->setRows(5);
     $fields->push(new TextField('ButtonLink', 'Button Link'));
     $fields->push(new TextField('ButtonLabel', 'Button Label'));
     $fields->push(new TextField('SortOrder', 'Sort Order'));
     $image = new CustomUploadField('Image', 'Image');
     $image->setFolderName('marketing');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push($image);
     $fields->push(new HiddenField('ParentPageID', 'ParentPageID'));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Name', 'Name'));
     $fields->push($description = new HtmlEditorField('Description'));
     $description->setRows(5);
     $fields->push(new TextField('ReleaseLink', 'Release Link'));
     $fields->push(new TextField('SortOrder', 'Sort Order'));
     $fields->push(new TextField('YoutubeID', 'YouTube ID for video Link'));
     //$fields->merge($this->Video()->getCMSFields());
     $image = new CustomUploadField('Logo', 'Logo');
     $image->setFolderName('marketing');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push($image);
     $presentation = new UploadField('Presentation', 'Presentation');
     $presentation->setFolderName('marketing');
     $fields->push($presentation);
     $fields->push(new HiddenField('ParentPageID', 'ParentPageID'));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Name', 'Name'));
     $fields->push(new CheckboxField('ShowGlobe', 'Show Globe'));
     $fields->push($description = new HtmlEditorField('Description'));
     $description->setRows(5);
     $fields->push(new TextField('SortOrder', 'Sort Order'));
     $image = new CustomUploadField('Image', 'Image');
     $image->setFolderName('marketing');
     $image->setAllowedFileCategories('image');
     $image_validator = new Upload_Validator();
     $image_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg'));
     $image->setValidator($image_validator);
     $fields->push($image);
     $files = new UploadField('CollateralFiles', 'Files', $this->CollateralFiles());
     $files->setFolderName('marketing');
     $fields->push($files);
     $config = new GridFieldConfig_RecordEditor(3);
     $config->addComponent(new GridFieldSortableRows('SortOrder'));
     $fields->push(new GridField('CollateralLinks', 'CollateralLinks', $this->CollateralLinks(), $config));
     $fields->push(new HiddenField('ParentPageID', 'ParentPageID'));
     return $fields;
 }
Esempio n. 17
0
 function __construct($controller, $name, $article = null, bool $is_manager, $use_actions = true)
 {
     $IDField = new HiddenField('newsID');
     //madatory fields
     $HeadlineField = new TextField('headline', 'Headline (150 character max)', '', $maxLength = 150);
     $HeadlineField->addExtraClass('headline');
     $SummaryField = new HtmlEditorField('summary', 'Summary (300 character max)');
     $SummaryField->addExtraClass('summary');
     $SummaryField->setAttribute('max_chars', 300);
     $CityField = new TextField('city', 'City');
     $StateField = new TextField('state', 'State');
     $CountryField = new CountryDropdownField('country', 'Country');
     $TagsField = new TextField('tags', 'Tags');
     $DateEmbargoField = new TextField('date_embargo', 'Desired release date/time: Time zone is Central Time. Please ensure your release date is in Central Time
         (<a target="_blank" href="http://www.timeanddate.com/worldclock/converter.html">time converter</a>)');
     $DateEmbargoField->addExtraClass('datefield');
     if ($is_manager) {
         $DateExpireField = new TextField('date_expire', 'Expire Date');
         $DateExpireField->addExtraClass('datefield');
     }
     $UpdatedField = new DatetimeField_Readonly('date_updated', 'Last Updated');
     //$UpdatedField->addExtraClass('inline');
     //optional fields
     $BodyField = new HtmlEditorField('body', 'Body');
     $LinkField = new TextField('link', 'Link');
     $DocumentField = new CustomUploadField('Document', 'Document');
     $DocumentField->addExtraClass('hidden');
     $DocumentField->setCanAttachExisting(false);
     $DocumentField->setAllowedMaxFileNumber(1);
     $DocumentField->setAllowedFileCategories('doc');
     $DocumentField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $DocumentField->setFolderName('news-documents');
     $sizeMB = 1;
     // 1 MB
     $size = $sizeMB * 1024 * 1024;
     // 1 MB in bytes
     $DocumentField->getValidator()->setAllowedMaxFileSize($size);
     $DocumentField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     $DocumentField->setRecordClass('File');
     $ImageField = new CustomUploadField('Image', 'Image (Max size 2Mb - Suggested size 300x250px)');
     $ImageField->setCanAttachExisting(false);
     $ImageField->setAllowedMaxFileNumber(1);
     $ImageField->setAllowedFileCategories('image');
     $ImageField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $ImageField->setFolderName('news-images');
     $ImageField->setRecordClass('BetterImage');
     $ImageField->getUpload()->setReplaceFile(false);
     $ImageField->setOverwriteWarning(false);
     $sizeMB = 2;
     // 2 MB
     $size = $sizeMB * 1024 * 1024;
     // 2 MB in bytes
     $ImageField->getValidator()->setAllowedMaxFileSize($size);
     $ImageField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     if ($is_manager) {
         $IsLandscapeField = new CheckboxField('is_landscape', 'Is Banner? (landscape image)');
         $IsLandscapeField->addExtraClass('is_landscape');
     }
     if ($article) {
         $IDField->setValue($article->ID);
         $HeadlineField->setValue($article->Headline);
         $SummaryField->setValue($article->Summary);
         $CityField->setValue($article->City);
         $StateField->setValue($article->State);
         $CountryField->setValue($article->Country);
         $TagsField->setValue($article->getTagsCSV());
         if ($article->DateEmbargo) {
             $DateEmbargoField->setValue(date('m/d/Y g:i a', strtotime($article->DateEmbargo)));
         } else {
             $DateEmbargoField->setValue(gmdate('m/d/Y g:i a'));
         }
         $UpdatedField->setValue($article->LastEdited);
         $BodyField->setValue($article->Body);
         $LinkField->setValue($article->Link);
         if ($article->DateExpire) {
             $DateExpireField->setValue(date('m/d/Y g:i a', strtotime($article->DateExpire)));
         }
         $IsLandscapeField->setValue($article->IsLandscape);
         //submitter read only
         $SubmitterFirstNameField = new ReadonlyField('submitter_first_name', 'First Name');
         $SubmitterLastNameField = new ReadonlyField('submitter_last_name', 'Last Name');
         $SubmitterEmailField = new ReadonlyField('submitter_email', 'Email');
         $SubmitterCompanyField = new ReadonlyField('submitter_company', 'Company');
         $SubmitterPhoneField = new ReadonlyField('submitter_phone', 'Phone');
         $SubmitterFirstNameField->setValue($article->getSubmitter()->FirstName);
         $SubmitterLastNameField->setValue($article->getSubmitter()->LastName);
         $SubmitterEmailField->setValue($article->getSubmitter()->Email);
         $SubmitterCompanyField->setValue($article->getSubmitter()->Company);
         $SubmitterPhoneField->setValue($article->getSubmitter()->Phone);
     } else {
         // submitter fields
         $SubmitterFirstNameField = new TextField('submitter_first_name', 'First Name');
         $SubmitterLastNameField = new TextField('submitter_last_name', 'Last Name');
         $SubmitterEmailField = new TextField('submitter_email', 'Email');
         $SubmitterCompanyField = new TextField('submitter_company', 'Company');
         $SubmitterPhoneField = new TextField('submitter_phone', 'Phone');
         $LinkField->setValue('http://');
     }
     $fields = new FieldList($IDField, $HeadlineField, $SummaryField, $CityField, $StateField, $CountryField, $TagsField, $DateEmbargoField);
     if ($is_manager) {
         $fields->push($DateExpireField);
         $fields->push($UpdatedField);
     }
     $fields->push(new LiteralField('clear', '<div class="clear"></div>'));
     $fields->push($BodyField);
     $fields->push($LinkField);
     $fields->push($DocumentField);
     if ($article) {
         $image = $article->Image();
         $document = $article->Document();
         if ($document->exists()) {
             $fields->push(new LiteralField('image_preview', $document->CMSThumbnail()));
         }
         $fields->push(new LiteralField('break', '<br/>'));
         $fields->push($ImageField);
         if ($image->exists()) {
             $ImageField->setValue(null, $article);
         }
     } else {
         $fields->push(new LiteralField('break', '<br/>'));
         $fields->push($ImageField);
     }
     if ($is_manager) {
         $fields->push($IsLandscapeField);
         $fields->push(new LiteralField('break', '<br/>'));
     }
     $fields->push(new LiteralField('break', '<br/><hr/>'));
     $fields->push(new LiteralField('title', '<h2>Submitter</h2>'));
     $fields->push($SubmitterFirstNameField);
     $fields->push($SubmitterLastNameField);
     $fields->push($SubmitterEmailField);
     $fields->push($SubmitterCompanyField);
     $fields->push($SubmitterPhoneField);
     // Create action
     $actions = new FieldList();
     $actions->push(new FormAction('saveNewsArticle', 'Save'));
     $this->addExtraClass('news-registration-form');
     parent::__construct($controller, $name, $fields, $actions, $validator = null);
 }
Esempio n. 18
0
 function __construct($controller, $name)
 {
     // Name Set
     $FirstNameField = new TextField('FirstName', "First Name");
     $LastNameField = new TextField('Surname', "Last Name");
     // Email Addresses
     $PrimaryEmailField = new TextField('Email', "Primary Email Address");
     $SecondEmailField = new TextField('SecondEmail', "Second Email Address");
     $ThirdEmailField = new TextField('ThirdEmail', "Third Email Address");
     // Replace Fields
     $ReplaceBioField = new HiddenField('ReplaceBio', 'ReplaceBio', 0);
     $ReplaceNameField = new HiddenField('ReplaceName', 'ReplaceName', 0);
     $ReplaceSurnameField = new HiddenField('ReplaceSurname', 'ReplaceSurname', 0);
     // Shirt Size Field
     $ShirtSizeField = new DropdownField('ShirtSize', 'Choose A Shirt Size', array('Small' => "Men's Small", 'Medium' => "Men's Medium", 'Large' => "Men's Large", 'XL' => "Men's XL", 'XXL' => "Men's XXL", 'WS' => "Womens Small", 'WM' => "Womens Medium", 'WL' => "Womens Large", 'WXL' => "Womens XL", 'WXXL' => 'Womens XXL'));
     $affiliations = new FieldGroup(new HeaderField('Affiliations'), new LiteralField("add-affiliation", "<a class='roundedButton' id='add-affiliation' title='Add New Affiliation' href='#'>Add New Affiliation</a>"), new LiteralField("affiliations-container", "<div id='affiliations-container'></div>"));
     $StatementOfInterestField = new TextField('StatementOfInterest', 'Statement of Interest');
     $StatementOfInterestField->addExtraClass('autocompleteoff');
     // Photo
     $PhotoField = new CustomUploadField('Photo', 'Photo <em>(Optional)</em>');
     $PhotoField->setCanAttachExisting(false);
     $PhotoField->setAllowedMaxFileNumber(1);
     $PhotoField->setAllowedFileCategories('image');
     $PhotoField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $PhotoField->setFolderName('profile-images');
     $sizeMB = 1;
     // 1 MB
     $size = $sizeMB * 1024 * 1024;
     // 1 MB in bytes
     $PhotoField->getValidator()->setAllowedMaxFileSize($size);
     $PhotoField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     // Biography
     $BioField = new TextAreaField('Bio', 'Bio: A Little Bit About You <em>(Optional)</em>', 10, 15);
     // Food Preference
     $FoodPreferenceField = new CheckboxSetField('FoodPreference', 'Do you have any food preferences we can help accomodate?', array('Vegan' => 'Vegan', 'Vegetarian' => 'Vegetarian', 'Gluten' => 'Gluten allergy', 'Peanut' => 'Peanut allergy'));
     // Other Field
     $OtherFoodField = new TextField('OtherFood', 'Other Food Considerations');
     $OtherFoodField->addExtraClass('other-field');
     // IRC and Twitter
     $IRCHandleField = new TextField('IRCHandle', 'IRC Handle <em>(Optional)</em>');
     $TwitterNameField = new TextField('TwitterName', 'Twitter Name <em>(Optional)</em>');
     $LinkedInProfileField = new TextField('LinkedInProfile', 'LinkedIn Profile <em>(Optional)</em>');
     // Associated Projects
     $ProjectsField = new CheckboxSetField('Projects', 'What programs are you involved with? <em>(Optional)</em>', array('Nova' => 'Compute', 'Swift' => 'Object Storage', 'Glance' => 'Image Service', 'Keystone' => 'Identity Service', 'Horizon' => 'Dashboard', 'Quantum' => 'Networking', 'Cinder' => 'Block Storage', 'Ceilometer' => 'Metering/Monitoring', 'Heat' => 'Orchestration', 'Trove' => 'Database Service', 'Ironic' => 'Bare Metal', 'Queue' => 'Queue Service', 'DataProcessing' => 'Data Processing', 'Oslo' => 'Common Libraries', 'Openstack-ci' => 'Infrastructure', 'Openstack-manuals' => 'Documentation', 'QA' => 'Quality Assurance', 'Deployment' => 'Deployment', 'DevStack' => 'DevStack', 'Release' => 'Release Cycle Management'));
     // Other Projects Field
     $OtherProjectField = new TextField('OtherProject', 'Other Project (if one above does not match)');
     $OtherProjectField->addExtraClass('other-field');
     //Newsletter Field
     $subscribedToNewsletterField = new CheckboxField('SubscribedToNewsletter', 'I don\'t mind occasionally receiving the OpenStack community newsletter.');
     $DisplayOnSiteField = new CheckboxField('DisplayOnSite', 'Include this bio on openstack.org.');
     // New Gender Field
     $GenderField = new OptionSetField('Gender', 'I identify my gender as:', array('Male' => 'Male', 'Female' => 'Female', 'Specify' => 'Let me specify', 'Prefer not to say' => 'Prefer not to say'));
     $GenderSpecifyField = new TextField('GenderSpecify', 'Specify your gender');
     $GenderSpecifyField->addExtraClass('hide');
     $fields = new FieldList(new LiteralField('header', '<h3 class="section-divider">Public Information</h3>'), new HeaderField("First & Last Name"), $FirstNameField, $LastNameField, $ReplaceBioField, $ReplaceNameField, $ReplaceSurnameField, new LiteralField('break', '<hr/>'), $affiliations, new HiddenField("Affiliations", "Affiliations", ""), new LiteralField('instructions', '<p>For our purposes, an affiliation is defined as any company where you are an officer, director or employee, or any person or company that has paid you more than $60,000 USD as an independent contractor in the last 12 months. Please list all affiliations which meet this criteria. If you\'re not being paid to work on OpenStack please put "Unaffiliated".</p>'), new LiteralField('break', '<hr/>'), $StatementOfInterestField, new LiteralField('instructions', '<p>Your statement of interest should be a few words describing your objectives or plans for OpenStack.</p>'), new LiteralField('break', '<hr/>'), $IRCHandleField, $TwitterNameField, $LinkedInProfileField, $BioField, $PhotoField, new LiteralField('break', '<hr/>'), $ProjectsField, $OtherProjectField, new LiteralField('header', '<h3 class="section-divider">Private Information</h3>'), new HeaderField("Email Addresses"), new LiteralField('instructions', '<p class="info"><strong>If you\'re an active developer on the OpenStack project, please list any email addresses you use to commit code.</strong> (This will really help us avoid duplicates!) If you contributed code ONLY using gerrit, all email addresses you used will be listed on the <a href="https://review.openstack.org/#/settings/web-identities" target="_blank">web identities page</a>. If you have contributed also <em>before</em> gerrit was put in place, please make an effort to remember other email addresses you may have used. Interested in how to <a href="http://wiki.openstack.org/HowToContribute" target="_blank">become a contributor</a>?</p>'), $PrimaryEmailField, new LiteralField('instructions', '<p class="info">This email address is also the account name you use to login.</p>'), $SecondEmailField, $ThirdEmailField, new LiteralField('break', '<hr/>'), $GenderField, $GenderSpecifyField, new LiteralField('instructions', '<p>It\'s perfectly acceptable if you choose not to tell us: we appreciate you becoming a member of OpenStack Foundation. The information will remain private and only used to monitor our effort to improve gender diversity in our community.</p>'), new LiteralField('break', '<hr/>'), $FoodPreferenceField, $OtherFoodField, new LiteralField('break', '<hr/>'), $ShirtSizeField, $subscribedToNewsletterField, $DisplayOnSiteField, new LiteralField('break', '<hr/>'), new TextField('Address', _t('Addressable.ADDRESS', 'Street Address (Line1)')), new TextField('Suburb', _t('Addressable.SUBURB', 'Street Address (Line2)')), new TextField('City', _t('Addressable.CITY', 'City')));
     // Address Continued
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields->push(new DropdownField('State', $label, $this->allowedStates));
     } elseif (!is_string($this->allowedStates)) {
         $fields->push(new TextField('State', $label));
     }
     $fields->push(new TextField('Postcode', _t('Addressable.POSTCODE', 'Postcode')));
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $countryField = new DropdownField('Country', $label, $this->allowedCountries);
         $countryField->setEmptyString('-- Select One --');
         $fields->push($countryField);
     } elseif (!is_string($this->allowedCountries)) {
         $countryField = new CountryDropdownField('Country', $label);
         $countryField->setEmptyString('-- Select One --');
         $fields->push($countryField);
     }
     $fields->push(new LiteralField('break', '<hr/>'));
     $fields->push(new LiteralField('changepassword', '<a href="/Security/changepassword">Click here to change your password</a>'));
     // Create action
     $actions = new FieldList(new FormAction('SaveProfile', 'Save'));
     // Create validators
     $validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('FirstName', 'Surname', 'StatementOfInterest', 'Address', 'City'), new RequiredFields('Email', 'Country')));
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
Esempio n. 19
0
 /** static $icon = "icon/path"; */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     //
     // Add in the projects tab with a checklist of projects
     //
     // Get all existing projects
     $projects = Project::get();
     if (!empty($projects)) {
         // create an arry('ID' => 'Name')
         $map = $projects->map('ID', 'Name');
         // create a Checkbox group based on the array
         $fields->addFieldToTab('Root.Projects', new CheckboxSetField($name = 'Projects', $title = 'Select Projects', $source = $map));
     }
     //
     // Add a image field for uploading Logo
     $logo = new CustomUploadField('Logo', 'Logo');
     $logo->setAllowedFileCategories('image');
     $logo->setFolderName('logos');
     $fields->addFieldToTab("Root.Main", $logo);
     //
     // Add fields for quote and quote author
     //
     $fields->addFieldToTab("Root.Main", new TextAreaField('PullQuote', 'Company quote about Openstack'));
     $fields->addFieldToTab("Root.Main", new TextField('PullQuoteAuthor', 'Author of the quote'));
     //
     // Add in the files tab to upload files
     //
     $fields->addFieldToTab("Root.Files", new GridField('Attachments', 'Attachments', $this->Attachments()));
     //
     // Add in the Photos tab to upload photos
     //
     $imagesTable = new GridField('Photos', 'Photos', $this->Photos());
     $fields->addFieldToTab('Root.Photos', $imagesTable);
     //
     // Add in the Links tab to set links for the OpenStack User
     //
     $linksTable = new GridField('Links', 'Links', $this->Links());
     $fields->addFieldToTab('Root.Links', $linksTable);
     //
     // Hide unneeded tabs and rename the main tab
     //
     $fields->removeFieldsFromTab('Root', array('GoogleSitemap'));
     $fields->fieldByName('Root.Main')->setTitle('User Details');
     //
     // Adjust the fields on the newly renamed User Details tab
     //
     $fields->removeFieldFromTab("Root.Main", "MenuTitle");
     $fields->renameField("Title", "Company / Org Name");
     $fields->renameField("Content", "Company / Org Description");
     $fields->addFieldToTab('Root.Main', new CheckboxField('ListedOnSite', 'Display this company on OpenStack.org'), 'Content');
     $fields->addFieldToTab('Root.Main', new CheckboxField('FeaturedOnSite', 'Feature this company on the main User Stories page'), 'Content');
     $fields->addFieldToTab('Root.Main', new TextField('URL', 'Company URL'), 'Content');
     $fields->addFieldToTab('Root.Main', new TextField('Headquarters', 'Company Headquarters (Location)'), 'Content');
     $fields->addFieldToTab('Root.Main', new TextField('Industry'), 'Content');
     $fields->addFieldToTab('Root.Main', new HTMLEditorField('Objectives', 'Objectives for deploying OpenStack'), 'Content');
     //
     // Add category fields
     //
     $fields->addFieldToTab("Root.Main", new DropdownField('Category', 'Choose a category', $this->dbObject('Category')->enumValues()), 'Content');
     $fields->addFieldToTab("Root.Main", new DropdownField('Use Case', 'Choose a use case', $this->dbObject('UseCase')->enumValues()), 'Content');
     return $fields;
 }
 function __construct($controller, $name, $speaker = null, $member = null, $email = null)
 {
     // Get the city for the current member
     if ($member) {
         $country = $member->Country;
     } else {
         $country = '';
     }
     // Fields
     $FirstNameField = new TextField('FirstName', "First Name");
     $LastNameField = new TextField('LastName', "Last Name");
     $TitleField = new TextField('Title', "Title");
     $BioField = new TinyMCEEditorField('Bio', "Bio");
     $BioField->addExtraClass('bio');
     // Country Field
     $CountryCodes = CountryCodes::$iso_3166_countryCodes;
     $CountryField = new DropdownField('Country', 'Country of Residence', $CountryCodes);
     $CountryField->setEmptyString('-- Select One --');
     $CountryField->setValue($country);
     // ID Fields
     $SpeakerIDField = new HiddenField('SpeakerID', 'SpeakerID', "");
     $MemberIDField = new HiddenField('MemberID', 'MemberID');
     // Replace Fields
     $ReplaceBioField = new HiddenField('ReplaceBio', 'ReplaceBio', 0);
     $ReplaceNameField = new HiddenField('ReplaceName', 'ReplaceName', 0);
     $ReplaceSurnameField = new HiddenField('ReplaceSurname', 'ReplaceSurname', 0);
     // IRC and Twitter
     $IRCHandleField = new TextField('IRCHandle', 'IRC Handle <em>(Optional)</em>');
     $TwiiterNameField = new TextField('TwitterName', 'Twitter Name <em>(Optional)</em>');
     // Upload Speaker Photo
     $PhotoField = new CustomUploadField('Photo', 'Upload a speaker photo');
     $PhotoField->setCanAttachExisting(false);
     $PhotoField->setAllowedMaxFileNumber(1);
     $PhotoField->setAllowedFileCategories('image');
     $PhotoField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $PhotoField->setFolderName('profile-images');
     $sizeMB = 2;
     // 1 MB
     $size = $sizeMB * 1024 * 1024;
     // 1 MB in bytes
     $PhotoField->getValidator()->setAllowedMaxFileSize($size);
     $PhotoField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     // Opt In Field
     $OptInField = new CheckboxField('AvailableForBureau', "I'd like to be in the speaker bureau.");
     $WillingVideoField = new CheckboxField('WillingToPresentVideo', "Willing to present via video conference.");
     // Funded Travel
     $FundedTravelField = new CheckboxField('FundedTravel', "My Company would be willing to fund my travel to events.");
     // Willing to travel
     $WillingToTravel = new OptionSetField('WillingToTravel', 'I am willing to travel to events:', array(1 => 'Yes', 0 => 'No'));
     // Countries to travel
     $CountriesToTravelField = new MultiDropdownField('CountriesToTravel', 'Countries willing to travel to:', $CountryCodes);
     $CountriesToTravelField->addExtraClass('travel-field');
     // Spoken Languages
     $LanguageField1 = new TextField('Language[1]', '#1');
     $LanguageField2 = new TextField('Language[2]', '#2');
     $LanguageField3 = new TextField('Language[3]', '#3');
     $LanguageField4 = new TextField('Language[4]', '#4');
     $LanguageField5 = new TextField('Language[5]', '#5');
     // Area of Expertise
     $ExpertiseField1 = new TextField('Expertise[1]', '#1');
     $ExpertiseField2 = new TextField('Expertise[2]', '#2');
     $ExpertiseField3 = new TextField('Expertise[3]', '#3');
     $ExpertiseField4 = new TextField('Expertise[4]', '#4');
     $ExpertiseField5 = new TextField('Expertise[5]', '#5');
     // Links To Presentations
     $PresentationLinkField1 = new TextField('PresentationLink[1]', '#1');
     $PresentationTitleField1 = new TextField('PresentationTitle[1]', '');
     $PresentationLinkField2 = new TextField('PresentationLink[2]', '#2');
     $PresentationTitleField2 = new TextField('PresentationTitle[2]', '');
     $PresentationLinkField3 = new TextField('PresentationLink[3]', '#3');
     $PresentationTitleField3 = new TextField('PresentationTitle[3]', '');
     $PresentationLinkField4 = new TextField('PresentationLink[4]', '#4');
     $PresentationTitleField4 = new TextField('PresentationTitle[4]', '');
     $PresentationLinkField5 = new TextField('PresentationLink[5]', '#5');
     $PresentationTitleField5 = new TextField('PresentationTitle[5]', '');
     $NotesField = new TinyMCEEditorField('Notes', "Notes");
     $NotesField->addExtraClass('notes');
     // Load Existing Data if present
     if ($speaker) {
         $this->record = $speaker;
         $FirstNameField->setValue($speaker->FirstName);
         $LastNameField->setValue($speaker->LastName);
         $BioField->setValue($speaker->Bio);
         $SpeakerIDField->setValue($speaker->ID);
         $MemberIDField->setValue($speaker->MemberID);
         $TitleField->setValue($speaker->Title);
         $IRCHandleField->setValue($speaker->IRCHandle);
         $TwiiterNameField->setValue($speaker->TwitterName);
         $PhotoField->setValue(null, $speaker);
         $OptInField->setValue($speaker->AvailableForBureau);
         $WillingVideoField->setValue($speaker->WillingToPresentVideo);
         $FundedTravelField->setValue($speaker->FundedTravel);
         $WillingToTravel->setValue($speaker->WillingToTravel);
         $NotesField->setValue($speaker->Notes);
         foreach ($speaker->AreasOfExpertise() as $key => $expertise) {
             if ($key > 4) {
                 break;
             }
             ${'ExpertiseField' . ($key + 1)}->setValue($expertise->Expertise);
         }
         foreach ($speaker->Languages() as $key => $language) {
             if ($key > 4) {
                 break;
             }
             ${'LanguageField' . ($key + 1)}->setValue($language->Language);
         }
         $country_array = array();
         foreach ($speaker->TravelPreferences() as $pref_country) {
             $country_array[] = $pref_country->Country;
         }
         $CountriesToTravelField->setValue(implode(',', $country_array));
         foreach ($speaker->OtherPresentationLinks() as $key => $presentation) {
             ${'PresentationLinkField' . ($key + 1)}->setValue($presentation->LinkUrl);
             ${'PresentationTitleField' . ($key + 1)}->setValue($presentation->Title);
         }
     } elseif ($member) {
         $FirstNameField->setValue($member->FirstName);
         $LastNameField->setValue($member->LastName);
         $BioField->setValue($member->Bio);
         $MemberIDField->setValue($member->ID);
         $IRCHandleField->setValue($member->IRCHandle);
         $TwiiterNameField->setValue($member->TwitterName);
     }
     $fields = new FieldList($FirstNameField, $LastNameField, $TitleField, $CountryField, $BioField, $SpeakerIDField, $MemberIDField, $ReplaceBioField, $ReplaceNameField, $ReplaceSurnameField, $IRCHandleField, $TwiiterNameField, $PhotoField, $OptInField, $WillingVideoField, $FundedTravelField, $WillingToTravel, $CountriesToTravelField, $LanguageField1, $LanguageField2, $LanguageField3, $LanguageField4, $LanguageField5, $ExpertiseField1, $ExpertiseField2, $ExpertiseField3, $ExpertiseField4, $ExpertiseField5, $PresentationLinkField1, $PresentationTitleField1, $PresentationLinkField2, $PresentationTitleField2, $PresentationLinkField3, $PresentationTitleField3, $PresentationLinkField4, $PresentationTitleField4, $PresentationLinkField5, $PresentationTitleField5, $NotesField);
     $save_action = new FormAction('addAction', 'Save Speaker Details');
     $save_action->addExtraClass('btn btn-primary');
     $actions = new FieldList($save_action);
     $validator = new RequiredFields('FirstName', 'LastName', 'Title');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 function __construct($controller, $name, $speaker = null, $member = null, $email = null)
 {
     // Get the city for the current member
     if ($member) {
         $country = $member->Country;
     } else {
         $country = '';
     }
     // Fields
     $FirstNameField = new TextField('FirstName', "Speaker's First Name");
     $LastNameField = new TextField('LastName', "Speaker's Last Name");
     $TitleField = new TextField('Title', "Speaker's Title");
     $BioField = new TextAreaField('Bio', "Speaker's Bio");
     // ID Fields
     $SpeakerIDField = new HiddenField('SpeakerID', 'SpeakerID', "");
     $MemberIDField = new HiddenField('MemberID', 'MemberID');
     // Replace Fields
     $ReplaceBioField = new HiddenField('ReplaceBio', 'ReplaceBio', 0);
     $ReplaceNameField = new HiddenField('ReplaceName', 'ReplaceName', 0);
     $ReplaceSurnameField = new HiddenField('ReplaceSurname', 'ReplaceSurname', 0);
     // IRC and Twitter
     $IRCHandleField = new TextField('IRCHandle', 'IRC Handle <em>(Optional)</em>');
     $TwiiterNameField = new TextField('TwitterName', 'Twitter Name <em>(Optional)</em>');
     // Upload Speaker Photo
     $PhotoField = new CustomUploadField('Photo', 'Upload a speaker photo');
     $PhotoField->setCanAttachExisting(false);
     $PhotoField->setAllowedMaxFileNumber(1);
     $PhotoField->setAllowedFileCategories('image');
     $PhotoField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
     $PhotoField->setFolderName('profile-images');
     $sizeMB = 2;
     // 1 MB
     $size = $sizeMB * 1024 * 1024;
     // 1 MB in bytes
     $PhotoField->getValidator()->setAllowedMaxFileSize($size);
     $PhotoField->setCanPreviewFolder(false);
     // Don't show target filesystem folder on upload field
     // Opt In Field
     $OptInField = new CheckboxField('AvailableForBureau', "I'd like to be in the speaker bureau.");
     $Divider = new LiteralField('hr', '<hr/>');
     // Funded Travel
     $FundedTravelField = new CheckboxField('FundedTravel', "My Company would be willing to fund my travel to events.");
     // Country Field
     $CountryCodes = CountryCodes::$iso_3166_countryCodes;
     $CountryField = new DropdownField('Country', 'Country', $CountryCodes);
     $CountryField->setEmptyString('-- Select One --');
     $CountryField->setValue($country);
     $ExpertiseField = new TextareaField('Expertise', 'Topics of interest (one per line)');
     // Load Existing Data if present
     if ($speaker) {
         $this->record = $speaker;
         $FirstNameField->setValue($speaker->FirstName);
         $LastNameField->setValue($speaker->LastName);
         $BioField->setValue($speaker->Bio);
         $SpeakerIDField->setValue($speaker->ID);
         $MemberIDField->setValue($speaker->MemberID);
         $TitleField->setValue($speaker->Title);
         $IRCHandleField->setValue($speaker->IRCHandle);
         $TwiiterNameField->setValue($speaker->TwitterName);
         $OptInField->setValue($speaker->AvailableForBureau);
         $FundedTravelField->setValue($speaker->FundedTravel);
         $ExpertiseField->setValue($speaker->Expertise);
         $PhotoField->setValue(null, $speaker);
     } elseif ($member) {
         $FirstNameField->setValue($member->FirstName);
         $LastNameField->setValue($member->LastName);
         $BioField->setValue($member->Bio);
         $MemberIDField->setValue($member->ID);
         $IRCHandleField->setValue($member->IRCHandle);
         $TwiiterNameField->setValue($member->TwitterName);
     }
     $fields = new FieldList($FirstNameField, $LastNameField, $TitleField, $BioField, $SpeakerIDField, $MemberIDField, $ReplaceBioField, $ReplaceNameField, $ReplaceSurnameField, $IRCHandleField, $TwiiterNameField, $PhotoField, $Divider, $OptInField, $FundedTravelField, $CountryField, $ExpertiseField);
     $actions = new FieldList(new FormAction('addAction', 'Save Speaker Details'));
     $validator = new RequiredFields('FirstName', 'LastName', 'Title');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }