Add option to display direct CardDAV urls for Kolab address books in the Roundcube UI
This commit is contained in:
parent
1800bd6556
commit
e6e2044d40
8 changed files with 63 additions and 1 deletions
|
@ -11,4 +11,12 @@
|
||||||
*/
|
*/
|
||||||
$rcmail_config['kolab_addressbook_prio'] = 0;
|
$rcmail_config['kolab_addressbook_prio'] = 0;
|
||||||
|
|
||||||
|
// Base URL to build fully qualified URIs to access calendars via CALDAV
|
||||||
|
// The following replacement variables are supported:
|
||||||
|
// %h - Current HTTP host
|
||||||
|
// %u - Current webmail user name
|
||||||
|
// %n - Folder name
|
||||||
|
// %i - Folder UUID
|
||||||
|
// $rcmail_config['kolab_addressbook_carddav_url'] = 'http://%h/iRony/addressbooks/%u/%i';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -18,6 +18,7 @@ rcube_webmail.prototype.set_book_actions = function()
|
||||||
|
|
||||||
this.enable_command('book-create', true);
|
this.enable_command('book-create', true);
|
||||||
this.enable_command('book-edit', 'book-delete', source && sources[source] && sources[source].kolab && sources[source].editable);
|
this.enable_command('book-edit', 'book-delete', source && sources[source] && sources[source].kolab && sources[source].editable);
|
||||||
|
this.enable_command('book-showurl', source && sources[source] && sources[source].carddavurl);
|
||||||
};
|
};
|
||||||
|
|
||||||
rcube_webmail.prototype.book_create = function()
|
rcube_webmail.prototype.book_create = function()
|
||||||
|
@ -38,6 +39,29 @@ 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) {
|
||||||
|
$('div.showurldialog:ui-dialog').dialog('close');
|
||||||
|
|
||||||
|
var $dialog = $('<div>').addClass('showurldialog').append('<p>'+rcmail.gettext('carddavurldescription', 'kolab_addressbook')+'</p>'),
|
||||||
|
textbox = $('<textarea>').addClass('urlbox').css('width', '100%').attr('rows', 2).appendTo($dialog);
|
||||||
|
|
||||||
|
$dialog.dialog({
|
||||||
|
resizable: true,
|
||||||
|
closeOnEscape: true,
|
||||||
|
title: rcmail.gettext('bookshowurl', 'kolab_addressbook'),
|
||||||
|
close: function() {
|
||||||
|
$dialog.dialog("destroy").remove();
|
||||||
|
},
|
||||||
|
width: 520
|
||||||
|
}).show();
|
||||||
|
|
||||||
|
textbox.val(source.carddavurl).select();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// displays page with book edit/create form
|
// displays page with book edit/create form
|
||||||
rcube_webmail.prototype.book_show_contentframe = function(action, framed)
|
rcube_webmail.prototype.book_show_contentframe = function(action, framed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,6 +117,7 @@ class kolab_addressbook extends rcube_plugin
|
||||||
'undelete' => $abook->undelete && $undelete,
|
'undelete' => $abook->undelete && $undelete,
|
||||||
'realname' => rcube_charset::convert($abook->get_realname(), 'UTF7-IMAP'), // IMAP folder name
|
'realname' => rcube_charset::convert($abook->get_realname(), 'UTF7-IMAP'), // IMAP folder name
|
||||||
'class_name' => $abook->get_namespace(),
|
'class_name' => $abook->get_namespace(),
|
||||||
|
'carddavurl' => $abook->get_carddav_url(),
|
||||||
'kolab' => true,
|
'kolab' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,10 @@ class kolab_addressbook_ui
|
||||||
$options = array('book-create', 'book-edit', 'book-delete');
|
$options = array('book-create', 'book-edit', 'book-delete');
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
|
|
||||||
|
if ($this->rc->config->get('kolab_addressbook_carddav_url')) {
|
||||||
|
$options[] = 'book-showurl';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($options as $command) {
|
foreach ($options as $command) {
|
||||||
$content = html::tag('li', $idx ? null : array('class' => 'separator_above'),
|
$content = html::tag('li', $idx ? null : array('class' => 'separator_above'),
|
||||||
$this->plugin->api->output->button(array(
|
$this->plugin->api->output->button(array(
|
||||||
|
@ -82,7 +86,8 @@ class kolab_addressbook_ui
|
||||||
$this->plugin->api->add_content($content, 'groupoptions');
|
$this->plugin->api->add_content($content, 'groupoptions');
|
||||||
|
|
||||||
$this->rc->output->add_label('kolab_addressbook.bookdeleteconfirm',
|
$this->rc->output->add_label('kolab_addressbook.bookdeleteconfirm',
|
||||||
'kolab_addressbook.bookdeleting');
|
'kolab_addressbook.bookdeleting', 'kolab_addressbook.bookshowurl',
|
||||||
|
'kolab_addressbook.carddavurldescription');
|
||||||
}
|
}
|
||||||
// book create/edit form
|
// book create/edit form
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -178,6 +178,24 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
return $this->namespace;
|
return $this->namespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compose an URL for CardDAV access to this address book (if configured)
|
||||||
|
*/
|
||||||
|
public function get_carddav_url()
|
||||||
|
{
|
||||||
|
$url = null;
|
||||||
|
$rcmail = rcmail::get_instance();
|
||||||
|
if ($template = $rcmail->config->get('kolab_addressbook_carddav_url', null)) {
|
||||||
|
return strtr($template, array(
|
||||||
|
'%h' => $_SERVER['HTTP_HOST'],
|
||||||
|
'%u' => urlencode($rcmail->get_user_name()),
|
||||||
|
'%i' => urlencode($this->storagefolder->get_uid()),
|
||||||
|
'%n' => urlencode($this->imap_folder),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the current group
|
* Setter for the current group
|
||||||
|
|
|
@ -25,6 +25,8 @@ $labels['bookdelete'] = 'Adressbuch löschen';
|
||||||
$labels['bookproperties'] = 'Eigenschaften des Adressbuchs';
|
$labels['bookproperties'] = 'Eigenschaften des Adressbuchs';
|
||||||
$labels['bookname'] = 'Name des Buches';
|
$labels['bookname'] = 'Name des Buches';
|
||||||
$labels['parentbook'] = 'Übergeordnetes Buch';
|
$labels['parentbook'] = 'Übergeordnetes Buch';
|
||||||
|
$labels['bookshowurl'] = 'CardDAV-URL anzeigen';
|
||||||
|
$labels['carddavurldescription'] = 'Benutzen Sie folgende Addresse in einer <a href="http://en.wikipedia.org/wiki/CardDAV" target="_blank">CalDAV</a>-Anwendung um dieses spezifische Adressbuch mit dem Computer oder Mobiltelefon zu synchronisieren.';
|
||||||
|
|
||||||
$labels['addressbookprio'] = 'Reihenfolge der Adressbücher';
|
$labels['addressbookprio'] = 'Reihenfolge der Adressbücher';
|
||||||
$labels['personalfirst'] = 'Private(s) Adressbuch/Adressbücher zuerst';
|
$labels['personalfirst'] = 'Private(s) Adressbuch/Adressbücher zuerst';
|
||||||
|
|
|
@ -25,6 +25,8 @@ $labels['bookdelete'] = 'Adressbuch löschen';
|
||||||
$labels['bookproperties'] = 'Eigenschaften des Adressbuchs';
|
$labels['bookproperties'] = 'Eigenschaften des Adressbuchs';
|
||||||
$labels['bookname'] = 'Name des Buches';
|
$labels['bookname'] = 'Name des Buches';
|
||||||
$labels['parentbook'] = 'Übergeordnetes Buch';
|
$labels['parentbook'] = 'Übergeordnetes Buch';
|
||||||
|
$labels['bookshowurl'] = 'CardDAV-URL anzeigen';
|
||||||
|
$labels['carddavurldescription'] = 'Benutzen Sie folgende Addresse in einer <a href="http://en.wikipedia.org/wiki/CardDAV" target="_blank">CalDAV</a>-Anwendung um dieses spezifische Adressbuch mit dem Computer oder Mobiltelefon zu synchronisieren.';
|
||||||
|
|
||||||
$labels['addressbookprio'] = 'Reihenfolge der Adressbücher';
|
$labels['addressbookprio'] = 'Reihenfolge der Adressbücher';
|
||||||
$labels['personalfirst'] = 'Private(s) Adressbuch/Adressbücher zuerst';
|
$labels['personalfirst'] = 'Private(s) Adressbuch/Adressbücher zuerst';
|
||||||
|
|
|
@ -25,6 +25,8 @@ $labels['bookdelete'] = 'Delete address book';
|
||||||
$labels['bookproperties'] = 'Address book properties';
|
$labels['bookproperties'] = 'Address book properties';
|
||||||
$labels['bookname'] = 'Book name';
|
$labels['bookname'] = 'Book name';
|
||||||
$labels['parentbook'] = 'Superior book';
|
$labels['parentbook'] = 'Superior book';
|
||||||
|
$labels['bookshowurl'] = 'Show CardDAV URL';
|
||||||
|
$labels['carddavurldescription'] = 'Copy this address to a <a href="http://en.wikipedia.org/wiki/CardDAV" target="_blank">CardDAV</a> client application to fully synchronize this specific address book with your computer or mobile device.';
|
||||||
|
|
||||||
$labels['addressbookprio'] = 'Address book(s) selection/behaviour';
|
$labels['addressbookprio'] = 'Address book(s) selection/behaviour';
|
||||||
$labels['personalfirst'] = 'Personal address book(s) first';
|
$labels['personalfirst'] = 'Personal address book(s) first';
|
||||||
|
|
Loading…
Add table
Reference in a new issue