Show CardDAV URL also for GAL (T143)
Added configuration option kolab_addressbook_carddav_ldap
This commit is contained in:
parent
818e55ad25
commit
34aa2d17a9
3 changed files with 45 additions and 9 deletions
|
@ -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'] = '';
|
||||
|
||||
?>
|
||||
|
|
|
@ -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 = $('<div>').addClass('showurldialog').append('<p>'+rcmail.gettext('carddavurldescription', 'kolab_addressbook')+'</p>'),
|
||||
var txt = rcmail.gettext('carddavurldescription', 'kolab_addressbook'),
|
||||
$dialog = $('<div>').addClass('showurldialog').append('<p>' + txt + '</p>'),
|
||||
textbox = $('<textarea>').addClass('urlbox').css('width', '100%').attr('rows', 2).appendTo($dialog);
|
||||
|
||||
$dialog.dialog({
|
||||
$dialog.dialog({
|
||||
resizable: true,
|
||||
closeOnEscape: true,
|
||||
title: rcmail.gettext('bookshowurl', 'kolab_addressbook'),
|
||||
close: function() {
|
||||
$dialog.dialog("destroy").remove();
|
||||
$dialog.dialog("destroy").remove();
|
||||
},
|
||||
width: 520
|
||||
}).show();
|
||||
}).show();
|
||||
|
||||
textbox.val(source.carddavurl).select();
|
||||
textbox.val(url).select();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -63,9 +63,21 @@ class kolab_addressbook_ui
|
|||
$options = array('book-create', 'book-edit', 'book-delete', 'book-remove');
|
||||
$idx = 0;
|
||||
|
||||
if ($this->rc->config->get('kolab_addressbook_carddav_url')) {
|
||||
if ($dav_url = $this->rc->config->get('kolab_addressbook_carddav_url')) {
|
||||
$options[] = 'book-showurl';
|
||||
$this->rc->output->set_env('kolab_addressbook_carddav_url', true);
|
||||
|
||||
// set CardDAV URI for specified ldap addressbook
|
||||
if ($ldap_abook = $this->rc->config->get('kolab_addressbook_carddav_ldap')) {
|
||||
$dav_ldap_url = strtr($dav_url, array(
|
||||
'%h' => $_SERVER['HTTP_HOST'],
|
||||
'%u' => urlencode($this->rc->get_user_name()),
|
||||
'%i' => 'ldap-directory',
|
||||
'%n' => '',
|
||||
));
|
||||
$this->rc->output->set_env('kolab_addressbook_carddav_ldap', $ldap_abook);
|
||||
$this->rc->output->set_env('kolab_addressbook_carddav_ldap_url', $dav_ldap_url);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($options as $command) {
|
||||
|
|
Loading…
Add table
Reference in a new issue