mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-15 04:24:41 +01:00
feature: option/setting to be enabled to suppress ruler that separates EMailbody from signature; option/setting to be able to insert the signature at the top of a message to be composed
This commit is contained in:
parent
55c628e61a
commit
87eedef72f
@ -1000,6 +1000,66 @@
|
||||
|
||||
$response = new xajaxResponse();
|
||||
$response->addScript('setSignature('.$Identities->signature.');');
|
||||
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
function changeComposeSignature($_composeID,$_oldSig,$_signatureID,$_currentMode,$_content)
|
||||
{
|
||||
// we need a lot of encoding/decoding transforming here to get at least some acceptable result
|
||||
// the changing does not work with all sigs, as the old Signature may not match the Signaturepart in Content
|
||||
|
||||
if($this->_debug) error_log(__METHOD__.$_oldSig.','.$_signatureID.'#');
|
||||
$bocompose = CreateObject('felamimail.bocompose', $_composeID);
|
||||
// prepare signatures, the selected sig may be used on top of the body
|
||||
require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc.php');
|
||||
$boSignatures = new felamimail_bosignatures();
|
||||
$oldSignature = $boSignatures->getSignature($_oldSig);
|
||||
$oldSigText = $oldSignature->fm_signature;
|
||||
$signature = $boSignatures->getSignature($_signatureID);
|
||||
$sigText = $signature->fm_signature;
|
||||
|
||||
if ($_currentMode == 'plain')
|
||||
{
|
||||
$oldSigText = $bocompose->convertHTMLToText($oldSigText);
|
||||
$sigText = $bocompose->convertHTMLToText($sigText);
|
||||
$_content = utf8_decode($_content);
|
||||
if($this->_debug) error_log(__METHOD__." Old signature:".$oldSigText);
|
||||
}
|
||||
|
||||
$oldSigText = bofelamimail::merge($oldSigText,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||
$sigText = bofelamimail::merge($sigText,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||
$oldSigText = str_replace(array("\r","\t","<br />\n",": "),array("","","<br />",":"),($_currentMode == 'html'?html::purify($oldSigText):$oldSigText));
|
||||
$_content = str_replace(array("\r","\t","<br />\n",": "),array("","","<br />",":"),($_currentMode == 'html'?html::purify($_content):$_content));
|
||||
$found = strpos($_content,trim($oldSigText));
|
||||
if ($found !== false && $_oldSig != -2 && !(empty($oldSigText) || trim($bocompose->convertHTMLToText($oldSigText)) ==''))
|
||||
{
|
||||
$_content = substr_replace($_content,$sigText,$found,mb_strlen($oldSigText));
|
||||
}
|
||||
if ($_oldSig == -2 && (empty($oldSigText) || trim($bocompose->convertHTMLToText($oldSigText)) ==''))
|
||||
{
|
||||
// if there is no sig selected, there is no way to replace a signature
|
||||
}
|
||||
if ($found === false)
|
||||
{
|
||||
if($this->_debug) error_log(__METHOD__." Old Signature failed to match:".$oldSigText);
|
||||
if($this->_debug) error_log(__METHOD__." Compare content:".$_content);
|
||||
}
|
||||
$response = new xajaxResponse();
|
||||
if ($_currentMode == 'html') $_content = utf8_decode($_content);
|
||||
$escaped = utf8_encode(str_replace(array("'", "\r", "\n"), array("\\'", "\\r", "\\n"), $_content));
|
||||
//error_log(__METHOD__.$escaped);
|
||||
if ($_currentMode == 'html')
|
||||
$response->addScript("showHTMLEditor('$escaped');");
|
||||
else
|
||||
$response->addScript("showPlainEditor('$escaped');");
|
||||
/*
|
||||
if ($found===false)
|
||||
{
|
||||
$warning = lang("Switching of Signatures failed");
|
||||
$response->addScript('alert('.$warning.');');
|
||||
}
|
||||
*/
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
|
@ -777,8 +777,21 @@
|
||||
$_formData['body'] = preg_replace('/=\r\n/', '', $_formData['body']);
|
||||
$_formData['body'] = quoted_printable_decode($_formData['body']);
|
||||
}
|
||||
$disableRuler = false;
|
||||
#if ($realCharset != $this->displayCharset) error_log("Error: bocompose::createMessage found Charset ($realCharset) differs from DisplayCharset (".$this->displayCharset.")");
|
||||
$signature = $_signature->fm_signature;
|
||||
if ((isset($this->preferencesArray['insertSignatureAtTopOfMessage']) && $this->preferencesArray['insertSignatureAtTopOfMessage']))
|
||||
{
|
||||
// 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 teplate will not be applied.
|
||||
$signature = null; // note: no signature, no ruler!!!!
|
||||
}
|
||||
if ((isset($this->preferencesArray['disableRulerForSignatureSeparation']) &&
|
||||
$this->preferencesArray['disableRulerForSignatureSeparation']) ||
|
||||
empty($signature) || trim($this->convertHTMLToText($signature)) =='')
|
||||
{
|
||||
$disableRuler = true;
|
||||
}
|
||||
$signature = bofelamimail::merge($signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||
if($_formData['mimeType'] =='html') {
|
||||
$_mailObject->IsHTML(true);
|
||||
@ -788,10 +801,12 @@
|
||||
$bostationery = new felamimail_bostationery();
|
||||
$_mailObject->Body = $bostationery->render($this->sessionData['stationeryID'],$_formData['body'],$signature);
|
||||
} else {
|
||||
$_mailObject->Body = $_formData['body'] .'<hr style="border:dotted 1px silver; width:90%; border:dotted 1px silver;">'. $signature;
|
||||
$_mailObject->Body = $_formData['body'] .
|
||||
($disableRuler ?'<br>':'<hr style="border:dotted 1px silver; width:90%; border:dotted 1px silver;">').
|
||||
$signature;
|
||||
}
|
||||
$_mailObject->AltBody = $this->convertHTMLToText($_formData['body']).
|
||||
"\r\n-- \r\n".
|
||||
($disableRuler ?"\r\n":"\r\n-- \r\n").
|
||||
$this->convertHTMLToText($signature);
|
||||
#print "<pre>$_mailObject->AltBody</pre>";
|
||||
#print htmlentities($_signature['signature']);
|
||||
@ -809,7 +824,8 @@
|
||||
$_mailObject->Body = $this->convertHTMLToText($_formData['body'],false);
|
||||
#$_mailObject->Body = $_formData['body'];
|
||||
if(!empty($signature)) {
|
||||
$_mailObject->Body .= "\r\n-- \r\n". $this->convertHTMLToText($signature);
|
||||
$_mailObject->Body .= ($disableRuler ?"\r\n":"\r\n-- \r\n").
|
||||
$this->convertHTMLToText($signature);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@
|
||||
return array();
|
||||
}
|
||||
|
||||
function getPreferences()
|
||||
function getPreferences($getUserDefinedProfiles=true)
|
||||
{
|
||||
if (isset($this->sessionData['profileData']) && is_a($this->sessionData['profileData'],'ea_preferences')) {
|
||||
$this->profileData = $this->sessionData['profileData'];
|
||||
@ -214,7 +214,7 @@
|
||||
if(!is_a($profileData, 'ea_preferences') || !is_a($profileData->ic_server[0], 'defaultimap')) {
|
||||
return false;
|
||||
}
|
||||
if($profileData->userDefinedAccounts && $GLOBALS['egw_info']['user']['apps']['felamimail']) {
|
||||
if($profileData->userDefinedAccounts && $GLOBALS['egw_info']['user']['apps']['felamimail'] && $getUserDefinedProfiles) {
|
||||
// get user defined accounts
|
||||
$accountData = $this->getAccountData($profileData);
|
||||
|
||||
|
@ -85,7 +85,7 @@ class felamimail_hooks
|
||||
);
|
||||
$no_yes_copy = array_merge($no_yes,array('2'=>lang('yes, offer copy option')));
|
||||
|
||||
$prefAllowManageFolders = $no_yes;
|
||||
$prefAllowManageFolders = $no_yes;
|
||||
|
||||
$forwardOptions = array(
|
||||
'asmail' => lang('forward as attachment'),
|
||||
@ -395,6 +395,24 @@ class felamimail_hooks
|
||||
'default'=> 0,
|
||||
'admin' => False,
|
||||
),
|
||||
'disableRulerForSignatureSeparation' => array(
|
||||
'type' => 'select',
|
||||
'label' => 'disable Ruler for separation of mailbody and signature when adding signature to composed message (this is not according to RFC).<br>If you use templates, this option is only applied to the text part of the message.',
|
||||
'name' => 'disableRulerForSignatureSeparation',
|
||||
'values' => $no_yes,
|
||||
'xmlrpc' => True,
|
||||
'default'=> 0,
|
||||
'admin' => False,
|
||||
),
|
||||
'insertSignatureAtTopOfMessage' => array(
|
||||
'type' => 'select',
|
||||
'label' => 'insert the signature at top of the new (or reply) message when opening compose dialog (you may not be able to switch signatures)',
|
||||
'name' => 'insertSignatureAtTopOfMessage',
|
||||
'values' => $no_yes,
|
||||
'xmlrpc' => True,
|
||||
'default'=> 0,
|
||||
'admin' => False,
|
||||
),
|
||||
'sieveScriptName' => array(
|
||||
'type' => 'input',
|
||||
'label' => 'sieve script name',
|
||||
|
@ -272,6 +272,8 @@
|
||||
$this->t->set_block('composeForm','simple_text');
|
||||
|
||||
$this->translate();
|
||||
// store the selected Signature
|
||||
$this->t->set_var("mySigID",($presetSig ? $presetSig : $sessionData['signatureID']));
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['addressbook']) {
|
||||
$this->t->set_var("link_addressbook",$GLOBALS['egw']->link('/index.php',array(
|
||||
@ -408,27 +410,11 @@
|
||||
$this->t->set_var('lang_no_subject',lang('No subject given!'));
|
||||
$this->t->pparse("out","header");
|
||||
|
||||
// body
|
||||
if($sessionData['mimeType'] == 'html') {
|
||||
$mode = 'simple';
|
||||
#if (isset($GLOBALS['egw_info']['server']['enabled_spellcheck'])) $mode = 'egw_simple_spellcheck';
|
||||
$style="border:0px; width:100%; height:400px;";
|
||||
// dont run purify, as we already did that (getCleanHTML).
|
||||
$this->t->set_var('tinymce', html::fckEditorQuick('body', $mode, $sessionData['body'],'400px','100%',false));
|
||||
$this->t->set_var('mimeType', 'html');
|
||||
$ishtml=1;
|
||||
} else {
|
||||
$style="border:0px; width:100%; height:400px;";
|
||||
// initalize the CKEditor Object to enable switching back and force
|
||||
$editor = $editorObject->init(). html::fckEditorQuick('body', 'ascii', $sessionData['body'],'400px','99%');
|
||||
$this->t->set_var('tinymce', $editor); //html::fckEditorQuick('body', 'ascii', $sessionData['body'],'400px','99%'));
|
||||
$this->t->set_var('mimeType', 'text');
|
||||
$ishtml=0;
|
||||
}
|
||||
|
||||
// prepare signatures, the selected sig may be used on top of the body
|
||||
require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc.php');
|
||||
$boSignatures = new felamimail_bosignatures();
|
||||
$signatures = $boSignatures->getListOfSignatures();
|
||||
|
||||
if (empty($sessionData['signatureID'])) {
|
||||
if ($signatureData = $boSignatures->getDefaultSignature()) {
|
||||
if (is_array($signatureData)) {
|
||||
@ -445,6 +431,47 @@
|
||||
foreach($signatures as $signature) {
|
||||
$selectSignatures[$signature['fm_signatureid']] = lang('Signature').': '.$signature['fm_description'];
|
||||
}
|
||||
$disableRuler = false;
|
||||
$signature = $boSignatures->getSignature(($presetSig ? $presetSig : $sessionData['signatureID']));
|
||||
if ((isset($this->bocompose->preferencesArray['disableRulerForSignatureSeparation']) &&
|
||||
$this->bocompose->preferencesArray['disableRulerForSignatureSeparation']) ||
|
||||
empty($signature->fm_signature) || trim($this->bocompose->convertHTMLToText($signature->fm_signature)) =='')
|
||||
{
|
||||
$disableRuler = true;
|
||||
}
|
||||
$insertSigOnTop = false;
|
||||
if (isset($this->bocompose->preferencesArray['insertSignatureAtTopOfMessage']) && $this->bocompose->preferencesArray['insertSignatureAtTopOfMessage'])
|
||||
{
|
||||
$insertSigOnTop = true;
|
||||
if($sessionData['mimeType'] == 'html') {
|
||||
$before = ($disableRuler ?' <br>':' <br><hr style="border:dotted 1px silver; width:90%; border:dotted 1px silver;">');
|
||||
$inbetween = ' <br>';
|
||||
} else {
|
||||
$before = ($disableRuler ?"\r\n\r\n":"\r\n\r\n-- \r\n");
|
||||
$inbetween = "\r\n";
|
||||
}
|
||||
$sigText = bofelamimail::merge($signature->fm_signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||
$sessionData['body'] = $before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText)).$inbetween.$sessionData['body'];
|
||||
}
|
||||
|
||||
// prepare body
|
||||
if($sessionData['mimeType'] == 'html') {
|
||||
$mode = 'simple';
|
||||
#if (isset($GLOBALS['egw_info']['server']['enabled_spellcheck'])) $mode = 'egw_simple_spellcheck';
|
||||
$style="border:0px; width:100%; height:400px;";
|
||||
// dont run purify, as we already did that (getCleanHTML).
|
||||
$this->t->set_var('tinymce', html::fckEditorQuick('body', $mode, $sessionData['body'],'400px','100%',false));
|
||||
$this->t->set_var('mimeType', 'html');
|
||||
$ishtml=1;
|
||||
} else {
|
||||
$style="border:0px; width:100%; height:400px;";
|
||||
// initalize the CKEditor Object to enable switching back and force
|
||||
$editor = html::fckEditorQuick('body', 'ascii', $sessionData['body'],'400px','99%');
|
||||
$this->t->set_var('tinymce', $editor); //html::fckEditorQuick('body', 'ascii', $sessionData['body'],'400px','99%'));
|
||||
$this->t->set_var('mimeType', 'text');
|
||||
$ishtml=0;
|
||||
}
|
||||
|
||||
|
||||
$bostationery = new felamimail_bostationery();
|
||||
$selectStationeries = array(
|
||||
@ -457,7 +484,8 @@
|
||||
$showStationaries = true;
|
||||
$selectStationeries += $validStationaries;
|
||||
}
|
||||
$selectBoxSignature = html::select('signatureID', ($presetSig ? $presetSig : $sessionData['signatureID']), $selectSignatures, true, "style='width: 35%;' onchange='fm_compose_changeInputType(this)'");
|
||||
// if ID of signature Select Box is set, we allow for changing the sig onChange of the signatueSelect
|
||||
$selectBoxSignature = html::select('signatureID', ($presetSig ? $presetSig : $sessionData['signatureID']), $selectSignatures, true, ($insertSigOnTop?"id='signatureID'":"")." style='width: 35%;' onchange='fm_compose_changeInputType(this)'");
|
||||
$selectBoxStationery = html::select('stationeryID', ($presetStationery ? $presetStationery : 0), $selectStationeries, true, "style='width: 35%;'");
|
||||
$this->t->set_var("select_signature", $selectBoxSignature);
|
||||
$this->t->set_var("select_stationery", ($showStationaries ? $selectBoxStationery:''));
|
||||
|
@ -515,6 +515,48 @@ function fm_compose_changeInputType(_selectBox) {
|
||||
}
|
||||
|
||||
var tdElements = selectBoxRow.getElementsByTagName('td');
|
||||
if (_selectBox.name = 'signatureID') {
|
||||
var sigBox = document.getElementById('signatureID');
|
||||
//alert(sigBox);
|
||||
// if we find the id, signature is inserted at the top of the message on compose start.
|
||||
if (sigBox == null)
|
||||
{
|
||||
//alert ("could not find sigBox");
|
||||
}
|
||||
else
|
||||
{
|
||||
var currSig = document.getElementById('mySigID');
|
||||
currentSig = currSig.value;
|
||||
// we try to change the signature
|
||||
fm_compose_changeSignature(currentSig,_selectBox.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fm_compose_changeSignature(_oldSig,_signatureID) {
|
||||
//alert ("found sigBox");
|
||||
var htmlFlag = document.getElementsByName('_is_html')[0];
|
||||
var currentEditor = htmlFlag.value;
|
||||
var content = '';
|
||||
var currentMode ='';
|
||||
if (_oldSig != _signatureID)
|
||||
{
|
||||
if (currentEditor == 1)
|
||||
{
|
||||
currentMode='html';
|
||||
var ckeditor = CKEDITOR.instances['body'];
|
||||
var content = ckeditor.getData();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentMode='plain';
|
||||
var plaineditor = document.getElementsByName('body')[0];
|
||||
content = plaineditor.value;
|
||||
}
|
||||
|
||||
xajax_doXMLHTTP("felamimail.ajaxfelamimail.changeComposeSignature",composeID,_oldSig,_signatureID,currentMode,content);
|
||||
document.getElementById('mySigID').value = _signatureID;
|
||||
}
|
||||
}
|
||||
|
||||
function fm_compose_setFolderSelectValue(_folderName) {
|
||||
@ -794,14 +836,36 @@ function removeFCK(fieldId)
|
||||
|
||||
function changeIdentity(SelectedId)
|
||||
{
|
||||
//alert(SelectedId.value);
|
||||
// we do the old style (just changing the id, (to be inserted after compose before sending))
|
||||
// but setSignature may try to initiate a switch of the signature within the email body if conditions match
|
||||
xajax_doXMLHTTP("felamimail.ajaxfelamimail.setComposeSignature", SelectedId.value);
|
||||
}
|
||||
function setSignature(SelectedId)
|
||||
{
|
||||
//alert("IS:"+document.getElementById('mySigID').value);
|
||||
var sigBox = document.getElementById('mySigID');
|
||||
currentSig = sigBox.value;
|
||||
|
||||
for (i = 0; i < document.doit.signatureID.length; ++i)
|
||||
if (document.doit.signatureID.options[i].value == SelectedId)
|
||||
{
|
||||
document.doit.signatureID.options[i].selected = true;
|
||||
document.getElementById('mySigID').value = SelectedId;
|
||||
}
|
||||
//else
|
||||
// document.doit.signatureID.options[i].selected = false;
|
||||
|
||||
//alert("Now:"+document.getElementById('mySigID').value);
|
||||
var sigBox = document.getElementById('signatureID');
|
||||
//alert(sigBox);
|
||||
// if we find the id, signature is inserted at the top of the message on compose start.
|
||||
// so we try toi switch, ...
|
||||
if (sigBox == null)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// we try to change the signature
|
||||
if (currentSig != SelectedId) fm_compose_changeSignature(currentSig,SelectedId);
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ deleted felamimail de gelöscht
|
||||
deleted folder successfully! felamimail de Ordner erfolgreich gelöscht
|
||||
deleting messages felamimail de lösche Nachrichten
|
||||
disable felamimail de Deaktivieren
|
||||
disable Ruler for separation of mailbody and signature when adding signature to composed message (this is not according to RFC).<br>If you use templates, this option is only applied to the text part of the message. felamimail de Deaktiviere den automatisch hinzugefügten Trenner zwischen EMailkörper und Signatur (Achtung: Dies ist nicht RFC konform). <br>Wenn Sie Templates zur Formatierung Ihrer EMail benutzen, wird diese Option nur dann Auswirkungen haben, wenn Sie die Signatur am Anfang der EMail eifügen lassen.
|
||||
discard felamimail de verwerfen
|
||||
discard message felamimail de Nachricht verwerfen
|
||||
display message in new window felamimail de Nachricht in neuem Fenster anzeigen
|
||||
@ -251,6 +252,7 @@ inbox felamimail de Posteingang
|
||||
incoming mail server(imap) felamimail de eingehender Mailserver (IMAP)
|
||||
index order felamimail de Spaltenanordnung
|
||||
info felamimail de Info
|
||||
insert the signature at top of the new (or reply) message when opening compose dialog (you may not be able to switch signatures) felamimail de Einfügen der Signatur am Anfang einer neuen EMail (auch Antworten/Weiterleiten). <br>Die Signatur ist dann Teil der EMail und kann möglicherweise nicht über die Funktionalität >Signatur ändern/auswählen< verändert werden.
|
||||
invalid user name or password felamimail de Falscher Benutzername oder Pasword
|
||||
javascript felamimail de JavaScript
|
||||
jumping to end felamimail de springe zum Ende
|
||||
|
@ -102,6 +102,7 @@ deleted felamimail en deleted
|
||||
deleted folder successfully! felamimail en Deleted folder successfully!
|
||||
deleting messages felamimail en deleting messages
|
||||
disable felamimail en Disable
|
||||
disable Ruler for separation of mailbody and signature when adding signature to composed message (this is not according to RFC).<br>If you use templates, this option is only applied to the text part of the message. felamimail en disable Ruler for separation of mailbody and signature when adding signature to composed message (this is not according to RFC).<br>If you use templates, this option is only applied to the text part of the message.
|
||||
discard felamimail en discard
|
||||
discard message felamimail en discard message
|
||||
display message in new window felamimail en Display message in new window
|
||||
@ -254,6 +255,7 @@ inbox felamimail en INBOX
|
||||
incoming mail server(imap) felamimail en incoming mail server(IMAP)
|
||||
index order felamimail en Index Order
|
||||
info felamimail en Info
|
||||
insert the signature at top of the new (or reply) message when opening compose dialog (you may not be able to switch signatures) felamimail en insert the signature at top of the new (or reply) message when opening compose dialog (you may not be able to switch signatures)
|
||||
invalid user name or password felamimail en Invalid user name or password
|
||||
javascript felamimail en JavaScript
|
||||
jumping to end felamimail en jumping to end
|
||||
|
@ -45,6 +45,7 @@
|
||||
<form method="post" name="doit" action="{link_action}" ENCTYPE="multipart/form-data" onsubmit="return check_data();">
|
||||
<input type="hidden" id="saveAsDraft" name="saveAsDraft" value="0">
|
||||
<input type="hidden" id="printit" name="printit" value="0">
|
||||
<input type="hidden" id="mySigID" name="mySigID" value="{mySigID}">
|
||||
<TABLE WIDTH="99%" CELLPADDING="1" CELLSPACING="0" style="border: solid #aaaaaa 1px; border-right: solid black 1px; border-bottom: solid black 1px;">
|
||||
<tr class="navbarBackground">
|
||||
<td align="left" width="270px">
|
||||
|
Loading…
Reference in New Issue
Block a user