| | |
| | | | | |
| | | | 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) | |
| | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | |
| | | */ |
| | | |
| | | $jsenv = array(); |
| | |
| | | $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 |
| | |
| | | $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'); |
| | |
| | | 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'); |
| | | } |
| | | } |
| | | } |