MINOR: usability improvements to the email popup

This commit is contained in:
Will Rossiter 2009-07-17 03:40:18 +00:00
parent 1ba4972e00
commit f20a6f2c31
2 changed files with 13 additions and 9 deletions

View File

@ -574,28 +574,32 @@ class UserDefinedForm_EmailRecipient extends DataObject {
* @return FieldSet * @return FieldSet
*/ */
public function getCMSFields_forPopup() { public function getCMSFields_forPopup() {
$fields = new FieldSet( $fields = new FieldSet(
new TextField('EmailSubject', _t('UserDefinedForm.EMAILSUBJECT', 'Email Subject')), new TextField('EmailSubject', _t('UserDefinedForm.EMAILSUBJECT', 'Email Subject')),
new TextField('EmailFrom', _t('UserDefinedForm.FROMADDRESS','From Address')), new TextField('EmailFrom', _t('UserDefinedForm.FROMADDRESS','Send Email From')),
new TextField('EmailAddress', _t('UserDefinedForm.SENDEMAILTO','Send Email To')), new TextField('EmailAddress', _t('UserDefinedForm.SENDEMAILTO','Send Email To')),
new CheckboxField('SendPlain', _t('UserDefinedForm.SENDPLAIN', 'Send Email as Plain Text (HTML will be stripped)')) new CheckboxField('SendPlain', _t('UserDefinedForm.SENDPLAIN', 'Send Email as Plain Text (HTML will be stripped)')),
new TextareaField('EmailBody', 'Body')
); );
if($this->Form()) { if($this->Form()) {
$validEmailFields = DataObject::get("EditableEmailField", "ParentID = '$this->FormID'"); $validEmailFields = DataObject::get("EditableEmailField", "ParentID = '$this->FormID'");
$multiOptionFields = DataObject::get("EditableMultipleOptionField", "ParentID = '$this->FormID'");
// if they have email fields then we could send from it
if($validEmailFields) { if($validEmailFields) {
$validEmailFields = $validEmailFields->toDropdownMap('ID', 'Title'); $validEmailFields = $validEmailFields->toDropdownMap('ID', 'Title');
$fields->push(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.SENDEMAILINSTEAD', 'Send Email Instead From'),$validEmailFields, '', null, _t('UserDefinedForm.USEDEFINEDVALUE', 'Use Defined Value'))); $fields->insertAfter(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASFROM', '.. or Select a Form Field to use as the From Address'),$validEmailFields, '', null,""), 'EmailFrom');
} }
$dropdownFields = DataObject::get("EditableMultipleOptionField", "ParentID = '$this->FormID'"); // if they have multiple options
if($dropdownFields) { if($multiOptionFields) {
$dropdownFields = $dropdownFields->toDropdownMap('ID', 'Title'); $multiOptionFields = $multiOptionFields->toDropdownMap('ID', 'Title');
$fields->push(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.SENDEMAILTO', 'Send Email Instead To'), $dropdownFields, '', null, _t('UserDefinedForm.USEDEFINEDVALUE', 'Use Defined Value'))); $fields->insertAfter(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASTO', '.. or Select a Field to use as the To Address'), $multiOptionFields, '', null, ""), 'EmailAddress');
} }
} }
$fields->push(new TextareaField('EmailBody', 'Body'));
return $fields; return $fields;
} }
} }

View File

@ -237,7 +237,7 @@ $lang['en_US']['UserDefinedForm']['PLURALNAME'] = array(
); );
$lang['en_US']['UserDefinedForm']['RECEIVED'] = 'Received Submissions'; $lang['en_US']['UserDefinedForm']['RECEIVED'] = 'Received Submissions';
$lang['en_US']['UserDefinedForm']['SENDEMAILINSTEAD'] = 'Send Email Instead From'; $lang['en_US']['UserDefinedForm']['SENDEMAILINSTEAD'] = 'Send Email Instead From';
$lang['en_US']['UserDefinedForm']['SENDEMAILTO'] = 'Send Email Instead To'; $lang['en_US']['UserDefinedForm']['SENDEMAILTO'] = 'Send Email To';
$lang['en_US']['UserDefinedForm']['SENDPLAIN'] = 'Send Email as Plain Text (HTML will be stripped)'; $lang['en_US']['UserDefinedForm']['SENDPLAIN'] = 'Send Email as Plain Text (HTML will be stripped)';
$lang['en_US']['UserDefinedForm']['SHOWCLEARFORM'] = 'Show Clear Form Button'; $lang['en_US']['UserDefinedForm']['SHOWCLEARFORM'] = 'Show Clear Form Button';
$lang['en_US']['UserDefinedForm']['SINGULARNAME'] = array( $lang['en_US']['UserDefinedForm']['SINGULARNAME'] = array(