Merge branch 'dev-advanced-ldap-groups':

- Refactoring: separated address book implementation from generic LDAP wrapper class
- Auto-detect and use VLV indices for all search operations
- Additional group configuration options for LDAP address books
- Allow address books to display a multi-level group hierarchy in the contacts list
pull/82/head
Thomas Bruederli 12 years ago
commit dd54725b21

@ -651,6 +651,7 @@ $rcmail_config['ldap_public']['Verisign'] = array(
'phone:work' => 'telephoneNumber',
'phone:mobile' => 'mobile',
'phone:pager' => 'pager',
'phone:workfax' => 'facsimileTelephoneNumber',
'street' => 'street',
'zipcode' => 'postalCode',
'region' => 'st',
@ -661,9 +662,8 @@ $rcmail_config['ldap_public']['Verisign'] = array(
'department' => 'ou',
'jobtitle' => 'title',
'notes' => 'description',
'photo' => 'jpegPhoto',
// these currently don't work:
// 'phone:workfax' => 'facsimileTelephoneNumber',
// 'photo' => 'jpegPhoto',
// 'manager' => 'manager',
// 'assistant' => 'secretary',
),
@ -674,27 +674,48 @@ $rcmail_config['ldap_public']['Verisign'] = array(
// 'uid' => 'md5(microtime())', // You may specify PHP code snippets which are then eval'ed
// 'mail' => '{givenname}.{sn}@mydomain.com', // or composite strings with placeholders for existing attributes
),
'sort' => 'cn', // The field to sort the listing by.
'scope' => 'sub', // search mode: sub|base|list
'filter' => '(objectClass=inetOrgPerson)', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
'fuzzy_search' => true, // server allows wildcard search
'vlv' => false, // Enable Virtual List View to more efficiently fetch paginated data (if server supports it)
'numsub_filter' => '(objectClass=organizationalUnit)', // with VLV, we also use numSubOrdinates to query the total number of records. Set this filter to get all numSubOrdinates attributes for counting
'sizelimit' => '0', // Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
'timelimit' => '0', // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.
'referrals' => true|false, // Sets the LDAP_OPT_REFERRALS option. Mostly used in multi-domain Active Directory setups
'sort' => 'cn', // The field to sort the listing by.
'scope' => 'sub', // search mode: sub|base|list
'filter' => '(objectClass=inetOrgPerson)', // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
'fuzzy_search' => true, // server allows wildcard search
'vlv' => false, // Enable Virtual List View to more efficiently fetch paginated data (if server supports it)
'vlv_search' => false, // Use Virtual List View functions for autocompletion searches (if server supports it)
'numsub_filter' => '(objectClass=organizationalUnit)', // with VLV, we also use numSubOrdinates to query the total number of records. Set this filter to get all numSubOrdinates attributes for counting
'config_root_dn' => 'cn=config', // Root DN to search config entries (e.g. vlv indexes)
'sizelimit' => '0', // Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
'timelimit' => '0', // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.
'referrals' => false, // Sets the LDAP_OPT_REFERRALS option. Mostly used in multi-domain Active Directory setups
// definition for contact groups (uncomment if no groups are supported)
// for the groups base_dn, the user replacements %fu, %u, $d and %dc work as for base_dn (see above)
// if the groups base_dn is empty, the contact base_dn is used for the groups as well
// -> in this case, assure that groups and contacts are separated due to the concernig filters!
'groups' => array(
'base_dn' => '',
'scope' => 'sub', // search mode: sub|base|list
'filter' => '(objectClass=groupOfNames)',
'groups' => array(
'base_dn' => '',
'scope' => 'sub', // Search mode: sub|base|list
'filter' => '(objectClass=groupOfNames)',
'object_classes' => array("top", "groupOfNames"),
'member_attr' => 'member', // name of the member attribute, e.g. uniqueMember
'name_attr' => 'cn', // attribute to be used as group name
'member_attr' => 'member', // Name of the member attribute, e.g. uniqueMember
'name_attr' => 'cn', // Attribute to be used as group name
'member_filter' => '(objectclass=*)', // Optional filter to use when querying for group members
'vlv' => false, // Use VLV controls to list groups
),
// this configuration replaces the regular groups listing in the directory tree with
// a hard-coded list of groups, each listing entries with the configured base DN and filter.
// if the 'groups' option from above is set, it'll be shown as the first entry with the name 'Groups'
'group_filters' => array(
'departments' => array(
'name' => 'Company Departments',
'scope' => 'list',
'base_dn' => 'ou=Groups,dc=mydomain,dc=com',
'filter' => '(|(objectclass=groupofuniquenames)(objectclass=groupofurls))',
),
'customers' => array(
'name' => 'Customers',
'scope' => 'sub',
'base_dn' => 'ou=Customers,dc=mydomain,dc=com',
'filter' => '(objectClass=inetOrgPerson)',
),
),
);
*/

@ -294,7 +294,7 @@ class rcmail extends rcube
$list[$id] = array(
'id' => $id,
'name' => html::quote($prop['name']),
'groups' => is_array($prop['groups']),
'groups' => !empty($prop['groups']) || !empty($prop['group_filters']),
'readonly' => !$prop['writable'],
'hidden' => $prop['hidden'],
'autocomplete' => in_array($id, $autocomplete)

@ -255,7 +255,8 @@ function rcube_webmail()
}
}
else if (this.env.action == 'compose') {
this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', 'cancel', 'toggle-editor', 'list-adresses', 'search', 'reset-search', 'extwin'];
this.env.address_group_stack = [];
this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', 'cancel', 'toggle-editor', 'list-adresses', 'pushgroup', 'search', 'reset-search', 'extwin'];
if (this.env.drafts_mailbox)
this.env.compose_commands.push('savedraft')
@ -323,11 +324,13 @@ function rcube_webmail()
break;
case 'addressbook':
this.env.address_group_stack = [];
if (this.gui_objects.folderlist)
this.env.contactfolders = $.extend($.extend({}, this.env.address_sources), this.env.contactgroups);
this.enable_command('add', 'import', this.env.writable_source);
this.enable_command('list', 'listgroup', 'listsearch', 'advanced-search', true);
this.enable_command('list', 'listgroup', 'pushgroup', 'popgroup', 'listsearch', 'advanced-search', true);
if (this.gui_objects.contactslist) {
this.contact_list = new rcube_list_widget(this.gui_objects.contactslist,
@ -1097,11 +1100,25 @@ function rcube_webmail()
}
break;
case 'pushgroup':
// add group ID to stack
this.env.address_group_stack.push(props.id);
if (obj && event)
rcube_event.cancel(event);
case 'listgroup':
this.reset_qsearch();
this.list_contacts(props.source, props.id);
break;
case 'popgroup':
if (this.env.address_group_stack.length > 1) {
this.env.address_group_stack.pop();
this.reset_qsearch();
this.list_contacts(props.source, this.env.address_group_stack[this.env.address_group_stack.length-1]);
}
break;
case 'import-messages':
var form = props || this.gui_objects.importform;
$('input[name="_unlock"]', form).val(this.set_busy(true, 'importwait'));
@ -3091,7 +3108,13 @@ function rcube_webmail()
this.compose_recipient_select = function(list)
{
this.enable_command('add-recipient', list.selection.length > 0);
var id, n, recipients = 0;
for (n=0; n < list.selection.length; n++) {
id = list.selection[n];
if (this.env.contactdata[id])
recipients++;
}
this.enable_command('add-recipient', recipients);
};
this.compose_add_recipient = function(field)
@ -4109,7 +4132,7 @@ function rcube_webmail()
if (this.preview_timer)
clearTimeout(this.preview_timer);
var n, id, sid, ref = this, writable = false,
var n, id, sid, contact, ref = this, writable = false,
source = this.env.source ? this.env.address_sources[this.env.source] : null;
// we don't have dblclick handler here, so use 200 instead of this.dblclick_time
@ -4124,29 +4147,35 @@ function rcube_webmail()
// we'll also need to know sources used in selection for copy
// and group-addmember operations (drag&drop)
this.env.selection_sources = [];
if (!source) {
for (n in list.selection) {
if (source) {
this.env.selection_sources.push(this.env.source);
}
for (n in list.selection) {
contact = list.data[list.selection[n]];
if (!source) {
sid = String(list.selection[n]).replace(/^[^-]+-/, '');
if (sid && this.env.address_sources[sid]) {
writable = writable || !this.env.address_sources[sid].readonly;
writable = writable || (!this.env.address_sources[sid].readonly && !contact.readonly);
this.env.selection_sources.push(sid);
}
}
this.env.selection_sources = $.unique(this.env.selection_sources);
}
else {
this.env.selection_sources.push(this.env.source);
writable = !source.readonly;
else {
writable = writable || (!source.readonly && !contact.readonly);
}
}
this.env.selection_sources = $.unique(this.env.selection_sources);
}
// if a group is currently selected, and there is at least one contact selected
// thend we can enable the group-remove-selected command
this.enable_command('group-remove-selected', this.env.group && list.selection.length > 0);
this.enable_command('group-remove-selected', this.env.group && list.selection.length > 0 && writable);
this.enable_command('compose', this.env.group || list.selection.length > 0);
this.enable_command('export-selected', list.selection.length > 0);
this.enable_command('edit', id && writable);
this.enable_command('delete', list.selection.length && writable);
this.enable_command('delete', list.selection.length > 0 && writable);
return false;
};
@ -4174,11 +4203,29 @@ function rcube_webmail()
else if (!this.env.search_request)
folder = group ? 'G'+src+group : src;
this.select_folder(folder, '', true);
this.env.source = src;
this.env.group = group;
// truncate groups listing stack
var index = $.inArray(this.env.group, this.env.address_group_stack);
if (index < 0)
this.env.address_group_stack = [];
else
this.env.address_group_stack = this.env.address_group_stack.slice(0,index);
// make sure the current group is on top of the stack
if (this.env.group) {
this.env.address_group_stack.push(this.env.group);
// mark the first group on the stack as selected in the directory list
folder = 'G'+src+this.env.address_group_stack[0];
}
else if (this.gui_objects.addresslist_title) {
$(this.gui_objects.addresslist_title).html(this.get_label('contacts'));
}
this.select_folder(folder, '', true);
// load contacts remotely
if (this.gui_objects.contactslist) {
this.list_contacts_remote(src, group, page);
@ -4233,16 +4280,38 @@ function rcube_webmail()
this.list_contacts_clear = function()
{
this.contact_list.data = {};
this.contact_list.clear(true);
this.show_contentframe(false);
this.enable_command('delete', false);
this.enable_command('compose', this.env.group ? true : false);
};
this.set_group_prop = function(prop)
{
if (this.gui_objects.addresslist_title) {
var boxtitle = $(this.gui_objects.addresslist_title).html(''); // clear contents
// add link to pop back to parent group
if (this.env.address_group_stack.length > 1) {
$('<a href="#list">...</a>')
.addClass('poplink')
.appendTo(boxtitle)
.click(function(e){ return ref.command('popgroup','',this); });
boxtitle.append('&nbsp;&raquo;&nbsp;');
}
boxtitle.append($('<span>'+prop.name+'</span>'));
}
this.triggerEvent('groupupdate', prop);
};
// load contact record
this.load_contact = function(cid, action, framed)
{
var win, url = {}, target = window;
var win, url = {}, target = window,
rec = this.contact_list ? this.contact_list.data[cid] : null;
if (win = this.get_frame_window(this.env.contentframe)) {
url._framed = 1;
@ -4252,7 +4321,9 @@ function rcube_webmail()
// load dummy content, unselect selected row(s)
if (!cid)
this.contact_list.clear_selection();
this.enable_command('delete', 'compose', 'export-selected', cid);
this.enable_command('compose', rec && rec.email);
this.enable_command('export-selected', rec && rec._type != 'group');
}
else if (framed)
return false;
@ -4362,7 +4433,7 @@ function rcube_webmail()
};
// update a contact record in the list
this.update_contact_row = function(cid, cols_arr, newcid, source)
this.update_contact_row = function(cid, cols_arr, newcid, source, data)
{
var c, row, list = this.contact_list;
@ -4376,10 +4447,11 @@ function rcube_webmail()
}
list.update_row(cid, cols_arr, newcid, true);
list.data[cid] = data;
};
// add row to contacts list
this.add_contact_row = function(cid, cols, classes)
this.add_contact_row = function(cid, cols, classes, data)
{
if (!this.gui_objects.contactslist)
return false;
@ -4401,6 +4473,8 @@ function rcube_webmail()
row.cols.push(col);
}
// store data in list member
list.data[cid] = data;
list.insert_row(row);
this.enable_command('export', list.rowcount > 0);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,130 @@
<?php
/*
+-----------------------------------------------------------------------+
| Roundcube/rcube_ldap_result.php |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2006-2013, The Roundcube Dev Team |
| Copyright (C) 2013, Kolab Systems AG |
| |
| 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: |
| Model class that represents an LDAP search result |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
*/
/**
* Model class representing an LDAP search result
*
* @package Framework
* @subpackage LDAP
*/
class rcube_ldap_result implements Iterator
{
public $conn;
public $ldap;
public $base_dn;
public $filter;
private $count = null;
private $current = null;
private $iteratorkey = 0;
/**
* Default constructor
*
* @param resource $conn LDAP link identifier
* @param resource $ldap LDAP result entry identifier
* @param string $base_dn Base DN used to get this result
* @param string $filter Filter query used to get this result
* @param integer $count Record count value (pre-calculated)
*/
function __construct($conn, $ldap, $base_dn, $filter, $count = null)
{
$this->conn = $conn;
$this->ldap = $ldap;
$this->base_dn = $base_dn;
$this->filter = $filter;
$this->count = $count;
}
/**
* Wrapper for ldap_sort()
*/
public function sort($attr)
{
return ldap_sort($this->conn, $this->ldap, $attr);
}
/**
* Get entries count
*/
public function count()
{
if (!isset($this->count))
$this->count = ldap_count_entries($this->conn, $this->ldap);
return $this->count;
}
/**
* Wrapper for ldap_get_entries()
*
* @param boolean $normalize Optionally normalize the entries to a list of hash arrays
* @return array List of LDAP entries
*/
public function entries($normalize = false)
{
$entries = ldap_get_entries($this->conn, $this->ldap);
return $normalize ? rcube_ldap_generic::normalize_result($entries) : $entries;
}
/**
* Wrapper for ldap_get_dn() using the current entry pointer
*/
public function get_dn()
{
return $this->current ? ldap_get_dn($this->conn, $this->current) : null;
}
/*** Implements the PHP 5 Iterator interface to make foreach work ***/
function current()
{
$attrib = ldap_get_attributes($this->conn, $this->current);
$attrib['dn'] = ldap_get_dn($this->conn, $this->current);
return $attrib;
}
function key()
{
return $this->iteratorkey;
}
function rewind()
{
$this->iteratorkey = 0;
$this->current = ldap_first_entry($this->conn, $this->ldap);
}
function next()
{
$this->iteratorkey++;
$this->current = ldap_next_entry($this->conn, $this->current);
}
function valid()
{
return (bool)$this->current;
}
}

@ -356,6 +356,7 @@ $labels['lastpage'] = 'Show last page';
$labels['group'] = 'Group';
$labels['groups'] = 'Groups';
$labels['listgroup'] = 'List group members';
$labels['personaladrbook'] = 'Personal Addresses';
$labels['searchsave'] = 'Save search';

@ -307,7 +307,7 @@ function rcmail_contacts_list($attrib)
global $CONTACTS, $OUTPUT;
// define list of cols to be displayed
$a_show_cols = array('name');
$a_show_cols = array('name','action');
// add id to message list table if not specified
if (!strlen($attrib['id']))
@ -336,31 +336,73 @@ function rcmail_js_contacts_list($result, $prefix='')
return;
// define list of cols to be displayed
$a_show_cols = array('name');
$a_show_cols = array('name','action');
while ($row = $result->next()) {
$row['CID'] = $row['ID'];
$row['email'] = reset(rcube_addressbook::get_col_values('email', $row, true));
$source_id = $OUTPUT->get_env('source');
$a_row_cols = array();
$classes = array('person'); // org records will follow some day
$classes = array($row['_type'] ? $row['_type'] : 'person');
// build contact ID with source ID
if (isset($row['sourceid'])) {
$row['ID'] = $row['ID'].'-'.$row['sourceid'];
$source_id = $row['sourceid'];
}
// format each col
foreach ($a_show_cols as $col) {
$val = $col == 'name' ? rcube_addressbook::compose_list_name($row) : $row[$col];
$a_row_cols[$col] = Q($val);
$val = '';
switch ($col) {
case 'name':
$val = Q(rcube_addressbook::compose_list_name($row));
break;
case 'action':
if ($row['_type'] == 'group') {
$val = html::a(array(
'href' => '#list',
'rel' => $row['ID'],
'title' => rcube_label('listgroup'),
'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", JS_OBJECT_NAME, $source_id, $row['CID']),
), '&raquo;');
}
else
$val = '&nbsp;';
break;
default:
$val = Q($row[$col]);
break;
}
$a_row_cols[$col] = $val;
}
if ($row['readonly'])
$classes[] = 'readonly';
$OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes));
$OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes), array_intersect_key($row, array('ID'=>1,'readonly'=>1,'_type'=>1,'email'=>1,'name'=>1)));
}
}
function rcmail_contacts_list_title($attrib)
{
global $OUTPUT;
$attrib += array('label' => 'contacts', 'id' => 'rcmabooklisttitle', 'tag' => 'span');
unset($attrib['name']);
$OUTPUT->add_gui_object('addresslist_title', $attrib['id']);
$OUTPUT->add_label('contacts');
return html::tag($attrib['tag'], $attrib, rcube_label($attrib['label']), html::$common_attrib);
}
// similar function as /steps/settings/identities.inc::rcmail_identity_frame()
function rcmail_contact_frame($attrib)
{
@ -429,7 +471,7 @@ function rcmail_get_type_label($type)
function rcmail_contact_form($form, $record, $attrib = null)
{
global $RCMAIL, $CONFIG;
global $RCMAIL;
// Allow plugins to modify contact form content
$plugin = $RCMAIL->plugins->exec_hook('contact_form', array(
@ -438,7 +480,7 @@ function rcmail_contact_form($form, $record, $attrib = null)
$form = $plugin['form'];
$record = $plugin['record'];
$edit_mode = $RCMAIL->action != 'show';
$del_button = $attrib['deleteicon'] ? html::img(array('src' => $CONFIG['skin_path'] . $attrib['deleteicon'], 'alt' => rcube_label('delete'))) : rcube_label('delete');
$del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => rcube_label('delete'))) : rcube_label('delete');
unset($attrib['deleteicon']);
$out = '';
@ -695,12 +737,15 @@ function rcmail_contact_form($form, $record, $attrib = null)
function rcmail_contact_photo($attrib)
{
global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG;
global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL;
if ($result = $CONTACTS->get_result())
$record = $result->first();
$photo_img = $attrib['placeholder'] ? $CONFIG['skin_path'] . $attrib['placeholder'] : 'program/resources/blank.gif';
$photo_img = $attrib['placeholder'] ? $RCMAIL->output->get_skin_file($attrib['placeholder']) : 'program/resources/blank.gif';
if ($record['_type'] == 'group' && $attrib['placeholdergroup'])
$photo_img = $RCMAIL->output->get_skin_file($attrib['placeholdergroup']);
$RCMAIL->output->set_env('photo_placeholder', $photo_img);
unset($attrib['placeholder']);
@ -791,6 +836,7 @@ $OUTPUT->add_handlers(array(
'directorylist' => 'rcmail_directory_list',
// 'groupslist' => 'rcmail_contact_groups',
'addresslist' => 'rcmail_contacts_list',
'addresslisttitle' => 'rcmail_contacts_list_title',
'addressframe' => 'rcmail_contact_frame',
'recordscountdisplay' => 'rcmail_rowcount_display',
'searchform' => array($OUTPUT, 'search_form')

@ -81,6 +81,11 @@ else {
$OUTPUT->show_message('contactsearchonly', 'notice');
$OUTPUT->command('command', 'advanced-search');
}
if ($CONTACTS->group_id) {
$OUTPUT->command('set_group_prop', array('ID' => $CONTACTS->group_id)
+ array_intersect_key((array)$CONTACTS->get_group($CONTACTS->group_id), array('name'=>1,'email'=>1)));
}
}
// update message count display

@ -134,11 +134,11 @@ if (!empty($cid))
$record['email'] = reset($CONTACTS->get_col_values('email', $record, true));
$record['name'] = rcube_addressbook::compose_list_name($record);
foreach (array('name', 'email') as $col)
foreach (array('name') as $col)
$a_js_cols[] = Q((string)$record[$col]);
// update the changed col in list
$OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source);
$OUTPUT->command('parent.update_contact_row', $cid, $a_js_cols, $newcid, $source, $record);
// show confirmation
$OUTPUT->show_message('successfullysaved', 'confirmation', null, false);

@ -213,8 +213,11 @@ function rcmail_contact_record_groups($contact_id)
$checkbox = new html_checkbox(array('name' => '_gid[]',
'class' => 'groupmember', 'disabled' => $CONTACTS->readonly));
foreach ($GROUPS as $group) {
foreach (array_merge($GROUPS, $members) as $group) {
$gid = $group['ID'];
if ($seen[$gid]++)
continue;
$table->add(null, $checkbox->show($members[$gid] ? $gid : null,
array('value' => $gid, 'id' => 'ff_gid' . $gid)));
$table->add(null, html::label('ff_gid' . $gid, Q($group['name'])));

@ -73,8 +73,11 @@ else {
$CONTACTS->set_pagesize($page_size);
$CONTACTS->set_page($page);
if ($group_id = get_input_value('_gid', RCUBE_INPUT_GPC)) {
$CONTACTS->set_group($group_id);
}
// list groups of this source (on page one)
if ($CONTACTS->groups && $CONTACTS->list_page == 1) {
else if ($CONTACTS->groups && $CONTACTS->list_page == 1) {
foreach ($CONTACTS->list_groups() as $group) {
$CONTACTS->reset();
$CONTACTS->set_group($group['ID']);
@ -89,6 +92,19 @@ else {
'contactgroup' => html::span(array('title' => $email), Q($group['name']))), 'group');
}
}
// make virtual groups clickable to list their members
else if ($group_prop['virtual']) {
$row_id = 'G'.$group['ID'];
$OUTPUT->command('add_contact_row', $row_id, array(
'contactgroup' => html::a(array(
'href' => '#list',
'rel' => $row['ID'],
'title' => rcube_label('listgroup'),
'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", JS_OBJECT_NAME, $source, $group['ID']),
), Q($group['name']) . '&nbsp;' . html::span('action', '&raquo;'))),
'group',
array('ID' => $group['ID'], 'name' => $group['name'], 'virtual' => true));
}
// show group with count
else if (($result = $CONTACTS->count()) && $result->count) {
$row_id = 'E'.$group['ID'];
@ -97,10 +113,12 @@ else {
'contactgroup' => Q($group['name'] . ' (' . intval($result->count) . ')')), 'group');
}
}
$CONTACTS->reset();
$CONTACTS->set_group(0);
}
// get contacts for this user
$CONTACTS->set_group(0);
$result = $CONTACTS->list_records($afields);
}
}
@ -118,10 +136,13 @@ else if (!empty($result) && $result->count > 0) {
foreach ($emails as $i => $email) {
$row_id = $row['ID'].$i;
$jsresult[$row_id] = format_email_recipient($email, $name);
$classname = $row['_type'] == 'group' ? 'group' : 'person';
$keyname = $row['_type'] == 'group' ? 'contactgroup' : 'contact';
$OUTPUT->command('add_contact_row', $row_id, array(
'contact' => html::span(array('title' => $email), Q($name ? $name : $email) .
$keyname => html::span(array('title' => $email), Q($name ? $name : $email) .
($name && count($emails) > 1 ? '&nbsp;' . html::span('email', Q($email)) : '')
)), 'person');
)), $classname);
}
}
}

