summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-03 10:44:41 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-10-15 08:09:28 (GMT)
commit3d494afddb626d60ba7012911772ec44aad36bf3 (patch)
treec32509474ded378eeaf62f40c7357623b6f416ad /plugins
parenta604dbd3e47168ea31ca13b73fdce843774c9818 (diff)
downloadroundcubemail-plugins-kolab-3d494afddb626d60ba7012911772ec44aad36bf3.tar.gz
Add option to display direct CardDAV urls for Kolab address books in the Roundcube UI
Diffstat (limited to 'plugins')
-rw-r--r--plugins/kolab_addressbook/config.inc.php.dist8
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.js24
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.php1
-rw-r--r--plugins/kolab_addressbook/lib/kolab_addressbook_ui.php7
-rw-r--r--plugins/kolab_addressbook/lib/rcube_kolab_contacts.php18
-rw-r--r--plugins/kolab_addressbook/localization/de_CH.inc2
-rw-r--r--plugins/kolab_addressbook/localization/de_DE.inc2
-rw-r--r--plugins/kolab_addressbook/localization/en_US.inc2
8 files changed, 63 insertions, 1 deletions
diff --git a/plugins/kolab_addressbook/config.inc.php.dist b/plugins/kolab_addressbook/config.inc.php.dist
index 02745c8..0a0decf 100644
--- a/plugins/kolab_addressbook/config.inc.php.dist
+++ b/plugins/kolab_addressbook/config.inc.php.dist
@@ -11,4 +11,12 @@
*/
$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';
+
?>
diff --git a/plugins/kolab_addressbook/kolab_addressbook.js b/plugins/kolab_addressbook/kolab_addressbook.js
index b024fab..5824880 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.js
+++ b/plugins/kolab_addressbook/kolab_addressbook.js
@@ -18,6 +18,7 @@ rcube_webmail.prototype.set_book_actions = function()
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-showurl', source && sources[source] && sources[source].carddavurl);
};
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
rcube_webmail.prototype.book_show_contentframe = function(action, framed)
{
diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index d6f0d6d..a3f480c 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -117,6 +117,7 @@ class kolab_addressbook extends rcube_plugin
'undelete' => $abook->undelete && $undelete,
'realname' => rcube_charset::convert($abook->get_realname(), 'UTF7-IMAP'), // IMAP folder name
'class_name' => $abook->get_namespace(),
+ 'carddavurl' => $abook->get_carddav_url(),
'kolab' => true,
);
}
diff --git a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
index 7546046..5e4e4d5 100644
--- a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
+++ b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php
@@ -58,6 +58,10 @@ class kolab_addressbook_ui
$options = array('book-create', 'book-edit', 'book-delete');
$idx = 0;
+ if ($this->rc->config->get('kolab_addressbook_carddav_url')) {
+ $options[] = 'book-showurl';
+ }
+
foreach ($options as $command) {
$content = html::tag('li', $idx ? null : array('class' => 'separator_above'),
$this->plugin->api->output->button(array(
@@ -82,7 +86,8 @@ class kolab_addressbook_ui
$this->plugin->api->add_content($content, 'groupoptions');
$this->rc->output->add_label('kolab_addressbook.bookdeleteconfirm',
- 'kolab_addressbook.bookdeleting');
+ 'kolab_addressbook.bookdeleting', 'kolab_addressbook.bookshowurl',
+ 'kolab_addressbook.carddavurldescription');
}
// book create/edit form
else {
diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 365e251..13c7740 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -178,6 +178,24 @@ class rcube_kolab_contacts extends rcube_addressbook
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
diff --git a/plugins/kolab_addressbook/localization/de_CH.inc b/plugins/kolab_addressbook/localization/de_CH.inc
index 3439448..130564b 100644
--- a/plugins/kolab_addressbook/localization/de_CH.inc
+++ b/plugins/kolab_addressbook/localization/de_CH.inc
@@ -25,6 +25,8 @@ $labels['bookdelete'] = 'Adressbuch löschen';
$labels['bookproperties'] = 'Eigenschaften des Adressbuchs';
$labels['bookname'] = 'Name des Buches';
$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['personalfirst'] = 'Private(s) Adressbuch/Adressbücher zuerst';
diff --git a/plugins/kolab_addressbook/localization/de_DE.inc b/plugins/kolab_addressbook/localization/de_DE.inc
index 2c2a5d2..8f44c8f 100644
--- a/plugins/kolab_addressbook/localization/de_DE.inc
+++ b/plugins/kolab_addressbook/localization/de_DE.inc
@@ -25,6 +25,8 @@ $labels['bookdelete'] = 'Adressbuch löschen';
$labels['bookproperties'] = 'Eigenschaften des Adressbuchs';
$labels['bookname'] = 'Name des Buches';
$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['personalfirst'] = 'Private(s) Adressbuch/Adressbücher zuerst';
diff --git a/plugins/kolab_addressbook/localization/en_US.inc b/plugins/kolab_addressbook/localization/en_US.inc
index a66426f..c1ab0f5 100644
--- a/plugins/kolab_addressbook/localization/en_US.inc
+++ b/plugins/kolab_addressbook/localization/en_US.inc
@@ -25,6 +25,8 @@ $labels['bookdelete'] = 'Delete address book';
$labels['bookproperties'] = 'Address book properties';
$labels['bookname'] = 'Book name';
$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['personalfirst'] = 'Personal address book(s) first';