1
0
Fork 0
- Fixed the main problem with the CC-Recipients (now the recipients are still there after reloading the page etc. incl. the right setting in mysqldumper.ini with dots instead of underscores)
- Add required validators to the E-Mail-Input-Fields
- Changed the misspelling Reciptient to Recipient in  E-Mail-jQuery and E-Mail-PHP-Functions
- Fixed the problem with the E-Mail programs (identically with the CC-Recipients. After reloading the page etc. the data was lost)
Dieser Commit ist enthalten in:
Harald-Innetzberger 2011-09-03 16:29:27 +00:00
Ursprung 9ab6601ee3
Commit 6072297b26
3 geänderte Dateien mit 150 neuen und 139 gelöschten Zeilen

Datei anzeigen

@ -23,8 +23,6 @@ SenderAddress = ""
SenderName = "" SenderName = ""
RecipientAddress = "" RecipientAddress = ""
RecipientName = "" RecipientName = ""
RecipientCc.0.Address = ""
RecipientCc.0.Name = ""
attachBackup = "n" attachBackup = "n"
Maxsize = "" Maxsize = ""
MaxsizeUnit = "kb" MaxsizeUnit = "kb"

Datei anzeigen

@ -49,7 +49,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
$this->_addSender(); $this->_addSender();
$this->_addRecipient(); $this->_addRecipient();
$this->_addButtonAddRecipientCc(); $this->_addButtonAddRecipientCc();
// add Recipients CC // add Recipients CC
$ccElements = $this->_setRecipientCc( $ccElements = $this->_setRecipientCc(
$this->_config->get('config.email.RecipientCc') $this->_config->get('config.email.RecipientCc')
@ -57,7 +57,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
$this->_addAttachement(); $this->_addAttachement();
$this->_addEmailProgram(); $this->_addEmailProgram();
// create and add display group // create and add display group
$elements = array( $elements = array(
'sendEmail', 'sendEmail',
@ -65,7 +65,8 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
'SenderName', 'SenderName',
'RecipientAddress', 'RecipientAddress',
'RecipientName', 'RecipientName',
'AddCc'); 'AddCc'
);
// add cc-recipients // add cc-recipients
if (count($ccElements)>0) { if (count($ccElements)>0) {
$elements = array_merge( $elements = array_merge(
@ -73,6 +74,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
$ccElements $ccElements
); );
} }
$elements = array_merge( $elements = array_merge(
$elements, $elements,
array( array(
@ -151,92 +153,6 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
) )
); );
} }
/**
* Add Cc-Recipients
*
* @param array $configRecipientCc All Cc-Recipients
*
* @return array Element names to add to display group
*/
private function _setRecipientCc($recipientsCc)
{
if ($recipientsCc === null) {
return;
}
if (count($recipientsCc) == 0) {
return;
}
$elements = array();
//$i = 0;
foreach ($recipientsCc as $i => $recipient) {
//Recipient CC email
$this->addElement(
'text',
'RecipientCc_'.$i.'_Address',
array(
'class' => 'text emailToggle',
'label' => 'L_EMAIL_CC',
'listsep' => ' ',
'size' => 30,
'disableLoadDefaultDecorators' => true,
'decorators' => array('LineStart'),
'validators' => array('EmailAddress'),
)
);
//CC name
$this->addElement(
'text',
'RecipientCc_'.$i.'_Name',
array(
'class' => 'text emailToggle',
'label' => 'L_NAME',
'listsep' => ' ',
'size' => 30,
'disableLoadDefaultDecorators' => true,
'decorators' => array('LineMiddle'),
)
);
//button delete recipient
$confirmDelete = sprintf(
$this->_lang->getTranslator()->_('L_CONFIRM_RECIPIENT_DELETE'),
$recipient['Name']
);
$confirmDelete = Msd_Html::getJsQuote($confirmDelete, true);
$this->addElement(
'button',
'DeleteCc_'.$i,
array(
'disableLoadDefaultDecorators' => true,
'content' =>
$this->getView()->getIcon('delete') . ' ' .
$this->_lang->getTranslator()->_('L_DELETE'),
'decorators' => array('LineEnd'),
'escape' => false,
'label' => '',
'class' => 'Formbutton emailToggle',
'onclick' =>
'if (!confirm(\'Ha\')) return false;'
.' deleteEmailReciptientCc(\'' . $i .'\');',
)
);
$elements = array_merge(
$elements,
array(
'RecipientCc_'.$i.'_Address',
'RecipientCc_'.$i.'_Name',
'DeleteCc_'.$i,
)
);
$i++;
}
return $elements;
}
/** /**
* Adds line with sender inputs * Adds line with sender inputs
@ -255,11 +171,9 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
'size' => 30, 'size' => 30,
'listsep' => ' ', 'listsep' => ' ',
'disableLoadDefaultDecorators' => true, 'disableLoadDefaultDecorators' => true,
'required' => true,
'decorators' => array('LineStart'), 'decorators' => array('LineStart'),
'validators' => array( 'validators' => array('EmailAddress'),
new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING),
'EmailAddress'
),
) )
); );
@ -273,6 +187,48 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
'size' => 30, 'size' => 30,
'listsep' => ' ', 'listsep' => ' ',
'disableLoadDefaultDecorators' => true, 'disableLoadDefaultDecorators' => true,
'required' => true,
'decorators' => array('LineEnd'),
'validators' => array('NotEmpty'),
)
);
}
/**
* Add line with recipient name and e-mail
*
* @return void
*/
private function _addRecipient()
{
//Recipient email
$this->addElement(
'text',
'RecipientAddress',
array(
'class' => 'text emailToggle',
'label' => 'L_EMAIL_RECIPIENT',
'size' => 30,
'listsep' => ' ',
'disableLoadDefaultDecorators' => true,
'required' => true,
'decorators' => array('LineStart'),
'validators' => array('EmailAddress'),
)
);
//Recipient name
$this->addElement(
'text',
'RecipientName',
array(
'class' => 'text emailToggle',
'label' => 'L_NAME',
'size' => 30,
'listsep' => ' ',
'disableLoadDefaultDecorators' => true,
'required' => true,
'decorators' => array('LineEnd'), 'decorators' => array('LineEnd'),
'validators' => array('NotEmpty'), 'validators' => array('NotEmpty'),
) )
@ -298,46 +254,101 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
'escape' => false, 'escape' => false,
'label' => '', 'label' => '',
'class' => 'Formbutton emailToggle', 'class' => 'Formbutton emailToggle',
'onclick' => "addEmailReciptientCc();", 'onclick' => "addEmailRecipientCc();",
) )
); );
} }
/**
* Add line with recipient name and e-mail /**
* Add Cc-Recipients
* *
* @return void * @param $recipientsCc
*
* @internal param array $configRecipientCc All Cc-Recipients
*
* @return array Element names to add to display group
*/ */
private function _addRecipient() private function _setRecipientCc($recipientsCc)
{ {
if ($recipientsCc === null) {
return;
}
//Recipient email if (count($recipientsCc) == 0) {
$this->addElement( return;
'text', }
'RecipientAddress',
array(
'class' => 'text emailToggle',
'label' => 'L_EMAIL_RECIPIENT',
'size' => 30,
'listsep' => ' ',
'disableLoadDefaultDecorators' => true,
'decorators' => array('LineStart'),
'validators' => array('EmailAddress'),
)
);
//Recipient name $elements = array();
$this->addElement( #$i = 0;
'text', foreach ($recipientsCc as $i => $recipient) {
'RecipientName', //Recipient CC email
array( $this->addElement(
'class' => 'text emailToggle', 'text',
'label' => 'L_NAME', 'RecipientCc_'.$i.'_Address',
'size' => 30, array(
'listsep' => ' ', 'class' => 'text emailToggle',
'disableLoadDefaultDecorators' => true, 'label' => 'L_EMAIL_CC',
'decorators' => array('LineEnd'), 'listsep' => ' ',
) 'size' => 30,
); 'disableLoadDefaultDecorators' => true,
'required' => true,
'decorators' => array('LineStart'),
'validators' => array('EmailAddress'),
)
);
//CC name
$this->addElement(
'text',
'RecipientCc_'.$i.'_Name',
array(
'class' => 'text emailToggle',
'label' => 'L_NAME',
'listsep' => ' ',
'size' => 30,
'disableLoadDefaultDecorators' => true,
'required' => true,
'decorators' => array('LineMiddle'),
'validators' => array('NotEmpty'),
)
);
//button delete recipient
$confirmDelete = sprintf(
$this->_lang->getTranslator()->_('L_CONFIRM_RECIPIENT_DELETE'),
$recipient['Name']
);
$confirmDelete = Msd_Html::getJsQuote($confirmDelete, true);
$this->addElement(
'button',
'DeleteCc_'.$i,
array(
'disableLoadDefaultDecorators' => true,
'content' =>
$this->getView()->getIcon('delete') . ' ' .
$this->_lang->getTranslator()->_('L_DELETE'),
'decorators' => array('LineEnd'),
'escape' => false,
'label' => '',
'class' => 'Formbutton emailToggle',
'onclick' =>
'if (!confirm(\'Ha\')) return false;'
.' deleteEmailRecipientCc(\'' . $i .'\');',
)
);
$elements = array_merge(
$elements,
array(
'RecipientCc_'.$i.'_Address',
'RecipientCc_'.$i.'_Name',
'DeleteCc_'.$i,
)
);
$i++;
}
return $elements;
} }
/** /**
@ -443,6 +454,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
'label' => $this->_lang->getTranslator()->_('L_SMTP_HOST'), 'label' => $this->_lang->getTranslator()->_('L_SMTP_HOST'),
'disableLoadDefaultDecorators' => true, 'disableLoadDefaultDecorators' => true,
'decorators' => array('Default'), 'decorators' => array('Default'),
'validators' => array('NotEmpty'),
) )
); );
$this->addElement( $this->addElement(
@ -523,22 +535,22 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
$values = parent::getValidValues($data, true); $values = parent::getValidValues($data, true);
$newArray = array(); $newArray = array();
while (false !== (list($key, $value) = each($values))) { while (false !== (list($key, $value) = each($values))) {
if (substr($key, 0, 18) != 'email_RecipientCc_') { if (substr($key, 0, 12) != 'RecipientCc_') {
continue; continue;
} }
list($prefix, $index, $fieldKey) = explode('_', $key); list($prefix, $index, $fieldKey) = explode('_', $key);
if (!isset($values['email_Recipient'])) { if (!isset($values['RecipientCc'])) {
$values[$prefix] = array(); $values[$prefix] = array();
} }
if (!isset($newArray[$index])) { if (!isset($values[$key])) {
$newArray[$index] = array(); $values[$key] = array();
} }
$newArray[$index][$fieldKey] = $value; $newArray[$index][$fieldKey] = $value;
unset($values[$key]); unset($values[$key]);
} }
$values['email_RecipientCc'] = array_values($newArray); $values['RecipientCc'] = array_values($newArray);
return $values; return $values;
} }
@ -568,6 +580,7 @@ class Application_Form_Config_Email extends Zend_Form_SubForm
} }
return parent::setDefaults($defaults); return parent::setDefaults($defaults);
} }
/** /**
* Set input default value * Set input default value
* *

Datei anzeigen

@ -1,5 +1,5 @@
<?php <?php
$addReciptientCcUrl = $this->url( $addRecipientCcUrl = $this->url(
array( array(
'controller' => 'config', 'controller' => 'config',
'action' => 'add.Recipient.Cc', 'action' => 'add.Recipient.Cc',
@ -7,7 +7,7 @@ $addReciptientCcUrl = $this->url(
null, null,
true true
); );
$deleteReciptientCcUrl = $this->url( $deleteRecipientCcUrl = $this->url(
array( array(
'controller' => 'config', 'controller' => 'config',
'action' => 'delete.Recipient.Cc', 'action' => 'delete.Recipient.Cc',
@ -139,16 +139,16 @@ $deleteFtpConnectionUrl = $this->url(
}); });
} }
function addEmailReciptientCc() function addEmailRecipientCc()
{ {
$('#config_form').attr('action','<?php echo $addReciptientCcUrl; ?>'); $('#config_form').attr('action','<?php echo $addRecipientCcUrl; ?>');
$('#config_form').submit(); $('#config_form').submit();
} }
function deleteEmailReciptientCc(recipientId) function deleteEmailRecipientCc(recipientId)
{ {
setParam(recipientId); setParam(recipientId);
$('#config_form').attr('action','<?php echo $deleteReciptientCcUrl; ?>'); $('#config_form').attr('action','<?php echo $deleteRecipientCcUrl; ?>');
$('#config_form').submit(); $('#config_form').submit();
} }