Fix errors on addressbook delete and no list update on name change (#3559)

This commit is contained in:
Aleksander Machniak 2014-09-03 10:36:53 +02:00
parent 1a73dfa923
commit fdde6fcbf0
3 changed files with 27 additions and 14 deletions

View file

@ -309,7 +309,21 @@ rcube_webmail.prototype.book_delete_done = function(id, recur)
// action executed after book create/update
rcube_webmail.prototype.book_update = function(data, old)
{
var link, classes = [(data.group || ''), 'addressbook'];
var classes = ['addressbook'],
oldid = old ? rcmail.html_identifier_encode(old) : null,
content = $('<div class="subscribed">').append(
$('<a>').html(data.name).attr({
href: this.url('', { _source: data.id }),
rel: data.id,
onclick: "return rcmail.command('list', '" + data.id + "', this)"
}),
$('<span>').attr({
'class': 'subscribed',
role: 'checkbox',
'aria-checked': true,
title: this.gettext('kolab_addressbook.foldersubscribe')
})
);
this.show_contentframe(false);
@ -319,19 +333,17 @@ rcube_webmail.prototype.book_update = function(data, old)
if (data.group)
classes.push(data.group);
link = $('<a>').html(data.name)
.attr({
href: this.url('', { _source: data.id }),
rel: data.id,
onclick: "return rcmail.command('list', '" + data.id + "', this)"
});
// update (remove old row)
if (old) {
this.treelist.update(old, { id: data.id, html:link, classes: classes, parent:(old != data.id ? data.parent : null) }, data.group || true);
// is the folder subscribed?
if (!$('#rcmli' + oldid + ' > div.subscribed').length) {
content.removeClass('subscribed').find('span').attr('aria-checked', false);
}
this.treelist.update(old, {id: data.id, html: content, classes: classes, parent: (old != data.id ? data.parent : null)}, data.group || true);
}
else {
this.treelist.insert({ id: data.id, html:link, classes: classes, childlistclass: 'groups' }, data.parent, data.group || true);
this.treelist.insert({id: data.id, html: content, classes: classes, childlistclass: 'groups'}, data.parent, data.group || true);
}
this.env.contactfolders[data.id] = this.env.address_sources[data.id] = data;

View file

@ -627,7 +627,7 @@ class kolab_addressbook extends rcube_plugin
$this->rc->output->show_message('kolab_addressbook.book'.$type.'d', 'confirmation');
$this->rc->output->command('set_env', 'delimiter', $delimiter);
$this->rc->output->command('book_update', array(
'id' => kolab_storage::folder_id($folder),
'id' => kolab_storage::folder_id($folder, true),
'name' => $kolab_folder->get_foldername(),
'readonly' => false,
'editable' => true,
@ -636,7 +636,7 @@ class kolab_addressbook extends rcube_plugin
'group' => $kolab_folder->get_namespace(),
'parent' => kolab_storage::folder_id($kolab_folder->get_parent()),
'kolab' => true,
), kolab_storage::folder_id($prop['oldname']));
), kolab_storage::folder_id($prop['oldname'], true));
$this->rc->output->send('iframe');
}
@ -762,7 +762,7 @@ class kolab_addressbook extends rcube_plugin
}
}
}
if ($success) {
$this->rc->output->show_message('successfullysaved', 'confirmation');
}
@ -790,7 +790,7 @@ class kolab_addressbook extends rcube_plugin
$this->rc->output->command('set_rowcount', rcmail_get_rowcount_text(new rcube_result_set()));
$this->rc->output->command('set_env', 'delimiter', $delimiter);
$this->rc->output->command('list_contacts_clear');
$this->rc->output->command('book_delete_done', kolab_storage::folder_id($folder));
$this->rc->output->command('book_delete_done', kolab_storage::folder_id($folder, true));
}
else {
$this->rc->output->show_message('kolab_addressbook.bookdeleteerror', 'error');

View file

@ -103,6 +103,7 @@ class kolab_addressbook_ui
'kolab_addressbook.listsearchresults',
'kolab_addressbook.nraddressbooksfound',
'kolab_addressbook.noaddressbooksfound',
'kolab_addressbook.foldersubscribe',
'resetsearch');
}
// book create/edit form