summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-03-02 14:48:26 +0000
committeralecpl <alec@alec.pl>2010-03-02 14:48:26 +0000
commit55243b590c9baaea47c78ed99c8099ff091ebad7 (patch)
tree11f004553e493289e1098961176805a4af020921 /program/steps/mail
parent3704b78841ba05c31a2acaeabdffb9c471bb6610 (diff)
- Hide 'add contact' icon if there's no writable address book
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/func.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index a8ef65139..be3bbbf06 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1170,7 +1170,8 @@ function rcmail_alter_html_link($matches)
*/
function rcmail_address_string($input, $max=null, $linked=false, $addicon=null)
{
- global $IMAP, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN;
+ global $IMAP, $RCMAIL, $PRINT_MODE, $CONFIG, $OUTPUT, $EMAIL_ADDRESS_PATTERN;
+ static $got_writable_abook = null;
$a_parts = $IMAP->decode_address_list($input);
@@ -1181,6 +1182,10 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null)
$j = 0;
$out = '';
+ if ($got_writable_abook === null && $books = $RCMAIL->get_address_sources(true)) {
+ $got_writable_abook = true;
+ }
+
foreach ($a_parts as $part) {
$j++;
if ($PRINT_MODE) {
@@ -1200,7 +1205,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null)
$out .= html::span(array('title' => $part['mailto'], 'class' => "rcmContactAddress"), Q($part['name']));
}
- if ($addicon) {
+ if ($addicon && $got_writable_abook) {
$out .= '&nbsp;' . html::a(array(
'href' => "#add",
'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($part['string'])),