alecpl
2010-03-02 55243b590c9baaea47c78ed99c8099ff091ebad7
- Hide 'add contact' icon if there's no writable address book


1 files modified
9 ■■■■ changed files
program/steps/mail/func.inc 9 ●●●● patch | view | raw | blame | history
program/steps/mail/func.inc
@@ -1170,7 +1170,8 @@
 */
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 @@
  $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 @@
        $out .= html::span(array('title' => $part['mailto'], 'class' => "rcmContactAddress"), Q($part['name']));
      }
      if ($addicon) {
      if ($addicon && $got_writable_abook) {
        $out .= ' ' . html::a(array(
            'href' => "#add",
            'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($part['string'])),