@ -224,6 +224,37 @@
-o-text-overflow: ellipsis;
}
#contacts-table .contact.readonly td
{
font-style: italic;
}
#contacts-table td.name
{
width: 95%;
}
#contacts-table td.action
{
width: 12px;
padding: 0px 6px 0 4px;
text-align: right;
}
#contacts-table td.action a
{
font-size: 16px;
font-weight: bold;
font-style: normal;
text-decoration: none;
color: #333;
}
#contacts-table .selected td.action a
{
color: #fff;
}
#contacts-box
{
position: absolute;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -1690,6 +1690,14 @@ input.from_address
-o-text-overflow: ellipsis;
}
#contacts-table td span.email
{
display: inline;
color: #ccc;
font-style: italic;
margin-left: 0.5em;
}
#abookcountbar
{
margin-top: 4px;

@ -75,7 +75,7 @@
<div id="addressscreen">
<div id="addresslist">
<div class="boxtitle"><roundcube:label name="contacts" /></div>
<roundcube:object name="addresslisttitle" label="contacts" tag="div" class="boxtitle" />
<div class="boxlistcontent">
<roundcube:object name="addresslist" id="contacts-table" class="records-table" cellspacing="0" summary="Contacts list" noheader="true" />
</div>

@ -13,7 +13,7 @@
<div id="sourcename"><roundcube:label name="addressbook" />: <roundcube:var name="env:sourcename" /></div>
<roundcube:endif />
<div id="contactphoto"><roundcube:object name="contactphoto" id="contactpic" placeholder="/images/contactpic.png" /></div>
<div id="contactphoto"><roundcube:object name="contactphoto" id="contactpic" placeholder="/images/contactpic.png" placeholderGroup="/images/contactgroup.png" /></div>
<roundcube:object name="contacthead" id="contacthead" />
<div style="clear:both"></div>
<div id="contacttabs">

@ -75,10 +75,6 @@
text-overflow: ellipsis;
}
#contacts-table .contact.readonly td {
font-style: italic;
}
#directorylist li.addressbook a {
background-position: 6px -766px;
}
@ -131,6 +127,28 @@
left: 20px;
}
#contacts-table .contact.readonly td {
font-style: italic;
}
#contacts-table td.name {
width: 95%;
}
#contacts-table td.action {
width: 24px;
padding: 4px;
}
#contacts-table td.action a {
display: block;
width: 16px;
height: 14px;
text-indent: -5000px;
overflow: hidden;
background: url(images/listicons.png) -2px -1180px no-repeat;
}
#contacts-table .contact td.name {
background-position: 6px -1603px;
}
@ -141,6 +159,29 @@
font-weight: bold;
}
#contacts-table .group td.name {
background-position: 6px -1555px;
}
#contacts-table .group.selected td.name,
#contacts-table .group.unfocused td.name {
background-position: 6px -1579px;
font-weight: bold;
}
#addresslist .boxtitle {
padding-right: 95px;
overflow: hidden;
text-overflow: ellipsis;
}
#addresslist .boxtitle a.poplink {
color: #004458;
font-size: 14px;
line-height: 12px;
text-decoration: none;
}
#contact-frame {
position: absolute;
top: 0;

