Remove mailto links from sender/recipient addresses in message list and wait for the context menu (#1484931)

release-0.6
thomascube 17 years ago
parent 9e7a1b4167
commit 8e44f425f8

@ -245,7 +245,7 @@ function rcmail_message_list($attrib)
foreach ($a_show_cols as $col) foreach ($a_show_cols as $col)
{ {
if ($col=='from' || $col=='to') if ($col=='from' || $col=='to')
$cont = Q(rcmail_address_string($header->$col, 3, $attrib['addicon']), 'show'); $cont = Q(rcmail_address_string($header->$col, 3, false, $attrib['addicon']), 'show');
else if ($col=='subject') else if ($col=='subject')
{ {
$action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show';
@ -757,7 +757,7 @@ function rcmail_message_headers($attrib, $headers=NULL)
$header_value = format_date($headers[$hkey]); $header_value = format_date($headers[$hkey]);
} }
else if (in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to'))) else if (in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to')))
$header_value = Q(rcmail_address_string($headers[$hkey], NULL, $attrib['addicon']), 'show'); $header_value = Q(rcmail_address_string($headers[$hkey], null, true, $attrib['addicon']), 'show');
else else
$header_value = Q($IMAP->decode_header($headers[$hkey])); $header_value = Q($IMAP->decode_header($headers[$hkey]));
@ -942,8 +942,8 @@ function rcmail_alter_html_link($tag, $attrs, $container_id)
/** /**
* decode address string and re-format it as HTML links * decode address string and re-format it as HTML links
*/ */
function rcmail_address_string($input, $max=NULL, $addicon=NULL) function rcmail_address_string($input, $max=null, $linked=false, $addicon=null)
{ {
global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN; global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN;
$a_parts = $IMAP->decode_address_list($input); $a_parts = $IMAP->decode_address_list($input);
@ -955,48 +955,56 @@ function rcmail_address_string($input, $max=NULL, $addicon=NULL)
$j = 0; $j = 0;
$out = ''; $out = '';
foreach ($a_parts as $part) foreach ($a_parts as $part) {
{
$j++; $j++;
if ($PRINT_MODE) if ($PRINT_MODE) {
$out .= sprintf('%s <%s>', Q($part['name']), $part['mailto']); $out .= sprintf('%s <%s>', Q($part['name']), $part['mailto']);
else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) }
{ else if (preg_match($EMAIL_ADDRESS_PATTERN, $part['mailto'])) {
$out .= sprintf('<a href="mailto:%s" onclick="return %s.command(\'compose\',\'%s\',this)" class="rcmContactAddress" title="%s">%s</a>', if ($linked) {
Q($part['mailto']), $out .= html::a(array(
JS_OBJECT_NAME, 'href' => 'mailto:'.$part['mailto'],
JQ($part['mailto']), 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($part['mailto'])),
Q($part['mailto']), 'title' => $part['mailto'],
Q($part['name'])); 'class' => "rcmContactAddress",
),
if ($addicon) Q($part['name']));
$out .= sprintf('&nbsp;<a href="#add" onclick="return %s.command(\'add-contact\',\'%s\',this)" title="%s"><img src="%s%s" alt="add" border="0" /></a>',
JS_OBJECT_NAME,
urlencode($part['string']),
rcube_label('addtoaddressbook'),
$CONFIG['skin_path'],
$addicon);
} }
else else {
{ $out .= html::span(array('title' => $part['mailto'], 'class' => "rcmContactAddress"), Q($part['name']));
}
if ($addicon) {
$out .= '&nbsp;' . html::a(array(
'href' => "#add",
'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($part['string'])),
'title' => rcube_label('addtoaddressbook'),
),
html::img(array(
'src' => $CONFIG['skin_path'] . $addicon,
'alt' => "Add contact",
'border' => 0,
)));
}
}
else {
if ($part['name']) if ($part['name'])
$out .= Q($part['name']); $out .= Q($part['name']);
if ($part['mailto']) if ($part['mailto'])
$out .= (strlen($out) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($part['mailto'])); $out .= (strlen($out) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($part['mailto']));
} }
if ($c>$j) if ($c>$j)
$out .= ','.($max ? '&nbsp;' : ' '); $out .= ','.($max ? '&nbsp;' : ' ');
if ($max && $j==$max && $c>$j) if ($max && $j==$max && $c>$j) {
{
$out .= '...'; $out .= '...';
break; break;
}
} }
}
return $out; return $out;
} }
function rcmail_message_part_controls() function rcmail_message_part_controls()

@ -18,7 +18,7 @@ body.extwin
margin: 10px; margin: 10px;
} }
body, td, th, span, div, p, h3 body, td, th, div, p, h3
{ {
font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
font-size: 12px; font-size: 12px;

Loading…
Cancel
Save