handle new signature preference

This commit is contained in:
Klaus Leithoff 2014-12-04 13:48:43 +00:00
parent 3f50472828
commit 35deef9672
2 changed files with 20 additions and 7 deletions

View File

@ -939,12 +939,18 @@ class mail_compose
if (stripos($content['body'],'<html><head></head><body>')!==false) $content['body'] = str_ireplace(array('<html><head></head><body>','</body></html>'),array('',''),$content['body']);
//error_log(__METHOD__.__LINE__.array2string($this->mailPreferences));
$blockElements = array('address','blockquote','center','del','dir','div','dl','fieldset','form','h1','h2','h3','h4','h5','h6','hr','ins','isindex','menu','noframes','noscript','ol','p','pre','table','ul');
if (isset($this->mailPreferences['insertSignatureAtTopOfMessage']) &&
$this->mailPreferences['insertSignatureAtTopOfMessage'] &&
if ($this->mailPreferences['insertSignatureAtTopOfMessage']!='no_belowaftersend' &&
!(isset($_POST['mySigID']) && !empty($_POST['mySigID']) ) && !$suppressSigOnTop
)
{
$insertSigOnTop = ($insertSigOnTop?$insertSigOnTop:true);
// ON tOP OR BELOW? pREF CAN TELL
/*
Signature behavior preference changed. New default, if not set -> 0
'0' => 'After reply, visible during compose',
'1' => 'Before reply, visible during compose',
'no_belowaftersend' => 'Appened after reply before sending',
*/
$insertSigOnTop = ($insertSigOnTop?$insertSigOnTop:($this->mailPreferences['insertSignatureAtTopOfMessage']?$this->mailPreferences['insertSignatureAtTopOfMessage']:'below'));
$sigText = mail_bo::merge($signature['ident_signature'],array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
if ($content['mimeType'] == 'html')
{
@ -2067,8 +2073,14 @@ class mail_compose
}
$disableRuler = false;
$signature = $_identity['ident_signature'];
if ((isset($this->mailPreferences['insertSignatureAtTopOfMessage']) && $this->mailPreferences['insertSignatureAtTopOfMessage']))
/*
Signature behavior preference changed. New default, if not set -> 0
'0' => 'After reply, visible during compose',
'1' => 'Before reply, visible during compose',
'no_belowaftersend' => 'Appened after reply before sending',
*/
$sigAlreadyThere = $this->mailPreferences['insertSignatureAtTopOfMessage']!='no_belowaftersend'?1:0;
if ($sigAlreadyThere)
{
// note: if you use stationery ' s the insert signatures at the top does not apply here anymore, as the signature
// is already part of the body, so the signature part of the template will not be applied.
@ -2080,11 +2092,12 @@ class mail_compose
{
$disableRuler = true;
}
/* should be handled by identity object itself
if($signature)
{
$signature = mail_bo::merge($signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
}
*/
if ($_formData['attachments'] && $_formData['filemode'] != egw_sharing::ATTACH && $_send)
{
$attachment_links = $this->getAttachmentLinks($_formData['attachments'], $_formData['filemode'],

View File

@ -321,7 +321,7 @@ class mail_hooks
'values' => array(
'0' => 'After reply, visible during compose',
'1' => 'Before reply, visible during compose',
'' => 'Appened after reply before sending',
'no_belowaftersend' => 'Appened after reply before sending',
),
'xmlrpc' => True,
'default'=> '0',