From 0d5aab2b6cb3c5401e820a57bda0658ef9d6055b Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 15 Feb 2013 13:04:50 +0000 Subject: [PATCH] attempt to handle preformatting of html correctly on compose --- felamimail/inc/class.bocompose.inc.php | 2 +- felamimail/inc/class.uicompose.inc.php | 28 ++++++++++++++++++-------- felamimail/inc/class.uiwidgets.inc.php | 6 ++++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/felamimail/inc/class.bocompose.inc.php b/felamimail/inc/class.bocompose.inc.php index 8695e072b8..fc41bcdd18 100644 --- a/felamimail/inc/class.bocompose.inc.php +++ b/felamimail/inc/class.bocompose.inc.php @@ -597,7 +597,7 @@ $ccAddress = @htmlspecialchars(lang("cc")).": ".$ccAddress.($bodyParts['0']['mimeType'] == 'text/html'?"
":"\r\n"); } if($bodyParts['0']['mimeType'] == 'text/html') { - $this->sessionData['body'] = /*"
".*/" "."
".'----------------'.lang("original message").'-----------------'."".'
'. + $this->sessionData['body'] = /*"
".*//*" ".*/"
".'----------------'.lang("original message").'-----------------'."".'
'. @htmlspecialchars(lang("from")).": ".$fromAddress."
". $toAddress.$ccAddress. @htmlspecialchars(lang("date").": ".$headers['DATE'],ENT_QUOTES | ENT_IGNORE,felamimail_bo::$displayCharset, false)."
". diff --git a/felamimail/inc/class.uicompose.inc.php b/felamimail/inc/class.uicompose.inc.php index 58edeecbf0..64356d7b52 100644 --- a/felamimail/inc/class.uicompose.inc.php +++ b/felamimail/inc/class.uicompose.inc.php @@ -669,32 +669,44 @@ // User preferences for style $font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font']; $font_size = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size']; - $font_span = ''; + $font_span = ''.' '.''; if (empty($font) && empty($font_size)) $font_span = ''; } //remove possible html header stuff if (stripos($sessionData['body'],'')!==false) $sessionData['body'] = str_ireplace(array('',''),array('',''),$sessionData['body']); //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']) && $this->bocompose->preferencesArray['insertSignatureAtTopOfMessage'] && !(isset($_POST['mySigID']) && !empty($_POST['mySigID']) ) && !$suppressSigOnTop ) { $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') { - $before = ($disableRuler ?' 
':' 

'); + $before = (!empty($font_span) && !($insertSigOnTop === 'below')?$font_span:' ').($disableRuler?''/*($sigTextStartsWithBlockElement?'':'

')*/:'


'); $inbetween = ' 
'; - if (!empty($font_span) && !($insertSigOnTop === 'below')) $before = $font_span.$before.'
'; } else { $before = ($disableRuler ?"\r\n\r\n":"\r\n\r\n-- \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') $sigText = "".$sigText.""; + if ($sessionData['mimeType'] == 'html') + { + $sigText = ($sigTextStartsWithBlockElement?'':"
")."".$sigText."".($sigTextStartsWithBlockElement?'':"
"); + } if ($insertSigOnTop === 'below') { - $sessionData['body'] = $font_span.($font_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 { @@ -703,7 +715,7 @@ } else { - $sessionData['body'] = $font_span.($font_span?($insertSigOnTop?'​':($isReply||isset($replyID)||empty($sessionData['body'])?' ':'')).'':'').$sessionData['body']; + $sessionData['body'] = $font_span.$sessionData['body']; } //error_log(__METHOD__.__LINE__.$sessionData['body']); // prepare body @@ -720,7 +732,7 @@ $sessionData['body'] = utf8_encode($sessionData['body']); } } - + //error_log(__METHOD__.__LINE__.$sessionData['body']); if($sessionData['mimeType'] == 'html') { $mode = 'simple-withimage'; //$mode ='advanced';// most helpful for debuging diff --git a/felamimail/inc/class.uiwidgets.inc.php b/felamimail/inc/class.uiwidgets.inc.php index 3f7e9334a3..80d792d1c4 100644 --- a/felamimail/inc/class.uiwidgets.inc.php +++ b/felamimail/inc/class.uiwidgets.inc.php @@ -211,6 +211,12 @@ class uiwidgets $key = array_search($longName,$userDefinedFunctionFolders); $image1 = $image2 = $image3 = "'MailFolder".$key.".png'"; } + elseif (in_array($longName,$suFolders)) + { + $image1 = "'folderNoSelectClosed.gif'"; + $image2 = "'folderNoSelectOpen.gif'"; + $image3 = "'folderNoSelectClosed.gif'"; + } else { $image1 = "'MailFolderPlain.png'";