summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php1
-rw-r--r--plugins/tasklist/drivers/tasklist_driver.php18
-rw-r--r--plugins/tasklist/localization/en_US.inc2
-rw-r--r--plugins/tasklist/skins/larry/templates/mainview.html5
-rw-r--r--plugins/tasklist/tasklist.js29
-rw-r--r--plugins/tasklist/tasklist_ui.php1
6 files changed, 56 insertions, 0 deletions
diff --git a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
index 65e7fc5..4fccf7e 100644
--- a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
+++ b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
@@ -151,6 +151,7 @@ class tasklist_kolab_driver extends tasklist_driver
'subtype' => $folder->subtype,
'group' => $folder->default ? 'default' : $folder->get_namespace(),
'class' => trim($folder->get_namespace() . ($folder->default ? ' default' : '')),
+ 'caldavuid' => $folder->get_uid(),
);
}
diff --git a/plugins/tasklist/drivers/tasklist_driver.php b/plugins/tasklist/drivers/tasklist_driver.php
index 1de0353..8a06db3 100644
--- a/plugins/tasklist/drivers/tasklist_driver.php
+++ b/plugins/tasklist/drivers/tasklist_driver.php
@@ -359,6 +359,24 @@ abstract class tasklist_driver
}
/**
+ * Compose an URL for CalDAV access to the given list (if configured)
+ */
+ public function tasklist_caldav_url($list)
+ {
+ $rcmail = rcube::get_instance(); console($list);
+ if (!empty($list['caldavuid']) && ($template = $rcmail->config->get('calendar_caldav_url', null))) {
+ return strtr($template, array(
+ '%h' => $_SERVER['HTTP_HOST'],
+ '%u' => urlencode($rcmail->get_user_name()),
+ '%i' => urlencode($list['caldavuid']),
+ '%n' => urlencode($list['editname']),
+ ));
+ }
+
+ return null;
+ }
+
+ /**
* Handler for user_delete plugin hook
*
* @param array Hash array with hook arguments
diff --git a/plugins/tasklist/localization/en_US.inc b/plugins/tasklist/localization/en_US.inc
index 57ad7e5..ee66759 100644
--- a/plugins/tasklist/localization/en_US.inc
+++ b/plugins/tasklist/localization/en_US.inc
@@ -20,6 +20,8 @@ $labels['searchterms'] = 'Search terms';
$labels['notasklistsfound'] = 'No tasklists found';
$labels['nrtasklistsfound'] = '$nr tasklists found';
$labels['removelist'] = 'Remove from list';
+$labels['showcaldavurl'] = 'Show CalDAV URL';
+$labels['caldavurldescription'] = 'Copy this address to a <a href="http://en.wikipedia.org/wiki/CalDAV" target="_blank">CalDAV</a> client application (e.g. Evolution or Mozilla Thunderbird) to synchronize this specific tasklist with your computer or mobile device.';
$labels['newtask'] = 'New Task';
$labels['createtask'] = 'Create Task <Enter>';
diff --git a/plugins/tasklist/skins/larry/templates/mainview.html b/plugins/tasklist/skins/larry/templates/mainview.html
index 1e7aa43..f80b2f7 100644
--- a/plugins/tasklist/skins/larry/templates/mainview.html
+++ b/plugins/tasklist/skins/larry/templates/mainview.html
@@ -56,6 +56,11 @@
<!--<li role="menuitem"><roundcube:button command="list-import" label="tasklist.import" classAct="active" /></li>-->
<roundcube:if condition="env:tasklist_driver == 'kolab'" />
<li role="menuitem"><roundcube:button command="list-remove" label="tasklist.removelist" classAct="active" /></li>
+ <roundcube:endif />
+ <roundcube:if condition="config:calendar_caldav_url" />
+ <li role="menuitem"><roundcube:button command="list-showurl" label="tasklist.showcaldavurl" classAct="active" /></li>
+ <roundcube:endif />
+ <roundcube:if condition="env:tasklist_driver == 'kolab'" />
<li role="menuitem"><roundcube:button command="folders" task="settings" type="link" label="managefolders" classAct="active" /></li>
<roundcube:endif />
</ul>
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 9f18746..a01689f 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -120,6 +120,7 @@ function rcube_tasklist_ui(settings)
this.expand_collapse = expand_collapse;
this.list_delete = list_delete;
this.list_remove = list_remove;
+ this.list_showurl = list_showurl;
this.list_edit_dialog = list_edit_dialog;
this.unlock_saving = unlock_saving;
@@ -172,6 +173,7 @@ function rcube_tasklist_ui(settings)
rcmail.enable_command('list-delete', has_permission(me.tasklists[node.id], 'xa'));
rcmail.enable_command('list-import', has_permission(me.tasklists[node.id], 'i'));
rcmail.enable_command('list-remove', me.tasklists[node.id] && me.tasklists[node.id].removable);
+ rcmail.enable_command('list-showurl', me.tasklists[node.id] && !!me.tasklists[node.id].caldavurl);
me.selected_list = node.id;
});
tasklists_widget.addEventListener('subscribe', function(p) {
@@ -2879,6 +2881,32 @@ function rcube_tasklist_ui(settings)
}
/**
+ *
+ */
+ function list_showurl(id)
+ {
+ var list = me.tasklists[id];
+ if (list && list.caldavurl) {
+ $('div.showurldialog:ui-dialog').dialog('close');
+
+ var $dialog = $('<div>').addClass('showurldialog').append('<p>'+rcmail.gettext('caldavurldescription', 'tasklist')+'</p>'),
+ textbox = $('<textarea>').addClass('urlbox').css('width', '100%').attr('rows', 2).appendTo($dialog);
+
+ $dialog.dialog({
+ resizable: true,
+ closeOnEscape: true,
+ title: rcmail.gettext('showcaldavurl', 'tasklist'),
+ close: function() {
+ $dialog.dialog("destroy").remove();
+ },
+ width: 520
+ }).show();
+
+ textbox.val(list.caldavurl).select();
+ }
+ }
+
+ /**
* Execute search
*/
function quicksearch()
@@ -3115,6 +3143,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
rcmail.register_command('list-edit', function(){ rctasks.list_edit_dialog(rctasks.selected_list); }, false);
rcmail.register_command('list-delete', function(){ rctasks.list_delete(rctasks.selected_list); }, false);
rcmail.register_command('list-remove', function(){ rctasks.list_remove(rctasks.selected_list); }, false);
+ rcmail.register_command('list-showurl', function(){ rctasks.list_showurl(rctasks.selected_list); }, false);
rcmail.register_command('search', function(){ rctasks.quicksearch(); }, true);
rcmail.register_command('reset-search', function(){ rctasks.reset_search(); }, true);
diff --git a/plugins/tasklist/tasklist_ui.php b/plugins/tasklist/tasklist_ui.php
index cb00b0f..a46aa1e 100644
--- a/plugins/tasklist/tasklist_ui.php
+++ b/plugins/tasklist/tasklist_ui.php
@@ -248,6 +248,7 @@ class tasklist_ui
$prop['sortable'] = $this->plugin->driver->sortable;
$prop['attachments'] = $this->plugin->driver->attachments;
$prop['attendees'] = $this->plugin->driver->attendees;
+ $prop['caldavurl'] = $this->plugin->driver->tasklist_caldav_url($prop);
$jsenv[$id] = $prop;
}