From e46cc9499efb8539be4a8701155c32fabbd81d28 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 31 Jul 2014 11:36:18 +0200 Subject: [PATCH] Add support for task-specific participant status values --- .../libcalendaring/lib/libcalendaring_itip.php | 15 +++++++++++---- plugins/libcalendaring/localization/en_US.inc | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php index ece0e484..93bdfee9 100644 --- a/plugins/libcalendaring/lib/libcalendaring_itip.php +++ b/plugins/libcalendaring/lib/libcalendaring_itip.php @@ -60,6 +60,11 @@ class libcalendaring_itip $this->rsvp_status = array_merge($this->rsvp_actions, array('delegated')); } + public function set_rsvp_status($status) + { + $this->rsvp_status = $status; + } + /** * Wrapper for rcube_plugin::gettext() * Checking for a label in different domains @@ -246,7 +251,8 @@ class libcalendaring_itip // attach ics file for this event $ical = libcalendaring::get_ical(); $ics = $ical->export(array($event), $method, false, $method == 'REQUEST' && $this->plugin->driver ? array($this->plugin->driver, 'get_attachment_body') : false); - $message->addAttachment($ics, 'text/calendar', 'event.ics', false, '8bit', '', RCMAIL_CHARSET . "; method=" . $method); + $filename = $event['_type'] == 'task' ? 'todo.ics' : 'event.ics'; + $message->addAttachment($ics, 'text/calendar', $filename, false, '8bit', '', RCMAIL_CHARSET . "; method=" . $method); return $message; } @@ -321,9 +327,10 @@ class libcalendaring_itip $listed = false; foreach ($existing['attendees'] as $attendee) { if ($attendee['role'] != 'ORGANIZER' && strcasecmp($attendee['email'], $event['attendee']) == 0) { - if (in_array($status, array('ACCEPTED','TENTATIVE','DECLINED','DELEGATED'))) { - $html = html::div('rsvp-status ' . strtolower($status), $this->gettext(array( - 'name' => 'attendee'.strtolower($status), + $status_lc = strtolower($status); + if (in_array($status_lc, $this->rsvp_status)) { + $html = html::div('rsvp-status ' . $status_lc, $this->gettext(array( + 'name' => 'attendee' . $status_lc, 'vars' => array( 'delegatedto' => Q($attendee['delegated-to'] ?: '?'), ) diff --git a/plugins/libcalendaring/localization/en_US.inc b/plugins/libcalendaring/localization/en_US.inc index 7e8c7175..f3a506ba 100644 --- a/plugins/libcalendaring/localization/en_US.inc +++ b/plugins/libcalendaring/localization/en_US.inc @@ -86,6 +86,8 @@ $labels['itipobjectnotfound'] = 'The object referred by this message was not fou $labels['itipsubjectaccepted'] = '"$title" has been accepted by $name'; $labels['itipsubjecttentative'] = '"$title" has been tentatively accepted by $name'; $labels['itipsubjectdeclined'] = '"$title" has been declined by $name'; +$labels['itipsubjectin-process'] = '"$title" is in-process by $name'; +$labels['itipsubjectcompleted'] = '"$title" was completed by $name'; $labels['itipsubjectcancel'] = 'Your participation in "$title" has been cancelled'; $labels['itipnewattendee'] = 'This is a reply from a new participant'; @@ -99,18 +101,24 @@ $labels['youhaveaccepted'] = 'You have accepted this invitation'; $labels['youhavetentative'] = 'You have tentatively accepted this invitation'; $labels['youhavedeclined'] = 'You have declined this invitation'; $labels['youhavedelegated'] = 'You have delegated this invitation'; +$labels['youhavein-process'] = 'You are working on this assignment'; +$labels['youhavecompleted'] = 'You have completed this assignment'; $labels['youhaveneeds-action'] = 'Your response to this invitation is still pending'; $labels['youhavepreviouslyaccepted'] = 'You have previously accepted this invitation'; $labels['youhavepreviouslytentative'] = 'You have previously accepted this invitation tentatively'; $labels['youhavepreviouslydeclined'] = 'You have previously declined this invitation'; $labels['youhavepreviouslydelegated'] = 'You have previously delegated this invitation'; +$labels['youhavepreviouslyin-process'] = 'You have previously reported to work on this assignment'; +$labels['youhavepreviouslycompleted'] = 'You have previously completed this assignment'; $labels['youhavepreviouslyneeds-action'] = 'Your response to this invitation is still pending'; $labels['attendeeaccepted'] = 'Participant has accepted'; $labels['attendeetentative'] = 'Participant has tentatively accepted'; $labels['attendeedeclined'] = 'Participant has declined'; $labels['attendeedelegated'] = 'Participant has delegated to $delegatedto'; +$labels['attendeein-process'] = 'Participant is in-process'; +$labels['attendeecompleted'] = 'Participant has completed'; $labels['notanattendee'] = 'You\'re not listed as an attendee of this object'; $labels['outdatedinvitation'] = 'This invitation has been replaced by a newer version';