From 53d62616190ae4ffee1b0d6eae543fda8d85cdd9 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 07 Apr 2010 11:53:48 -0400
Subject: [PATCH] Fix group expansion which was lost in r3457 + apply patch for autocompletion timeouts from #1486059
---
program/steps/mail/autocomplete.inc | 1 +
program/js/app.js | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/program/js/app.js b/program/js/app.js
index e7f81da..b95cebd 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3238,9 +3238,11 @@
var insert = '';
// insert all members of a group
- if (typeof this.env.contacts[id] == 'object' && this.env.contacts[id].members) {
- for (var i=0; i < this.env.contacts[id].members.length; i++)
- insert += this.env.contacts[id].members[i] + ', ';
+ if (typeof this.env.contacts[id] == 'object' && this.env.contacts[id].id) {
+ insert += this.env.contacts[id].name + ', ';
+ this.group2expand = $.extend({}, this.env.contacts[id]);
+ this.group2expand.input = this.ksearch_input;
+ this.http_request('group-expand', '_source='+urlencode(this.env.contacts[id].source)+'&_gid='+urlencode(this.env.contacts[id].id), false);
}
else if (typeof this.env.contacts[id] == 'string')
insert = this.env.contacts[id] + ', ';
@@ -3251,6 +3253,14 @@
cpos = p+insert.length;
if (this.ksearch_input.setSelectionRange)
this.ksearch_input.setSelectionRange(cpos, cpos);
+ };
+
+ this.replace_group_recipients = function(id, recipients)
+ {
+ if (this.group2expand && this.group2expand.id == id) {
+ this.group2expand.input.value = this.group2expand.input.value.replace(this.group2expand.name, recipients);
+ this.group2expand = null;
+ }
};
// address search processor
@@ -3286,7 +3296,7 @@
if (old_value && old_value.length && this.env.contacts && !this.env.contacts.length && q.indexOf(old_value) == 0)
return;
- this.display_message(this.get_label('searching'), 'loading', true);
+ this.display_message(this.get_label('searching'), 'loading', false);
this.http_post('autocomplete', '_search='+urlencode(q));
};
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index 724f14a..b761f53 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -26,6 +26,7 @@
$abook = $RCMAIL->get_address_book(get_input_value('_source', RCUBE_INPUT_GPC));
if ($gid = get_input_value('_gid', RCUBE_INPUT_GPC)) {
$members = array();
+ $abook->set_group($gid);
$abook->set_pagesize(1000); // TODO: limit number of group members by config
$result = $abook->list_records(array('email','name'));
while ($result && ($sql_arr = $result->iterate()))
--
Gitblit v1.9.1