public function getHTMLFragments($gridField)
 {
     $this->gridField = $gridField;
     Requirements::javascript('summit/javascript/GridFieldBulkAction.js');
     Requirements::css('summit/css/GridFieldBulkAction.css');
     $field = new DropdownField(sprintf('%s[EntityID]', __CLASS__), '', $this->getEntities());
     $field->setEmptyString("-- select --");
     $field->addExtraClass('no-change-track');
     $field->addExtraClass('select-entity');
     $data = new ArrayData(array('Title' => $this->title, 'Link' => Controller::join_links($gridField->Link(), 'assignBulkAction', '{entityID}'), 'ClassField' => $field, 'Colspan' => count($gridField->getColumns()) - 1));
     return array($this->targetFragment => $data->renderWith(__CLASS__));
 }
 function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //point of contact
     $fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name'));
     $fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email'));
     //main info
     $fields->push($title = new TextField('title', 'Title'));
     $fields->push($url = new TextField('url', 'Url'));
     $fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?'));
     $fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type")));
     $ddl_type->setEmptyString("--SELECT A JOB TYPE --");
     $fields->push($description = new HtmlEditorField('description', 'Description'));
     $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
     $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
     $fields->push($company = new CompanyField('company', 'Company'));
     $point_of_contact_name->addExtraClass('job_control');
     $point_of_contact_email->addExtraClass('job_control');
     $title->addExtraClass('job_control');
     $url->addExtraClass('job_control');
     $description->addExtraClass('job_control');
     $instructions->addExtraClass('job_control');
     $expiration_date->addExtraClass('job_control');
     $company->addExtraClass('job_control');
     //location
     $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
     $ddl_locations->addExtraClass('location_type');
     $ddl_locations->addExtraClass('job_control');
     $fields->push($ddl_locations);
     $fields->push($city = new TextField('city', 'City'));
     $fields->push($state = new TextField('state', 'State'));
     $fields->push($country = new CountryDropdownField('country', 'Country'));
     $city->addExtraClass('physical_location');
     $state->addExtraClass('physical_location');
     $country->addExtraClass('physical_location');
     // Guard against automated spam registrations by optionally adding a field
     // that is supposed to stay blank (and is hidden from most humans).
     // The label and field name are intentionally common ("username"),
     // as most spam bots won't resist filling it out. The actual username field
     // on the forum is called "Nickname".
     $fields->push(new TextField('user_name', 'UserName'));
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveJobRegistrationRequest', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]);
     $this->addExtraClass('job-registration-form');
     $this->addExtraClass('input-form');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 public function getHTMLFragments($gridField)
 {
     $this->gridField = $gridField;
     Requirements::javascript('summit/javascript/GridFieldWipeDevicesDataAction.js');
     Requirements::css('summit/css/GridFieldWipeDevicesDataAction.css');
     $actions = array();
     $actions['wipe-all'] = 'Wipe all devices';
     $actions['wipe-user'] = '******';
     $field = new DropdownField(sprintf('%s[ActionID]', __CLASS__), '', $actions);
     $field->setEmptyString("-- select --");
     $field->addExtraClass('no-change-track');
     $field->addExtraClass('select-wipe-action');
     $data = new ArrayData(array('Title' => "Create Wipe Data Device Event", 'Link' => Controller::join_links($gridField->Link(), 'wipeDevicesDataAction', '{ActionID}'), 'LinkAutocomple' => Controller::join_links($gridField->Link(), 'wipeDevicesGetAttendeesAction'), 'ClassField' => $field));
     return array($this->targetFragment => $data->renderWith(__CLASS__));
 }
	function testAddExtraClass() {
		/* DropdownField has an extra class name and is in the HTML the field returns */
		$dropdownField = new DropdownField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'), '', null, '(Select one)');
		$dropdownField->addExtraClass('thisIsMyExtraClassForDropdownField');
		preg_match('/thisIsMyExtraClassForDropdownField/', $dropdownField->Field(), $matches);
		$this->assertTrue($matches[0] == 'thisIsMyExtraClassForDropdownField');
	}
 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;
 }
 /**
  * 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);
 }
Esempio n. 8
0
 function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //main info
     $fields->push($title = new TextField('title', 'Title'));
     $fields->push($url = new TextField('url', 'Url'));
     $fields->push($description = new HtmlEditorField('description', 'Description'));
     $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
     $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
     $fields->push($company = new TextField('company_name', 'Company'));
     $title->addExtraClass('job_control');
     $url->addExtraClass('job_control');
     $description->addExtraClass('job_control');
     $instructions->addExtraClass('job_control');
     $expiration_date->addExtraClass('job_control');
     $company->addExtraClass('job_control');
     //location
     $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
     $ddl_locations->addExtraClass('location_type');
     $ddl_locations->addExtraClass('job_control');
     $fields->push($ddl_locations);
     $fields->push($city = new TextField('city', 'City'));
     $fields->push($state = new TextField('state', 'State'));
     $fields->push($country = new CountryDropdownField('country', 'Country'));
     $city->addExtraClass('physical_location');
     $state->addExtraClass('physical_location');
     $country->addExtraClass('physical_location');
     // Guard against automated spam registrations by optionally adding a field
     // that is supposed to stay blank (and is hidden from most humans).
     // The label and field name are intentionally common ("username"),
     // as most spam bots won't resist filling it out. The actual username field
     // on the forum is called "Nickname".
     $fields->push(new TextField('user_name', 'UserName'));
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveJob', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'company_name', 'instructions', 'description')));
     $this->addExtraClass('job-registration-form');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 /**
  * Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
  *
  * Here are 4 built-in fragments: 'header', 'footer', 'before', and 'after', but components may also specify
  * fragments of their own.
  *
  * To specify a new fragment, specify a new fragment by including the text "$DefineFragment(fragmentname)" in the
  * HTML that you return.  Fragment names should only contain alphanumerics, -, and _.
  *
  * If you attempt to return HTML for a fragment that doesn't exist, an exception will be thrown when the GridField
  * is rendered.
  *
  * @return Array
  */
 public function getHTMLFragments($gridField)
 {
     $forTemplate = new ArrayData(array());
     $forTemplate->Fields = new ArrayList();
     $stageTitle = _t('PublishableGridFieldAction.STAGE', 'Stage');
     $stages = array('Latest' => _t('PublishableGridFieldAction.LATEST_VERSION', 'All'), 'All' => _t('PublishableGridFieldAction.LATEST_VERSION', 'All (Including Deleted)'), 'Live' => _t('PublishableGridFieldAction.STAGE_LIVE', 'Published'), 'Stage' => _t('PublishableGridFieldAction.STAGE_STAGE', 'Draft'));
     $currentStage = $gridField->State->PublishableGridField->currentStage;
     $stageDropdownField = new DropdownField('PublishableStage', $stageTitle, $stages, $currentStage);
     $stageDropdownField->addExtraClass('no-change-track');
     $forTemplate->Fields->push($stageDropdownField);
     return array($this->targetFragment => $forTemplate->renderWith($this->itemClass));
 }
