mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUG: open ticket 7314 fixing some bugs that have been found
This commit is contained in:
parent
4335d8d910
commit
eba5edd60b
@ -70,11 +70,11 @@ class UserDefinedForm extends Page {
|
|||||||
$fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions',_t('UserDefinedForm.SAVESUBMISSIONS',"Disable Saving Submissions to Server")));
|
$fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions',_t('UserDefinedForm.SAVESUBMISSIONS',"Disable Saving Submissions to Server")));
|
||||||
$fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField( "Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this ) );
|
$fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField( "Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this ) );
|
||||||
|
|
||||||
UserDefinedForm_EmailRecipient::$summary_fields=array(
|
UserDefinedForm_EmailRecipient::$summary_fields=array(
|
||||||
'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
|
'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
|
||||||
'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
|
'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
|
||||||
'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')
|
'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')
|
||||||
);
|
);
|
||||||
|
|
||||||
// who do we email on submission
|
// who do we email on submission
|
||||||
$emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
|
$emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
|
||||||
@ -85,7 +85,7 @@ class UserDefinedForm extends Page {
|
|||||||
$onCompleteFieldSet = new FieldList(
|
$onCompleteFieldSet = new FieldList(
|
||||||
$editor=new HtmlEditorField( "OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'), _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage))
|
$editor=new HtmlEditorField( "OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'), _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage))
|
||||||
);
|
);
|
||||||
$editor->setRows(3);
|
$editor->setRows(3);
|
||||||
|
|
||||||
$fields->addFieldsToTab("Root.OnComplete", $onCompleteFieldSet);
|
$fields->addFieldsToTab("Root.OnComplete", $onCompleteFieldSet);
|
||||||
$fields->addFieldsToTab("Root.Options", $this->getFormOptions());
|
$fields->addFieldsToTab("Root.Options", $this->getFormOptions());
|
||||||
@ -672,7 +672,7 @@ JS
|
|||||||
if(!$this->DisableSaveSubmissions) $submittedForm->write();
|
if(!$this->DisableSaveSubmissions) $submittedForm->write();
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
$attachments = array();
|
$attachments = array();
|
||||||
|
|
||||||
$submittedFields = new ArrayList();
|
$submittedFields = new ArrayList();
|
||||||
|
|
||||||
@ -756,7 +756,7 @@ JS
|
|||||||
// check to see if they are a dynamic sender. eg based on a email field a user selected
|
// check to see if they are a dynamic sender. eg based on a email field a user selected
|
||||||
if($recipient->SendEmailFromField()) {
|
if($recipient->SendEmailFromField()) {
|
||||||
$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailFromField()->Name);
|
$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailFromField()->Name);
|
||||||
if($submittedFormField) {
|
if($submittedFormField && is_string($submittedFormField->Value)) {
|
||||||
$email->setFrom($submittedFormField->Value);
|
$email->setFrom($submittedFormField->Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -764,12 +764,12 @@ JS
|
|||||||
if($recipient->SendEmailToField()) {
|
if($recipient->SendEmailToField()) {
|
||||||
$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailToField()->Name);
|
$submittedFormField = $submittedFields->find('Name', $recipient->SendEmailToField()->Name);
|
||||||
|
|
||||||
if($submittedFormField) {
|
if($submittedFormField && is_string($submittedFormField->Value)) {
|
||||||
$email->setTo($submittedFormField->Value);
|
$email->setTo($submittedFormField->Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->extend('updateEmail', $email, $recipient, $emailData);
|
$this->extend('updateEmail', $email, $recipient, $emailData);
|
||||||
|
|
||||||
if($recipient->SendPlain) {
|
if($recipient->SendPlain) {
|
||||||
$body = strip_tags($recipient->EmailBody) . "\n ";
|
$body = strip_tags($recipient->EmailBody) . "\n ";
|
||||||
@ -859,7 +859,8 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
|||||||
|
|
||||||
// if they have email fields then we could send from it
|
// if they have email fields then we could send from it
|
||||||
if($validEmailFields) {
|
if($validEmailFields) {
|
||||||
$fields->insertAfter(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASFROM', '.. or Select a Form Field to use as the From Address'), $validEmailFields->map('ID', 'Title'), '', null,""), 'EmailFrom');
|
$fields->insertAfter(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASFROM', '.. or Select a Form Field to use as the From Address'),
|
||||||
|
$validEmailFields->map('ID', 'Title'), '', null,""), 'EmailFrom');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if they have multiple options
|
// if they have multiple options
|
||||||
@ -875,7 +876,8 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$multiOptionFields = $multiOptionFields->map('ID', 'Title');
|
$multiOptionFields = $multiOptionFields->map('ID', 'Title');
|
||||||
$fields->insertAfter(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASTO', '.. or Select a Field to use as the To Address'), $multiOptionFields, '', null, ""), 'EmailAddress');
|
$fields->insertAfter(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASTO', '.. or Select a Field to use as the To Address'),
|
||||||
|
$multiOptionFields, '', null, ""), 'EmailAddress');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +906,7 @@ class UserDefinedForm_SubmittedFormEmail extends Email {
|
|||||||
protected $ss_template = "SubmittedFormEmail";
|
protected $ss_template = "SubmittedFormEmail";
|
||||||
protected $data;
|
protected $data;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct($submittedFields = null) {
|
||||||
parent::__construct();
|
parent::__construct($submittedFields = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,12 @@ class EditableLiteralField extends EditableFormField {
|
|||||||
static $plural_name = 'HTML Blocks';
|
static $plural_name = 'HTML Blocks';
|
||||||
|
|
||||||
public function getFieldConfiguration() {
|
public function getFieldConfiguration() {
|
||||||
|
$customSettings = unserialize($this->CustomSettings);
|
||||||
|
$content = (isset($customSettings['Content'])) ? $customSettings['Content'] : '';
|
||||||
$textAreaField = new TextareaField(
|
$textAreaField = new TextareaField(
|
||||||
$this->getSettingName('Content'),
|
$this->getSettingName('Content'),
|
||||||
"HTML"
|
"HTML",
|
||||||
|
$content
|
||||||
);
|
);
|
||||||
$textAreaField->setRows(4);
|
$textAreaField->setRows(4);
|
||||||
$textAreaField->setColumns(20);
|
$textAreaField->setColumns(20);
|
||||||
@ -44,4 +46,4 @@ class EditableLiteralField extends EditableFormField {
|
|||||||
public function showInReports() {
|
public function showInReports() {
|
||||||
return (!$this->getSetting('HideFromReports'));
|
return (!$this->getSetting('HideFromReports'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user