Show CalDAV URL in tasks view (#3908); relies on the 'calendar_caldav_url' config option from the calendar module
This commit is contained in:
parent
664732411d
commit
c8715ff2e7
6 changed files with 56 additions and 0 deletions
|
@ -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(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -358,6 +358,24 @@ abstract class tasklist_driver
|
|||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
|
@ -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>';
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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) {
|
||||
|
@ -2878,6 +2880,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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue