summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-09-03 08:36:53 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-09-03 08:36:53 (GMT)
commitfdde6fcbf08157f3432fe5b9b1d49a34a274427d (patch)
tree04746234b70292a295b8623f8fba02852ab6ada1
parent1a73dfa923a25a00f606291c9787805a971a491d (diff)
downloadroundcubemail-plugins-kolab-fdde6fcbf08157f3432fe5b9b1d49a34a274427d.tar.gz
Fix errors on addressbook delete and no list update on name change (#3559)
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.js32
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.php8
-rw-r--r--plugins/kolab_addressbook/lib/kolab_addressbook_ui.php1
3 files changed, 27 insertions, 14 deletions
diff --git a/plugins/kolab_addressbook/kolab_addressbook.js b/plugins/kolab_addressbook/kolab_addressbook.js
index ee60569..aa6df6e 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.js
+++ b/plugins/kolab_addressbook/kolab_addressbook.js
@@ -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;
diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index e9f143f..e3824bc 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -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');
diff --git a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
index 898dd8c..10d49f6 100644
--- a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
+++ b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
@@ -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