Ejemplo n.º 1
0
 function __construct($controller, $name, $talkID)
 {
     // Email Address Field
     $EmailAddressField = new TextField('Email', "Speaker's Email Address");
     $formData = Session::get("FormInfo.Form_CallForSpeakersRegistrationForm.data");
     if ($formData['Email']) {
         $email = $formData['Email'];
     } else {
         $email = Member::currentUser()->Email;
     }
     $EmailAddressField->setValue($email);
     // Talk ID
     $TalkField = new HiddenField('TalkID', "TalkID", $talkID);
     $fields = new FieldList($EmailAddressField, $TalkField);
     $talk = NULL;
     if ($talkID != NULL) {
         // Look to see if the presentation has at least one speaker attached
         $talkID = Convert::raw2sql($talkID);
         $talk = Talk::get()->byID($talkID);
     }
     if ($talk && $talk->HasSpeaker()) {
         $actions = new FieldList(new FormAction('addAction', 'Add New Speaker'), new FormAction('done', 'Done Editing Speakers'));
     } else {
         $actions = new FieldList(new FormAction('addAction', 'Add First Speaker'));
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
 public function __construct($controller, $name, ITransactionManager $tx_manager)
 {
     $fields = new FieldList(new EmailField('Email', _t('Member.EMAIL', 'Email')));
     $actions = new FieldList(new FormAction('forgotPassword', _t('Security.BUTTONSEND', 'Send me the password reset link')));
     $validator = new RequiredFields(array('Email'));
     $this->tx_manager = $tx_manager;
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 function __construct($controller, $name)
 {
     // Define fields //////////////////////////////////////
     $fields = new FieldList(new TextAreaField('Bio', "Provide Brief Biography of Yourself"), new TextAreaField('RelationshipToOpenStack', "What is your relationship to OpenStack, and why is its success important to you? What would you say is your biggest contribution to OpenStack's success to date?"), new TextAreaField('Experience', "Describe your experience with other non profits or serving as a board member. How does your experience prepare you for the role of a board member?"), new TextAreaField('BoardsRole', "What do you see as the Board's role in OpenStack's success?"), new TextAreaField('TopPriority', "What do you think the top priority of the Board should be in 2016?"));
     $actionButton = new FormAction('saveCandidateApplicationForm', 'Save Candidate Application');
     //$actionButton->addExtraClass('btn green-btn');
     $actions = new FieldList($actionButton);
     parent::__construct($controller, $name, $fields, $actions);
 }
 function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //point of contact
     $fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name'));
     $fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email'));
     //main info
     $fields->push($title = new TextField('title', 'Title'));
     $fields->push($url = new TextField('url', 'Url'));
     $fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?'));
     $fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type")));
     $ddl_type->setEmptyString("--SELECT A JOB TYPE --");
     $fields->push($description = new HtmlEditorField('description', 'Description'));
     $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
     $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
     $fields->push($company = new CompanyField('company', 'Company'));
     $point_of_contact_name->addExtraClass('job_control');
     $point_of_contact_email->addExtraClass('job_control');
     $title->addExtraClass('job_control');
     $url->addExtraClass('job_control');
     $description->addExtraClass('job_control');
     $instructions->addExtraClass('job_control');
     $expiration_date->addExtraClass('job_control');
     $company->addExtraClass('job_control');
     //location
     $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
     $ddl_locations->addExtraClass('location_type');
     $ddl_locations->addExtraClass('job_control');
     $fields->push($ddl_locations);
     $fields->push($city = new TextField('city', 'City'));
     $fields->push($state = new TextField('state', 'State'));
     $fields->push($country = new CountryDropdownField('country', 'Country'));
     $city->addExtraClass('physical_location');
     $state->addExtraClass('physical_location');
     $country->addExtraClass('physical_location');
     // Guard against automated spam registrations by optionally adding a field
     // that is supposed to stay blank (and is hidden from most humans).
     // The label and field name are intentionally common ("username"),
     // as most spam bots won't resist filling it out. The actual username field
     // on the forum is called "Nickname".
     $fields->push(new TextField('user_name', 'UserName'));
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveJobRegistrationRequest', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]);
     $this->addExtraClass('job-registration-form');
     $this->addExtraClass('input-form');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 function __construct($controller, $name)
 {
     Requirements::css(THEMES_DIR . "/openstack/css/OsLogoProgramForm.css");
     Requirements::customScript("\n            jQuery(document).ready(function() {\n\n                if(\$('#OsLogoProgramForm_Form_CurrentSponsor').prop('checked') != true){\n                    \$('#openstack-companies').hide();\n                    \$('#non-sponsor-company').show();                    \n                } else {\n                    \$('#openstack-companies').show();\n                    \$('#non-sponsor-company').hide();                                        \n                }\n\n                \$('#OsLogoProgramForm_Form_CurrentSponsor').click(function () {                \n                    \$('#openstack-companies').toggle();\n                    \$('#non-sponsor-company').toggle();\n                });\n            });\n        ");
     $companies = Company::get()->filter('MemberLevel:not', 'Mention')->where('MemberLevel IS NOT NULL')->sort('Name', 'ASC');
     if ($companies) {
         $companiesField = new DropdownField('CompanyID', 'Company', $companies->map('ID', 'Name', '--Select Company--'));
     }
     $projects = Project::get();
     if ($projects) {
         $projectsField = new CheckboxSetField('Projects', 'Select the OpenStack projects your product uses:', $projects->map('Name', 'Name'));
     }
     $fields = new FieldList(new TextField('FirstName', 'First Name'), new TextField('Surname', 'Last Name'), new EmailField('Email', 'Email Address'), new TextField('Phone', 'Phone Number'), new CheckboxSetField('Program', 'Which logo program best fits your product offering?', OsLogoProgramResponse::$avialable_programs), new LiteralField('HR', '<hr/>'), new CheckboxField('CurrentSponsor', 'My company is a Corporate Sponsor or Gold/Platinum Member of the OpenStack Foundation.'), new LiteralField('DIV', '<div id="openstack-companies">'), $companiesField, new TextField('OtherCompany', 'Other Company (if not listed above)'), new LiteralField('DIV', '</div>'), new LiteralField('DIV', '<div id="non-sponsor-company">'), new TextField('NonSponsorCompany', 'Company Name'), new LiteralField('DIV', '</div>'), new TextField('Product', 'Product or Service Name'), new LiteralField('ProductNote', 'If your proposed product name includes the OpenStack word mark, it will need to be approved as part of the licensing process.<br><br>'), new LiteralField('HR', '<hr/>'), new TextAreaField('CompanyDetails', 'Product or Service Description'), new CheckboxSetField('Category', 'Which of the following categories does your product fit into?  This will help us recommend the approprite licensing and associated marketing programs and assets:', OsLogoProgramResponse::$avialable_categories), new CheckboxSetField('Regions', 'In which regions does your company operate?', OsLogoProgramResponse::$avialable_regions), $projectsField, new CheckboxField('APIExposed', 'My product exposes the OpenStack API'));
     $actionButton = new FormAction('save', 'Request Information');
     $actions = new FieldList($actionButton);
     $validator = new RequiredFields('FirstName', 'Surname', 'Email', 'Phone');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
Ejemplo n.º 6
0
 function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //main info
     $fields->push($title = new TextField('title', 'Title'));
     $fields->push($url = new TextField('url', 'Url'));
     $fields->push($description = new HtmlEditorField('description', 'Description'));
     $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
     $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
     $fields->push($company = new TextField('company_name', 'Company'));
     $title->addExtraClass('job_control');
     $url->addExtraClass('job_control');
     $description->addExtraClass('job_control');
     $instructions->addExtraClass('job_control');
     $expiration_date->addExtraClass('job_control');
     $company->addExtraClass('job_control');
     //location
     $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
     $ddl_locations->addExtraClass('location_type');
     $ddl_locations->addExtraClass('job_control');
     $fields->push($ddl_locations);
     $fields->push($city = new TextField('city', 'City'));
     $fields->push($state = new TextField('state', 'State'));
     $fields->push($country = new CountryDropdownField('country', 'Country'));
     $city->addExtraClass('physical_location');
     $state->addExtraClass('physical_location');
     $country->addExtraClass('physical_location');
     // Guard against automated spam registrations by optionally adding a field
     // that is supposed to stay blank (and is hidden from most humans).
     // The label and field name are intentionally common ("username"),
     // as most spam bots won't resist filling it out. The actual username field
     // on the forum is called "Nickname".
     $fields->push(new TextField('user_name', 'UserName'));
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveJob', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'company_name', 'instructions', 'description')));
     $this->addExtraClass('job-registration-form');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 function __construct($controller, $name, $use_actions = true)
 {
     $RatingField = new TextField('rating', '');
     $RatingField->setValue(0);
     $TitleField = new TextField('title', 'Title');
     $CommentField = new HtmlEditorField('comment', 'Comment');
     $CommentField->setRows(8);
     $CompanyServiceIDField = new HiddenField('company_service_ID', '');
     $CompanyServiceIDField->setValue($controller->company_service_ID);
     $LoggedInField = new HiddenField('logged_in', '');
     if (Member::CurrentUser()) {
         $LoggedInField->setValue(1);
     }
     $fields = new FieldList($RatingField, $TitleField, $CommentField, $CompanyServiceIDField, $LoggedInField);
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveReview', 'Submit'));
     }
     $this->addExtraClass('review-form');
     parent::__construct($controller, $name, $fields, $actions);
 }
Ejemplo n.º 8
0
 /**
  * @param Controller $controller
  * @param String $name
  * @param FieldList $fields
  * @param FieldList $actions
  * @param ISurveyDynamicEntityStep $step
  * @param null $validator
  */
 function __construct($controller, $name, FieldList $fields, FieldList $actions, ISurveyDynamicEntityStep $step, $validator = null)
 {
     parent::__construct($controller, $name, $fields, $actions, $validator);
     $this->step = $step;
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
0
 function MobileRegistrationForm($membership)
 {
     //Membership
     $membershipField = new HiddenField('MembershipType', null, $membership);
     // Name Set
     $FirstNameField = new TextField('FirstName', "First Name");
     $LastNameField = new TextField('Surname', "Last Name");
     // Country
     $label = _t('Addressable.COUNTRY', 'Country');
     $countryField = new CountryDropdownField('Country', $label);
     $countryField->setEmptyString('-- Select One --');
     $countryField->addExtraClass('chzn-select');
     // Email Addresses
     $PrimaryEmailField = new TextField('Email', "Primary Email Address");
     $fields = new FieldList($membershipField, $FirstNameField, $LastNameField, $countryField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('login_text', '<div class="login_lit"> You will use this to login. </div>'));
     $fields->push(new ConfirmedPasswordField('Password', 'Password'));
     $actions = new FieldList(new FormAction('doRegisterMobile', 'Complete Registration'));
     $validator = new Member_Validator('FirstName', 'Surname', 'Email', 'Country', 'Password');
     $form = new HoneyPotForm($this, 'MobileRegistrationForm', $fields, $actions, $validator);
     if ($data = Session::get("FormInfo.{$form->FormName()}.data")) {
         return $form->loadDataFrom($data);
     }
     return $form;
 }
Ejemplo n.º 11
0
 function RegistrationForm()
 {
     // Name Set
     $FirstNameField = new TextField('FirstName', "First Name");
     $LastNameField = new TextField('Surname', "Last Name");
     // Email Addresses
     $PrimaryEmailField = new TextField('Email', "Primary Email Address");
     // 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');
     $StatementOfInterestField = new TextField('StatementOfInterest', 'Statement of Interest');
     $StatementOfInterestField->addExtraClass('autocompleteoff');
     $affiliations = new AffiliationField('Affiliations', 'Affiliations');
     $affiliations->setMode('local');
     $fields = new FieldList($FirstNameField, $LastNameField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('instructions', '<p>This will also be your login name.</p>'), 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/>'), $affiliations, $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/>'), 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')));
     $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));
     }
     $AdressField = new TextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $fields->push($AdressField);
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $countryField = new DropdownField('Country', $label, $this->allowedCountries);
         $countryField->addExtraClass('chzn-select');
         $countryField->setEmptyString('-- Select One --');
         $fields->push($countryField);
     } elseif (!is_string($this->allowedCountries)) {
         $countryField = new CountryDropdownField('Country', $label);
         $countryField->setEmptyString('-- Select One --');
         $countryField->addExtraClass('chzn-select');
         $fields->push($countryField);
     }
     $fields->push(new LiteralField('break', '<hr/>'));
     $fields->push(new ConfirmedPasswordField('Password', 'Password'));
     $fields->push(new HiddenField('MembershipType', 'MembershipType', 'foundation'));
     $actions = new FieldList(new FormAction('doRegister', 'Submit My Application'));
     $validator = new Member_Validator('FirstName', 'Surname', 'Email', 'StatementOfInterest', 'Address', 'City', 'Country', 'Password');
     $form = new HoneyPotForm($this, 'RegistrationForm', $fields, $actions, $validator);
     if ($data = Session::get("FormInfo.{$form->FormName()}.data")) {
         if (isset($data['HiddenAffiliations'])) {
             $affiliations->setValue($data['HiddenAffiliations']);
         }
         return $form->loadDataFrom($data);
     }
     return $form;
 }