Cleanup issues found during backport

This commit is contained in:
Jörg Lehrke 2010-02-23 18:19:12 +00:00
parent de840a1fcc
commit 85b6ba5ef0
4 changed files with 42 additions and 33 deletions

View File

@ -98,8 +98,11 @@ class calendar_groupdav extends groupdav_handler
*/
function propfind($path,$options,&$files,$user,$id='')
{
if ($this->debug) error_log(__METHOD__."($path,".array2string($options).",,$user,$id)");
$starttime = microtime(true);
if ($this->debug)
{
error_log(__METHOD__."($path,".array2string($options).",,$user,$id)");
$starttime = microtime(true);
}
// ToDo: add parameter to only return id & etag
$cal_filters = array(
@ -121,7 +124,11 @@ class calendar_groupdav extends groupdav_handler
{
return false;
}
if ($this->debug > 1) error_log(__METHOD__."($path,,,$user,$id) cal_filters=".array2string($cal_filters));
if ($this->debug > 1)
{
error_log(__METHOD__."($path,,,$user,$id) cal_filters=".
array2string($cal_filters));
}
// check if we have to return the full calendar data or just the etag's
if (!($calendar_data = $options['props'] == 'all' && $options['root']['ns'] == groupdav::CALDAV) && is_array($options['props']))
@ -183,7 +190,11 @@ class calendar_groupdav extends groupdav_handler
);
}
}
if ($this->debug) error_log(__METHOD__."($path) took ".(microtime(true) - $starttime).' to return '.count($files['files']).' items');
if ($this->debug)
{
error_log(__METHOD__."($path) took ".(microtime(true) - $starttime).
' to return '.count($files['files']).' items');
}
return true;
}
@ -284,11 +295,9 @@ class calendar_groupdav extends groupdav_handler
{
foreach($options['other'] as $option)
{
if ($option['name'] == 'href')
{
$parts = explode('/',$option['data']);
if (is_numeric($id = basename(array_pop($parts),'.ics'))) $ids[] = $id;
}
}
@ -424,13 +433,13 @@ class calendar_groupdav extends groupdav_handler
*/
function put(&$options,$id,$user=null)
{
if($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
if ($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
$return_no_access=true; // as handled by importVCal anyway and allows it to set the status for participants
$event = $this->_common_get_put_delete('PUT',$options,$id,$return_no_access);
if (!is_null($event) && !is_array($event))
{
if($this->debug) error_log(__METHOD__.print_r($event,true).function_backtrace());
if ($this->debug) error_log(__METHOD__.print_r($event,true).function_backtrace());
return $event;
}
$handler = $this->_get_handler();

View File

@ -196,6 +196,7 @@ class calendar_ical extends calendar_boupdate
'UID' => 'uid',
'RECURRENCE-ID' => 'recurrence',
'SEQUENCE' => 'etag',
'STATUS' => 'status',
);
if (!is_array($this->supportedFields)) $this->setSupportedFields();
@ -218,7 +219,7 @@ class calendar_ical extends calendar_boupdate
{
$mailtoOrganizer = false;
$organizerCN = false;
$recurrence = $recur_date;
$recurrence = $this->date2usertime($recur_date);
$tzid = null;
if (!is_array($event)
@ -622,6 +623,10 @@ class calendar_ical extends calendar_boupdate
}
break;
case 'STATUS':
$attributes['STATUS'] = 'CONFIRMED';
break;
case 'CATEGORIES':
if ($event['category'] && ($values['CATEGORIES'] = $this->get_categories($event['category'])))
{
@ -641,12 +646,12 @@ class calendar_ical extends calendar_boupdate
{
$icalFieldName = 'X-RECURRENCE-ID';
}
if ($recurrence)
if ($recur_date)
{
// We handle a pseudo exception
if (isset($event['whole_day']))
{
$time = new egw_time($recurrence,egw_time::$server_timezone);
$time = new egw_time($recur_date,egw_time::$server_timezone);
$time->setTimezone(self::$tz_cache[$event['tzid']]);
$arr = egw_time::to($time,'array');
$vevent->setAttribute($icalFieldName, array(
@ -658,7 +663,7 @@ class calendar_ical extends calendar_boupdate
}
else
{
$attributes[$icalFieldName] = self::getDateTime($recurrence,$tzid,$parameters[$icalFieldName]);
$attributes[$icalFieldName] = self::getDateTime($recur_date,$tzid,$parameters[$icalFieldName]);
}
}
elseif ($event['recurrence'] && $event['reference'])
@ -734,7 +739,6 @@ class calendar_ical extends calendar_boupdate
{
$attributes[$icalFieldName] = $value;
}
break;
}
}
@ -1089,8 +1093,8 @@ class calendar_ical extends calendar_boupdate
// If this is an updated meeting, and the client doesn't support
// participants OR the event no longer contains participants, add them back
$event['participants'] = $event_info['stored_event']['participants'];
$event['participant_types'] = $event_info['stored_event']['participant_types'];
unset($event['participants']);
unset($event['participant_types']);
}
else
{
@ -1748,6 +1752,7 @@ class calendar_ical extends calendar_boupdate
$defaultFields['basic'] = $defaultFields['minimal'] + array(
'recur_exception' => 'recur_exception',
'priority' => 'priority',
'status' => 'status',
);
$defaultFields['nexthaus'] = $defaultFields['basic'] + array(
@ -2662,14 +2667,6 @@ class calendar_ical extends calendar_boupdate
function search($_vcalData, $contentID=null, $relax=false)
{
if (is_null($contentID))
{
$eventId = -1;
}
else
{
$eventId = $contentID;
}
if (($events = $this->icaltoegw($_vcalData)))
{
// this function only supports searching a single event

View File

@ -312,10 +312,7 @@ class calendar_sif extends calendar_boupdate
if ($this->event['recur_noenddate'] == 0)
{
$recur_enddate = $this->vCalendar->_parseDateTime($this->event['recur_enddate']);
$finalEvent['recur_enddate'] = mktime(
date('H', 23),
date('i', 59),
date('s', 59),
$finalEvent['recur_enddate'] = mktime(0, 0, 0,
date('m', $recur_enddate),
date('d', $recur_enddate),
date('Y', $recur_enddate));
@ -480,6 +477,11 @@ class calendar_sif extends calendar_boupdate
// overwrite with server data for merge
foreach ($event_info['stored_event'] as $key => $value)
{
if (in_array($key, array('participants', 'participant_types')))
{
unset($event[$key]);
continue;
}
if (!empty($value)) $event[$key] = $value;
}
}
@ -487,8 +489,8 @@ class calendar_sif extends calendar_boupdate
{
// not merge
// SIF clients do not support participants => add them back
$event['participants'] = $event_info['stored_event']['participants'];
$event['participant_types'] = $event_info['stored_event']['participant_types'];
unset($event['participants']);
unset($event['participant_types']);
if ($event['whole_day'] && $event['tzid'] != $event_info['stored_event']['tzid'])
{
if (!isset(self::$tz_cache[$event_info['stored_event']['tzid']]))

View File

@ -1491,16 +1491,14 @@ ORDER BY cal_user_type, cal_usre_id
* get stati of all recurrences of an event for a specific participant
*
* @param int $cal_id
* @param int $uid participant uid
* @param int $uid=null participant uid; if == null return only the recur dates
* @param int $start=0 if != 0: startdate of the search/list (servertime)
* @param int $end=0 if != 0: enddate of the search/list (servertime)
*
* @return array recur_date => status pairs (index 0 => main status)
*/
function get_recurrences($cal_id, $uid, $start=0, $end=0)
function get_recurrences($cal_id, $uid=null, $start=0, $end=0)
{
$user_type = $user_id = null;
self::split_user($uid, $user_type, $user_id);
$participant_status = array();
$where = array('cal_id' => $cal_id);
if ($start != 0 && $end == 0) $where[] = '(cal_recur_date = 0 OR cal_recur_date >= ' . (int)$start . ')';
@ -1515,6 +1513,9 @@ ORDER BY cal_user_type, cal_usre_id
// inititalize the array
$participant_status[$row['cal_recur_date']] = null;
}
if (is_null($uid)) return $participant_status;
$user_type = $user_id = null;
self::split_user($uid, $user_type, $user_id);
$where = array(
'cal_id' => $cal_id,
'cal_user_type' => $user_type ? $user_type : 'u',