Esempio n. 10
0
 function RegistrationForm()
 {
     // Name Set
     $FirstNameField = new TextField('FirstName', "First Name");
     $LastNameField = new TextField('Surname', "Last Name");
     // Email Addresses
     $PrimaryEmailField = new TextField('Email', "Primary Email Address");
     // New Gender Field
     $GenderField = new OptionSetField('Gender', 'I identify my gender as:', array('Male' => 'Male', 'Female' => 'Female', 'Specify' => 'Let me specify', 'Prefer not to say' => 'Prefer not to say'));
     $GenderSpecifyField = new TextField('GenderSpecify', 'Specify your gender');
     $GenderSpecifyField->addExtraClass('hide');
     $StatementOfInterestField = new TextField('StatementOfInterest', 'Statement of Interest');
     $StatementOfInterestField->addExtraClass('autocompleteoff');
     $affiliations = new AffiliationField('Affiliations', 'Affiliations');
     $affiliations->setMode('local');
     $fields = new FieldList($FirstNameField, $LastNameField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('instructions', '<p>This will also be your login name.</p>'), new LiteralField('break', '<hr/>'), $GenderField, $GenderSpecifyField, new LiteralField('instructions', '<p>It\'s perfectly acceptable if you choose not to tell us: we appreciate you becoming a member of OpenStack Foundation. The information will remain private and only used to monitor our effort to improve gender diversity in our community.</p>'), new LiteralField('break', '<hr/>'), $affiliations, $StatementOfInterestField, new LiteralField('instructions', '<p>Your statement of interest should be a few words describing your objectives or plans for OpenStack.</p>'), new LiteralField('break', '<hr/>'), new TextField('Address', _t('Addressable.ADDRESS', 'Street Address (Line1)')), new TextField('Suburb', _t('Addressable.SUBURB', 'Street Address (Line2)')), new TextField('City', _t('Addressable.CITY', 'City')));
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields->push(new DropdownField('State', $label, $this->allowedStates));
     } elseif (!is_string($this->allowedStates)) {
         $fields->push(new TextField('State', $label));
     }
     $AdressField = new TextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $fields->push($AdressField);
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $countryField = new DropdownField('Country', $label, $this->allowedCountries);
         $countryField->addExtraClass('chzn-select');
         $countryField->setEmptyString('-- Select One --');
         $fields->push($countryField);
     } elseif (!is_string($this->allowedCountries)) {
         $countryField = new CountryDropdownField('Country', $label);
         $countryField->setEmptyString('-- Select One --');
         $countryField->addExtraClass('chzn-select');
         $fields->push($countryField);
     }
     $fields->push(new LiteralField('break', '<hr/>'));
     $fields->push(new ConfirmedPasswordField('Password', 'Password'));
     $fields->push(new HiddenField('MembershipType', 'MembershipType', 'foundation'));
     $actions = new FieldList(new FormAction('doRegister', 'Submit My Application'));
     $validator = new Member_Validator('FirstName', 'Surname', 'Email', 'StatementOfInterest', 'Address', 'City', 'Country', 'Password');
     $form = new HoneyPotForm($this, 'RegistrationForm', $fields, $actions, $validator);
     if ($data = Session::get("FormInfo.{$form->FormName()}.data")) {
         if (isset($data['HiddenAffiliations'])) {
             $affiliations->setValue($data['HiddenAffiliations']);
         }
         return $form->loadDataFrom($data);
     }
     return $form;
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('ProcessInfo');
        $fields->removeByName('StopStageID');
        $fields->removeByName('StopButton');
        $fields->removeByName('ContinueButton');
        $fields->removeByName('DecisionPoint');
        $fields->removeByName('CaseFinal');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">3</span><span class="arrow"></span>
				<span class="title">Stage Settings</span>
			</span>
		</h3>'), 'Title');
        $caseFinalMap = ProcessCase::get()->filter(array('ParentProcessID' => $this->ParentID))->map("ID", "Title")->toArray();
        asort($caseFinalMap);
        $case = ListboxField::create('CaseFinal', 'Final step for these Cases')->setMultiple(true)->setSource($caseFinalMap)->setAttribute('data-placeholder', _t('ProcessAdmin.Cases', 'Cases', 'Placeholder text for a dropdown'));
        $fields->insertAfter($case, 'Title');
        $fields->insertAfter($group = new CompositeField($label = new LabelField('switchLabel', 'Act as Decision Point'), new CheckboxField('DecisionPoint', '')), 'ParentID');
        $group->addExtraClass("field special process-noborder");
        $label->addExtraClass("left");
        $fields->dataFieldByName('Content')->setRows(10);
        if ($this->ID > 0) {
            $fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p></p>'));
            $fields->addFieldToTab('Root.Main', $processInfo = new CompositeField($grid = new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo()->sort(array('TypeID' => 'ASC', 'ProcessCaseID' => 'ASC', 'LinksToAnotherStageID' => 'ASC')), $gridConfig = GridFieldConfig_RelationEditor::create())));
            $gridConfig->addComponent(new GridFieldSortableRows('Order'));
            $processInfo->addExtraClass('process-spacing');
            $grid->addExtraClass('toggle-grid');
        } else {
            $fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p class="message info">Save this stage to add info</p>'));
        }
        $fields->insertBefore(new LiteralField('StageTitleInfo', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">4</span><span class="arrow"></span>
					<span class="title">Information</span>
				</span>
			</h3>'), 'SaveRecord');
        $stopStage = ProcessStopStage::get();
        if ($stopStage) {
            $fields->insertBefore($inner = new CompositeField(new LiteralField('Decision', '<h3>Decision Point</h3>'), new LiteralField('ExplainStop', '<label class="right">Choose a stop stage if you would like this stage to act as a decision point</label>'), $stop = new DropdownField('StopStageID', 'Stop Stage', $stopStage->map('ID', 'Title')), $continue = new TextField('ContinueButton', 'Button: Continue (e.g. "Yes")'), new TextField('StopButton', 'Button: Stop (e.g. "No")')), 'ProcessInfo');
            $stop->setEmptyString('No stop after this stage');
            $inner->addExtraClass('message special toggle-decide');
            $continue->addExtraClass('process-noborder');
            $stop->addExtraClass('process-noborder');
        }
        return $fields;
    }
 public function updateDateTimeCMSFields($fields)
 {
     if (!($locations = DataObject::get('EventLocation'))) {
         return;
     }
     $capacities = array();
     foreach ($locations as $location) {
         if ($location->Capacity) {
             $capacities[$location->ID] = (int) $location->Capacity;
         }
     }
     $dropdown = new DropdownField('LocationID', _t('EventLocations.LOCATION', 'Location'), $locations->map('ID', 'Title'), null, null, true);
     $dropdown->addExtraClass('{ capacities: ' . Convert::array2json($capacities) . ' }');
     $fields->addFieldToTab('Root.Main', $dropdown, 'StartDate');
 }
 public function getHTMLFragments($grid)
 {
     $classes = $this->getClasses($grid);
     if (!count($classes)) {
         return array();
     }
     GridFieldExtensions::include_requirements();
     $field = new DropdownField(sprintf('%s[ClassName]', __CLASS__), '', $classes, $this->defaultClass);
     $field->setAttribute('id', uniqid());
     if (Config::inst()->get('GridFieldAddNewMultiClass', 'showEmptyString')) {
         $field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
     }
     $field->addExtraClass('no-change-track');
     $data = new ArrayData(array('Title' => $this->getTitle(), 'Link' => Controller::join_links($grid->Link(), 'add-multi-class', '{class}'), 'ClassField' => $field));
     return array($this->getFragment() => $data->renderWith('GridFieldAddNewMultiClass'));
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Features", $grid = GridField::create("Features", "Features", $this->owner->Features(), GridFieldConfig_RecordEditor::create()));
     $grid->getConfig()->removeComponentsByType('GridFieldDataColumns')->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewInlineButton())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldOrderableRows());
     $grid->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('FeatureID' => function ($record, $column, $grid) {
         $dropdown = new DropdownField($column, 'Feature', Feature::get()->map('ID', 'Title')->toArray());
         $dropdown->addExtraClass('on_feature_select_fetch_value_field');
         return $dropdown;
     }, 'Value' => function ($record, $column, $grid) {
         if ($record->FeatureID) {
             $field = $record->Feature()->getValueField();
             $field->setName($column);
             return $field;
         }
         return new HiddenField($column);
     }));
 }
 /**
  * Add subsites-specific fields to the folder editor.
  */
 function updateCMSFields(FieldList $fields)
 {
     if ($this->owner instanceof Folder) {
         $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);
             $fields->push(new LiteralField('Message', '<p class="message notice">' . _t('ASSETADMIN.SUBSITENOTICE', 'Folders and files created in the main site are accessible by all subsites.') . '</p>'));
         }
     }
 }
 public function getHTMLFragments($grid)
 {
     $addable = $this->getAddableSections($grid);
     $base = $grid->Link('addsection');
     $links = array();
     if (!$addable) {
         return array();
     }
     foreach ($addable as $class => $title) {
         $links[Controller::join_links($base, $class)] = $title;
     }
     Requirements::javascript('memberprofiles/javascript/MemberProfilesAddSection.js');
     Requirements::css('memberprofiles/css/MemberProfilesAddSection.css');
     $select = new DropdownField("{$grid->getName()}[SectionClass]", '', $links);
     $select->setEmptyString(_t('MemberProfiles.SECTIONTYPE', '(Section type)'));
     $select->addExtraClass('no-change-track');
     $data = new ArrayData(array('Title' => _t('MemberProfiles.ADDSECTION', 'Add Section'), 'Select' => $select));
     return array('buttons-before-left' => $data->renderWith('MemberProfilesAddSectionButton'));
 }
    public function updateCMSFields(FieldList $fields)
    {
        Requirements::javascript('marketplace/code/ui/admin/js/openstack.release.supported.api.version.admin.ui.js');
        $fields->removeByName('ApiVersionID');
        $versions = OpenStackApiVersion::get()->map('ID', 'Version');
        $ddl = new DropdownField('ApiVersionID', 'API Version', $versions);
        $ddl->addExtraClass('ddl-api-version-id');
        $ddl->setEmptyString('--Select An API Version --');
        $fields->insertAfter($ddl, 'OpenStackComponentID');
        $versions = array();
        foreach (OpenStackComponent::get()->filter('SupportsVersioning', true) as $component) {
            foreach ($component->getVersions() as $version) {
                if (!array_key_exists(intval($component->getIdentifier()), $versions)) {
                    $versions[intval($component->getIdentifier())] = array();
                }
                array_push($versions[intval($component->getIdentifier())], array('value' => intval($version->getIdentifier()), 'text' => $version->getVersion()));
            }
        }
        $json_data = json_encode($versions);
        $script = <<<JS
\t\t<script>
\t\tvar versions = {$json_data};
\t\t</script>
JS;
        $fields->add(new LiteralField('js_data', $script));
        $fields->removeByName('OpenStackComponentID');
        //kludge; get parent id from url....
        $url = preg_split('/\\//', $_REQUEST['url']);
        $release_id = (int) $url[8];
        //components
        $components = OpenStackComponent::get()->filter('SupportsVersioning', true)->innerJoin('OpenStackRelease_OpenStackComponents', "OpenStackRelease_OpenStackComponents.OpenStackComponentID = OpenStackComponent.ID AND OpenStackReleaseID = {$release_id} ");
        $components_source = array();
        foreach ($components as $comp) {
            $components_source[$comp->ID] = sprintf('%s (%s)', $comp->Name, $comp->CodeName);
        }
        $ddl = new DropdownField('OpenStackComponentID', 'OpenStack Component', $components_source);
        $ddl->setEmptyString('--Select A OS Component--');
        $ddl->addExtraClass('ddl-os-component-id');
        $fields->insertBefore($ddl, 'ApiVersionID');
        $fields->insertAfter(new TextField("ReleaseVersion", "Release Version"), 'ReleaseID');
        $fields->insertAfter(new LiteralField('ReleaseVersionTitle', '<p>You could get this data from <a href="http://docs.openstack.org/releases" target="_blank">http://docs.openstack.org/releases</a></p>'), 'ReleaseVersion');
        return $fields;
    }
