mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-12 19:16:49 +01:00
fixed signature issues
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
CHANGELOG RoundCube Webmail
|
||||
---------------------------
|
||||
|
||||
2006/12/03 (estadtherr)
|
||||
----------
|
||||
- Added fix to convert HTML signatures for plain text messages
|
||||
- Fixed signature delimeter character to be standard (Bug #1484035)
|
||||
|
||||
|
||||
2006/12/01 (thomasb)
|
||||
----------
|
||||
- Implemented preview pane
|
||||
|
||||
@@ -1714,50 +1714,54 @@ function rcube_webmail()
|
||||
if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity])
|
||||
{
|
||||
sig = this.env.signatures[this.env.identity]['text'];
|
||||
if (sig.indexOf('--')!=0)
|
||||
sig = '--\n'+sig;
|
||||
|
||||
if (sig.indexOf('-- ')!=0)
|
||||
sig = '-- \n'+sig;
|
||||
|
||||
p = message.lastIndexOf(sig);
|
||||
if (p>=0)
|
||||
message = message.substring(0, p-1) + message.substring(p+sig.length, message.length);
|
||||
}
|
||||
|
||||
|
||||
// add the new signature string
|
||||
if (this.env.signatures && this.env.signatures[id])
|
||||
{
|
||||
sig = this.env.signatures[id]['text'];
|
||||
if (sig.indexOf('--')!=0)
|
||||
sig = '--\n'+sig;
|
||||
if (this.env.signatures[id]['is_html'])
|
||||
{
|
||||
sig = this.env.signatures[id]['plain_text'];
|
||||
}
|
||||
if (sig.indexOf('-- ')!=0)
|
||||
sig = '-- \n'+sig;
|
||||
message += '\n'+sig;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var eid = tinyMCE.getEditorId('_message');
|
||||
// editor is a TinyMCE_Control object
|
||||
var editor = tinyMCE.getInstanceById(eid);
|
||||
var msgDoc = editor.getDoc();
|
||||
var msgBody = msgDoc.body;
|
||||
var eid = tinyMCE.getEditorId('_message');
|
||||
// editor is a TinyMCE_Control object
|
||||
var editor = tinyMCE.getInstanceById(eid);
|
||||
var msgDoc = editor.getDoc();
|
||||
var msgBody = msgDoc.body;
|
||||
|
||||
if (this.env.signatures && this.env.signatures[id])
|
||||
if (this.env.signatures && this.env.signatures[id])
|
||||
{
|
||||
// Append the signature as a span within the body
|
||||
var sigElem = msgDoc.getElementById("_rc_sig");
|
||||
if (!sigElem)
|
||||
{
|
||||
// Append the signature as a span within the body
|
||||
var sigElem = msgDoc.getElementById("_rc_sig");
|
||||
if (!sigElem)
|
||||
{
|
||||
sigElem = msgDoc.createElement("span");
|
||||
sigElem.setAttribute("id", "_rc_sig");
|
||||
msgBody.appendChild(sigElem);
|
||||
}
|
||||
if (this.env.signatures[id]['is_html'])
|
||||
{
|
||||
sigElem.innerHTML = this.env.signatures[id]['text'];
|
||||
}
|
||||
else
|
||||
{
|
||||
sigElem.innerHTML = '<pre>' + this.env.signatures[id]['text'] + '</pre>';
|
||||
}
|
||||
sigElem = msgDoc.createElement("span");
|
||||
sigElem.setAttribute("id", "_rc_sig");
|
||||
msgBody.appendChild(sigElem);
|
||||
}
|
||||
if (this.env.signatures[id]['is_html'])
|
||||
{
|
||||
sigElem.innerHTML = this.env.signatures[id]['text'];
|
||||
}
|
||||
else
|
||||
{
|
||||
sigElem.innerHTML = '<pre>' + this.env.signatures[id]['text'] + '</pre>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (input_message)
|
||||
|
||||
@@ -164,7 +164,7 @@ class html2text
|
||||
'$this->_build_link_list("\\1", "\\2")', // <a href="">
|
||||
"strtoupper(\"\n\n\\1\n\n\")", // H1 - H3
|
||||
"ucwords(\"\n\n\\1\n\n\")", // H4 - H6
|
||||
"\n\n\t", // <P>
|
||||
"\n", // <P>
|
||||
"\n", // <br>
|
||||
'strtoupper("\\1")', // <b>
|
||||
'_\\1_', // <i>
|
||||
@@ -232,6 +232,15 @@ class html2text
|
||||
* @see _build_link_list()
|
||||
*/
|
||||
var $_link_list = array();
|
||||
|
||||
/**
|
||||
* Boolean flag, true if a table of link URLs should be listed after the text.
|
||||
*
|
||||
* @var boolean $_do_links
|
||||
* @access private
|
||||
* @see html2text()
|
||||
*/
|
||||
var $_do_links = true;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -242,15 +251,17 @@ class html2text
|
||||
*
|
||||
* @param string $source HTML content
|
||||
* @param boolean $from_file Indicates $source is a file to pull content from
|
||||
* @param boolean $do_link_table indicate whether a table of link URLs is desired
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function html2text( $source = '', $from_file = false )
|
||||
function html2text( $source = '', $from_file = false, $do_link_table = true )
|
||||
{
|
||||
if ( !empty($source) ) {
|
||||
$this->set_html($source, $from_file);
|
||||
}
|
||||
$this->set_base_url();
|
||||
$this->_do_links = $produce_link_table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -409,6 +420,8 @@ class html2text
|
||||
*/
|
||||
function _build_link_list($link, $display)
|
||||
{
|
||||
if (! $this->_do_links) return $display;
|
||||
|
||||
$link_lc = strtolower($link);
|
||||
|
||||
if (substr($link_lc, 0, 7) == 'http://' || substr($link_lc, 0, 8) == 'https://' || substr($link_lc, 0, 7) == 'mailto:')
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
require_once('Mail/mimeDecode.php');
|
||||
require_once('lib/html2text.inc');
|
||||
|
||||
// define constants for message compose mode
|
||||
define('RCUBE_COMPOSE_REPLY', 0x0106);
|
||||
@@ -296,6 +297,12 @@ function rcmail_compose_header_from($attrib)
|
||||
{
|
||||
$a_signatures[$identity_id]['text'] = $sql_arr['signature'];
|
||||
$a_signatures[$identity_id]['is_html'] = ($sql_arr['html_signature'] == 1) ? true : false;
|
||||
if ($a_signatures[$identity_id]['is_html'])
|
||||
{
|
||||
$h2t = new html2text($a_signatures[$identity_id]['text'], false, false);
|
||||
$plainTextPart = $h2t->get_text();
|
||||
$a_signatures[$identity_id]['plain_text'] = trim($plainTextPart);
|
||||
}
|
||||
}
|
||||
|
||||
// set identity if it's one of the reply-message recipients
|
||||
|
||||
@@ -56,7 +56,7 @@ function rcube_identity_form($attrib)
|
||||
"theme_advanced_toolbar_location : 'top'," .
|
||||
"theme_advanced_toolbar_align : 'left'," .
|
||||
"theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr'," .
|
||||
"theme_advanced_buttons2 : 'link,unlink,forecolor,fontselect,fontsizeselect'," .
|
||||
"theme_advanced_buttons2 : 'link,unlink,code,forecolor,fontselect,fontsizeselect'," .
|
||||
"theme_advanced_buttons3 : '' });");
|
||||
|
||||
if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity')
|
||||
|
||||
Reference in New Issue
Block a user