Load groups when adding an address book folder from search
This commit is contained in:
parent
8d2b943cb6
commit
d777456fcf
2 changed files with 14 additions and 3 deletions
|
@ -161,9 +161,9 @@ if (window.rcmail) {
|
|||
.addEventListener('insert-item', function(data) {
|
||||
// register new address source
|
||||
rcmail.env.address_sources[data.id] = rcmail.env.contactfolders[data.id] = data.data;
|
||||
if (data.data.subscribed)
|
||||
rcmail.http_post('plugin.book-subscribe', { _source:data.id, _permanent:1 });
|
||||
// TODO: load groups and add them to the list
|
||||
// subscribe folder and load groups to add them to the list
|
||||
if (!data.data.virtual)
|
||||
rcmail.http_post('plugin.book-subscribe', { _source:data.id, _permanent:data.data.subscribed?1:0, _groups:1 });
|
||||
})
|
||||
.addEventListener('search-complete', function(data) {
|
||||
if (data.length)
|
||||
|
|
|
@ -743,6 +743,17 @@ class kolab_addressbook extends rcube_plugin
|
|||
$success |= $folder->subscribe(intval($_POST['_permanent']));
|
||||
if (isset($_POST['_active']))
|
||||
$success |= $folder->activate(intval($_POST['_active']));
|
||||
|
||||
// list groups for this address book
|
||||
if (!empty($_POST['_groups'])) {
|
||||
$abook = new rcube_kolab_contacts($folder->name);
|
||||
foreach ((array)$abook->list_groups() as $prop) {
|
||||
$prop['source'] = $id;
|
||||
$prop['id'] = $prop['ID'];
|
||||
unset($prop['ID']);
|
||||
$this->rc->output->command('insert_contact_group', $prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
|
|
Loading…
Add table
Reference in a new issue