Esempio n. 18
0
 function RegistrationForm()
 {
     // Name Set
     $FirstNameField = new TextField('FirstName', "First Name");
     $LastNameField = new TextField('Surname', "Last Name");
     // Email Addresses
     $PrimaryEmailField = new TextField('Email', "Primary Email Address");
     // New Gender Field
     $GenderField = new OptionSetField('Gender', 'I identify my gender as:', array('Male' => 'Male', 'Female' => 'Female', 'Specify' => 'Let me specify', 'Prefer not to say' => 'Prefer not to say'));
     $GenderSpecifyField = new TextField('GenderSpecify', 'Specify your gender');
     $GenderSpecifyField->addExtraClass('hide');
     $StatementOfInterestField = new TextField('StatementOfInterest', 'Statement of Interest');
     $StatementOfInterestField->addExtraClass('autocompleteoff');
     $affiliations = new FieldGroup(new HeaderField('Affiliations'), new LiteralField("add-affiliation", "<a class='roundedButton' id='add-affiliation' title='Add New Affiliation' href='#'>Add New Affiliation</a>"), new LiteralField("affiliations-container", "<div id='affiliations-container'></div>"));
     $fields = new FieldList($FirstNameField, $LastNameField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('instructions', '<p>This will also be your login name.</p>'), new LiteralField('break', '<hr/>'), $GenderField, $GenderSpecifyField, new LiteralField('instructions', '<p>It\'s perfectly acceptable if you choose not to tell us: we appreciate you becoming a member of OpenStack Foundation. The information will remain private and only used to monitor our effort to improve gender diversity in our community.</p>'), new LiteralField('break', '<hr/>'), $affiliations, new HiddenField("Affiliations", "Affiliations", ""), new LiteralField('instructions', '<p>For our purposes, an affiliation is defined as any company where you are an officer, director or employee, or any person or company that has paid you more than $60,000 USD as an independent contractor in the last 12 months. Please list all affiliations which meet this criteria. If you\'re not being paid to work on OpenStack please put "Unaffiliated".</p>'), $StatementOfInterestField, new LiteralField('instructions', '<p>Your statement of interest should be a few words describing your objectives or plans for OpenStack.</p>'), new LiteralField('break', '<hr/>'), new TextField('Address', _t('Addressable.ADDRESS', 'Street Address (Line1)')), new TextField('Suburb', _t('Addressable.SUBURB', 'Street Address (Line2)')), new TextField('City', _t('Addressable.CITY', 'City')));
     $label = _t('Addressable.STATE', 'State');
     if (is_array($this->allowedStates)) {
         $fields->push(new DropdownField('State', $label, $this->allowedStates));
     } elseif (!is_string($this->allowedStates)) {
         $fields->push(new TextField('State', $label));
     }
     $AdressField = new TextField('Postcode', _t('Addressable.POSTCODE', 'Postcode'));
     $fields->push($AdressField);
     $label = _t('Addressable.COUNTRY', 'Country');
     if (is_array($this->allowedCountries)) {
         $countryField = new DropdownField('Country', $label, $this->allowedCountries);
         $countryField->addExtraClass('chzn-select');
         $countryField->setEmptyString('-- Select One --');
         $fields->push($countryField);
     } elseif (!is_string($this->allowedCountries)) {
         $countryField = new CountryDropdownField('Country', $label);
         $countryField->setEmptyString('-- Select One --');
         $countryField->addExtraClass('chzn-select');
         $fields->push($countryField);
     }
     $fields->push(new LiteralField('break', '<hr/>'));
     $fields->push(new ConfirmedPasswordField('Password', 'Password'));
     $fields->push(new HiddenField('MembershipType', 'MembershipType', 'foundation'));
     $actions = new FieldList(new FormAction('doRegister', 'Submit My Application'));
     $validator = new Member_Validator('FirstName', 'Surname', 'Email', 'StatementOfInterest', 'Address', 'City', 'Country', 'Password');
     return new HoneyPotForm($this, 'RegistrationForm', $fields, $actions, $validator);
 }
 /**
  * Aggiorna l'elenco delle possibili opzioni di link
  * @param Form $form
  * @return type
  */
 public function updateLinkForm($form)
 {
     Requirements::javascript(LINKABLE_DATAOBJECTS_DIR . "/javascript/linkable-dataobjects.js");
     $fields = $form->Fields();
     /* @var $linkTipe CompositeField */
     $compositeField = $fields[1];
     /* @var $linkTipe OptionsetField */
     $linkTipe = $fields[1]->fieldByName("LinkType");
     $options = $linkTipe->getSource();
     $linkables = ClassInfo::implementorsOf('Linkable');
     foreach ($linkables as $class) {
         $identifier = str_replace('\\', '-', strtolower($class));
         $options[$identifier] = $class::LinkLabel();
         $linkTipe->setSource($options);
         $dropdown = new DropdownField($identifier, _t('HtmlEditorField.NEWS', $class::LinkLabel()), $class::get()->map('ID', 'Title'));
         $dropdown->addExtraClass('linkabledo');
         $compositeField->insertBefore($dropdown, 'Description');
     }
     return $form;
 }
 public function __construct(ISingleValueTemplateQuestion $question, $value = null)
 {
     $children = new FieldList();
     $this->question = $question;
     $current_user = Member::currentUser();
     $current_affiliations = $current_user->getCurrentAffiliations();
     if (!$current_affiliations) {
         $children->add($txt = new TextField($question->name(), $question->label()));
         $txt->addExtraClass('input-organization-name');
     } else {
         if (intval($current_affiliations->count()) > 1) {
             $source = array();
             foreach ($current_affiliations as $a) {
                 $org = $a->Organization();
                 $source[$org->ID] = $org->Name;
             }
             $source['0'] = "-- New One --";
             $children->add($ddl = new DropdownField($question->name() . 'ID', $question->label(), $source));
             $ddl->setEmptyString('-- Select Your Organization --');
             $ddl->addExtraClass('select-organization-name');
             if (!is_null($value)) {
                 $org = Org::get()->filter('Name', $value)->first();
                 if ($org) {
                     $ddl->setValue($org->ID);
                 }
             }
             $children->add($txt = new TextField($question->name(), ''));
             $txt->addExtraClass('input-organization-name');
         } else {
             $children->add($txt = new TextField($question->name(), $question->label(), $current_user->getOrgName()));
             $txt->addExtraClass('input-organization-name');
         }
     }
     parent::__construct($children);
     $control_css_class = strtolower($this->question->name() . '-composite');
     $this->addExtraClass($control_css_class);
     Requirements::javascript('survey_builder/js/survey.organization.field.js');
     Requirements::customScript("\n        jQuery(document).ready(function(\$) {\n            \$('.'+'{$control_css_class}').survey_organization_field();\n        });");
 }
 /**
  * @todo This should be generated by JavaScript, but we don't have the date libraries'
  */
 function Field($properties = array())
 {
     $this->addExtraClass('timedropdownfield');
     $html = parent::Field($properties);
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript('framework/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript('timedropdownfield/javascript/TimeDropdownField.js');
     Requirements::css('timedropdownfield/css/TimeDropdownField.css');
     $iteratedTime = new Zend_Date('00:00:00', 'h:mm:ss');
     $options = array();
     $count = 24 * (60 / $this->config['interval']);
     for ($i = 0; $i < $count; $i++) {
         $key = $iteratedTime->toString($this->getConfig('datavalueformat'));
         $options[$key] = $iteratedTime->toString($this->getConfig('timeformat'));
         $iteratedTime->add($this->config['interval'], Zend_Date::MINUTE);
     }
     $dropdownField = new DropdownField('dropdown_' . $this->getName(), false, $options, $this->Value());
     $dropdownField->addExtraClass('presets');
     $dropdownField->setHasEmptyDefault(true);
     $dropdownField->setForm($this->getForm());
     $html .= $dropdownField->Field();
     $html .= '<a href="#" class="presets-trigger"></a>';
     return $html;
 }
Esempio n. 22
0
 public function __construct($name, $title, $value = null)
 {
     $this->name = $name;
     $this->title = $title;
     $children = new FieldList();
     $source = Company::get()->sort('Name')->map('ID', 'Name')->toArray();
     $source['0'] = "-- New Company --";
     $children->add($ddl = new DropdownField($name . '_id', $title, $source));
     $ddl->setEmptyString('-- Select Your Company --');
     $ddl->addExtraClass('select-company-name');
     if (!is_null($value)) {
         $c = Company::get()->filter('Name', $value)->first();
         if ($c) {
             $ddl->setValue($c->ID);
         }
     }
     $children->add($txt = new TextField($name, ''));
     $txt->addExtraClass('input-company-name');
     parent::__construct($children);
     $control_css_class = strtolower('company-composite');
     $this->addExtraClass($control_css_class);
     Requirements::javascript('openstack/code/utils/CustomHTMLFields/js/company.field.js');
     Requirements::customScript("\n        jQuery(document).ready(function(\$) {\n            \$('.'+'{$control_css_class}').company_field();\n        });");
 }
 public function ArchiveUnitDropdown()
 {
     $months = array();
     $months['1'] = _t('filterablearchive.JANUARY', 'Januari');
     $months['2'] = _t('filterablearchive.FEBRUARY', 'Februari');
     $months['3'] = _t('filterablearchive.MARCH', 'Maart');
     $months['4'] = _t('filterablearchive.APRIL', 'April');
     $months['5'] = _t('filterablearchive.MAY', 'Mei');
     $months['6'] = _t('filterablearchive.JUNE', 'Juni');
     $months['7'] = _t('filterablearchive.JULY', 'Juli');
     $months['8'] = _t('filterablearchive.AUGUST', 'Augustus');
     $months['9'] = _t('filterablearchive.SEPTEMBER', 'September');
     $months['10'] = _t('filterablearchive.OCTOBER', 'Oktober');
     $months['11'] = _t('filterablearchive.NOVEMBER', 'November');
     $months['12'] = _t('filterablearchive.DECEMBER', 'December');
     // build array with available archive 'units'
     $items = $this->owner->getItems();
     //$dateField = $this->owner->getFilterableArchiveConfigValue('managed_object_date_field');
     $dateField = Config::inst()->get($this->owner->className, 'managed_object_date_field');
     $itemArr = array();
     foreach ($items as $item) {
         if (!$item->{$dateField}) {
             continue;
         }
         $dateObj = DBField::create_field('Date', strtotime($item->{$dateField}));
         // add month if not yet in array;
         if ($this->owner->ArchiveUnit == 'day') {
             $arrkey = $dateObj->Format('Y/m/d/');
             $arrval = $dateObj->Format('d ') . $months[$dateObj->Format('n')] . $dateObj->Format(' Y');
         } elseif ($this->owner->ArchiveUnit == 'month') {
             $arrkey = $dateObj->Format('Y/m/');
             $arrval = $months[$dateObj->Format('n')] . $dateObj->Format(' Y');
         } else {
             $arrkey = $dateObj->Format('Y/');
             $arrval = $dateObj->Format('Y');
         }
         if (!array_key_exists($arrkey, $itemArr)) {
             $itemArr[$arrkey] = $arrval;
         }
     }
     $DrDown = new DropdownField('archiveunits', '', $itemArr);
     $DrDown->setEmptyString(_t('filterablearchive.FILTER', 'Filter items'));
     $DrDown->addExtraClass("dropdown form-control");
     // specific to the 'archive' action defined by FilterableArchiveHolder_ControllerExtension (if available)
     $ctrl = Controller::curr();
     $activeUnit = "";
     if ($ctrl::has_extension("FilterableArchiveHolder_ControllerExtension")) {
         if ($cYear = $ctrl->getArchiveYear()) {
             $activeUnit .= "{$cYear}/";
         }
         if ($cMonth = $ctrl->getArchiveMonth()) {
             $activeUnit .= str_pad("{$cMonth}/", 3, "0", STR_PAD_LEFT);
         }
         if ($cDay = $ctrl->getArchiveDay()) {
             $activeUnit .= str_pad("{$cDay}/", 3, "0", STR_PAD_LEFT);
         }
     }
     $DrDown->setValue($activeUnit);
     // again, tie this to the 'archive' action;
     $DrDown->setAttribute('onchange', "location = '{$this->owner->AbsoluteLink()}date/'+this.value;");
     return $DrDown;
 }
Esempio n. 24
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;
 }
