mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge branch '4.4' into 4.5
This commit is contained in:
commit
d953603bed
@ -4,6 +4,8 @@ sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
dist: precise
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.3
|
||||
|
@ -45,10 +45,14 @@ class EditableFileField extends EditableFormField
|
||||
)
|
||||
);
|
||||
|
||||
$fields->addFieldToTab("Root.Main", new LiteralField("FileUploadWarning",
|
||||
"<p class=\"message notice\">" . _t("UserDefinedForm.FileUploadWarning",
|
||||
"Files uploaded through this field could be publicly accessible if the exact URL is known")
|
||||
. "</p>"), "Type");
|
||||
$fields->addFieldToTab("Root.Main", new LiteralField(
|
||||
"FileUploadWarning",
|
||||
"<p class=\"message notice\">"
|
||||
. _t(
|
||||
"UserDefinedForm.FileUploadWarning",
|
||||
"Files uploaded through this field could be publicly accessible if the exact URL is known"
|
||||
) . "</p>"
|
||||
), "Type");
|
||||
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
@ -57,6 +61,8 @@ class EditableFileField extends EditableFormField
|
||||
->setDescription("Note: Maximum php allowed size is {$this->getPHPMaxFileSizeMB()} MB")
|
||||
);
|
||||
|
||||
$fields->removeByName('Default');
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
@ -261,10 +261,7 @@ class UserDefinedForm_EmailRecipient extends DataObject
|
||||
->addExtraClass('toggle-html-only'),
|
||||
TextareaField::create('EmailBody', _t('UserDefinedForm.EMAILBODY', 'Body'))
|
||||
->addExtraClass('toggle-plain-only'),
|
||||
LiteralField::create(
|
||||
'EmailPreview',
|
||||
'<div id="EmailPreview" class="field toggle-html-only">' . $preview . '</div>'
|
||||
)
|
||||
LiteralField::create('EmailPreview', $preview)
|
||||
));
|
||||
|
||||
$fields->fieldByName('Root.EmailContent')->setTitle(_t('UserDefinedForm_EmailRecipient.EMAILCONTENTTAB', 'Email Content'));
|
||||
@ -421,7 +418,10 @@ class UserDefinedForm_EmailRecipient extends DataObject
|
||||
*/
|
||||
public function getEmailBodyContent()
|
||||
{
|
||||
return $this->SendPlain ? $this->EmailBody : $this->EmailBodyHtml;
|
||||
if ($this->SendPlain) {
|
||||
return DBField::create_field('HTMLText', $this->EmailBody)->NoHTML();
|
||||
}
|
||||
return DBField::create_field('HTMLText', $this->EmailBodyHtml)->RAW();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ class SubmittedFileField extends SubmittedFormField
|
||||
{
|
||||
if ($file = $this->UploadedFile()) {
|
||||
if (trim($file->getFilename(), '/') != trim(ASSETS_DIR, '/')) {
|
||||
return $this->UploadedFile()->URL;
|
||||
return $this->UploadedFile()->AbsoluteLink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,9 +81,14 @@ class SubmittedForm extends DataObject
|
||||
$self->Values()->sort('Created', 'ASC')
|
||||
);
|
||||
|
||||
$exportColumns = array(
|
||||
'Title' => 'Title',
|
||||
'ExportValue' => 'Value'
|
||||
);
|
||||
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldDataColumns());
|
||||
$config->addComponent(new GridFieldExportButton());
|
||||
$config->addComponent(new GridFieldExportButton('after', $exportColumns));
|
||||
$config->addComponent(new GridFieldPrintButton());
|
||||
$values->setConfig($config);
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
"require": {
|
||||
"silverstripe/framework": "~3.2",
|
||||
"silverstripe/cms": "~3.2",
|
||||
"silverstripe-australia/gridfieldextensions": "~1.1",
|
||||
"symbiote/silverstripe-gridfieldextensions": "~1.1",
|
||||
"silverstripe/segment-field": "^1.0"
|
||||
},
|
||||
"suggest": {
|
||||
|
@ -1,14 +1,6 @@
|
||||
/**
|
||||
* Animations
|
||||
*/
|
||||
@keyframes rowSlide {
|
||||
0% {
|
||||
top: 20%;
|
||||
}
|
||||
100% {
|
||||
top: 80%;
|
||||
}
|
||||
}
|
||||
@keyframes flashBackground {
|
||||
0% {
|
||||
background-color: white;
|
||||
@ -42,10 +34,6 @@
|
||||
.cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item .handle {
|
||||
min-height: 46px;
|
||||
}
|
||||
.cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item.newField {
|
||||
position: fixed;
|
||||
animation: rowSlide .5s ease forwards;
|
||||
}
|
||||
.cms .uf-field-editor table.ss-gridfield-table .ss-gridfield-item.flashBackground {
|
||||
animation: flashBackground 2s linear;
|
||||
}
|
||||
|
@ -92,19 +92,11 @@
|
||||
$newField.find('.col-Title input').focus();
|
||||
}
|
||||
|
||||
// animate the row positioning (add the first class)
|
||||
if (document.createElement('div').style.animationName !== void 0) {
|
||||
$newField.addClass('newField');
|
||||
}
|
||||
|
||||
// Once the animation has completed
|
||||
setTimeout(function () {
|
||||
$newField.removeClass('newField').addClass('flashBackground');
|
||||
$newField.addClass('flashBackground');
|
||||
$(".cms-content-fields").scrollTop($(".cms-content-fields")[0].scrollHeight);
|
||||
if($groupEnd) {
|
||||
$groupEnd.css('visibility', 'visible');
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -5,12 +5,11 @@
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
|
||||
var sendPlain = $('input[name="SendPlain"]');
|
||||
var recipient = {
|
||||
// Some fields are only visible when HTML email are being sent.
|
||||
updateFormatSpecificFields: function () {
|
||||
var sendPlainChecked = $('#SendPlain')
|
||||
.find('input[type="checkbox"]')
|
||||
.is(':checked');
|
||||
var sendPlainChecked = sendPlain.is(':checked');
|
||||
|
||||
$(".field.toggle-html-only")[sendPlainChecked ? 'hide' : 'show']();
|
||||
$(".field.toggle-plain-only")[sendPlainChecked ? 'show' : 'hide']();
|
||||
@ -27,7 +26,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#SendPlain').entwine({
|
||||
sendPlain.entwine({
|
||||
onchange: function () {
|
||||
recipient.updateFormatSpecificFields();
|
||||
}
|
||||
|
@ -2,11 +2,6 @@
|
||||
* Animations
|
||||
*/
|
||||
|
||||
@keyframes rowSlide {
|
||||
0% {top: 20%;}
|
||||
100% {top: 80%;}
|
||||
}
|
||||
|
||||
@keyframes flashBackground {
|
||||
0% {background-color: white;}
|
||||
10% {background-color: #dcfedd;}
|
||||
@ -44,11 +39,6 @@
|
||||
min-height: 46px;
|
||||
}
|
||||
|
||||
&.newField {
|
||||
position: fixed;
|
||||
animation: rowSlide .5s ease forwards;
|
||||
}
|
||||
|
||||
&.flashBackground {
|
||||
animation: flashBackground 2s linear;
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
class UserDefinedForm_EmailRecipientTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = 'UserDefinedForm_EmailRecipientTest.yml';
|
||||
|
||||
public function testShortcodesAreRenderedInEmailPreviewContent()
|
||||
{
|
||||
$page = $this->objFromFixture('SiteTree', 'about_us');
|
||||
|
||||
$recipient = UserDefinedForm_EmailRecipient::create();
|
||||
$recipient->SendPlain = false;
|
||||
$recipient->EmailBodyHtml = '<p>Some email content. About us: [sitetree_link,id=' . $page->ID . '].</p>';
|
||||
|
||||
$result = $recipient->getEmailBodyContent();
|
||||
$this->assertContains('/about-us/', $result);
|
||||
|
||||
$recipient->SendPlain = true;
|
||||
$recipient->EmailBody = 'Some email content. About us: [sitetree_link,id=' . $page->ID . '].';
|
||||
|
||||
$result = $recipient->getEmailBodyContent();
|
||||
$this->assertContains('/about-us/', $result);
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
SiteTree:
|
||||
about_us:
|
||||
Title: About Us
|
||||
URLSegment: about-us
|
Loading…
Reference in New Issue
Block a user