Changeset 4965 in subversion


Ignore:
Timestamp:
Jul 25, 2011 7:48:50 AM (22 months ago)
Author:
alec
Message:
  • Fixed display name on contact lists
Location:
trunk/roundcubemail/program
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_addressbook.php

    r4919 r4965  
    435435     * 
    436436     * @param array  Hash array with contact data as key-value pairs 
     437     * @param bool   The name will be used on the list 
     438     * 
    437439     * @return string Display name 
    438440     */ 
    439     public static function compose_display_name($contact) 
     441    public static function compose_display_name($contact, $list_mode = false) 
    440442    { 
    441443        $contact = rcmail::get_instance()->plugins->exec_hook('contact_displayname', $contact); 
     
    447449        // use email address part for name 
    448450        $email = is_array($contact['email']) ? $contact['email'][0] : $contact['email']; 
     451 
    449452        if ($email && (empty($fn) || $fn == $email)) { 
     453            // Use full email address on contacts list 
     454            if ($list_mode) 
     455                return $email; 
     456 
    450457            list($emailname) = explode('@', $email); 
    451458            if (preg_match('/(.*)[\.\-\_](.*)/', $emailname, $match)) 
  • trunk/roundcubemail/program/steps/addressbook/func.inc

    r4959 r4965  
    295295 
    296296        // format each col 
    297         foreach ($a_show_cols as $col) 
    298             $a_row_cols[$col] = Q($row[$col]); 
     297        foreach ($a_show_cols as $col) { 
     298            $val = $row[$col]; 
     299            if ($val == '' && $col == 'name') { 
     300                $val = rcube_addressbook::compose_display_name($row, true); 
     301            } 
     302            $a_row_cols[$col] = Q($val); 
     303        } 
    299304 
    300305        $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols); 
  • trunk/roundcubemail/program/steps/addressbook/save.inc

    r4959 r4965  
    189189    $record = $CONTACTS->get_record($newcid ? $newcid : $cid, true); 
    190190    $record['email'] = reset($CONTACTS->get_col_values('email', $record, true)); 
    191     if (!$record['name']) 
    192       $record['name'] = $record['email']; 
     191    if (empty($record['name'])) 
     192      $record['name']  = rcube_addressbook::compose_display_name($record, true); 
    193193 
    194194    foreach (array('name', 'email') as $col) 
Note: See TracChangeset for help on using the changeset viewer.