Esempio n. 25
0
 /**
  * Creates a dropdown for selection of folders for choosing an existing file
  *
  * @return DropdownField
  */
 public function ImportDropdown()
 {
     $UploadFolder = $this->getUploadFolder();
     $id = $UploadFolder != "Uploads" ? Folder::findOrMake($UploadFolder)->ID : null;
     $class = class_exists("SimpleTreeDropdownField") ? "SimpleTreeDropdownField" : "DropdownField";
     $d = new $class("ImportFolderID_{$this->id()}", _t('Uploadify.CHOOSEIMPORTFOLDER', 'Choose a folder'), "Folder", $id, "Filename");
     if (class_exists("SimpleTreeDropdownField")) {
         $d = new SimpleTreeDropdownField("ImportFolderID_{$this->id()}", _t('Uploadify.CHOOSEIMPORTFOLDER', 'Choose a folder'), "Folder", $id, "Filename");
     } else {
         $folders = DataObject::get("Folder");
         $d = new DropdownField("ImportFolderID_{$this->id()}", _t('Uploadify.CHOOSEIMPORTFOLDER', 'Choose a folder'), $folders->toDropDownMap("ID", "Title"));
     }
     $d->setEmptyString('-- ' . _t('Uploadify.PLEASESELECT', 'Select a folder') . ' --');
     $d->addExtraClass("{'url' : '" . $this->Link('importlist') . "' }");
     return $d;
 }
