Allow accept/decline/delegate (again) on event update request (Bifrost#T27859)

When handling an iTip request for an updated event where
start or end date has been changed, user will be able to change
his participant status.

In such cases we display RSVP buttons instead of "Update in my calendar"
button and highlight the event date.

So, e.g. if you accepted the event and then its time has been
changed by the organizer, you will be able to decline it or vice-versa.
This commit is contained in:
Aleksander Machniak 2017-03-30 10:25:12 +02:00
parent b692c6f6fa
commit 3840ffc5fe
3 changed files with 31 additions and 11 deletions

View file

@ -2222,6 +2222,11 @@ div.calendar-invitebox td em {
font-weight: bold;
}
div.calendar-invitebox td.date.modified {
font-weight: bold;
color: red;
}
#event-rsvp .rsvp-buttons,
div.calendar-invitebox .itip-buttons div {
margin-top: 0.5em;

View file

@ -359,8 +359,8 @@ class libcalendaring_itip
{
$action = $event['rsvp'] ? 'rsvp' : '';
$status = $event['fallback'];
$latest = false;
$html = '';
$latest = $resheduled = false;
$html = '';
if (is_numeric($event['changed']))
$event['changed'] = new DateTime('@'.$event['changed']);
@ -384,6 +384,13 @@ class libcalendaring_itip
break;
}
}
// Detect re-sheduling
if (!$latest) {
// FIXME: This is probably to simplistic, or maybe we should just check
// attendee's RSVP flag in the new event?
$resheduled = $existing['start'] != $event['start'] || $existing['end'] > $event['end'];
}
}
else {
$rsvp = $event['rsvp'] && $this->rc->config->get('calendar_allow_itip_uninvited', true);
@ -406,6 +413,9 @@ class libcalendaring_itip
else if (!$existing && !$rsvp) {
$action = 'import';
}
else if ($resheduled) {
$action = 'rsvp';
}
else if ($status_lc != 'needs-action') {
$action = !$latest ? 'update' : '';
}
@ -453,14 +463,15 @@ class libcalendaring_itip
}
return array(
'uid' => $event['uid'],
'id' => asciiwords($event['uid'], true),
'existing' => $existing ? true : false,
'saved' => $existing ? true : false,
'latest' => $latest,
'status' => $status,
'action' => $action,
'html' => $html,
'uid' => $event['uid'],
'id' => asciiwords($event['uid'], true),
'existing' => $existing ? true : false,
'saved' => $existing ? true : false,
'latest' => $latest,
'status' => $status,
'action' => $action,
'resheduled' => $resheduled,
'html' => $html,
);
}

View file

@ -1287,10 +1287,14 @@ rcube_libcalendaring.update_itip_object_status = function(p)
$('#rsvp-'+p.id+' input.button').prop('disabled', false)
.filter('.'+String(p.status||'unknown').toLowerCase()).prop('disabled', p.latest);
}
// show rsvp/import buttons (with calendar selector)
$('#'+p.action+'-'+p.id).show().find('input.button').last().after(p.select);
// highlight date if date change detected
if (p.resheduled)
$('.calendar-eventdetails td.date').addClass('modified');
// show itip box appendix after replacing the given placeholders
if (p.append && p.append.selector) {
var elem = $(p.append.selector);