@ -41,6 +41,7 @@ a.deletebutton,
.boxfooter .listbutton .inner,
.attachmentslist li a.delete,
.attachmentslist li a.cancelupload,
#contacts-table td.action a,
.previewheader .iconlink,
.minimal #taskbar .button-inner {
/* workaround for text-indent which also offsets the background image */

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

@ -1238,6 +1238,19 @@ div.message-partheaders .headers-table td.header {
text-overflow: ellipsis;
}
#contacts-table td.contactgroup a {
color: #376572;
text-decoration: none;
}
#contacts-table td.contactgroup a span {
display: inline-block;
font-size: 16px;
font-weight: bold;
line-height: 11px;
margin-left: 0.3em;
}
#contacts-table tr:first-child td {
border-top: 0;
}

@ -1059,6 +1059,10 @@ table.listing tr.droptarget td {
background-color: #e8e798;
}
.listbox table.listing {
background-color: #d9ecf4;
}
table.listing,
table.layout {
border: 0;

@ -50,7 +50,7 @@
<!-- contacts list -->
<div id="addresslist" class="uibox listbox">
<h2 class="boxtitle"><roundcube:label name="contacts" /></h2>
<roundcube:object name="addresslisttitle" label="contacts" tag="h2" class="boxtitle" />
<div class="scroller withfooter">
<roundcube:object name="addresslist" id="contacts-table" class="listing" noheader="true" />
</div>

@ -13,7 +13,7 @@
<div id="sourcename"><roundcube:label name="addressbook" />: <roundcube:var name="env:sourcename" /></div>
<roundcube:endif />
<div id="contactphoto"><roundcube:object name="contactphoto" id="contactpic" placeholder="/images/contactpic.png" /></div>
<div id="contactphoto"><roundcube:object name="contactphoto" id="contactpic" placeholder="/images/contactpic.png" placeholderGroup="/images/contactgroup.png" /></div>
<roundcube:object name="contacthead" id="contacthead" />
<br style="clear:both" />

@ -191,6 +191,8 @@ function rcube_mail_ui()
/*** addressbook task ***/
else if (rcmail.env.task == 'addressbook') {
rcmail.addEventListener('afterupload-photo', show_uploadform);
rcmail.addEventListener('beforepushgroup', push_contactgroup);
rcmail.addEventListener('beforepopgroup', pop_contactgroup);
if (rcmail.env.action == '') {
new rcube_splitter({ id:'addressviewsplitterd', p1:'#addressview-left', p2:'#addressview-right',
@ -825,6 +827,35 @@ function rcube_mail_ui()
});
}
function push_contactgroup(p)
{
// lets the contacts list swipe to the left, nice!
var table = $('#contacts-table'),
scroller = table.parent().css('overflow', 'hidden');
table.clone()
.css({ position:'absolute', top:'0', left:'0', width:table.width()+'px', 'z-index':10 })
.appendTo(scroller)
.animate({ left: -(table.width()+5) + 'px' }, 300, 'swing', function(){
$(this).remove();
scroller.css('overflow', 'auto')
});
}
function pop_contactgroup(p)
{
// lets the contacts list swipe to the left, nice!
var table = $('#contacts-table'),
scroller = table.parent().css('overflow', 'hidden'),
clone = table.clone().appendTo(scroller);
table.css({ position:'absolute', top:'0', left:-(table.width()+5) + 'px', width:table.width()+'px', height:table.height()+'px', 'z-index':10 })
.animate({ left:'0' }, 300, 'linear', function(){
clone.remove();
$(this).css({ position:'relative', left:'0', width:'100%', height:'auto', 'z-index':1 });
scroller.css('overflow', 'auto')
});
}
function show_uploadform()
{
@ -835,7 +866,7 @@ function rcube_mail_ui()
$dialog.dialog('close');
return;
}
// add icons to clone file input field
if (rcmail.env.action == 'compose' && !$dialog.data('extended')) {
$('<a>')

Loading…
Cancel
Save