summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js12
-rw-r--r--program/lib/Roundcube/rcube_ldap.php14
-rw-r--r--program/steps/mail/autocomplete.inc5
3 files changed, 24 insertions, 7 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 28a1b38ab..20bda2e32 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4310,11 +4310,15 @@ function rcube_webmail()
this.ksearch_destroy();
// insert all members of a group
- if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].id) {
+ if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].type == 'group') {
insert += this.env.contacts[id].name + this.env.recipients_delimiter;
this.group2expand[this.env.contacts[id].id] = $.extend({ input: this.ksearch_input }, this.env.contacts[id]);
this.http_request('mail/group-expand', {_source: this.env.contacts[id].source, _gid: this.env.contacts[id].id}, false);
}
+ else if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].name) {
+ insert = this.env.contacts[id].name + this.env.recipients_delimiter;
+ trigger = true;
+ }
else if (typeof this.env.contacts[id] === 'string') {
insert = this.env.contacts[id] + this.env.recipients_delimiter;
trigger = true;
@@ -4328,7 +4332,7 @@ function rcube_webmail()
this.ksearch_input.setSelectionRange(cpos, cpos);
if (trigger) {
- this.triggerEvent('autocomplete_insert', { field:this.ksearch_input, insert:insert });
+ this.triggerEvent('autocomplete_insert', { field:this.ksearch_input, insert:insert, data:this.env.contacts[id] });
this.compose_type_activity++;
}
};
@@ -4423,7 +4427,7 @@ function rcube_webmail()
return;
// display search results
- var i, len, ul, li, text, init,
+ var i, len, ul, li, text, type, init,
value = this.ksearch_value,
data = this.ksearch_data,
maxlen = this.env.autocomplete_max ? this.env.autocomplete_max : 15;
@@ -4457,11 +4461,13 @@ function rcube_webmail()
if (results && (len = results.length)) {
for (i=0; i < len && maxlen > 0; i++) {
text = typeof results[i] === 'object' ? results[i].name : results[i];
+ type = typeof results[i] === 'object' ? results[i].type : '';
li = document.createElement('LI');
li.innerHTML = text.replace(new RegExp('('+RegExp.escape(value)+')', 'ig'), '##$1%%').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/##([^%]+)%%/g, '<b>$1</b>');
li.onmouseover = function(){ ref.ksearch_select(this); };
li.onmouseup = function(){ ref.ksearch_click(this) };
li._rcm_id = this.env.contacts.length + i;
+ if (type) li.className = type;
ul.appendChild(li);
maxlen -= 1;
}
diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index de3790e5c..55a64acec 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -95,8 +95,8 @@ class rcube_ldap extends rcube_addressbook
if (empty($this->prop['groups']['scope']))
$this->prop['groups']['scope'] = 'sub';
// extend group objectclass => member attribute mapping
- if (!empty($this->prop['groups']['class_member_attr']))
- $this->group_types = array_merge($this->group_types, $this->prop['groups']['class_member_attr']);
+ if (!empty($this->prop['groups']['event-panel-summary']))
+ $this->group_types = array_merge($this->group_types, $this->prop['groups']['event-panel-summary']);
// add group name attrib to the list of attributes to be fetched
$fetch_attributes[] = $this->prop['groups']['name_attr'];
@@ -1409,6 +1409,16 @@ class rcube_ldap extends rcube_addressbook
$fieldmap['name'] = $this->group_data['name_attr'] ? $this->group_data['name_attr'] : $this->prop['groups']['name_attr'];
}
+ // assign object type from object class mapping
+ if (!empty($this->prop['class_type_map'])) {
+ foreach (array_map('strtolower', (array)$rec['objectclass']) as $objcls) {
+ if (!empty($this->prop['class_type_map'][$objcls])) {
+ $out['_type'] = $this->prop['class_type_map'][$objcls];
+ break;
+ }
+ }
+ }
+
foreach ($fieldmap as $rf => $lf)
{
for ($i=0; $i < $rec[$lf]['count']; $i++) {
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index c15de92cf..20cf94084 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -90,7 +90,7 @@ if (!empty($book_types) && strlen($search)) {
// skip duplicates
if (!in_array($contact, $contacts)) {
- $contacts[] = $contact;
+ $contacts[] = array('name' => $contact, 'type' => $sql_arr['_type']);
$sort_keys[] = sprintf('%s %03d', $sql_arr['name'] , $idx++);
if (count($contacts) >= $MAXNUM) {
@@ -118,7 +118,7 @@ if (!empty($book_types) && strlen($search)) {
if ($group_prop['email']) {
$idx = 0;
foreach ((array)$group_prop['email'] as $email) {
- $contacts[] = format_email_recipient($email, $group['name']);
+ $contacts[] = array('name' => format_email_recipient($email, $group['name']), 'type' => 'group');
$sort_keys[] = sprintf('%s %03d', $group['name'] , $idx++);
if (count($contacts) >= $MAXNUM) {
@@ -131,6 +131,7 @@ if (!empty($book_types) && strlen($search)) {
$sort_keys[] = $group['name'];
$contacts[] = array(
'name' => $group['name'] . ' (' . intval($result->count) . ')',
+ 'type' => 'group',
'id' => $group['ID'],
'source' => $id
);