mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-30 22:51:01 +02:00
- implemented regular CalDAV free-busy-query report
- fixed FBTYPE for tentative accepted invitations: BUSY-TENTATIVE - fixed typo stalling outbox free-busy request
This commit is contained in:
@ -123,6 +123,11 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
error_log(__METHOD__."($path,".array2string($options).",,$user,$id)");
|
error_log(__METHOD__."($path,".array2string($options).",,$user,$id)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($options['root']['name'] == 'free-busy-query')
|
||||||
|
{
|
||||||
|
return $this->free_busy_report($path, $options, $user);
|
||||||
|
}
|
||||||
|
|
||||||
// ToDo: add parameter to only return id & etag
|
// ToDo: add parameter to only return id & etag
|
||||||
$filter = array(
|
$filter = array(
|
||||||
'users' => $user,
|
'users' => $user,
|
||||||
@ -710,7 +715,7 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
$organizer = $component->getAttribute('ORGANIZER');
|
$organizer = $component->getAttribute('ORGANIZER');
|
||||||
$attendees = $component->getAttribute('ATTENDEE');
|
$attendees = $component->getAttribute('ATTENDEE');
|
||||||
// X-CALENDARSERVER-MASK-UID specifies to exclude given event from busy-time
|
// X-CALENDARSERVER-MASK-UID specifies to exclude given event from busy-time
|
||||||
$mask_uid = $component->getAttribte('X-CALENDARSERVER-MASK-UID');
|
$mask_uid = $component->getAttribute('X-CALENDARSERVER-MASK-UID');
|
||||||
|
|
||||||
header('Content-type: text/xml; charset=UTF-8');
|
header('Content-type: text/xml; charset=UTF-8');
|
||||||
|
|
||||||
@ -751,6 +756,35 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle free-busy-query report
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @param array $options
|
||||||
|
* @param int $user account_id
|
||||||
|
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
|
||||||
|
*/
|
||||||
|
function free_busy_report($path,$options,$user)
|
||||||
|
{
|
||||||
|
if (!$this->bo->check_perms(EGW_ACL_FREEBUSY, 0, $user))
|
||||||
|
{
|
||||||
|
return '403 Forbidden';
|
||||||
|
}
|
||||||
|
foreach($options['other'] as $filter)
|
||||||
|
{
|
||||||
|
if ($filter['name'] == 'time-range')
|
||||||
|
{
|
||||||
|
$start = $this->vCalendar->_parseDateTime($filter['attrs']['start']);
|
||||||
|
$end = $this->vCalendar->_parseDateTime($filter['attrs']['end']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$handler = $this->_get_handler();
|
||||||
|
header('Content-Type: text/calendar');
|
||||||
|
echo $handler->freebusy($user, $end, true, 'utf-8', $start, 'REPLY', array());
|
||||||
|
|
||||||
|
common::egw_exit(); // otherwise we get a 207 multistatus, not 200 Ok
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return priviledges for current user, default is read and read-current-user-privilege-set
|
* Return priviledges for current user, default is read and read-current-user-privilege-set
|
||||||
*
|
*
|
||||||
@ -982,7 +1016,10 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
$props['supported-report-set'] = HTTP_WebDAV_Server::mkprop('supported-report-set',array(
|
$props['supported-report-set'] = HTTP_WebDAV_Server::mkprop('supported-report-set',array(
|
||||||
HTTP_WebDAV_Server::mkprop('supported-report',array(
|
HTTP_WebDAV_Server::mkprop('supported-report',array(
|
||||||
HTTP_WebDAV_Server::mkprop('report',array(
|
HTTP_WebDAV_Server::mkprop('report',array(
|
||||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-multiget','')))))));
|
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-multiget',''))),
|
||||||
|
HTTP_WebDAV_Server::mkprop('report',array(
|
||||||
|
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'free-busy-query',''))),
|
||||||
|
))));
|
||||||
$props['supported-calendar-data'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-data',array(
|
$props['supported-calendar-data'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-data',array(
|
||||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0')),
|
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0')),
|
||||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0'))));
|
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0'))));
|
||||||
|
@ -3088,19 +3088,21 @@ class calendar_ical extends calendar_boupdate
|
|||||||
if ($event['non_blocking']) continue;
|
if ($event['non_blocking']) continue;
|
||||||
if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue;
|
if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue;
|
||||||
|
|
||||||
|
$fbtype = $event['participants'][$user] == 'T' ? 'BUSY-TENTATIVE' : 'BUSY';
|
||||||
|
|
||||||
if ($utc)
|
if ($utc)
|
||||||
{
|
{
|
||||||
$vfreebusy->setAttribute('FREEBUSY',array(array(
|
$vfreebusy->setAttribute('FREEBUSY',array(array(
|
||||||
'start' => $event['start'],
|
'start' => $event['start'],
|
||||||
'end' => $event['end'],
|
'end' => $event['end'],
|
||||||
)));
|
)), array('FBTYPE' => $fbtype));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$vfreebusy->setAttribute('FREEBUSY',array(array(
|
$vfreebusy->setAttribute('FREEBUSY',array(array(
|
||||||
'start' => date('Ymd\THis',$event['start']),
|
'start' => date('Ymd\THis',$event['start']),
|
||||||
'end' => date('Ymd\THis',$event['end']),
|
'end' => date('Ymd\THis',$event['end']),
|
||||||
)));
|
)), array('FBTYPE' => $fbtype));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user