Hide 'Save to calendar' option for VTODO attachments (#3227)

This commit is contained in:
Thomas Bruederli 2014-07-30 17:51:54 +02:00
parent b3c5acd66a
commit 228a1b2438
2 changed files with 32 additions and 20 deletions

View file

@ -2240,6 +2240,7 @@ class calendar extends rcube_plugin
}
$html = '';
$has_events = false;
foreach ($this->ics_parts as $mime_id) {
$part = $this->message->mime_parts[$mime_id];
$charset = $part->ctype_parameters['charset'] ? $part->ctype_parameters['charset'] : RCMAIL_CHARSET;
@ -2255,16 +2256,20 @@ class calendar extends rcube_plugin
if ($event['_type'] != 'event') // skip non-event objects (#2928)
continue;
$has_events = true;
// get prepared inline UI for this event object
$html .= html::div('calendar-invitebox',
$this->itip->mail_itip_inline_ui(
$event,
$this->ical->method,
$mime_id.':'.$idx,
'calendar',
rcube_utils::anytodatetime($this->message->headers->date)
)
);
if ($this->ical->method) {
$html .= html::div('calendar-invitebox',
$this->itip->mail_itip_inline_ui(
$event,
$this->ical->method,
$mime_id.':'.$idx,
'calendar',
rcube_utils::anytodatetime($this->message->headers->date)
)
);
}
// limit listing
if ($idx >= 3)
@ -2280,7 +2285,7 @@ class calendar extends rcube_plugin
}
// add "Save to calendar" button into attachment menu
if (!empty($this->ics_parts)) {
if ($has_events) {
$this->add_button(array(
'id' => 'attachmentsavecal',
'name' => 'attachmentsavecal',

View file

@ -1305,6 +1305,7 @@ class tasklist extends rcube_plugin
// @todo: Calendar plugin does the same, which means the
// attachment body is fetched twice, this is not optimal
$html = '';
$has_tasks = false;
foreach ($this->ics_parts as $mime_id) {
$part = $this->message->mime_parts[$mime_id];
$charset = $part->ctype_parameters['charset'] ? $part->ctype_parameters['charset'] : RCMAIL_CHARSET;
@ -1322,16 +1323,20 @@ class tasklist extends rcube_plugin
continue;
}
$has_tasks = true;
// get prepared inline UI for this event object
$html .= html::div('tasklist-invitebox',
$this->itip->mail_itip_inline_ui(
$task,
$this->ical->method,
$mime_id . ':' . $idx,
'tasks',
rcube_utils::anytodatetime($this->message->headers->date)
)
);
if ($this->ical->method) {
$html .= html::div('tasklist-invitebox',
$this->itip->mail_itip_inline_ui(
$task,
$this->ical->method,
$mime_id . ':' . $idx,
'tasks',
rcube_utils::anytodatetime($this->message->headers->date)
)
);
}
// limit listing
if ($idx >= 3) {
@ -1348,8 +1353,10 @@ class tasklist extends rcube_plugin
$p['content'] = $html . $p['content'];
$this->rc->output->add_label('tasklist.savingdata','tasklist.deletetaskconfirm','tasklist.declinedeleteconfirm');
}
// add "Save to calendar" button into attachment menu
// add "Save to tasks" button into attachment menu
if ($has_tasks) {
$this->add_button(array(
'id' => 'attachmentsavetask',
'name' => 'attachmentsavetask',