Aleksander Machniak
2012-05-22 041c93ce0bc00cb6417ce2e4bdce2ed84d37f50a
program/steps/mail/list_contacts.inc
@@ -6,7 +6,10 @@
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2012, The Roundcube Dev Team                            |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
 | See the README file for a full license statement.                     |
 |                                                                       |
 | PURPOSE:                                                              |
 |   Send contacts list to client (as remote response)                   |
@@ -14,9 +17,6 @@
 +-----------------------------------------------------------------------+
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+
 $Id$
*/
$jsenv = array();
@@ -42,7 +42,7 @@
                    $row_id = 'G'.$group['ID'];
                    $jsresult[$row_id] = format_email_recipient($email, $group['name']);
                    $OUTPUT->command('add_contact_row', $row_id, array(
                        'contactgroup' => html::span(array('title' => $email), Q($group['name']))));
                        'contactgroup' => html::span(array('title' => $email), Q($group['name']))), 'group');
                }
            }
            // show group with count
@@ -50,14 +50,14 @@
                $row_id = 'E'.$group['ID'];
                $jsresult[$row_id] = $group['name'];
                $OUTPUT->command('add_contact_row', $row_id, array(
                    'contactgroup' => Q($group['name'] . ' (' . intval($result->count) . ')')));
                    'contactgroup' => Q($group['name'] . ' (' . intval($result->count) . ')')), 'group');
            }
        }
    }
    // get contacts for this user
    $CONTACTS->set_group(0);
    $result = $CONTACTS->list_records(array('name', 'email'));
    $result = $CONTACTS->list_records(array('name', 'firstname', 'surname', 'email'));
    if (!$result->count && $result->searchonly) {
        $OUTPUT->show_message('contactsearchonly', 'notice');
@@ -65,14 +65,14 @@
    else if (!empty($result) && $result->count > 0) {
        // create javascript list
        while ($row = $result->next()) {
            $name = rcube_addressbook::compose_display_name($row, true);
            $name = rcube_addressbook::compose_list_name($row);
            // add record for every email address of the contact
            foreach ($CONTACTS->get_col_values('email', $row, true) as $i => $email) {
                $row_id = $row['ID'].$i;
                $jsresult[$row_id] = format_email_recipient($email, $name);
                $OUTPUT->command('add_contact_row', $row_id, array(
                    'contact' => html::span(array('title' => $email), Q($name ? $name : $email))));
                    'contact' => html::span(array('title' => $email), Q($name ? $name : $email))), 'person');
            }
        }
    }