mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge branch '5.2'
This commit is contained in:
commit
3bc2b45170
@ -71,6 +71,11 @@ class UpgradePolymorphicExtension extends DataExtension
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't rewrite class values when an existing value is set and is an instance of UserDefinedForm
|
||||||
|
if ($relationshipObject instanceof UserDefinedForm) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$entry->$fieldName = $this->defaultReplacement;
|
$entry->$fieldName = $this->defaultReplacement;
|
||||||
try {
|
try {
|
||||||
$entry->write();
|
$entry->write();
|
||||||
|
@ -27,6 +27,7 @@ use SilverStripe\ORM\ArrayList;
|
|||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||||
use SilverStripe\ORM\ValidationException;
|
use SilverStripe\ORM\ValidationException;
|
||||||
use SilverStripe\UserForms\Extension\UserFormFieldEditorExtension;
|
use SilverStripe\UserForms\Extension\UserFormFieldEditorExtension;
|
||||||
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
use SilverStripe\UserForms\Model\EditableFormField\EditableFieldGroup;
|
||||||
@ -801,12 +802,12 @@ class EditableFormField extends DataObject
|
|||||||
* Return the error message for this field. Either uses the custom
|
* Return the error message for this field. Either uses the custom
|
||||||
* one (if provided) or the default SilverStripe message
|
* one (if provided) or the default SilverStripe message
|
||||||
*
|
*
|
||||||
* @return Varchar
|
* @return DBVarchar
|
||||||
*/
|
*/
|
||||||
public function getErrorMessage()
|
public function getErrorMessage()
|
||||||
{
|
{
|
||||||
$title = strip_tags("'". ($this->Title ? $this->Title : $this->Name) . "'");
|
$title = strip_tags("'". ($this->Title ? $this->Title : $this->Name) . "'");
|
||||||
$standard = _t('SilverStripe\\Forms\\Form.FIELDISREQUIRED', '{name} is required.', ['name' => $title]);
|
$standard = _t(__CLASS__ . '.FIELDISREQUIRED', '{name} is required', ['name' => $title]);
|
||||||
|
|
||||||
// only use CustomErrorMessage if it has a non empty value
|
// only use CustomErrorMessage if it has a non empty value
|
||||||
$errorMessage = (!empty($this->CustomErrorMessage)) ? $this->CustomErrorMessage : $standard;
|
$errorMessage = (!empty($this->CustomErrorMessage)) ? $this->CustomErrorMessage : $standard;
|
||||||
|
@ -55,7 +55,7 @@ class EditableDateField extends EditableFormField
|
|||||||
public function getFormField()
|
public function getFormField()
|
||||||
{
|
{
|
||||||
$defaultValue = $this->DefaultToToday
|
$defaultValue = $this->DefaultToToday
|
||||||
? DBDatetime::now()->Format('Y-m-d')
|
? DBDatetime::now()->Format('yyyy-MM-dd')
|
||||||
: $this->Default;
|
: $this->Default;
|
||||||
|
|
||||||
$field = FormField::create($this->Name, $this->Title ?: false, $defaultValue)
|
$field = FormField::create($this->Name, $this->Title ?: false, $defaultValue)
|
||||||
|
@ -234,12 +234,17 @@ class EmailRecipient extends DataObject
|
|||||||
->getRequest()
|
->getRequest()
|
||||||
->setSession(Controller::curr()->getRequest()->getSession());
|
->setSession(Controller::curr()->getRequest()->getSession());
|
||||||
|
|
||||||
|
// If used in a regular page context, will have "/edit" on the end, if used in a trait context
|
||||||
|
// it won't. Strip that off in case.
|
||||||
|
$currentUrl = Controller::curr()->getRequest()->getURL();
|
||||||
|
if (substr($currentUrl, -5) === '/edit') {
|
||||||
|
$currentUrl = substr($currentUrl, 0, strlen($currentUrl) - 5);
|
||||||
|
}
|
||||||
|
$previewUrl = Controller::join_links($currentUrl, 'preview');
|
||||||
|
|
||||||
$preview = sprintf(
|
$preview = sprintf(
|
||||||
'<p><a href="%s" target="_blank" class="btn btn-outline-secondary">%s</a></p><em>%s</em>',
|
'<p><a href="%s" target="_blank" class="btn btn-outline-secondary">%s</a></p><em>%s</em>',
|
||||||
Controller::join_links(
|
$previewUrl,
|
||||||
$pageEditController->getEditForm()->FormAction(),
|
|
||||||
"field/EmailRecipients/item/{$this->ID}/preview"
|
|
||||||
),
|
|
||||||
_t('SilverStripe\\UserForms\\Model\\UserDefinedForm.PREVIEW_EMAIL', 'Preview email'),
|
_t('SilverStripe\\UserForms\\Model\\UserDefinedForm.PREVIEW_EMAIL', 'Preview email'),
|
||||||
_t(
|
_t(
|
||||||
'SilverStripe\\UserForms\\Model\\UserDefinedForm.PREVIEW_EMAIL_DESCRIPTION',
|
'SilverStripe\\UserForms\\Model\\UserDefinedForm.PREVIEW_EMAIL_DESCRIPTION',
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
namespace SilverStripe\UserForms\Model\Submission;
|
namespace SilverStripe\UserForms\Model\Submission;
|
||||||
|
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\UserForms\Model\Submission\SubmittedForm;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
use SilverStripe\Security\Member;
|
||||||
|
use SilverStripe\UserForms\Model\EditableFormField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data received from a UserDefinedForm submission
|
* Data received from a UserDefinedForm submission
|
||||||
@ -27,10 +29,6 @@ class SubmittedFormField extends DataObject
|
|||||||
'FormattedValue' => 'Value'
|
'FormattedValue' => 'Value'
|
||||||
];
|
];
|
||||||
|
|
||||||
private static $casting = [
|
|
||||||
'FormattedValue' => 'HTMLFragment'
|
|
||||||
];
|
|
||||||
|
|
||||||
private static $table_name = 'SubmittedFormField';
|
private static $table_name = 'SubmittedFormField';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,20 +74,20 @@ class SubmittedFormField extends DataObject
|
|||||||
/**
|
/**
|
||||||
* Generate a formatted value for the reports and email notifications.
|
* Generate a formatted value for the reports and email notifications.
|
||||||
* Converts new lines (which are stored in the database text field) as
|
* Converts new lines (which are stored in the database text field) as
|
||||||
* <brs> so they will output as newlines in the reports
|
* <brs> so they will output as newlines in the reports.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return DBField
|
||||||
*/
|
*/
|
||||||
public function getFormattedValue()
|
public function getFormattedValue()
|
||||||
{
|
{
|
||||||
return nl2br($this->dbObject('Value')->ATT());
|
return $this->dbObject('Value');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value of this submitted form field suitable for inclusion
|
* Return the value of this submitted form field suitable for inclusion
|
||||||
* into the CSV
|
* into the CSV
|
||||||
*
|
*
|
||||||
* @return Text
|
* @return DBField
|
||||||
*/
|
*/
|
||||||
public function getExportValue()
|
public function getExportValue()
|
||||||
{
|
{
|
||||||
|
@ -3,8 +3,6 @@ en:
|
|||||||
SELECTUPLOADFOLDER: 'Select upload folder'
|
SELECTUPLOADFOLDER: 'Select upload folder'
|
||||||
SilverStripe\CMS\Model\SiteTree:
|
SilverStripe\CMS\Model\SiteTree:
|
||||||
TABMAIN: Main
|
TABMAIN: Main
|
||||||
SilverStripe\Forms\Form:
|
|
||||||
FIELDISREQUIRED: '{name} is required.'
|
|
||||||
SilverStripe\UserForms:
|
SilverStripe\UserForms:
|
||||||
ADDEMAILRECIPIENT: 'Add Email Recipient'
|
ADDEMAILRECIPIENT: 'Add Email Recipient'
|
||||||
CLEARBUTTON: Clear
|
CLEARBUTTON: Clear
|
||||||
@ -57,6 +55,7 @@ en:
|
|||||||
EXTRACLASS_SELECT: 'Select from the list of allowed styles'
|
EXTRACLASS_SELECT: 'Select from the list of allowed styles'
|
||||||
EXTRACLASS_TITLE: 'Extra Styling/Layout'
|
EXTRACLASS_TITLE: 'Extra Styling/Layout'
|
||||||
EXTRACLASS_Title: 'Extra CSS classes'
|
EXTRACLASS_Title: 'Extra CSS classes'
|
||||||
|
FIELDISREQUIRED: '{name} is required'
|
||||||
GROUP: Group
|
GROUP: Group
|
||||||
INITIALVISIBILITY: 'Initial visibility'
|
INITIALVISIBILITY: 'Initial visibility'
|
||||||
MERGEFIELDNAME: 'Merge field'
|
MERGEFIELDNAME: 'Merge field'
|
||||||
@ -148,6 +147,8 @@ en:
|
|||||||
one: 'A Page Break'
|
one: 'A Page Break'
|
||||||
other: '{count} Page Breaks'
|
other: '{count} Page Breaks'
|
||||||
SINGULARNAME: 'Page Break'
|
SINGULARNAME: 'Page Break'
|
||||||
|
STEP_NEXT: Next
|
||||||
|
STEP_PREV: Prev
|
||||||
STEP_TITLE: 'Page {page}'
|
STEP_TITLE: 'Page {page}'
|
||||||
TITLE_FIRST: 'First Page'
|
TITLE_FIRST: 'First Page'
|
||||||
SilverStripe\UserForms\Model\EditableFormField\EditableLiteralField:
|
SilverStripe\UserForms\Model\EditableFormField\EditableLiteralField:
|
||||||
|
@ -5,10 +5,14 @@
|
|||||||
so the 'prev' and 'next' button are not used. These buttons are made visible via JavaScript.
|
so the 'prev' and 'next' button are not used. These buttons are made visible via JavaScript.
|
||||||
--%>
|
--%>
|
||||||
<li class="step-button-wrapper" aria-hidden="true" style="display:none;">
|
<li class="step-button-wrapper" aria-hidden="true" style="display:none;">
|
||||||
<button class="step-button-prev">Prev</button>
|
<button class="step-button-prev">
|
||||||
|
<%t SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.STEP_PREV "Prev" %>
|
||||||
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="step-button-wrapper" aria-hidden="true" style="display:none;">
|
<li class="step-button-wrapper" aria-hidden="true" style="display:none;">
|
||||||
<button class="step-button-next">Next</button>
|
<button class="step-button-next">
|
||||||
|
<%t SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.STEP_NEXT "Next" %>
|
||||||
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% if $Actions %>
|
<% if $Actions %>
|
||||||
|
Loading…
Reference in New Issue
Block a user