/**
  * (non-PHPdoc)
  *
  * @see SiteTree::getCMSFields()
  */
 public function getCMSFields()
 {
     // Get the fields from the parent implementation
     $fields = parent::getCMSFields();
     // List of available fields in the page
     $groupFields = $this->EditableFieldGroup()->Fields();
     $list = $this->Fields()->addMany($groupFields)->sort('Sort', 'ASC');
     // Add tab to edit fields values
     $this->buildPageFieldsTab($list, $fields);
     // GridField for managing page specific fields
     $config = GridFieldConfig_RelationEditor::create();
     $config->getComponentByType('GridFieldPaginator')->setItemsPerPage(10);
     $config->removeComponentsByType('GridFieldAddNewButton');
     $config->removeComponentsByType('GridFieldEditButton');
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(['Name' => _t('ConfigurablePage.NAME', 'Name'), 'Title' => _t('ConfigurablePage.TITLE', 'Title'), 'Sort' => _t('ConfigurablePage.SORT', 'Sort'), 'Group' => _t('ConfigurablePage.GROUP', 'Group')]);
     $config->addComponent(new GridFieldEditableManyManyExtraColumns(['Sort' => 'Int']), 'GridFieldEditButton');
     $config->getComponentByType('GridFieldDataColumns')->setFieldFormatting(['Group' => function ($value) {
         return !$value ? '' : $this->EditableFieldGroup()->Title;
     }]);
     $fieldsField = new GridField('Fields', 'Fields', $list, $config);
     // Drop-down list of editable field groups
     $groups = EditableFieldGroup::get()->map();
     $groups->unshift('', '');
     $groupsField = new DropdownField("EditableFieldGroupID", _t('ConfigurablePage.FIELDGROUP', 'Editable field group'), $groups);
     $groupsField->setDescription(_t('ConfigurablePage.FIELDGROUP_HELP', 'Select a group to load its collection of fields in the current page. ' . 'You need to click save to update the page fields.'));
     // Add fields to manage page fields tab
     $fields->addFieldToTab('Root.ManagePageFields', $groupsField);
     $fields->addFieldToTab('Root.ManagePageFields', $fieldsField);
     // JS & CSS for the gridfield sort column
     Requirements::javascript('configurablepage/javascript/ConfigurablePage.js');
     Requirements::css('configurablepage/css/ConfigurablePage.css');
     return $fields;
 }
 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', new TextField('Name', 'Name'));
     $f->addFieldToTab('Root.Main', $ddl = new DropdownField('ListType', 'ListType', $this->dbObject('ListType')->enumValues()));
     $f->addFieldToTab('Root.Main', $ddl2 = new DropdownField('CategoryID', 'Category', PresentationCategory::get()->filter('SummitID', $_REQUEST['SummitID'])->map('ID', 'Title')));
     $ddl->setEmptyString('-- Select List Type --');
     $ddl2->setEmptyString('-- Select Track  --');
     if ($this->ID > 0) {
         $config = GridFieldConfig_RecordEditor::create(25);
         $config->addComponent(new GridFieldAjaxRefresh(1000, false));
         $config->addComponent(new GridFieldPublishSummitEventAction());
         $config->removeComponentsByType('GridFieldDeleteAction');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents());
         $bulk_summit_types->setTitle('Set Summit Types');
         $result = DB::query("SELECT DISTINCT SummitEvent.*, Presentation.*\nFROM SummitEvent\nINNER JOIN Presentation ON Presentation.ID = SummitEvent.ID\nINNER JOIN SummitSelectedPresentation ON SummitSelectedPresentation.PresentationID = Presentation.ID\nINNER JOIN SummitSelectedPresentationList ON SummitSelectedPresentation.SummitSelectedPresentationListID = {$this->ID}\nORDER BY SummitSelectedPresentation.Order ASC\n");
         $presentations = new ArrayList();
         foreach ($result as $row) {
             $presentations->add(new Presentation($row));
         }
         $gridField = new GridField('SummitSelectedPresentations', 'Selected Presentations', $presentations, $config);
         $gridField->setModelClass('Presentation');
         $f->addFieldToTab('Root.Main', $gridField);
     }
     return $f;
 }
 public function scaffoldFormField($title = null, $params = null)
 {
     if (empty($this->object)) {
         return null;
     }
     $relationName = substr($this->name, 0, -2);
     $hasOneClass = $this->object->hasOneComponent($relationName);
     if ($hasOneClass && singleton($hasOneClass) instanceof Image) {
         $field = new UploadField($relationName, $title);
         $field->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
     } elseif ($hasOneClass && singleton($hasOneClass) instanceof File) {
         $field = new UploadField($relationName, $title);
     } else {
         $titleField = singleton($hasOneClass)->hasField('Title') ? "Title" : "Name";
         $list = DataList::create($hasOneClass);
         // Don't scaffold a dropdown for large tables, as making the list concrete
         // might exceed the available PHP memory in creating too many DataObject instances
         if ($list->count() < 100) {
             $field = new DropdownField($this->name, $title, $list->map('ID', $titleField));
             $field->setEmptyString(' ');
         } else {
             $field = new NumericField($this->name, $title);
         }
     }
     return $field;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         // Summit Images
         $summitImageField = singleton('SummitImage')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldDetailForm')->setFields($summitImageField);
         $gridField = new GridField('SummitImage', 'SummitImage', SummitImage::get(), $config);
         $fields->addFieldToTab('Root.SummitPageImages', $gridField);
         // Summit Image has_one selector
         $dropdown = DropdownField::create('SummitImageID', 'Please choose an image for this page', SummitImage::get()->map("ID", "Title", "Please Select"))->setEmptyString('(None)');
         $fields->addFieldToTab('Root.Main', $dropdown);
         $fields->addFieldsToTab('Root.Main', $ddl_summit = new DropdownField('SummitID', 'Summit', Summit::get()->map('ID', 'Name')));
         $ddl_summit->setEmptyString('(None)');
     }
     $fields->addFieldsToTab('Root.Main', new TextField('HeroCSSClass', 'Hero CSS Class'));
     //Google Conversion Tracking params
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionId", "Conversion Id", "994798451"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionLanguage", "Conversion Language", "en"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionFormat", "Conversion Format", "3"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new ColorField("GAConversionColor", "Conversion Color", "ffffff"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionLabel", "Conversion Label", "IuM5CK3OzQYQ89at2gM"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new TextField("GAConversionValue", "Conversion Value", "0"));
     $fields->addFieldToTab("Root.GoogleConversionTracking", new CheckboxField("GARemarketingOnly", "Remarketing Only"));
     //Facebook Conversion Params
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBPixelId", "Pixel Id", "6013247449963"));
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBValue", "Value", "0.00"));
     $fields->addFieldToTab("Root.FacebookConversionTracking", new TextField("FBCurrency", "Currency", "USD"));
     //Twitter
     $fields->addFieldToTab("Root.TwitterConversionTracking", new TextField("TwitterPixelId", "Pixel Id", "l5lav"));
     return $fields;
 }
 /**
  * @param FieldList $fields
  * @return FieldList|void
  */
 public function updateCMSFields(FieldList $fields)
 {
     $oldFields = $fields->toArray();
     foreach ($oldFields as $field) {
         $fields->remove($field);
     }
     $fields->push(new TextField("Title", "Title"));
     $fields->push(new HtmlEditorField("Summary", "Summary"));
     $fields->push(new HtmlEditorField("Description", "Description"));
     $fields->push(new MemberAutoCompleteField("Curator", "Curator"));
     $fields->push($ddl = new DropdownField('ReleaseID', 'Release', OpenStackRelease::get()->map("ID", "Name")));
     $ddl->setEmptyString('-- Select a Release --');
     if ($this->owner->ID > 0) {
         $components_config = new GridFieldConfig_RelationEditor(100);
         $components = new GridField("OpenStackComponents", "Supported Release Components", $this->owner->OpenStackComponents(), $components_config);
         $components_config->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchList($this->getAllowedComponents());
         $components_config->removeComponentsByType('GridFieldAddNewButton');
         //$components_config->addComponent(new GridFieldSortableRows('OpenStackSampleConfig_OpenStackComponents.Order'));
         $fields->push($components);
         $fields->push($ddl = new DropdownField('TypeID', 'Type', OpenStackSampleConfigurationType::get()->filter('ReleaseID', $this->owner->ReleaseID)->map("ID", "Type")));
         $ddl->setEmptyString('-- Select a Configuration Type --');
         $related_notes_config = new GridFieldConfig_RecordEditor(100);
         $related_notes = new GridField("RelatedNotes", "Related Notes", $this->owner->RelatedNotes(), $related_notes_config);
         $related_notes_config->addComponent(new GridFieldSortableRows('Order'));
         $fields->push($related_notes);
     }
     return $fields;
 }
 public function getFormField()
 {
     switch ($this->Type) {
         case 'dropdown':
             switch ($this->EmptyMode) {
                 case 'none':
                     $emptyText = false;
                     break;
                 case 'blank':
                     $emptyText = ' ';
                     break;
                 case 'text':
                     $emptyText = $this->EmptyText;
                     break;
             }
             $opts = $this->Options()->map('Key', 'Value')->toArray();
             $df = new DropdownField($this->getFormFieldName(), $this->Title, $opts, $this->Default, null);
             if (is_string($emptyText)) {
                 $df->setEmptyString($emptyText);
             }
             return $df;
         case 'optionset':
             return new OptionsetField($this->getFormFieldName(), $this->Title, $this->Options()->map('Key', 'Value'), $this->Default);
         case 'checkboxset':
             return new CheckboxSetField($this->getFormFieldName(), $this->Title, $this->Options()->map('Key', 'Value'), $this->Default);
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->add($ddl = new DropdownField('EmailTemplateID', 'Email Template', PermamailTemplate::get()->map('ID', 'Identifier')));
     $ddl->setEmptyString('-- Select an Email Template --');
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $type = new DropdownField('EventType', _t('ScoutDistrict.Events.TYPE', 'Type'), array('section-meeting' => _t('ScoutDistrict.Enum.SECTIONMEETING', 'Section Meeting'), 'leaders-meeting' => _t('ScoutDistrict.Enum.LEADERSMEETING', 'Leaders Meeting'), 'activity' => _t('ScoutDistrict.Enum.ACTIVITY', 'Activity'), 'fundraising' => _t('ScoutDistrict.Enum.FUNDRAISING', 'Fundraising'), 'committee' => _t('ScoutDistrict.Enum.COMMITTEE', 'Committee'), 'camp' => _t('ScoutDistrict.Enum.CAMP', 'Camp'), 'group' => _t('ScoutDistrict.Enum.GROUP', 'Group'), 'district' => _t('ScoutDistrict.Enum.DISTRICT', 'District'), 'training' => _t('ScoutDistrict.Enum.TRAINING', 'Training'), 'other' => _t('ScoutDistrict.Enum.OTHER', 'Other')));
     $type->setRightTitle(_t('ScoutDistrict.Events.TYPE_HELP', 'What Type of event is this'))->addExtraClass('help');
     $location = new TextField('EventLocation', _t('ScoutDistrict.Events.LOCATION', 'Location'));
     $location->setRightTitle(_t('ScoutDistrict.Events.LOCATION_HELP', 'Where is the event being held'))->addExtraClass('help');
     $latitude = new TextField('EventLatitude', _t('ScoutDistrict.Events.LATITUDE', 'Latitude'));
     $latitude->setRightTitle(_t('ScoutDistrict.Events.LATITUDE_HELP', 'Latitude of event Location'))->addExtraClass('help');
     $longitude = new TextField('EventLongitude', _t('ScoutDistrict.Events.LONGITUDE', 'Longitude'));
     $longitude->setRightTitle(_t('ScoutDistrict.Events.LONGITUDE_HELP', 'Longitude of event Location'))->addExtraClass('help');
     $bookingDetails = new TextareaField('EventBookingDetails', _t('ScoutDistrict.Events.BOOKINGDETAILS', 'Booking Details'));
     $bookingDetails->setRightTitle(_t('ScoutDistrict.Events.BOOKINGDETAILS_HELP', 'Details of how to book a place for the Event'))->addExtraClass('help');
     $bookingURL = new TextField('EventBookingURL', _t('ScoutDistrict.Events.BOOKINGURL', 'Booking URL'));
     $bookingURL->setRightTitle(_t('ScoutDistrict.Events.BOOKINGURL_HELP', 'The URL of an external site to book a place'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Scouts', array($type, $location, $latitude, $longitude, $bookingDetails, $bookingURL));
     $thumbnail = new UploadField('ThumbnailImage', _t('ScoutDistrict.Events.THUMBNAIL', 'Thumbnail Image'));
     $thumbnail->setFolderName('event/thumbnail');
     $thumbnail->setRightTitle(_t('ScoutDistrict.Events.THUMBNAIL_HELP', 'A small image for displaying in listing/aggregated content'))->addExtraClass('help');
     $image = new UploadField('Image', _t('ScoutDistrict.Events.IMAGE', 'Image'));
     $image->setFolderName('event/image');
     $image->setRightTitle(_t('ScoutDistrict.Events.IMAGE_HELP', 'A Larger image for displaying in event header'))->addExtraClass('help');
     $files = new UploadField('Files', _t('ScoutDistrict.Events.FILE', 'Files'));
     $files->setFolderName('event/file');
     $files->setRightTitle(_t('ScoutDistrict.Events.FILE_HELP', 'This can be a file containing information about the event or an application form, etc'))->addExtraClass('help');
     $fields->addFieldsToTab('Root.Files', array($thumbnail, $image, $files));
     return $fields;
 }
 function testZeroArraySourceNotOverwrittenByEmptyString()
 {
     $source = array(0 => 'zero');
     $field = new DropdownField('Field', null, $source);
     $field->setEmptyString('select...');
     $this->assertEquals($field->getSource(), array('' => 'select...', 0 => 'zero'));
 }
Example #10
0
 function getCMSFields()
 {
     $CountryCodes = CountryCodes::$iso_3166_countryCodes;
     $CountryCodes['Worldwide'] = 'Worldwide';
     $CountryCodes['Prefer not to say'] = 'Prefer not to say';
     $CountryCodes['Too many to list'] = 'Too many to list';
     $fields = new FieldList($rootTab = new TabSet("Root"));
     $fields->addFieldsToTab('Root.Main', array(new LiteralField('Break', '<p>Each deployment profile can be marked public if you wish for the basic information on this page to appear on openstack.org. If you select private we will treat all of the profile information as confidential information.</p>'), new OptionSetField('IsPublic', 'Would you like to keep this information confidential or allow the Foundation to share information about this deployment publicly?', array('1' => '<strong>Willing to share:</strong> The information on this page may be shared for this deployment', '0' => '<strong>Confidential:</strong> All details provided should be kept confidential to the OpenStack Foundation'), 0), new LiteralField('Break', '<hr/>'), new TextField('Label', 'Deployment Name<BR><p class="clean_text">Please create a friendly label, like “Production OpenStack Deployment”. This name is for your deployment in our survey tool. If several people at your organization work on one deployment, we would <b>really appreciate</b> you all referring to the same deployment by the same name!</p>'), $ddl_stage = new DropdownField('DeploymentStage', 'In what stage is your OpenStack deployment? (make a new deployment profile for each type of deployment)', DeploymentOptions::$stage_options), new MultiDropdownField('CountriesPhysicalLocation', 'In which country / countries is this OpenStack deployment physically located?', $CountryCodes), new MultiDropdownField('CountriesUsersLocation', 'In which country / countries are the users / customers for this deployment physically located?', $CountryCodes), $ddl_type = new DropdownField('DeploymentType', 'Deployment Type', DeploymentOptions::$deployment_type_options), new CustomCheckboxSetField('ProjectsUsed', 'Projects Used', DeploymentOptions::$projects_used_options), new CustomCheckboxSetField('CurrentReleases', 'What releases are you currently using?', DeploymentOptions::$current_release_options), new LiteralField('Break', 'Describe the workloads and frameworks running in this OpenStack environment.<BR>Select All That Apply'), new LiteralField('Break', '<hr/>'), new CustomCheckboxSetField('ServicesDeploymentsWorkloads', '<b>Services Deployments - workloads designed to be accessible for external users / customers</b>', DeploymentOptions::$services_deployment_workloads_options), $other_service_workload = new TextAreaField('OtherServicesDeploymentsWorkloads', ''), new CustomCheckboxSetField('EnterpriseDeploymentsWorkloads', '<b>Enterprise Deployments - workloads designed to be run internally to support business</b>', DeploymentOptions::$enterprise_deployment_workloads_options), $other_enterprise_workload = new TextAreaField('OtherEnterpriseDeploymentsWorkloads', ''), new CustomCheckboxSetField('HorizontalWorkloadFrameworks', '<b>Horizontal Workload Frameworks</b>', DeploymentOptions::$horizontal_workload_framework_options), $other_horizontal_workload = new TextAreaField('OtherHorizontalWorkloadFrameworks', '')));
     $ddl_type->setEmptyString('-- Select One --');
     $ddl_stage->setEmptyString('-- Select One --');
     $details = array(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 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 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', ''), new CustomCheckboxSetField('Hypervisors', 'If this deployment uses <b>OpenStack Compute (Nova)</b>, which hypervisors are you using?<BR>Select All That Apply', DeploymentOptions::$hypervisors_options), new TextareaField('OtherHypervisor', ''), new CustomCheckboxSetField('SupportedFeatures', 'Which compatibility APIs does this deployment support?<BR> Select All That Apply', DeploymentOptions::$deployment_features_options), new TextareaField('OtherSupportedFeatures', ''), 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), new TextareaField('OtherUsedDBForOpenStackComponents', ''), new CustomCheckboxSetField('NetworkDrivers', ' If this deployment uses <b>OpenStack Network (Neutron)</b>, which drivers are you using?<BR>Select All That Apply', DeploymentOptions::$network_driver_options), new TextareaField('OtherNetworkDriver', ''), new CustomCheckboxSetField('IdentityDrivers', 'If you are using <b>OpenStack Identity Service (Keystone)</b> which OpenStack identity drivers are you using?<BR>Select All That Apply', DeploymentOptions::$identity_driver_options), new TextareaField('OtherIndentityDriver', ''), new CustomCheckboxSetField('BlockStorageDrivers', 'If this deployment uses <b>OpenStack Block Storage (Cinder)</b>, which drivers are <BR>Select All That Apply', DeploymentOptions::$block_storage_divers_options), new TextareaField('OtherBlockStorageDriver', ''), new CustomCheckboxSetField('InteractingClouds', 'With what other clouds does this OpenStack deployment interact?<BR>Select All That Apply', DeploymentOptions::$interacting_clouds_options), new TextareaField('OtherInteractingClouds', ''), $ddl_users = new DropdownField('NumCloudUsers', 'Number of users', DeploymentOptions::$cloud_users_options), $ddl_nodes = new DropdownField('ComputeNodes', 'Physical compute nodes', DeploymentOptions::$compute_nodes_options), $ddl_cores = new DropdownField('ComputeCores', 'Processor cores', DeploymentOptions::$compute_cores_options), $ddl_instances = new DropdownField('ComputeInstances', 'Number of instances', DeploymentOptions::$compute_instances_options), $ddl_ips = new DropdownField('NetworkNumIPs', 'Number of fixed / floating IPs', DeploymentOptions::$network_ip_options), $ddl_block_size = new DropdownField('BlockStorageTotalSize', 'If this deployment uses <b>OpenStack Block Storage (Cinder)</b>, what is the size of its block storage?', DeploymentOptions::$storage_size_options), $ddl_block_size = new DropdownField('ObjectStorageSize', 'If this deployment uses <b>OpenStack Object Storage (Swift)</b>, what is the size of its block storage?', DeploymentOptions::$storage_size_options), $ddl_objects_size = new DropdownField('ObjectStorageNumObjects', 'If this deployment uses <b>OpenStack Object Storage (Swift)</b>, how many total objects are stored?', DeploymentOptions::$storage_objects_options), new LiteralField('Break', '<h3>Spotlight</h3>'), new LiteralField('Break', '<hr/>'), 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), $other_why_nova = new TextareaField('OtherWhyNovaNetwork', ''), $ddl_swift_dist_feat = new DropdownField('SwiftGlobalDistributionFeatures', 'Are you using Swift\'s global distribution features?', DeploymentOptions::$swift_global_distribution_features_options), $ddl_uses_cases = new DropdownField('SwiftGlobalDistributionFeaturesUsesCases', 'If yes, what is your use case?', DeploymentOptions::$swift_global_distribution_features_uses_cases_options), $other_uses_cases = new TextareaField('OtherSwiftGlobalDistributionFeaturesUsesCases', ''), $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), new TextareaField('OtherPlans2UseSwiftStoragePolicies', ''), $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), $other_tools = new TextareaField('OtherToolsUsedForYourUsers', ''), new TextareaField('Reason2Move2Ceilometer', 'If you are not using Ceilometer, what would allow you to move to it (optional free text)?'));
     $ddl_users->setEmptyString('-- Select One --');
     $ddl_nodes->setEmptyString('-- Select One --');
     $ddl_cores->setEmptyString('-- Select One --');
     $ddl_instances->setEmptyString('-- Select One --');
     $ddl_ips->setEmptyString('-- Select One --');
     $ddl_block_size->setEmptyString('-- Select One --');
     $ddl_block_size->setEmptyString('-- Select One --');
     $ddl_objects_size->setEmptyString('-- Select One --');
     $ddl_swift_dist_feat->setEmptyString('-- Select One --');
     $ddl_uses_cases->setEmptyString('-- Select One --');
     $ddl_policies->setEmptyString('-- Select One --');
     $ddl_other_tools->setEmptyString('-- Select One --');
     $fields->addFieldsToTab('Root.Details', $details);
     return $fields;
 }
 public function __construct($name, $title = null, $value = null, $form = null)
 {
     $allowed_types = $this->stat('allowed_types');
     $field_types = $this->stat('field_types');
     if (empty($allowed_types)) {
         $allowed_types = array_keys($field_types);
     }
     $field = new DropdownField("{$name}[Type]", '', array_combine($allowed_types, $allowed_types));
     $field->setEmptyString('Please choose the Link Type');
     $this->composite_fields['Type'] = $field;
     foreach ($allowed_types as $type) {
         $def = $field_types[$type];
         $field_name = "{$name}[{$type}]";
         switch ($def['field']) {
             case 'TreeDropdownField':
                 $field = new TreeDropdownField($field_name, '', 'SiteTree', 'ID', 'Title');
                 break;
             default:
                 $field = new TextField($field_name, '');
                 break;
         }
         $field->setDescription($def['description']);
         $field->addExtraClass('FlexiLinkCompositeField');
         $this->composite_fields[$type] = $field;
     }
     $this->setForm($form);
     parent::__construct($name, $title, $value, $form);
 }
    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());
        }
    }
 public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : Summit::ActiveSummitID();
     Requirements::javascript('summit/javascript/SummitPushNotification.js');
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', $txt = new TextareaField('Message', 'Message'));
     $txt->setAttribute('required', 'true');
     $f->addFieldToTab('Root.Main', $ddl_channel = new DropdownField('Channel', 'Channel', singleton('SummitPushNotification')->dbObject('Channel')->enumValues()));
     $f->addFieldToTab('Root.Main', $ddl_events = new DropdownField('EventID', 'Event', SummitEvent::get()->filter(['Published' => 1, 'SummitID' => $summit_id])->sort('Title', 'ASC')->Map('ID', 'FormattedTitle')));
     $f->addFieldToTab('Root.Main', $ddl_groups = new DropdownField('GroupID', 'Group', Group::get()->sort('Title', 'ASC')->Map('ID', 'Title')));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $ddl_channel->setEmptyString('--SELECT A CHANNEL--');
     $ddl_channel->setAttribute('required', 'true');
     $ddl_events->setEmptyString('--SELECT AN EVENT--');
     $ddl_events->addExtraClass('hidden');
     $ddl_groups->setEmptyString('--SELECT A GROUP--');
     $ddl_groups->addExtraClass('hidden');
     $config = GridFieldConfig_RelationEditor::create(50);
     $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $config->removeComponentsByType('GridFieldAddNewButton');
     $config->addComponent($auto_completer = new CustomGridFieldAddExistingAutocompleter('buttons-before-right'));
     $auto_completer->setResultsFormat('$Title ($Email)');
     $recipients = new GridField('Recipients', 'Member Recipients', $this->Recipients(), $config);
     $f->addFieldToTab('Root.Main', $recipients);
     return $f;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->insertAfter(new ToggleCompositeField('AfterRegistrationContent', _t('EventRegistration.AFTER_REG_CONTENT', 'After Registration Content'), array(new TextField('AfterRegTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterRegContent', _t('EventRegistration.CONTENT', 'Content')))), 'Content');
     $fields->insertAfter(new ToggleCompositeField('AfterUnRegistrationContent', _t('EventRegistration.AFTER_UNREG_CONTENT', 'After Un-Registration Content'), array(new TextField('AfterUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterUnregContent', _t('EventRegistration.CONTENT', 'Content')))), 'AfterRegistrationContent');
     if ($this->RegEmailConfirm) {
         $fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterRegistrationConfirmation', _t('EventRegistration.AFTER_REG_CONFIRM_CONTENT', 'After Registration Confirmation Content'), array(new TextField('AfterConfirmTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfirmContent', _t('EventRegistration.CONTENT', 'Content')))));
     }
     if ($this->UnRegEmailConfirm) {
         $fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterUnRegistrationConfirmation', _t('EventRegistration.AFTER_UNREG_CONFIRM_CONTENT', 'After Un-Registration Confirmation Content'), array(new TextField('AfterConfUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfUnregContent', _t('EventRegistration.CONTENT', 'Content')))));
     }
     $fields->addFieldToTab('Root.Tickets', new GridField('Tickets', 'Ticket Types', $this->Tickets(), GridFieldConfig_RecordEditor::create()));
     $generators = ClassInfo::implementorsOf('EventRegistrationTicketGenerator');
     if ($generators) {
         foreach ($generators as $generator) {
             $instance = new $generator();
             $generators[$generator] = $instance->getGeneratorTitle();
         }
         $generator = new DropdownField('TicketGenerator', _t('EventRegistration.TICKET_GENERATOR', 'Ticket generator'), $generators);
         $generator->setEmptyString(_t('EventManagement.NONE', '(None)'));
         $generator->setDescription(_t('EventManagement.TICKET_GENERATOR_NOTE', 'The ticket generator is used to generate a ticket file for the user to download.'));
         $fields->addFieldToTab('Root.Tickets', $generator);
     }
     $regGridFieldConfig = GridFieldConfig_Base::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldDeleteAction')->addComponents(new GridFieldButtonRow('after'), new GridFieldPrintButton('buttons-after-left'), new GridFieldExportButton('buttons-after-left'));
     $fields->addFieldsToTab('Root.Registrations', array(new GridField('Registrations', _t('EventManagement.REGISTRATIONS', 'Registrations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Valid'), $regGridFieldConfig), new GridField('CanceledRegistrations', _t('EventManagement.CANCELLATIONS', 'Cancellations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Canceled'), $regGridFieldConfig)));
     if ($this->RegEmailConfirm) {
         $fields->addFieldToTab('Root.Registrations', new ToggleCompositeField('UnconfirmedRegistrations', _t('EventManagement.UNCONFIRMED_REGISTRATIONS', 'Unconfirmed Registrations'), array(new GridField('UnconfirmedRegistrations', '', $this->DateTimes()->relation('Registrations')->filter('Status', 'Unconfirmed')))));
     }
     $fields->addFieldToTab('Root.Invitations', new GridField('Invitations', _t('EventManagement.INVITATIONS', 'Invitations'), $this->Invitations(), GridFieldConfig_RecordViewer::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new EventSendInvitationsButton($this))));
     return $fields;
 }
 public function updateFields(FieldList $fields)
 {
     if (!$this->owner->ID) {
         return $fields;
     }
     $tab = $fields->fieldByName('Root') ? $fields->findOrMakeTab('Root.Workflow') : $fields;
     if (Permission::check('APPLY_WORKFLOW')) {
         $definition = new DropdownField('WorkflowDefinitionID', _t('WorkflowApplicable.DEFINITION', 'Applied Workflow'));
         $definitions = $this->workflowService->getDefinitions()->map()->toArray();
         $definition->setSource($definitions);
         $definition->setEmptyString(_t('WorkflowApplicable.INHERIT', 'Inherit from parent'));
         $tab->push($definition);
         // Allow an optional selection of additional workflow definitions.
         if ($this->owner->WorkflowDefinitionID) {
             $fields->removeByName('AdditionalWorkflowDefinitions');
             unset($definitions[$this->owner->WorkflowDefinitionID]);
             $tab->push($additional = ListboxField::create('AdditionalWorkflowDefinitions', _t('WorkflowApplicable.ADDITIONAL_WORKFLOW_DEFINITIONS', 'Additional Workflows')));
             $additional->setSource($definitions);
             $additional->setMultiple(true);
         }
     }
     // Display the effective workflow definition.
     if ($effective = $this->getWorkflowInstance()) {
         $title = $effective->Definition()->Title;
         $tab->push(ReadonlyField::create('EffectiveWorkflow', _t('WorkflowApplicable.EFFECTIVE_WORKFLOW', 'Effective Workflow'), $title));
     }
     if ($this->owner->ID) {
         $config = new GridFieldConfig_Base();
         $config->addComponent(new GridFieldEditButton());
         $config->addComponent(new GridFieldDetailForm());
         $insts = $this->owner->WorkflowInstances();
         $log = new GridField('WorkflowLog', _t('WorkflowApplicable.WORKFLOWLOG', 'Workflow Log'), $insts, $config);
         $tab->push($log);
     }
 }
 public function getCMSFields()
 {
     $fields = new FieldList(new TabSet('Root'));
     $fields->addFieldToTab('Root.Main', new TextField('Title', $this->fieldLabel('Title')));
     $filter = '';
     $reqParent = isset($_REQUEST['ParentID']) ? (int) $_REQUEST['ParentID'] : 0;
     $attachTo = $this->ActionID ? $this->ActionID : $reqParent;
     if ($attachTo) {
         $action = DataObject::get_by_id('WorkflowAction', $attachTo);
         if ($action && $action->ID) {
             $filter = '"WorkflowDefID" = ' . (int) $action->WorkflowDefID;
         }
     }
     $actions = DataObject::get('WorkflowAction', $filter);
     $options = array();
     if ($actions) {
         $options = $actions->map();
     }
     $defaultAction = $action ? $action->ID : "";
     $typeOptions = array('Active' => _t('WorkflowTransition.Active', 'Active'), 'Passive' => _t('WorkflowTransition.Passive', 'Passive'));
     $fields->addFieldToTab('Root.Main', new DropdownField('ActionID', $this->fieldLabel('ActionID'), $options, $defaultAction));
     $fields->addFieldToTab('Root.Main', $nextActionDropdownField = new DropdownField('NextActionID', $this->fieldLabel('NextActionID'), $options));
     $nextActionDropdownField->setEmptyString(_t('WorkflowTransition.SELECTONE', '(Select one)'));
     $fields->addFieldToTab('Root.Main', new DropdownField('Type', _t('WorkflowTransition.TYPE', 'Type'), $typeOptions));
     $members = Member::get();
     $fields->findOrMakeTab('Root.RestrictToUsers', _t('WorkflowTransition.TabTitle', 'Restrict to users'));
     $fields->addFieldToTab('Root.RestrictToUsers', new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Restrict to Users'), $members));
     $fields->addFieldToTab('Root.RestrictToUsers', new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Restrict to Groups'), 'Group'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = $this->scaffoldFormFields(array('includeRelations' => $this->ID > 0, 'tabbed' => true, 'ajaxSafe' => true));
     $fields->insertAfter(new ReadonlyField('Type'), 'Title');
     $fields->removeByName('ListID');
     $fields->removeByName('ParentID');
     $fields->removeByName('Sort');
     $fields->removeByName('ExtraClass');
     /** Title
      * By default, the Title is used for reference only
      * Set $enable_title_in_template to true  when using title in template
      */
     if (!$this->enable_title_in_template) {
         $fields->removeByName('HideTitle');
         $title = $fields->fieldByName('Root.Main.Title');
         if ($title) {
             $title->setRightTitle('For reference only. Does not appear in the template.');
         }
     }
     $fields->addFieldToTab('Root.Settings', new TextField('ExtraClass', 'Extra CSS Classes to add'));
     if (!is_a($this, 'ElementList')) {
         $lists = ElementList::get()->filter('ParentID', $this->ParentID);
         if ($lists->exists()) {
             $fields->addFieldToTab('Root.Main', $move = new DropdownField('MoveToListID', 'Move this to another list', $lists->map('ID', 'CMSTitle'), ''));
             $move->setEmptyString('Select a list..');
             $move->setHasEmptyDefault(true);
         }
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 function getCMSFields()
 {
     $fields = new FieldList($rootTab = new TabSet("Root"));
     $fields->addFieldsToTab('Root.Main', array(new LiteralField('Break', ColumnFormatter::$left_column_start), 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('Break', ColumnFormatter::$right_column_start), 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)'))), $t2 = new TextareaField('OtherProgrammingLanguages', ''), new LiteralField('Break', ColumnFormatter::$end_columns), new LiteralField('Break', ColumnFormatter::$left_column_start), 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 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', '')));
     $docs->setEmptyString('-- Select One --');
     return $fields;
 }
 public function scaffoldFormField($title = null, $params = null)
 {
     if (empty($this->object)) {
         return null;
     }
     $relationName = substr($this->name, 0, -2);
     $hasOneClass = $this->object->hasOneComponent($relationName);
     if (empty($hasOneClass)) {
         return null;
     }
     $hasOneSingleton = singleton($hasOneClass);
     if ($hasOneSingleton instanceof File) {
         $field = new UploadField($relationName, $title);
         if ($hasOneSingleton instanceof Image) {
             $field->setAllowedFileCategories('image/supported');
         }
         return $field;
     }
     // Build selector / numeric field
     $titleField = $hasOneSingleton->hasField('Title') ? "Title" : "Name";
     $list = DataList::create($hasOneClass);
     // Don't scaffold a dropdown for large tables, as making the list concrete
     // might exceed the available PHP memory in creating too many DataObject instances
     if ($list->count() < 100) {
         $field = new DropdownField($this->name, $title, $list->map('ID', $titleField));
         $field->setEmptyString(' ');
     } else {
         $field = new NumericField($this->name, $title);
     }
     return $field;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Contact Form settings
     $recipient_field = new EmailField('DefaultRecipient', 'Email recipient');
     $recipient_field->setDescription('Default email address to send submissions to.');
     $subject_field = new TextField('Subject', 'Email subject');
     $subject_field->setDescription('Subject for the email.');
     $default_from_field = new EmailField('DefaultFrom', 'Email from');
     $default_from_field->setDescription('Default from email address.');
     $fields->addFieldToTab('Root.ContactForm.Settings', $recipient_field);
     $fields->addFieldToTab('Root.ContactForm.Settings', $subject_field);
     $fields->addFieldToTab('Root.ContactForm.Settings', $default_from_field);
     // Contact Form fields
     $conf = GridFieldConfig_RelationEditor::create(10);
     $conf->addComponent(new GridFieldSortableRows('SortOrder'));
     $data_columns = $conf->getComponentByType('GridFieldDataColumns');
     $data_columns->setDisplayFields(array('Name' => 'Name', 'Type' => 'Type', 'requiredText' => 'Required'));
     $contact_form_fields = new GridField('Fields', 'Field', $this->ContactFields(), $conf);
     $fields->addFieldToTab('Root.ContactForm.Fields', $contact_form_fields);
     // Recipient map
     $contact_fields = array();
     foreach ($this->ContactFields() as $contact_field) {
         $contact_fields[$contact_field->Name] = $contact_field->Name;
     }
     $recipient_map_field_field = new DropdownField('RecipientMapField', 'Recipient Map Field', $contact_fields);
     $recipient_map_field_field->setDescription('Field used to map recipients.');
     $recipient_map_field = new TextareaField('RecipientMap', 'Recipient Map');
     $recipient_map_field->setDescription('Map field values to an email address (format: value:email address) one per line.');
     $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field_field);
     $fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field);
     return $fields;
 }
 function __construct($controller, $name)
 {
     $org_field = null;
     $current_user = Member::currentUser();
     $current_affiliations = $current_user->getCurrentAffiliations();
     if (!$current_affiliations) {
         $org_field = new TextField('Organization', 'Your Organization Name');
     } else {
         if (count($current_affiliations) > 1) {
             $source = array();
             foreach ($current_affiliations as $a) {
                 $org = $a->Organization();
                 $source[$org->ID] = $org->Name;
             }
             $source['0'] = "-- New One --";
             $ddl = new DropdownField('OrgID', 'Your Organization', $source);
             $ddl->setEmptyString('-- Select Your Organization --');
             $org_field = new FieldGroup();
             $org_field->push($ddl);
             $org_field->push($txt = new TextField('Organization', ''));
             $txt->addExtraClass('new-org-name');
         } else {
             $org_field = new TextField('Organization', 'Your Organization Name', $current_user->getOrgName());
         }
     }
     $fields = new FieldList($org_field, new DropdownField('Industry', 'Your Organization’s Primary Industry', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$industry_options, array('' => '-- Please Select One --'), array('Other' => 'Other Industry (please specify)'))), new TextareaField('OtherIndustry', 'Other Industry'), $org_it_activity = new TextareaField('ITActivity', 'Your Organization’s Primary IT Activity'), new LiteralField('Break', '<hr/>'), new LiteralField('Break', '<p>Your Organization’s Primary Location or Headquarters</p>'), $country = new DropdownField('PrimaryCountry', 'Country', CountryCodes::$iso_3166_countryCodes), new TextField('PrimaryState', 'State / Province / Region'), new TextField('PrimaryCity', 'City'), new DropdownField('OrgSize', 'Your Organization Size (All Branches, Locations, Sites)', DeploymentSurveyOptions::$organization_size_options), new CustomCheckboxSetField('OpenStackInvolvement', 'What best describes your Organization’s involvement with OpenStack?<BR>Select All That Apply', ArrayUtils::AlphaSort(DeploymentSurveyOptions::$openstack_involvement_options)));
     $org_it_activity->addExtraClass('hidden');
     $country->setEmptyString('-- Select One --');
     $nextButton = new FormAction('NextStep', '  Next Step  ');
     $actions = new FieldList($nextButton);
     $validator = new RequiredFields();
     Requirements::javascript('surveys/js/deployment_survey_yourorganization_form.js');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 /**
  * @return Form
  */
 public function AddForm()
 {
     $fields = new FieldList(new LiteralField('SelectFieldType', '<p><strong>Please select a field type to add:</strong></p>'), $df = new DropdownField('ClassName', '', $this->getFieldTypes(), null, null));
     $df->setHasEmptyDefault(true);
     if ($schemaID = (int) $this->request->param('ID')) {
         $fields->push(new HiddenField('SchemaID', '', $schemaID));
     }
     $actions = new FieldList(FormAction::create('doAddField', 'Create')->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
     // Add a Cancel link which is a button-like link and link back to one level up.
     $curmbs = $this->Breadcrumbs();
     if ($curmbs && $curmbs->count() >= 2) {
         $one_level_up = $curmbs->offsetGet($curmbs->count() - 2);
         $text = "\n\t\t\t<a class=\"crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all\" href=\"" . $one_level_up->Link . "\">\n\t\t\t\tCancel\n\t\t\t</a>";
         $actions->push(new LiteralField('cancelbutton', $text));
     }
     $form = new Form($this, 'AddForm', $fields, $actions);
     $toplevelController = $this->getToplevelController();
     $form->setTemplate('LeftAndMain_EditForm');
     $form->addExtraClass('cms-content cms-edit-form center ss-tabset stacked');
     $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     //var_dump($this->popupController); die;
     $parents = $this->popupController->Breadcrumbs(false)->items;
     $form->Backlink = array_pop($parents)->Link;
     return $form;
 }
 public function getCMSFields()
 {
     $field = parent::getCMSFields();
     $origin_table = array('DeploymentSurvey' => 'DeploymentSurvey', 'AppDevSurvey' => 'AppDevSurvey');
     if (isset($_REQUEST['entity_survey'])) {
         $origin_table = array('Deployment' => 'Deployment');
     }
     $field->addFieldToTab('Root.Main', $ddl_origin_table = new DropdownField('OriginTable', 'OriginTable', $origin_table));
     $ddl_origin_table->setEmptyString('-- select an origin table --');
     $source = array();
     if ($this->ID > 0) {
         switch ($this->OriginTable) {
             case 'DeploymentSurvey':
                 $source = DeploymentSurveyFields::$fields;
                 break;
             case 'AppDevSurvey':
                 $source = AppDevSurveyFields::$fields;
                 break;
             case 'Deployment':
                 $source = DeploymentFields::$fields;
                 break;
         }
     }
     $field->addFieldToTab('Root.Main', $ddl_origin_field = new DropdownField('OriginField', 'OriginField', $source));
     $ddl_origin_field->setEmptyString('-- select an origin field --');
     Requirements::javascript('survey_builder/js/active_records/old.datamodel.survey.migration.mapping.js');
     return $field;
 }
 function __construct($controller, $name)
 {
     // Define fields //////////////////////////////////////
     $CurrentDeploymentID = Session::get('CurrentDeploymentID');
     $CountryCodes = CountryCodes::$iso_3166_countryCodes;
     $CountryCodes['Worldwide'] = 'Worldwide';
     $CountryCodes['Prefer not to say'] = 'Prefer not to say';
     $CountryCodes['Too many to list'] = 'Too many to list';
     $fields = new FieldList(new HiddenField('DeploymentID', 'DeploymentID', $CurrentDeploymentID), new LiteralField('Break', '<p>Each deployment profile can be marked public if you wish for the basic information on this page to appear on openstack.org. If you select private we will treat all of the profile information as confidential information.</p>'), new OptionSetField('IsPublic', 'Would you like to keep this information confidential or allow the Foundation to share information about this deployment publicly?', array('1' => '<strong>Willing to share:</strong> The information on this page may be shared for this deployment', '0' => '<strong>Confidential:</strong> All details provided should be kept confidential to the OpenStack Foundation'), 0), new LiteralField('Break', '<hr/>'), new TextField('Label', 'Deployment Name<BR><p class="clean_text">Please create a friendly label, like “Production OpenStack Deployment”. This name is for your deployment in our survey tool. If several people at your organization work on one deployment, we would <b>really appreciate</b> you all referring to the same deployment by the same name!</p>'), $ddl_stage = new DropdownField('DeploymentStage', 'In what stage is your OpenStack deployment? (make a new deployment profile for each type of deployment)', DeploymentOptions::$stage_options), new MultiDropdownField('CountriesPhysicalLocation', 'In which country / countries is this OpenStack deployment physically located?', $CountryCodes), new MultiDropdownField('CountriesUsersLocation', 'In which country / countries are the users / customers for this deployment physically located?', $CountryCodes), $ddl_type = new DropdownField('DeploymentType', 'Deployment Type', DeploymentOptions::$deployment_type_options), new CustomCheckboxSetField('ProjectsUsed', 'What projects does this deployment use?<BR>Select All That Apply', DeploymentOptions::$projects_used_options), new CustomCheckboxSetField('CurrentReleases', 'What releases does this deployment currently use?<BR>Select All That Apply', DeploymentOptions::$current_release_options), new LiteralField('Break', 'Describe the workloads and frameworks running in this OpenStack environment.<BR>Select All That Apply'), new LiteralField('Break', '<hr/>'), new CustomCheckboxSetField('ServicesDeploymentsWorkloads', '<b>Services Deployments - workloads designed to be accessible for external users / customers</b>', DeploymentOptions::$services_deployment_workloads_options), $other_service_workload = new TextAreaField('OtherServicesDeploymentsWorkloads', ''), new CustomCheckboxSetField('EnterpriseDeploymentsWorkloads', '<b>Enterprise Deployments - workloads designed to be run internally to support business</b>', DeploymentOptions::$enterprise_deployment_workloads_options), $other_enterprise_workload = new TextAreaField('OtherEnterpriseDeploymentsWorkloads', ''), new CustomCheckboxSetField('HorizontalWorkloadFrameworks', '<b>Horizontal Workload Frameworks</b>', DeploymentOptions::$horizontal_workload_framework_options), $other_horizontal_workload = new TextAreaField('OtherHorizontalWorkloadFrameworks', ''));
     $saveButton = new FormAction('SaveDeployment', 'Next Step');
     $nextButton = new CancelFormAction($controller->Link() . 'Deployments', 'Cancel');
     $other_service_workload->addExtraClass('hidden');
     $other_enterprise_workload->addExtraClass('hidden');
     $other_horizontal_workload->addExtraClass('hidden');
     $ddl_type->setEmptyString('-- Select One --');
     $ddl_stage->setEmptyString('-- Select One --');
     $actions = new FieldList($saveButton, $nextButton);
     // Create Validators
     $validator = null;
     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_deployment_details_form.js');
 }
 public function getCMSFields()
 {
     $conf = SiteConfig::current_site_config();
     $themes = $conf->getAvailableThemes();
     $theme = new DropdownField('Theme', _t('Multisites.THEME', 'Theme'), $themes);
     $theme->setEmptyString(_t('Multisites.DEFAULTTHEME', '(Default theme)'));
     $fields = new FieldList(new TabSet('Root', new Tab('Main', new HeaderField('SiteConfHeader', _t('Multisites.SITECONF', 'Site Configuration')), new TextField('Title', _t('Multisites.TITLE', 'Title')), new TextField('Tagline', _t('Multisites.TAGLINE', 'Tagline/Slogan')), $theme, new HeaderField('SiteURLHeader', _t('Multisites.SITEURL', 'Site URL')), new OptionsetField('Scheme', _t('Multisites.SCHEME', 'Scheme'), array('any' => _t('Multisites.ANY', 'Any'), 'http' => _t('Multisites.HTTP', 'HTTP'), 'https' => _t('Multisites.HTTPS', 'HTTPS (HTTP Secure)'))), new TextField('Host', _t('Multisites.HOST', 'Host')), new MultiValueTextField('HostAliases', _t('Multisites.HOSTALIASES', 'Host Aliases')), new CheckboxField('IsDefault', _t('Multisites.ISDEFAULT', 'Is this the default site?')), new HeaderField('SiteAdvancedHeader', _t('Multisites.SiteAdvancedHeader', 'Advanced Settings')), TextareaField::create('RobotsTxt', _t('Multisites.ROBOTSTXT', 'Robots.txt'))->setDescription(_t('Multisites.ROBOTSTXTUSAGE', '<p>Please consult <a href="http://www.robotstxt.org/robotstxt.html" target="_blank">http://www.robotstxt.org/robotstxt.html</a> for usage of the robots.txt file.</p>')))));
     $devIDs = Config::inst()->get('Multisites', 'developer_identifiers');
     if (is_array($devIDs)) {
         if (!ArrayLib::is_associative($devIDs)) {
             $devIDs = ArrayLib::valuekey($devIDs);
         }
         $fields->addFieldToTab('Root.Main', DropdownField::create('DevID', _t('Multisites.DeveloperIdentifier', 'Developer Identifier'), $devIDs));
     }
     if (Multisites::inst()->assetsSubfolderPerSite()) {
         $fields->addFieldToTab('Root.Main', new TreeDropdownField('FolderID', _t('Multisites.ASSETSFOLDER', 'Assets Folder'), 'Folder'), 'SiteURLHeader');
     }
     if (!Permission::check('SITE_EDIT_CONFIGURATION')) {
         foreach ($fields->dataFields() as $field) {
             $fields->makeFieldReadonly($field);
         }
     }
     $this->extend('updateSiteCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $field = parent::getCMSFields();
     $origin_table = array('DeploymentSurvey' => 'DeploymentSurvey', 'AppDevSurvey' => 'AppDevSurvey');
     if (isset($_REQUEST['entity_survey'])) {
         $origin_table = array('Deployment' => 'Deployment');
     }
     $field->addFieldToTab('Root.Main', $ddl_origin_table = new DropdownField('OriginTable', 'OriginTable', $origin_table));
     $ddl_origin_table->setEmptyString('-- select an origin table --');
     $source = array();
     if ($this->ID > 0) {
         switch ($this->OriginTable) {
             case 'DeploymentSurvey':
                 $source = DeploymentSurveyFields::$fields;
                 break;
             case 'AppDevSurvey':
                 $source = AppDevSurveyFields::$fields;
                 break;
             case 'Deployment':
                 $source = DeploymentFields::$fields;
                 break;
         }
     }
     $field->addFieldToTab('Root.Main', $ddl_origin_field = new DropdownField('OriginField', 'OriginField', $source));
     $ddl_origin_field->setEmptyString('-- select an origin field --');
     return $field;
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $cssFiles = new UploadField('CustomCSSFiles', _t('UserTemplatesExtension.CustomCSSFiles', "Custom CSS Files"));
        $jsFiles = new UploadField('CustomJSFiles', _t('UserTemplatesExtension.CustomJSFiles', "Custom JS Files"));
        $cssFiles->setFolderName(self::$css_folder);
        $jsFiles->setFolderName(self::$js_folder);
        $fields->removeByName('CustomCSSFiles');
        $fields->removeByName('CustomJSFiles');
        $templates = $this->fileBasedTemplates();
        if (count($templates)) {
            $fields->addFieldToTab('Root.Main', $dd = new DropdownField('ContentFile', _t('UserTemplatesExtension.CONTENT_FILE', 'File containing template'), $templates));
            $dd->setRightTitle('If selected, any Content set above will be ignored');
        } else {
            $fields->removeByName('ContentFile');
        }
        $fields->push($strict = CheckboxField::create('StrictActions', _t('UserTemplates.STRICT_ACTIONS', 'Require actions to be explicitly overridden')));
        $text = <<<DOC
   When applied to a page type that has sub-actions, an action template will be used ONLY if the action is listed below, and this main
\t   template will only be used for the 'index' action. If this is not checked, then this template will be used for ALL actions
\t   in the page it is applied to.
DOC;
        $strict->setRightTitle(_t('UserTemplates.STRICT_HELP', $text));
        $templates = DataList::create('UserTemplate')->filter(array('ID:not' => $this->ID));
        if ($templates->count()) {
            $templates = $templates->map();
            $fields->addFieldToTab('Root.Main', $kv = new KeyValueField('ActionTemplates', _t('UserTemplates.ACTION_TEMPLATES', 'Action specific templates'), array(), $templates));
            $kv->setRightTitle(_t('UserTemplates.ACTION_TEMPLATES_HELP', 'Specify an action name and select another user defined template to handle a specific action. Only used for Layout templates'));
        }
        $fields->addFieldToTab('Root.Main', $cssFiles);
        $fields->addFieldToTab('Root.Main', $jsFiles);
        return $fields;
    }
 /**
  * Add subsites-specific fields to the folder editor.
  */
 public function updateCMSFields(FieldList $fields)
 {
     $ctrl = null;
     if (Controller::has_curr()) {
         $ctrl = Controller::curr();
     }
     if (!$ctrl) {
         return;
     }
     // This fixes fields showing up for no reason in the list view (not moved to Details tab)
     if ($ctrl->getAction() !== 'EditForm') {
         return;
     }
     if ($this->owner instanceof Folder) {
         // Allow to move folders from one site to another
         $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
         $values = array();
         $values[0] = _t('FileSubsites.AllSitesDropdownOpt', 'All sites');
         foreach ($sites as $site) {
             $values[$site->ID] = $site->Title;
         }
         ksort($values);
         if ($sites) {
             //Dropdown needed to move folders between subsites
             $dropdown = new DropdownField('SubsiteID', _t('FileSubsites.SubsiteFieldLabel', 'Subsite'), $values);
             $dropdown->addExtraClass('subsites-move-dropdown');
             $fields->push($dropdown);
         }
         // On main site, allow showing this folder in subsite
         if ($this->owner->SubsiteID == 0 && !Subsite::currentSubsiteID()) {
             $fields->push(new CheckboxField('ShowInSubsites', _t('SubsiteFileExtension.ShowInSubsites', 'Show in subsites')));
         }
     }
 }
 /**
  * @return Form
  */
 public function InviteForm()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-metadata/jquery.metadata.js');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery_improvements.js');
     Requirements::javascript('eventmanagement/javascript/EventInvitationField_invite.js');
     if ($times = $this->form->getRecord()->DateTimes()) {
         $times = $times->map('ID', 'Summary');
     } else {
         $times = array();
     }
     // Get past date times attached to the parent calendar, so we can get
     // all registered members from them.
     $past = DataObject::get('RegisterableDateTime', sprintf('"CalendarID" = %d AND "StartDate" < \'%s\'', $this->form->getRecord()->CalendarID, date('Y-m-d')));
     if ($past) {
         $pastTimes = array();
         foreach ($past->groupBy('EventID') as $value) {
             $pastTimes[$value->First()->EventTitle()] = $value->map('ID', 'Summary');
         }
     } else {
         $pastTimes = array();
     }
     $fields = new Tab('Main', new HeaderField('Select A Date/Time To Invite To'), new DropdownField('TimeID', '', $times, null, null, true), new HeaderField('AddPeopleHeader', 'Add People To Invite From'), new SelectionGroup('AddPeople', array('From a member group' => $group = new DropdownField('GroupID', '', DataObject::get('Group')->map(), null, null, true), 'From a past event' => $time = new GroupedDropdownField('PastTimeID', '', $pastTimes, null, null, true))), new HeaderField('EmailsToSendHeader', 'People To Send Invite To'), $emails = new TableField('Emails', 'EventInvitation', array('Name' => 'Name', 'Email' => 'Email Address'), array('Name' => 'TextField', 'Email' => 'TextField')));
     $group->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromgroup')));
     $time->addExtraClass(sprintf("{ link: '%s' }", $this->Link('loadfromtime')));
     $emails->setCustomSourceItems(new DataObjectSet());
     $fields = new FieldSet(new TabSet('Root', $fields));
     $validator = new RequiredFields('TimeID');
     return new Form($this, 'InviteForm', $fields, new FieldSet(new FormAction('doInvite', 'Invite')), $validator);
 }
 public function getCMSFields()
 {
     if ($this->ID == 0) {
         $categorydropdown = TextField::create('CategoryDisclaimer')->setTitle('Category')->setDisabled(true)->setValue('You can assign a category once you have saved the record for the first time.');
     } else {
         $categories = ListCategory::get()->filter("ListPageID", "{$this->ListPageID}")->sort("Category ASC");
         $map = $categories ? $categories->map('ID', 'Category', 'Please Select') : array();
         if ($map) {
             $categorydropdown = new DropdownField('ListCategoryID', 'Category', $map);
             $categorydropdown->setEmptyString("-- Please Select --");
         } else {
             $categorydropdown = new DropdownField('ListCategoryID', 'Category', $map);
             $categorydropdown->setEmptyString("There are no categories created yet");
         }
     }
     $ImageField = UploadField::create('Photo')->setDescription('(Allowed filetypes: jpg, jpeg, png, gif)');
     $ImageField->folderName = 'ListPage';
     $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
     $DocumentField = UploadField::create('Resource')->setTitle('Resource/Document')->setDescription('(Allowed filetypes: pdf, doc, docx, txt, ppt, or pptx)');
     $DocumentField->folderName = "ListPage";
     $DocumentField->getValidator()->allowedExtensions = array('pdf', 'doc', 'docx', 'txt', 'ppt', 'pptx');
     $LinkField = TextField::create('Link')->setTitle('Link URL');
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array($categorydropdown, TextField::create('Title'), OptionSetField::create('LinkType')->setTitle('')->setSource($this->dbObject('LinkType')->enumValues()), TextField::create('Link')->setTitle('Link URL')->displayIf('LinkType')->isEqualTo('Link')->andIf('LinkType')->isNotEqualTo('Resource')->end(), DisplayLogicWrapper::create($DocumentField)->displayIf('LinkType')->isEqualTo('Resource')->andIf('LinkType')->isNotEqualTo('Link')->end(), $ImageField, HTMLEditorField::create('Content')));
     return $fields;
 }