From 34aa2d17a94430cf7b664126e9b5c568934e5b16 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Jul 2015 04:07:38 -0400 Subject: [PATCH] Show CardDAV URL also for GAL (T143) Added configuration option kolab_addressbook_carddav_ldap --- plugins/kolab_addressbook/config.inc.php.dist | 15 +++++++++++ .../kolab_addressbook/kolab_addressbook.js | 25 +++++++++++++------ .../lib/kolab_addressbook_ui.php | 14 ++++++++++- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/plugins/kolab_addressbook/config.inc.php.dist b/plugins/kolab_addressbook/config.inc.php.dist index 4abebb52..ba8f60d1 100644 --- a/plugins/kolab_addressbook/config.inc.php.dist +++ b/plugins/kolab_addressbook/config.inc.php.dist @@ -17,4 +17,19 @@ $config['kolab_addressbook_prio'] = 0; // %i - Folder UUID // $config['kolab_addressbook_carddav_url'] = 'http://%h/iRony/addressbooks/%u/%i'; +// Name of LDAP addressbook (a key in ldap_public configuration array) for which +// the CardDAV URI will be displayed if kolab_addressbook_carddav_url is set. +// Use it when iRony's kolabdav_ldap_directory is enabled. +// Note: kolab_addressbook_carddav_url must use %i and not %n. +// +// WARNING: There's limitations with volume and performance: +// CardDAV does a full sync of the entire contact resource. +// For LDAP this means that all entries matching the base_dn/filter are synced to every client. +// It's thus only recommended for small setups with a couple hundred LDAP entries. +// Other than that, the ldap-directory exposed in iRony is strictly read-only. +// Although correctly stated in the CardDAV properties, some clients (e.g. the Thunderbird SoGO connector) +// ignore these properties and allow modifications which then result in sync errors because the server +// denies such updates. +$config['kolab_addressbook_carddav_ldap'] = ''; + ?> diff --git a/plugins/kolab_addressbook/kolab_addressbook.js b/plugins/kolab_addressbook/kolab_addressbook.js index a73a6de9..ea2494c5 100644 --- a/plugins/kolab_addressbook/kolab_addressbook.js +++ b/plugins/kolab_addressbook/kolab_addressbook.js @@ -167,7 +167,7 @@ rcube_webmail.prototype.set_book_actions = function() this.enable_command('book-edit', props.rights.indexOf('a') >= 0); this.enable_command('book-delete', props.rights.indexOf('x') >= 0 || props.rights.indexOf('a') >= 0); this.enable_command('book-remove', props.removable); - this.enable_command('book-showurl', !!props.carddavurl); + this.enable_command('book-showurl', !!props.carddavurl || source == this.env.kolab_addressbook_carddav_ldap); }; rcube_webmail.prototype.book_create = function() @@ -199,24 +199,33 @@ rcube_webmail.prototype.book_delete = function() rcube_webmail.prototype.book_showurl = function() { - var source = this.env.source ? this.env.address_sources[this.env.source] : null; - if (source && source.carddavurl) { + var url, source; + + if (this.env.source) { + if (this.env.source == this.env.kolab_addressbook_carddav_ldap) + url = this.env.kolab_addressbook_carddav_ldap_url; + else if (source = this.env.address_sources[this.env.source]) + url = source.carddavurl; + } + + if (url) { $('div.showurldialog:ui-dialog').dialog('close'); - var $dialog = $('
').addClass('showurldialog').append('

'+rcmail.gettext('carddavurldescription', 'kolab_addressbook')+'

'), + var txt = rcmail.gettext('carddavurldescription', 'kolab_addressbook'), + $dialog = $('
').addClass('showurldialog').append('

' + txt + '

'), textbox = $('