Handle old revisions and diffs for recurrence instances; forward instance identifier to API for diff requests
This commit is contained in:
parent
17a3783b9a
commit
7dbb0d1b2f
2 changed files with 34 additions and 4 deletions
|
@ -2059,8 +2059,11 @@ class kolab_driver extends calendar_driver
|
||||||
|
|
||||||
list($uid, $mailbox, $msguid) = $this->_resolve_event_identity($event);
|
list($uid, $mailbox, $msguid) = $this->_resolve_event_identity($event);
|
||||||
|
|
||||||
|
// get diff for the requested recurrence instance
|
||||||
|
$instance_id = $event['id'] != $uid ? substr($event['id'], strlen($uid) + 1) : null;
|
||||||
|
|
||||||
// call Bonnie API
|
// call Bonnie API
|
||||||
$result = $this->bonnie_api->diff('event', $uid, $rev1, $rev2, $mailbox, $msguid);
|
$result = $this->bonnie_api->diff('event', $uid, $rev1, $rev2, $mailbox, $msguid, $instance_id);
|
||||||
if (is_array($result) && $result['uid'] == $uid) {
|
if (is_array($result) && $result['uid'] == $uid) {
|
||||||
$result['rev1'] = $rev1;
|
$result['rev1'] = $rev1;
|
||||||
$result['rev2'] = $rev2;
|
$result['rev2'] = $rev2;
|
||||||
|
@ -2175,6 +2178,7 @@ class kolab_driver extends calendar_driver
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$eventid = $event['id'];
|
||||||
$calid = $event['calendar'];
|
$calid = $event['calendar'];
|
||||||
list($uid, $mailbox, $msguid) = $this->_resolve_event_identity($event);
|
list($uid, $mailbox, $msguid) = $this->_resolve_event_identity($event);
|
||||||
|
|
||||||
|
@ -2186,7 +2190,26 @@ class kolab_driver extends calendar_driver
|
||||||
$event = $format->to_array();
|
$event = $format->to_array();
|
||||||
$format->get_attachments($event, true);
|
$format->get_attachments($event, true);
|
||||||
|
|
||||||
// TODO: get the right instance from a recurring event
|
// get the right instance from a recurring event
|
||||||
|
if ($eventid != $event['uid']) {
|
||||||
|
$instance_id = substr($eventid, strlen($event['uid']) + 1);
|
||||||
|
|
||||||
|
// check for recurrence exception first
|
||||||
|
if ($instance = $format->get_instance($instance_id)) {
|
||||||
|
$event = $instance;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// not a exception, compute recurrence...
|
||||||
|
$event['_formatobj'] = $format;
|
||||||
|
$recurrence_date = rcube_utils::anytodatetime($instance_id, $event['start']->getTimezone());
|
||||||
|
foreach ($this->get_recurring_events($event, $event['start'], $recurrence_date) as $instance) {
|
||||||
|
if ($instance['id'] == $eventid) {
|
||||||
|
$event = $instance;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($format->is_valid()) {
|
if ($format->is_valid()) {
|
||||||
$event['calendar'] = $calid;
|
$event['calendar'] = $calid;
|
||||||
|
|
|
@ -58,9 +58,16 @@ class kolab_bonnie_api
|
||||||
/**
|
/**
|
||||||
* Wrapper function for <object>.diff() API call
|
* Wrapper function for <object>.diff() API call
|
||||||
*/
|
*/
|
||||||
public function diff($type, $uid, $rev1, $rev2, $mailbox, $msguid=null)
|
public function diff($type, $uid, $rev1, $rev2, $mailbox, $msguid=null, $instance=null)
|
||||||
{
|
{
|
||||||
return $this->client->execute($type.'.diff', array('uid' => $uid, 'rev1' => $rev1, 'rev2' => $rev2, 'mailbox' => $mailbox, 'msguid' => $msguid));
|
return $this->client->execute($type.'.diff', array(
|
||||||
|
'uid' => $uid,
|
||||||
|
'rev1' => $rev1,
|
||||||
|
'rev2' => $rev2,
|
||||||
|
'mailbox' => $mailbox,
|
||||||
|
'msguid' => $msguid,
|
||||||
|
'instance' => $instance,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue