Merge remote-tracking branch 'origin/4.2' into 4.3

This commit is contained in:
Robbie Averill 2017-06-26 18:14:23 +12:00
commit fa5ca24110
5 changed files with 44 additions and 28 deletions

View File

@ -1,4 +1,4 @@
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details # See https://github.com/silverstripe/silverstripe-travis-support for setup details
sudo: false sudo: false
@ -14,9 +14,11 @@ matrix:
env: DB=MYSQL CORE_RELEASE=3 env: DB=MYSQL CORE_RELEASE=3
- php: 5.6 - php: 5.6
env: DB=MYSQL CORE_RELEASE=3.5 SECUREASSETS=1 env: DB=MYSQL CORE_RELEASE=3.5 SECUREASSETS=1
- php: 7.1
env: DB=MYSQL CORE_RELEASE=3.6
before_script: before_script:
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support - git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
- "if [ \"$SECUREASSETS\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi" - "if [ \"$SECUREASSETS\" = \"\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss; fi"
- "if [ \"$SECUREASSETS\" = \"1\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/secureassets; fi" - "if [ \"$SECUREASSETS\" = \"1\" ]; then php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/secureassets; fi"
- cd ~/builds/ss - cd ~/builds/ss

View File

@ -125,7 +125,6 @@ class UserDefinedForm extends Page
$self = $this; $self = $this;
$this->beforeUpdateCMSFields(function ($fields) use ($self) { $this->beforeUpdateCMSFields(function ($fields) use ($self) {
// define tabs // define tabs
$fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration')); $fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration'));
$fields->findOrMakeTab('Root.Recipients', _t('UserDefinedForm.RECIPIENTS', 'Recipients')); $fields->findOrMakeTab('Root.Recipients', _t('UserDefinedForm.RECIPIENTS', 'Recipients'));
@ -167,12 +166,6 @@ class UserDefinedForm extends Page
// view the submissions // view the submissions
$submissions = new GridField(
'Submissions',
_t('UserDefinedForm.SUBMISSIONS', 'Submissions'),
$self->Submissions()->sort('Created', 'DESC')
);
// make sure a numeric not a empty string is checked against this int column for SQL server // make sure a numeric not a empty string is checked against this int column for SQL server
$parentID = (!empty($self->ID)) ? (int) $self->ID : 0; $parentID = (!empty($self->ID)) ? (int) $self->ID : 0;
@ -243,10 +236,20 @@ SQL;
$export->setCsvHasHeader(true); $export->setCsvHasHeader(true);
$export->setExportColumns($columns); $export->setExportColumns($columns);
$submissions->setConfig($config); $submissions = GridField::create(
'Submissions',
_t('UserDefinedForm.SUBMISSIONS', 'Submissions'),
$self->Submissions()->sort('Created', 'DESC'),
$config
);
$fields->addFieldToTab('Root.Submissions', $submissions); $fields->addFieldToTab('Root.Submissions', $submissions);
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', 'Disable Saving Submissions to Server'))); $fields->addFieldToTab(
'Root.FormOptions',
CheckboxField::create(
'DisableSaveSubmissions',
_t('UserDefinedForm.SAVESUBMISSIONS', 'Disable Saving Submissions to Server')
)
);
}); });
$fields = parent::getCMSFields(); $fields = parent::getCMSFields();

View File

@ -1076,7 +1076,7 @@ class EditableFormField extends DataObject
foreach ($this->EffectiveDisplayRules() as $rule) { foreach ($this->EffectiveDisplayRules() as $rule) {
// Get the field which is effected // Get the field which is effected
/** @var EditableFormField $formFieldWatch */ /** @var EditableFormField $formFieldWatch */
$formFieldWatch = EditableFormField::get()->byId($rule->ConditionFieldID); $formFieldWatch = DataObject::get_by_id('EditableFormField', $rule->ConditionFieldID);
// Skip deleted fields // Skip deleted fields
if (! $formFieldWatch) { if (! $formFieldWatch) {
continue; continue;

View File

@ -228,7 +228,10 @@ class UserDefinedForm_EmailRecipient extends DataObject
if (!empty($this->EmailTemplate)) { if (!empty($this->EmailTemplate)) {
$preview = sprintf( $preview = sprintf(
'<p><a href="%s" target="_blank" class="ss-ui-button">%s</a></p><em>%s</em>', '<p><a href="%s" target="_blank" class="ss-ui-button">%s</a></p><em>%s</em>',
"admin/pages/edit/EditForm/field/EmailRecipients/item/{$this->ID}/preview", Controller::join_links(
singleton('CMSPageEditController')->getEditForm()->FormAction(),
"field/EmailRecipients/item/{$this->ID}/preview"
),
_t('UserDefinedForm.PREVIEW_EMAIL', 'Preview email'), _t('UserDefinedForm.PREVIEW_EMAIL', 'Preview email'),
_t('UserDefinedForm.PREVIEW_EMAIL_DESCRIPTION', 'Note: Unsaved changes will not appear in the preview.') _t('UserDefinedForm.PREVIEW_EMAIL_DESCRIPTION', 'Note: Unsaved changes will not appear in the preview.')
); );

View File

@ -20,11 +20,19 @@ class UserFormRecipientItemRequest extends GridFieldDetailForm_ItemRequest
*/ */
public function preview() public function preview()
{ {
return $this->customise(new ArrayData(array( // Enable theme for preview (may be needed for Shortcodes)
Config::nest();
Config::inst()->update('SSViewer', 'theme_enabled', true);
$content = $this->customise(new ArrayData(array(
'Body' => $this->record->getEmailBodyContent(), 'Body' => $this->record->getEmailBodyContent(),
'HideFormData' => $this->record->HideFormData, 'HideFormData' => $this->record->HideFormData,
'Fields' => $this->getPreviewFieldData() 'Fields' => $this->getPreviewFieldData()
)))->renderWith($this->record->EmailTemplate); )))->renderWith($this->record->EmailTemplate);
Config::unnest();
return $content;
} }
/** /**