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);
    }
 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);
 }
    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 __construct($controller, $name, $cleanupID)
    {
        if ($cleanupID) {
            $oEvent = DataObject::get_one('CleanUpGroup', "CleanUpGroup.ID = '{$cleanupID}'");
        } else {
            Director::redirectBack();
        }
        $Header = new HeaderField('Send a message', 3);
        $Name = new TextField('FirstName', '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', '20', '45');
        $Obj = new HiddenField('CleanupID', 'CleanupID', $cleanupID);
        $Name->addExtraClass('Required');
        $Email->addExtraClass('Required');
        $Message->addExtraClass('Required');
        $messageFields = new CompositeField($Header, $Name, $Phone, $Email, $Subject, $Message, $Obj);
        $fields = new FieldSet($messageFields);
        $actions = new FieldSet(new FormAction('processMessage', 'send'));
        //$validator = new RequiredFields('FirstName', 'Email', 'Message');
        Requirements::customScript('
			jQuery(document).ready(function() {

				jQuery("#SendForm_SendForm_FirstName").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#SendForm_SendForm_Name").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#SendForm_SendForm_Email").addClass("validate[required,custom[email]] text-input");
				jQuery("#SendForm_SendForm_Message").addClass("validate[required,length[6,300]] text-input");
				
				jQuery("#SendForm_SendForm").validationEngine()
				
			});
		');
        parent::__construct($controller, $name, $fields, $actions);
        //, $validator);
        $member = Member::currentUser();
        if ($member) {
            $this->loadDataFrom($member);
        }
    }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('Metadata');
     /* split keywords onto new lines for easy editing */
     $this->owner->setField('MetaKeywords', $this->keywordsOnNewLine());
     $advancedFields = array();
     $ExtraMetaFields = array();
     array_push($advancedFields, new HeaderField('SeoHdr', 'Search Engine Optimization', 2));
     if (!$this->owner->canCreate()) {
         $fields->removeByName('URLSegment');
         $fields->removeByName('MenuTitle');
         $fields->removeByName('Title');
         array_push($advancedFields, new LiteralField('TitleDescription', '<p class="metatitle" id="Form_EditForm_MetaTitleStats"></p>'));
         array_push($advancedFields, new TextField('MetaTitle', 'Meta Title', $this->owner->Title));
     }
     array_push($advancedFields, new LiteralField('StatsDescription', '<p class="metastats" id="Form_EditForm_MetaDescriptionStats"></p>'));
     array_push($advancedFields, $metaFieldDesc = new TextareaField('MetaDescription', 'Meta Description'));
     /* add class to prevent newlines */
     $metaFieldDesc->addExtraClass('noenter');
     $metaFieldDesc->setRightTitle(_t('SiteTree.METADESCHELP', "Search engines use this content for displaying search results."));
     array_push($ExtraMetaFields, $metaKeywordsDesc = new TextareaField('MetaKeywords', 'Meta Keywords'));
     $metaKeywordsDesc->setRightTitle(_t('SiteTree.METAKEYWHELP', "Keywords are now ignored by most of the major search engines."));
     array_push($ExtraMetaFields, $metaFieldExtra = new TextareaField("ExtraMeta", 'Custom Meta Tags'));
     $metaFieldExtra->setRightTitle(_t('SiteTree.METAEXTRAHELP', "HTML tags for additional meta information. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;"));
     $MetaStuff = ToggleCompositeField::create('MetaStuff', 'Additional Metadata', $ExtraMetaFields)->setHeadingLevel(5);
     array_push($advancedFields, $MetaStuff);
     if ($depTab = $fields->fieldByName('Root.Dependent')) {
         $dependencyArr = array();
         foreach ($depTab as $item) {
             array_push($dependencyArr, $item);
         }
         $dependencyPages = ToggleCompositeField::create('Dependencies', $depTab->Title(), $dependencyArr)->setHeadingLevel(5);
         array_push($advancedFields, $dependencyPages);
         $fields->removeByName('Dependent');
     }
     $fields->addFieldsToTab('Root.Advanced', $advancedFields);
     $seoTab = $fields->findOrMakeTab('Root.Advanced');
     $seoTab->addExtraClass('tab-to-right');
     return $fields;
 }
    function __construct($controller, $name)
    {
        $Header = new HeaderField('Invite people to join your clean up event', 3);
        $Name = new TextField('FirstName', 'Your name');
        $Phone = new TextField('Phone', 'Your phone number');
        $Email = new TextField('Email', 'Your email');
        $Subject = new TextField('Subject', 'Subject');
        $Recipients = new TextField('Recipients', 'Invite members (comma separated)', 'e.g. eg1@eg.co.nz, eg2@eg.co.nz');
        $Message = new TextareaField('Message', 'Your message', '10', '4');
        $Obj = new HiddenField('CleanupID', 'CleanupID');
        $Name->addExtraClass('Required');
        $Email->addExtraClass('Required');
        $Message->addExtraClass('Required');
        $messageFields = new CompositeField($Header, $Name, $Phone, $Email, $Subject, $Recipients, $Message, $Obj);
        $fields = new FieldSet($messageFields);
        $actions = new FieldSet(new FormAction('processInvites', 'send'));
        Requirements::customScript('
			jQuery(document).ready(function() {
		
				jQuery("#InviteForm_InviteForm_FirstName").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#InviteForm_InviteForm_Name").addClass("validate[required,custom[onlyLetter],length[0,100]] text-input");
				jQuery("#InviteForm_InviteForm_Email").addClass("validate[required,custom[email]] text-input");
				jQuery("#InviteForm_InviteForm_Message").addClass("validate[required,length[6,300]] text-input");
				jQuery("#InviteForm_InviteForm_Recipients").addClass("validate[required,length[6,300]] text-input");
				
				jQuery("#InviteForm_InviteForm").validationEngine()
				
				
			});
		');
        parent::__construct($controller, $name, $fields, $actions);
        $member = Member::currentUser();
        if ($member) {
            $this->loadDataFrom($member);
        }
    }
 function ContactForm()
 {
     error_log("Render form");
     $name = _t('ContactPage.NAME', 'Name');
     $email = _t('ContactPage.EMAIL', 'Email');
     $comments = _t('ContactPage.COMMENTS', 'Comments');
     $send = _t('ContactPage.SEND', 'Send');
     // Create fields
     $tf = new TextField('Name', $name);
     $tf->addExtraClass('span11');
     $ef = new EmailField('Email', $email);
     $ef->addExtraClass('span11');
     $taf = new TextareaField('Comments', $comments);
     $taf->addExtraClass('span11');
     $fields = new FieldList($tf, $ef, $taf);
     // Create action
     $fa = new FormAction('SendContactForm', $send);
     // for bootstrap
     $fa->useButtonTag = true;
     $fa->addExtraClass('btn btn-primary');
     $actions = new FieldList($fa);
     // Create action
     $validator = new RequiredFields('Name', 'Email', 'Comments');
     $form = new Form($this, 'ContactForm', $fields, $actions, $validator);
     $form->setTemplate('VerticalForm');
     $form->addExtraClass('well');
     return $form;
 }
 public function PostForm()
 {
     $fields = FieldList::create();
     if ($this->Options()->UserTitle) {
         $fields->push($title = TextField::create('Title', _t('MicroBlog.TITLE', 'Title')));
         $title->setAttribute('placeholder', _t('MicroBlog.TITLE_PLACEHOLDER', 'Title (optional)'));
     }
     $fields->push($taf = new TextareaField('Content', _t('MicroBlog.POST', 'Post')));
     $taf->setAttribute('placeholder', _t('MicroBlog.CONTENT_PLACEHOLDER', 'Add content here, eg text or a link'));
     $taf->setRows(3);
     $taf->addExtraClass('expandable');
     $taf->addExtraClass('postContent');
     $taf->addExtraClass('preview');
     $public = CheckboxField::create('PublicUsers', 'Public users', Config::inst()->get('TimelineController', 'default_public'));
     $loggedIn = CheckboxField::create('LoggedInUsers', "Logged in users", Config::inst()->get('TimelineController', 'default_logged_in'));
     $groups = Group::get()->filter("ParentID", 0);
     $specificGroups = null;
     if (class_exists('Multisites')) {
         $specificGroups = Multisites::inst()->getCurrentSite()->TargetedGroups();
     } else {
         $specificGroups = SiteConfig::current_site_config()->TargetedGroups();
     }
     if (count($specificGroups)) {
         $groups = $specificGroups;
     }
     $members = Member::get();
     if ($members->count() > $this->ajaxMemberLimit) {
         $member = AjaxSelect2Field::create('Members', "To")->setConfig('classToSearch', 'Member')->setConfig('multiple', true)->setConfig('searchFields', array('FirstName', 'Surname', 'Email'))->setConfig('resultsLimit', $this->ajaxMemberLimit);
     } else {
         $member = MultiSelect2Field::create('Members', "To", $members->map()->toArray())->setMultiple(true);
     }
     $group = MultiSelect2Field::create("Groups", "To Groups", $groups->map()->toArray())->setMultiple(true);
     $fields->push($public);
     $fields->push($loggedIn);
     $fields->push($member);
     $fields->push($group);
     $target = $this->getTargetFilter();
     if ($target) {
         $fields->push(HiddenField::create('PostTarget', '', $target));
     }
     $actions = new FieldList(new FormAction('savepost', _t('MicroBlog.SAVE', 'Add')));
     $form = new Form($this, 'PostForm', $fields, $actions);
     $this->extend('updatePostForm', $form);
     return $form;
 }
예제 #9
0
 function AddTrainingCourseForm()
 {
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript("datepicker/javascript/datepicker.js");
     Requirements::javascript('registration/javascript/edit.profile.training.form.js');
     // Name Set
     $Name = new TextField('Name', "Name");
     $Name->addExtraClass('course-name');
     $Link = new TextField('Link', "Link");
     $Link->addExtraClass('course-online-link url');
     $Description = new TextareaField('Description', "Description");
     $Description->addExtraClass('course-description');
     $Online = new CheckboxField('Online', "Is Online?");
     $Online->addExtraClass('course-online-checkbox');
     $Paid = new CheckboxField('Paid', "Is Paid?");
     $Level = new DropdownField('LevelID', 'Level', TrainingCourseLevel::get()->map('ID', 'Level'));
     $Projects = new CheckboxSetField('Projects', '', Project::get()->map('ID', 'Name'));
     $Program = new HiddenField('TrainingServiceID', "TrainingServiceID", $this->training_id);
     $Course = new HiddenField('ID', "course", 0);
     $show_blank_schedule = true;
     if (isset($this->EditCourseID)) {
         $locations_dto = $this->course_repository->getLocations($this->EditCourseID);
         for ($i = 0; $i < count($locations_dto); $i++) {
             $dto = $locations_dto[$i];
             $show_blank_schedule = false;
             $City[$i] = new TextField('City[' . $i . ']', "City", $dto->getCity());
             $City[$i]->addExtraClass('city_name');
             $State[$i] = new TextField('State[' . $i . ']', "State", $dto->getState());
             $State[$i]->addExtraClass('state');
             $Country[$i] = new DropdownField('Country[' . $i . ']', $dto->getCountry(), CountryCodes::$iso_3166_countryCodes, $dto->getCountry());
             $Country[$i]->setEmptyString('-- Select One --');
             $Country[$i]->addExtraClass('country');
             $LinkS[$i] = new TextField('LinkS[' . $i . ']', "Link", $dto->getLink());
             $LinkS[$i]->addExtraClass('url');
             $StartDate[$i] = new TextField('StartDate[' . $i . ']', "Start Date", is_null($dto->getStartDate()) ? '' : $dto->getStartDate());
             $StartDate[$i]->addExtraClass('dateSelector start');
             $EndDate[$i] = new TextField('EndDate[' . $i . ']', "End Date", is_null($dto->getEndDate()) ? '' : $dto->getEndDate());
             $EndDate[$i]->addExtraClass('dateSelector end');
         }
     }
     if ($show_blank_schedule) {
         $City = new TextField('City[]', "City");
         $City->addExtraClass('city_name');
         $State = new TextField('State[]', "State");
         $State->addExtraClass('state');
         $Country = new DropdownField('Country[]', 'Country', CountryCodes::$iso_3166_countryCodes);
         $Country->setEmptyString('-- Select One --');
         $Country->addExtraClass('country');
         $StartDate = new TextField('StartDate[]', "Start Date");
         $StartDate->addExtraClass('dateSelector start');
         $EndDate = new TextField('EndDate[]', "End Date");
         $EndDate->addExtraClass('dateSelector end');
         $LinkS = new TextField('LinkS[]', "Link");
         $LinkS->addExtraClass('url');
     }
     $fields = new FieldList($Name, $Description, $Link, new LiteralField('break', '<hr/><div class="horizontal-fields">'), $Online, $Paid, $Level, $Program, $Course, new LiteralField('break', '</div><hr/>'), new LiteralField('projects', '<h4>Projects</h4>'), $Projects, new LiteralField('schedule', '<h4>Schedule</h4>'), new LiteralField('instruction', '<p class="note_online">City, State and Country can\'t be edited when a course is marked <em>Online</em>.</p>'), new LiteralField('scheduleDiv', '<div id="schedules">'));
     if (!$show_blank_schedule) {
         for ($j = 0; $j < $i; $j++) {
             $fields->push(new LiteralField('scheduleDiv', '<div class="scheduleRow">'));
             $fields->push($City[$j]);
             $fields->push($State[$j]);
             $fields->push($Country[$j]);
             $fields->push($StartDate[$j]);
             $fields->push($EndDate[$j]);
             $fields->push($LinkS[$j]);
             $fields->push(new LiteralField('scheduleDiv', '</div>'));
         }
     } else {
         $fields->push(new LiteralField('scheduleDiv', '<div class="scheduleRow">'));
         $fields->push($City);
         $fields->push($State);
         $fields->push($Country);
         $fields->push($StartDate);
         $fields->push($EndDate);
         $fields->push($LinkS);
         $fields->push(new LiteralField('scheduleDiv', '</div>'));
     }
     $fields->push(new LiteralField('scheduleDivC', '</div>'));
     $fields->push(new LiteralField('addSchedule', '<button id="addSchedule" class="action">Add Another</button>'));
     $actions = new FieldList(new FormAction('AddCourse', 'Submit'));
     $validators = new ConditionalAndValidationRule(array(new RequiredFields('Name', 'Level'), new HtmlPurifierRequiredValidator('Description')));
     $form = new Form($this, 'AddTrainingCourseForm', $fields, $actions, $validators);
     if (isset($this->EditCourseID)) {
         $form->loadDataFrom($this->course_repository->getById($this->EditCourseID));
         unset($this->EditCourseID);
     } else {
         $form->loadDataFrom($this->request->postVars());
     }
     return $form;
 }
 function __construct($controller, $name)
 {
     $CurrentDeploymentID = Session::get('CurrentDeploymentID');
     // Define fields //////////////////////////////////////
     $fields = new FieldList(new LiteralField('Break', '<p>The questions on this page are optional, but will help us better understand the details of how the OpenStack software is being used. Any information you provide on this step will be treated as private and confidential and only used in aggregate reporting.</p><hr>'), new LiteralField('Break', '<p>The information below will help us better understand the most common configuration and component choices OpenStack deployments are using.</p>'), new LiteralField('Break', '<h3>Telemetry</h3>'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Please provide the following information about the size and scale of this OpenStack deployment. This information is optional, but will be kept confidential and <b>never</b> published in connection with you or your organization.</p>'), new DropdownField('OperatingSystems', 'What is the main operating system running this OpenStack cloud deployment?', ArrayUtils::AlphaSort(DeploymentOptions::$operating_systems_options, array('' => '-- Select One --'), array('Other' => 'Other (please specify)'))), $other_os = new TextareaField('OtherOperatingSystems', ''), new CustomCheckboxSetField('UsedPackages', 'What packages does this deployment use…?<BR>Select All That Apply', DeploymentOptions::$used_packages_options), new LiteralField('Container', '<div id="custom_package_reason_container" class="hidden">'), new CustomCheckboxSetField('CustomPackagesReason', ' If you have modified packages or have built your own packages, why?<BR>Select All That Apply', DeploymentOptions::$custom_package_reason_options), $other_custom_reason = new TextareaField('OtherCustomPackagesReason', ''), new LiteralField('Container', '</div>'), new CustomCheckboxSetField('DeploymentTools', 'What tools are you using to deploy / configure this cluster?<BR>Select All That Apply', DeploymentOptions::$deployment_tools_options), $other_deployment_tools = new TextareaField('OtherDeploymentTools', ''), new CustomCheckboxSetField('PaasTools', 'What Platform-as-a-Service (PaaS) tools are you using to manage applications on this OpenStack deployment?', ArrayUtils::AlphaSort(DeploymentOptions::$paas_tools_options, array('' => '-- Select One --'), array('Other' => 'Other Tool (please specify)'))), $other_paas = new TextareaField('OtherPaasTools', ''));
     $deployment = Controller::curr()->LoadDeployment($CurrentDeploymentID);
     if (is_null($deployment)) {
         Controller::curr()->redirect(Controller::curr()->Link() . 'Deployments');
     }
     $projects_used = $deployment->ProjectsUsed;
     if (strpos($projects_used, 'Openstack Compute (Nova)') !== false) {
         $fields->add(new CustomCheckboxSetField('Hypervisors', 'Which <b>OpenStack Compute (Nova)</b> hypervisors are you using?<BR>Select All That Apply', DeploymentOptions::$hypervisors_options));
         $fields->add($other_hyper = new TextareaField('OtherHypervisor', ''));
         $other_hyper->addExtraClass('hidden');
     }
     $fields->add(new CustomCheckboxSetField('SupportedFeatures', 'Which compatibility APIs does this deployment support?<BR> Select All That Apply', DeploymentOptions::$deployment_features_options));
     $fields->add($other_feat = new TextareaField('OtherSupportedFeatures', ''));
     $fields->add(new CustomCheckboxSetField('UsedDBForOpenStackComponents', 'What database do you use for the components of this OpenStack cloud?<BR>Select All That Apply', DeploymentOptions::$used_db_for_openstack_components_options));
     $fields->add($other_db = new TextareaField('OtherUsedDBForOpenStackComponents', ''));
     if (strpos($projects_used, 'Openstack Network') !== false) {
         $fields->add(new CustomCheckboxSetField('NetworkDrivers', ' Which <b>OpenStack Network (Neutron)</b> drivers are you using?<BR>Select All That Apply', DeploymentOptions::$network_driver_options));
         $fields->add($other_driver = new TextareaField('OtherNetworkDriver', ''));
         $other_driver->addExtraClass('hidden');
     }
     if (strpos($projects_used, 'Openstack Identity Service (Keystone)') !== false) {
         $fields->add(new CustomCheckboxSetField('IdentityDrivers', 'Which  <b>OpenStack Identity Service (Keystone)</b> drivers are you using?<BR>Select All That Apply', DeploymentOptions::$identity_driver_options));
         $fields->add($other_driver = new TextareaField('OtherIndentityDriver', ''));
         $other_driver->addExtraClass('hidden');
     }
     if (strpos($projects_used, 'Openstack Block Storage (Cinder)') !== false) {
         $fields->add(new CustomCheckboxSetField('BlockStorageDrivers', 'Which <b>OpenStack Block Storage (Cinder)</b> drivers are you using?<BR>Select All That Apply', DeploymentOptions::$block_storage_divers_options));
         $fields->add($other_driver = new TextareaField('OtherBlockStorageDriver', ''));
         $other_driver->addExtraClass('hidden');
     }
     $fields->add(new CustomCheckboxSetField('InteractingClouds', 'With what other clouds does this OpenStack deployment interact?<BR>Select All That Apply', DeploymentOptions::$interacting_clouds_options));
     $fields->add($other_interacting_clouds = new TextareaField('OtherInteractingClouds', ''));
     $other_interacting_clouds->addExtraClass('hidden');
     $other_custom_reason->addExtraClass('hidden');
     $other_os->addExtraClass('hidden');
     $other_paas->addExtraClass('hidden');
     $other_feat->addExtraClass('hidden');
     $other_db->addExtraClass('hidden');
     $other_deployment_tools->addExtraClass('hidden');
     $fields->add(new LiteralField('Break', '<h3>What’s the size of this cloud…?</h3>'));
     $fields->add(new LiteralField('Break', '<hr/>'));
     $fields->add($ddl_users = new DropdownField('NumCloudUsers', 'Number of users', DeploymentOptions::$cloud_users_options));
     $ddl_users->setEmptyString('-- Select One --');
     $fields->add($ddl_nodes = new DropdownField('ComputeNodes', 'Physical compute nodes', DeploymentOptions::$compute_nodes_options));
     $ddl_nodes->setEmptyString('-- Select One --');
     $fields->add($ddl_cores = new DropdownField('ComputeCores', 'Processor cores', DeploymentOptions::$compute_cores_options));
     $ddl_cores->setEmptyString('-- Select One --');
     $fields->add($ddl_instances = new DropdownField('ComputeInstances', 'Number of instances', DeploymentOptions::$compute_instances_options));
     $ddl_instances->setEmptyString('-- Select One --');
     $fields->add($ddl_ips = new DropdownField('NetworkNumIPs', 'Number of fixed / floating IPs', DeploymentOptions::$network_ip_options));
     $ddl_ips->setEmptyString('-- Select One --');
     if (strpos($projects_used, 'Openstack Block Storage (Cinder)') !== false) {
         $fields->add($ddl_block_size = new DropdownField('BlockStorageTotalSize', 'Which <b>OpenStack Block Storage (Cinder)</b> size are you using?', DeploymentOptions::$storage_size_options));
         $ddl_block_size->setEmptyString('-- Select One --');
     }
     if (strpos($projects_used, 'Openstack Object Storage (Swift)') !== false) {
         $fields->add($ddl_block_size = new DropdownField('ObjectStorageSize', 'Which <b>OpenStack Object Storage (Swift)</b> size are you using?', DeploymentOptions::$storage_size_options));
         $ddl_block_size->setEmptyString('-- Select One --');
         $fields->add($ddl_objects_size = new DropdownField('ObjectStorageNumObjects', 'How many <b>OpenStack Object Storage (Swift)</b> objects are stored?', DeploymentOptions::$storage_objects_options));
         $ddl_objects_size->setEmptyString('-- Select One --');
     }
     // SPOTLIGHT
     $fields->add(new LiteralField('Break', '<h3>Spotlight</h3>'));
     $fields->add(new LiteralField('Break', '<hr/>'));
     if (strpos($projects_used, 'Openstack Network') === false) {
         $fields->add(new CustomCheckboxSetField('WhyNovaNetwork', 'If this deployment uses nova-network and not OpenStack Network (Neutron), what would allow you to migrate to Neutron?', DeploymentOptions::$why_nova_network_options));
         $fields->add($other_why_nova = new TextareaField('OtherWhyNovaNetwork', ''));
         $other_why_nova->addExtraClass('hidden');
     }
     if (strpos($projects_used, 'Openstack Object Storage (Swift)') !== false) {
         $fields->add($ddl_swift_dist_feat = new DropdownField('SwiftGlobalDistributionFeatures', 'Are you using Swift\'s global distribution features?', DeploymentOptions::$swift_global_distribution_features_options));
         $ddl_swift_dist_feat->setEmptyString('-- Select One --');
         $fields->add($ddl_uses_cases = new DropdownField('SwiftGlobalDistributionFeaturesUsesCases', 'If yes, what is your use case?', DeploymentOptions::$swift_global_distribution_features_uses_cases_options));
         $ddl_uses_cases->setEmptyString('-- Select One --');
         $fields->add($other_uses_cases = new TextareaField('OtherSwiftGlobalDistributionFeaturesUsesCases', ''));
         $other_uses_cases->addExtraClass('hidden');
         $fields->add($ddl_policies = new DropdownField('Plans2UseSwiftStoragePolicies', 'Do you have plans to use Swift\'s storage policies or erasure codes in the next year?', DeploymentOptions::$plans_2_use_swift_storage_policies_options));
         $ddl_policies->setEmptyString('-- Select One --');
         $fields->add($other_policies = new TextareaField('OtherPlans2UseSwiftStoragePolicies', ''));
         $other_policies->addExtraClass('hidden');
     }
     $fields->add($ddl_other_tools = new DropdownField('ToolsUsedForYourUsers', 'What tools are you using charging or show-back for your users?', DeploymentOptions::$tools_used_for_your_users_options));
     $ddl_other_tools->setEmptyString('-- Select One --');
     $fields->add($other_tools = new TextareaField('OtherToolsUsedForYourUsers', ''));
     $other_tools->addExtraClass('hidden');
     $fields->add(new TextareaField('Reason2Move2Ceilometer', 'If you are not using Ceilometer, what would allow you to move to it (optional free text)?'));
     $saveButton = new FormAction('SaveDeployment', 'Save Deployment');
     $cancelButton = new CancelFormAction($controller->Link() . 'Deployments', 'Cancel');
     $actions = new FieldList($saveButton, $cancelButton);
     // Create Validators
     $validator = new RequiredFields();
     parent::__construct($controller, $name, $fields, $actions, $validator);
     if ($CurrentDeploymentID) {
         //Populate the form with the current members data
         if ($Deployment = $this->controller->LoadDeployment($CurrentDeploymentID)) {
             $this->loadDataFrom($Deployment->data());
         } else {
             // HTTP ERROR
             return $this->httpError(403, 'Access Denied.');
         }
     }
     Requirements::javascript('surveys/js/deployment_survey_deployments_form.js');
     Requirements::javascript('surveys/js/deployment_survey_more_deployment_details_form.js');
 }