mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 08:09:02 +01:00
attempt to handle preformatting of html correctly on compose
This commit is contained in:
parent
0dcd5dbe5c
commit
0d5aab2b6c
@ -597,7 +597,7 @@
|
|||||||
$ccAddress = @htmlspecialchars(lang("cc")).": ".$ccAddress.($bodyParts['0']['mimeType'] == 'text/html'?"<br>":"\r\n");
|
$ccAddress = @htmlspecialchars(lang("cc")).": ".$ccAddress.($bodyParts['0']['mimeType'] == 'text/html'?"<br>":"\r\n");
|
||||||
}
|
}
|
||||||
if($bodyParts['0']['mimeType'] == 'text/html') {
|
if($bodyParts['0']['mimeType'] == 'text/html') {
|
||||||
$this->sessionData['body'] = /*"<br>".*/" "."<div>".'----------------'.lang("original message").'-----------------'."".'<br>'.
|
$this->sessionData['body'] = /*"<br>".*//*" ".*/"<div>".'----------------'.lang("original message").'-----------------'."".'<br>'.
|
||||||
@htmlspecialchars(lang("from")).": ".$fromAddress."<br>".
|
@htmlspecialchars(lang("from")).": ".$fromAddress."<br>".
|
||||||
$toAddress.$ccAddress.
|
$toAddress.$ccAddress.
|
||||||
@htmlspecialchars(lang("date").": ".$headers['DATE'],ENT_QUOTES | ENT_IGNORE,felamimail_bo::$displayCharset, false)."<br>".
|
@htmlspecialchars(lang("date").": ".$headers['DATE'],ENT_QUOTES | ENT_IGNORE,felamimail_bo::$displayCharset, false)."<br>".
|
||||||
|
@ -669,32 +669,44 @@
|
|||||||
// User preferences for style
|
// User preferences for style
|
||||||
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
|
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
|
||||||
$font_size = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
|
$font_size = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
|
||||||
$font_span = '<span '.($font||$font_size?'style="':'').($font?'font-family:'.$font.'; ':'').';'.($font_size?'font-size:'.$font_size.'; ':'').'">';
|
$font_span = '<span '.($font||$font_size?'style="':'').($font?'font-family:'.$font.'; ':'').';'.($font_size?'font-size:'.$font_size.'; ':'').'">'.' '.'</span>';
|
||||||
if (empty($font) && empty($font_size)) $font_span = '';
|
if (empty($font) && empty($font_size)) $font_span = '';
|
||||||
}
|
}
|
||||||
//remove possible html header stuff
|
//remove possible html header stuff
|
||||||
if (stripos($sessionData['body'],'<html><head></head><body>')!==false) $sessionData['body'] = str_ireplace(array('<html><head></head><body>','</body></html>'),array('',''),$sessionData['body']);
|
if (stripos($sessionData['body'],'<html><head></head><body>')!==false) $sessionData['body'] = str_ireplace(array('<html><head></head><body>','</body></html>'),array('',''),$sessionData['body']);
|
||||||
//error_log(__METHOD__.__LINE__.array2string($this->bocompose->preferencesArray));
|
//error_log(__METHOD__.__LINE__.array2string($this->bocompose->preferencesArray));
|
||||||
|
$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->bocompose->preferencesArray['insertSignatureAtTopOfMessage']) &&
|
if (isset($this->bocompose->preferencesArray['insertSignatureAtTopOfMessage']) &&
|
||||||
$this->bocompose->preferencesArray['insertSignatureAtTopOfMessage'] &&
|
$this->bocompose->preferencesArray['insertSignatureAtTopOfMessage'] &&
|
||||||
!(isset($_POST['mySigID']) && !empty($_POST['mySigID']) ) && !$suppressSigOnTop
|
!(isset($_POST['mySigID']) && !empty($_POST['mySigID']) ) && !$suppressSigOnTop
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$insertSigOnTop = ($insertSigOnTop?$insertSigOnTop:true);
|
$insertSigOnTop = ($insertSigOnTop?$insertSigOnTop:true);
|
||||||
|
$sigText = felamimail_bo::merge($signature->fm_signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||||
|
if ($sessionData['mimeType'] == 'html')
|
||||||
|
{
|
||||||
|
$sigTextStartsWithBlockElement = ($disableRuler?false:true);
|
||||||
|
foreach($blockElements as $e)
|
||||||
|
{
|
||||||
|
if ($sigTextStartsWithBlockElement) break;
|
||||||
|
if (stripos(trim($sigText),'<'.$e)===0) $sigTextStartsWithBlockElement = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if($sessionData['mimeType'] == 'html') {
|
if($sessionData['mimeType'] == 'html') {
|
||||||
$before = ($disableRuler ?' <br>':' <br><hr style="border:1px dotted silver; width:90%;">');
|
$before = (!empty($font_span) && !($insertSigOnTop === 'below')?$font_span:' ').($disableRuler?''/*($sigTextStartsWithBlockElement?'':'<p style="margin:0px;"/>')*/:'<hr style="border:1px dotted silver; width:90%;">');
|
||||||
$inbetween = ' <br>';
|
$inbetween = ' <br>';
|
||||||
if (!empty($font_span) && !($insertSigOnTop === 'below')) $before = $font_span.$before.'</span>';
|
|
||||||
} else {
|
} else {
|
||||||
$before = ($disableRuler ?"\r\n\r\n":"\r\n\r\n-- \r\n");
|
$before = ($disableRuler ?"\r\n\r\n":"\r\n\r\n-- \r\n");
|
||||||
$inbetween = "\r\n";
|
$inbetween = "\r\n";
|
||||||
}
|
}
|
||||||
$sigText = felamimail_bo::merge($signature->fm_signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
if ($sessionData['mimeType'] == 'html')
|
||||||
if ($sessionData['mimeType'] == 'html') $sigText = "<!-- HTMLSIGBEGIN -->".$sigText."<!-- HTMLSIGEND -->";
|
{
|
||||||
|
$sigText = ($sigTextStartsWithBlockElement?'':"<div>")."<!-- HTMLSIGBEGIN -->".$sigText."<!-- HTMLSIGEND -->".($sigTextStartsWithBlockElement?'':"</div>");
|
||||||
|
}
|
||||||
|
|
||||||
if ($insertSigOnTop === 'below')
|
if ($insertSigOnTop === 'below')
|
||||||
{
|
{
|
||||||
$sessionData['body'] = $font_span.($font_span?'​</span>':'').$sessionData['body'].$before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText));
|
$sessionData['body'] = $font_span.$sessionData['body'].$before.($sessionData['mimeType'] == 'html'?$sigText:$this->bocompose->convertHTMLToText($sigText));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -703,7 +715,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sessionData['body'] = $font_span.($font_span?($insertSigOnTop?'​':($isReply||isset($replyID)||empty($sessionData['body'])?' ':'')).'</span>':'').$sessionData['body'];
|
$sessionData['body'] = $font_span.$sessionData['body'];
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__.__LINE__.$sessionData['body']);
|
//error_log(__METHOD__.__LINE__.$sessionData['body']);
|
||||||
// prepare body
|
// prepare body
|
||||||
@ -720,7 +732,7 @@
|
|||||||
$sessionData['body'] = utf8_encode($sessionData['body']);
|
$sessionData['body'] = utf8_encode($sessionData['body']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//error_log(__METHOD__.__LINE__.$sessionData['body']);
|
||||||
if($sessionData['mimeType'] == 'html') {
|
if($sessionData['mimeType'] == 'html') {
|
||||||
$mode = 'simple-withimage';
|
$mode = 'simple-withimage';
|
||||||
//$mode ='advanced';// most helpful for debuging
|
//$mode ='advanced';// most helpful for debuging
|
||||||
|
@ -211,6 +211,12 @@ class uiwidgets
|
|||||||
$key = array_search($longName,$userDefinedFunctionFolders);
|
$key = array_search($longName,$userDefinedFunctionFolders);
|
||||||
$image1 = $image2 = $image3 = "'MailFolder".$key.".png'";
|
$image1 = $image2 = $image3 = "'MailFolder".$key.".png'";
|
||||||
}
|
}
|
||||||
|
elseif (in_array($longName,$suFolders))
|
||||||
|
{
|
||||||
|
$image1 = "'folderNoSelectClosed.gif'";
|
||||||
|
$image2 = "'folderNoSelectOpen.gif'";
|
||||||
|
$image3 = "'folderNoSelectClosed.gif'";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$image1 = "'MailFolderPlain.png'";
|
$image1 = "'MailFolderPlain.png'";
|
||||||
|
Loading…
Reference in New Issue
Block a user