Esempio n. 26
0
 /**
  * @return FieldList
  */
 protected function getFieldsForImage($url, $file)
 {
     if ($file->File instanceof Image) {
         $formattedImage = $file->File->generateFormattedImage('SetWidth', Image::$asset_preview_width);
         $thumbnailURL = $formattedImage ? $formattedImage->URL : $url;
     } else {
         $thumbnailURL = $url;
     }
     $previewField = new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' src='{$thumbnailURL}?r=" . rand(1, 100000) . "' alt='{$file->Name}' />\n");
     if ($file->Width != null) {
         $dimensionsField = new FieldGroup(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), $widthField = new TextField('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), $file->Width), $heightField = new TextField('Height', " x " . _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), $file->Height));
     }
     $fields = new FieldList($filePreview = CompositeField::create(CompositeField::create($previewField)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':', $file->FileType), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'File size') . ':', $file->getSize()), $urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank" class="file-url">%s</a>', $file->Link(), $file->RelativeLink())), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded') . ':', $file->Created), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed') . ':', $file->LastEdited)))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info'), TextField::create('AltText', _t('HtmlEditorField.IMAGEALT', 'Alternative text (alt)'), $file->Title, 80)->setDescription(_t('HtmlEditorField.IMAGEALTTEXTDESC', 'Shown to screen readers or if image can not be displayed')), TextField::create('Title', _t('HtmlEditorField.IMAGETITLETEXT', 'Title text (tooltip)'))->setDescription(_t('HtmlEditorField.IMAGETITLETEXTDESC', 'For additional information about the image')), new TextField('CaptionText', _t('HtmlEditorField.CAPTIONTEXT', 'Caption text')), $alignment = new DropdownField('CSSClass', _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), array('left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'))), $dimensionsField);
     $urlField->dontEscape = true;
     if ($dimensionsField) {
         $dimensionsField->addExtraClass('dimensions last');
         $widthField->setMaxLength(5);
         $heightField->setMaxLength(5);
     } else {
         $alignment->addExtraClass('last');
     }
     $this->extend('updateFieldsForImage', $fields, $url, $file);
     return $fields;
 }
 /**
  * Adds the form fields for the batch actions
  * 
  * @param GridField $gridField GridField to get HTML fragments for
  * 
  * @return array
  */
 public function getHTMLFragments($gridField)
 {
     Requirements::css('silvercart/admin/css/SilvercartGridFieldBatchController.css');
     Requirements::javascript('silvercart/admin/javascript/SilvercartGridFieldBatchController.js');
     $source = array('' => 'Bitte wählen');
     $targetBatchActionObjects = $this->getTargetBatchActionObjects();
     foreach ($targetBatchActionObjects as $targetBatchAction => $targetBatchActionObject) {
         $source[$targetBatchAction] = $targetBatchActionObject->getTitle();
         $targetBatchActionObject->RequireJavascript();
     }
     $dropdown = new DropdownField($this->getDropdownName(), $this->getDropdownName(), $source);
     $dropdown->addExtraClass('grid-batch-action-selector');
     $button = new GridField_FormAction($gridField, 'execute_batch_action', _t('Silvercart.EXECUTE', 'Execute'), 'handleBatchAction', null);
     $button->setAttribute('data-icon', 'navigation');
     $button->addExtraClass('gridfield-button-batch');
     return array($this->targetFragment => '<div class="grid-batch-action-button"><div class="field dropdown plain">' . $dropdown->Field() . '</div><div class="grid-batch-action-callback-target"></div>' . $button->Field() . '</div>');
 }
 public function getHTMLFragments($gridField)
 {
     $fields = new ArrayList();
     $state = $gridField->State->UserFormsGridField;
     $selectedField = $state->filter;
     $selectedValue = $state->value;
     // show dropdown of all the fields available from the submitted form fields
     // that have been saved. Takes the titles from the currently live form.
     $columnField = new DropdownField('FieldNameFilter', '');
     $columnField->setSource($this->columns);
     $columnField->setEmptyString(_t('UserFormsGridFieldFilterHeader.FILTERSUBMISSIONS', 'Filter Submissions..'));
     $columnField->setHasEmptyDefault(true);
     $columnField->setValue($selectedField);
     $valueField = new TextField('FieldValue', '', $selectedValue);
     $columnField->addExtraClass('ss-gridfield-sort');
     $columnField->addExtraClass('no-change-track');
     $valueField->addExtraClass('ss-gridfield-sort');
     $valueField->addExtraClass('no-change-track');
     $valueField->setAttribute('placeholder', _t('UserFormsGridFieldFilterHeader.WHEREVALUEIS', 'where value is..'));
     $fields->push(new FieldGroup(new CompositeField($columnField, $valueField)));
     $fields->push(new FieldGroup(new CompositeField($start = new DateField('StartFilter', 'From'), $end = new DateField('EndFilter', 'Till'))));
     foreach (array($start, $end) as $date) {
         $date->setConfig('showcalendar', true);
         $date->setConfig('dateformat', 'y-mm-dd');
         $date->setConfig('datavalueformat', 'y-mm-dd');
         $date->addExtraClass('no-change-track');
     }
     $end->setValue($state->end);
     $start->setValue($state->start);
     $fields->push($actions = new FieldGroup(GridField_FormAction::create($gridField, 'filter', false, 'filter', null)->addExtraClass('ss-gridfield-button-filter')->setAttribute('title', _t('GridField.Filter', "Filter"))->setAttribute('id', 'action_filter_' . $gridField->getModelClass() . '_' . $columnField), GridField_FormAction::create($gridField, 'reset', false, 'reset', null)->addExtraClass('ss-gridfield-button-close')->setAttribute('title', _t('GridField.ResetFilter', "Reset"))->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField)));
     $actions->addExtraClass('filter-buttons');
     $actions->addExtraClass('no-change-track');
     $forTemplate = new ArrayData(array('Fields' => $fields));
     return array('header' => $forTemplate->renderWith('GridFieldFilterHeader_Row'));
 }