From e9147c17f015dcbe6056be586bf3be98c23da371 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 4 Dec 2014 14:42:44 +0000 Subject: [PATCH] handle new signature preference --- mail/inc/class.mail_compose.inc.php | 26 +++++++++++++++++++------- mail/inc/class.mail_hooks.inc.php | 12 ++++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 927ee36177..b83245ff4c 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -945,12 +945,18 @@ class mail_compose if (stripos($content['body'],'')!==false) $content['body'] = str_ireplace(array('',''),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') { @@ -2101,8 +2107,14 @@ class mail_compose $disableRuler = false; #if ($realCharset != $this->displayCharset) error_log("Error: bocompose::createMessage found Charset ($realCharset) differs from DisplayCharset (".$this->displayCharset.")"); $signature = $_signature['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. @@ -2114,12 +2126,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['mimeType'] =='html') { $_mailObject->IsHTML(true); if(!empty($signature)) { diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index 6b85b52366..84462f7ee1 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -315,12 +315,16 @@ class mail_hooks ), 'insertSignatureAtTopOfMessage' => array( 'type' => 'select', - 'label' => 'signature at top', - 'help' => 'insert the signature at top of the new (or reply) message when opening compose dialog (you may not be able to switch signatures)', + 'label' => 'Signature position and visibility', + 'help' => 'Should signature be inserted after (standard) or before a reply or inline forward, and should signature be visible and changeable during compose.', 'name' => 'insertSignatureAtTopOfMessage', - 'values' => $no_yes, + 'values' => array( + '0' => 'After reply, visible during compose', + '1' => 'Before reply, visible during compose', + 'no_belowaftersend' => 'Appened after reply before sending', + ), 'xmlrpc' => True, - 'default'=> 0, + 'default'=> '0', 'admin' => False, ), 'attachVCardAtCompose' => array(