Merge commit 'refs/merge-requests/89' of git://gitorious.org/owncloud/owncloud

Conflicts:
	apps/calendar/ajax/events.php
This commit is contained in:
Bart Visscher 2012-05-03 23:18:43 +02:00
commit 077ea94f71
2 changed files with 18 additions and 2 deletions

View File

@ -22,4 +22,3 @@ foreach($events as $event){
$output[] = OC_Calendar_App::generateEventOutput($event, $start, $end); $output[] = OC_Calendar_App::generateEventOutput($event, $start, $end);
} }
OCP\JSON::encodedPrint($output); OCP\JSON::encodedPrint($output);
?>

View File

@ -382,6 +382,16 @@ class OC_Calendar_App{
$end_dt->setTimezone(new DateTimeZone(self::$tz)); $end_dt->setTimezone(new DateTimeZone(self::$tz));
} }
// Handle exceptions to recurring events
$exceptionDateObjects = $vevent->select('EXDATE');
$exceptionDateMap = Array();
foreach ($exceptionDateObjects as $exceptionObject) {
foreach($exceptionObject->getDateTimes() as $datetime) {
$ts = $datetime->getTimestamp();
$exceptionDateMap[idate('Y',$ts)][idate('m', $ts)][idate('d', $ts)] = true;
}
}
if($event['repeating'] == 1){ if($event['repeating'] == 1){
$duration = (double) $end_dt->format('U') - (double) $start_dt->format('U'); $duration = (double) $end_dt->format('U') - (double) $start_dt->format('U');
$r = new When(); $r = new When();
@ -398,6 +408,13 @@ class OC_Calendar_App{
if($result > $end){ if($result > $end){
break; break;
} }
// Check for exceptions to recurring events
$ts = $result->getTimestamp();
if (isset($exceptionDateMap[idate('Y',$ts)][idate('m', $ts)][idate('d', $ts)])) {
continue;
}
unset($ts);
if($output['allDay'] == true){ if($output['allDay'] == true){
$output['start'] = $result->format('Y-m-d'); $output['start'] = $result->format('Y-m-d');
$output['end'] = date('Y-m-d', $result->format('U') + --$duration); $output['end'] = date('Y-m-d', $result->format('U') + --$duration);