R29310 - in /trunk/calendar/inc: class.calendar_ical.inc.php class.calendar_sif.inc.php class.calendar_uiforms.inc.php

Author: jlehrke
New Revision: 29310

URL: http://www.egroupware.org/viewvc/egroupware?rev=29310&view=rev
Log:
Fix various recurring event issues

Modified:
trunk/calendar/inc/class.calendar_ical.inc.php
trunk/calendar/inc/class.calendar_sif.inc.php
trunk/calendar/inc/class.calendar_uiforms.inc.php

Modified: trunk/calendar/inc/class.calendar_ical.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_ical.inc.php?rev=29310&r1=29309&r2=29310&view=diff

— trunk/calendar/inc/class.calendar_ical.inc.php (original)
+++ trunk/calendar/inc/class.calendar_ical.inc.php Wed Feb 24 16:05:00 2010
@@ -211,6 +211,7 @@
strtoupper($GLOBALS[‘egw_info’][‘user’][‘preferences’][‘common’][‘lang’]));
$vcal->setAttribute(‘VERSION’, $version);
$vcal->setAttribute(‘METHOD’, $method);

  •   $events_exported = false;
    
      if (!is_array($events)) $events = array($events);
    

@@ -893,9 +894,10 @@
}
}
$vcal->addComponent($vevent);

  •   }
    
  •   $retval = $vcal->exportvCalendar();
    
  •   	$events_exported = true;
    
  •   }
    
  •   $retval = $events_exported ? $vcal->exportvCalendar() : false;
      if ($this->log)
      {
      	error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ .
    

@@ -1070,7 +1072,7 @@
if (!isset($event[‘participants’][$uid]))
{
// Add it back in

  •   								$event['participants'][$uid] = $event['participant_types']['r'][substr($uid,1)] = $status;
    
  •   								$event['participants'][$uid] = $status;
      							}
      						}
      						break;
    

@@ -1083,7 +1085,14 @@
else
{
// no merge

  •   			if (!isset($this->supportedFields['participants']) || !count($event['participants']))
    
  •   			if(!isset($this->supportedFields['category']))
    
  •   			{
    
  •   				$event['category'] = $event_info['stored_event']['category'];
    
  •   			}
    
  •   			if (!isset($this->supportedFields['participants'])
    
  •   				|| !$event['participants']
    
  •   				|| !is_array($event['participants'])
    
  •   				|| !count($event['participants']))
      			{
      				if ($this->log)
      				{
    

@@ -1094,7 +1103,6 @@
// If this is an updated meeting, and the client doesn’t support
// participants OR the event no longer contains participants, add them back
unset($event[‘participants’]);

  •   				unset($event['participant_types']);
      			}
      			else
      			{
    

@@ -1119,20 +1127,19 @@
}
}
}

  •   			}
    
  •   			foreach ($event_info['stored_event']['participants'] as $uid => $status)
    
  •   			{
    
  •   				// Is it a resource and no longer present in the event?
    
  •   				if ($uid[0] == 'r' && !isset($event['participants'][$uid]))
    
  •   				{
    
  •   					if ($this->log)
    
  •   					{
    
  •   						error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
    
  •   							"() Restore resource $uid to status $status\n",3,$this->logfile);
    
  •   					}
    
  •   					// Add it back in
    
  •   					$event['participants'][$uid] = $event['participant_types']['r'][substr($uid,1)] = $status;
    
  •   				foreach ($event_info['stored_event']['participants'] as $uid => $status)
    
  •   				{
    
  •   					// Is it a resource and no longer present in the event?
    
  •   					if ($uid[0] == 'r' && !isset($event['participants'][$uid]))
    
  •   					{
    
  •   						if ($this->log)
    
  •   						{
    
  •   							error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
    
  •   								"() Restore resource $uid to status $status\n",3,$this->logfile);
    
  •   						}
    
  •   						// Add it back in
    
  •   						$event['participants'][$uid] = $status;
    
  •   					}
      				}
      			}
    

@@ -1188,7 +1195,9 @@
$event[‘owner’] = $this->user;
}

  •   		if (!is_array($event['participants']) || !count($event['participants']))
    
  •   		if (!$event['participants']
    
  •   			|| !is_array($event['participants'])
    
  •   			|| !count($event['participants']))
      		{
      			$status = $event['owner'] == $this->user ? 'A' : 'U';
      			$status = calendar_so::combine_status($status, 1, 'CHAIR');
    

@@ -1198,7 +1207,7 @@
{
foreach ($event[‘participants’] as $uid => $status)
{

  •   				// Is it a resource and no longer present in the event?
    
  •   				// if the client did not give us a proper status => set default
      				if ($status[0] == 'X')
      				{
      					if ($uid == $event['owner'])
    

@@ -1499,46 +1508,49 @@
$event_info[‘stored_event’] = $this->read($updated_id, 0, false, ‘server’);
}

  •   	// update status depending on the given event type
    
  •   	switch ($event_info['type'])
    
  •   	{
    
  •   		case 'SINGLE':
    
  •   		case 'SERIES-MASTER':
    
  •   		case 'SERIES-EXCEPTION':
    
  •   		case 'SERIES-EXCEPTION-PROPAGATE':
    
  •   			if (is_array($event_info['stored_event'])) // status update requires a stored event
    
  •   			{
    
  •   				if ($event_info['acl_edit'])
    
  •   				{
    
  •   					// update all participants if we have the right to do that
    
  •   					$this->update_status($event, $event_info['stored_event']);
    
  •   				}
    
  •   				elseif (isset($event['participants'][$this->user]) || isset($event_info['stored_event']['participants'][$this->user]))
    
  •   				{
    
  •   					// update the users status only
    
  •   					$this->set_status($event_info['stored_event']['id'], $this->user,
    
  •   						($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), 0, true);
    
  •   				}
    
  •   			}
    
  •   			break;
    
  •   		case 'SERIES-PSEUDO-EXCEPTION':
    
  •   			if (is_array($event_info['master_event'])) // status update requires a stored master event
    
  •   			{
    
  •   				$recurrence = $this->date2usertime($event['recurrence']);
    
  •   				if ($event_info['acl_edit'])
    
  •   				{
    
  •   					// update all participants if we have the right to do that
    
  •   					$this->update_status($event, $event_info['stored_event'], $recurrence);
    
  •   				}
    
  •   				elseif (isset($event['participants'][$this->user]) || isset($event_info['master_event']['participants'][$this->user]))
    
  •   				{
    
  •   					// update the users status only
    
  •   					$this->set_status($event_info['master_event']['id'], $this->user,
    
  •   						($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), $recurrence, true);
    
  •   				}
    
  •   			}
    
  •   			break;
    
  •   	if (isset($event['participants']))
    
  •   	{
    
  •   		// update status depending on the given event type
    
  •   		switch ($event_info['type'])
    
  •   		{
    
  •   			case 'SINGLE':
    
  •   			case 'SERIES-MASTER':
    
  •   			case 'SERIES-EXCEPTION':
    
  •   			case 'SERIES-EXCEPTION-PROPAGATE':
    
  •   				if (is_array($event_info['stored_event'])) // status update requires a stored event
    
  •   				{
    
  •   					if ($event_info['acl_edit'])
    
  •   					{
    
  •   						// update all participants if we have the right to do that
    
  •   						$this->update_status($event, $event_info['stored_event']);
    
  •   					}
    
  •   					elseif (isset($event['participants'][$this->user]) || isset($event_info['stored_event']['participants'][$this->user]))
    
  •   					{
    
  •   						// update the users status only
    
  •   						$this->set_status($event_info['stored_event']['id'], $this->user,
    
  •   							($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), 0, true);
    
  •   					}
    
  •   				}
    
  •   				break;
    
  •   			case 'SERIES-PSEUDO-EXCEPTION':
    
  •   				if (is_array($event_info['master_event'])) // status update requires a stored master event
    
  •   				{
    
  •   					$recurrence = $this->date2usertime($event['recurrence']);
    
  •   					if ($event_info['acl_edit'])
    
  •   					{
    
  •   						// update all participants if we have the right to do that
    
  •   						$this->update_status($event, $event_info['stored_event'], $recurrence);
    
  •   					}
    
  •   					elseif (isset($event['participants'][$this->user]) || isset($event_info['master_event']['participants'][$this->user]))
    
  •   					{
    
  •   						// update the users status only
    
  •   						$this->set_status($event_info['master_event']['id'], $this->user,
    
  •   							($event['participants'][$this->user] ? $event['participants'][$this->user] : 'R'), $recurrence, true);
    
  •   					}
    
  •   				}
    
  •   				break;
    
  •   		}
      	}
    
      	// choose which id to return to the client
    

@@ -1864,6 +1876,7 @@
case ‘d750i’:
case ‘p910i’:
case ‘g705i’:

  •   			case 'w890i':
      				$this->supportedFields = $defaultFields['basic'];
      				break;
      			default:
    

@@ -2491,7 +2504,7 @@
{
//Horde::logMessage("vevent2egw: set status to " . $status,
// FILE, LINE, PEAR_LOG_DEBUG);

  •   							$event['participants'][$this->user] =
    
  •   							$vcardData['participants'][$this->user] =
      								calendar_so::combine_status($status);
      						}
      						$status = 'U'; // keep the group
    

@@ -2532,12 +2545,12 @@
{
$attributes[‘params’][‘ROLE’] = ‘CHAIR’;
}

  •   					if (!isset($event['participants'][$uid]) ||
    
  •   							$event['participants'][$uid][0] != 'A')
    
  •   					if (!isset($vcardData['participants'][$uid]) ||
    
  •   							$vcardData['participants'][$uid][0] != 'A')
      					{
      						// for multiple entries the ACCEPT wins
      						// add quantity and role
    
  •   						$event['participants'][$uid] =
    
  •   						$vcardData['participants'][$uid] =
      							calendar_so::combine_status($status,
      								$attributes['params']['X-EGROUPWARE-QUANTITY'],
      								$attributes['params']['ROLE']);
    

@@ -2545,11 +2558,11 @@
break;

					case 'ORGANIZER':
  •   					if (isset($event['participants'][$uid]))
    
  •   					{
    
  •   						$status = $event['participants'][$uid];
    
  •   					if (isset($vcardData['participants'][$uid]))
    
  •   					{
    
  •   						$status = $vcardData['participants'][$uid];
      						calendar_so::split_status($status, $quantity, $role);
    
  •   						$event['participants'][$uid] =
    
  •   						$vcardData['participants'][$uid] =
      							calendar_so::combine_status($status, $quantity, 'CHAIR');
      					}
      					if (is_numeric($uid) && ($uid == $this->calendarOwner || !$this->calendarOwner))
    

@@ -2561,10 +2574,10 @@
{
// we must insert a CHAIR participant to keep the ORGANIZER
$event[‘owner’] = $this->user;

  •   						if (!isset($event['participants'][$uid]))
    
  •   						if (!isset($vcardData['participants'][$uid]))
      						{
      							// save the ORGANIZER as event CHAIR
    
  •   							$event['participants'][$uid] =
    
  •   							$vcardData['participants'][$uid] =
      								calendar_so::combine_status('U', 1, 'CHAIR');
      						}
      					}
    

@@ -2781,6 +2794,8 @@
*/
function update_status($new_event, $old_event , $recur_date=0)
{

  •   if (!isset($new_event['participants'])) return;
    
  •   // check the old list against the new list
      foreach ($old_event['participants'] as $userid => $status)
      {
    

Modified: trunk/calendar/inc/class.calendar_sif.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_sif.inc.php?rev=29310&r1=29309&r2=29310&view=diff

— trunk/calendar/inc/class.calendar_sif.inc.php (original)
+++ trunk/calendar/inc/class.calendar_sif.inc.php Wed Feb 24 16:05:00 2010
@@ -477,7 +477,7 @@
// overwrite with server data for merge
foreach ($event_info[‘stored_event’] as $key => $value)
{

  •   			if (in_array($key, array('participants', 'participant_types')))
    
  •   			if ($key == 'participants')
      			{
      				unset($event[$key]);
      				continue;
    

@@ -490,7 +490,6 @@
// not merge
// SIF clients do not support participants => add them back
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']]))
    

Modified: trunk/calendar/inc/class.calendar_uiforms.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_uiforms.inc.php?rev=29310&r1=29309&r2=29310&view=diff

— trunk/calendar/inc/class.calendar_uiforms.inc.php (original)
+++ trunk/calendar/inc/class.calendar_uiforms.inc.php Wed Feb 24 16:05:00 2010
@@ -238,7 +238,7 @@
$event[‘end’][‘hour’] = 23; $event[‘end’][‘minute’] = $event[‘end’][‘second’] = 59; unset($event[‘end’][‘raw’]);
$event[‘end’] = $this->bo->date2ts($event[‘end’]);
}

  •   	// some checks for recurances, if you give a date, make it a weekly repeating event and visa versa
    
  •   	// some checks for recurrences, if you give a date, make it a weekly repeating event and visa versa
      	if ($event['recur_type'] == MCAL_RECUR_NONE && $event['recur_data']) $event['recur_type'] = MCAL_RECUR_WEEKLY;
      	if ($event['recur_type'] == MCAL_RECUR_WEEKLY && !$event['recur_data'])
      	{
    

@@ -833,14 +833,11 @@
// check if we should create an exception
if ($_GET[‘exception’])
{

  •   				// exception: preserv participants of this event and merge it with the 0-recurrence
    
  •   				$participants = array('participants' => $event['participants'],'participant_types' => $event['participant_types']);
    
  •   				$event = array_merge($this->bo->read($cal_id,0,true),$participants);
      				$msg = $this->_create_exception($event,$preserv);
      			}
      			else
      			{
    
  •   				$event = $this->bo->read($cal_id,0,true); // read the 0-recurrence
    
  •   				$event = $this->bo->read($cal_id,0,true);
      			}
      		}
      	}
    

@@ -1077,12 +1074,12 @@
$GLOBALS[‘egw’]->js->set_onload(“set_style_by_class(‘table’,‘end_hide’,‘display’,’”.($content[‘duration’] && isset($sel_options[‘duration’][$content[‘duration’]]) ? ‘none’ : ‘block’)."’);");

		$readonlys['recur_exception'] = !count($content['recur_exception']);	// otherwise we get a delete button
  •   	if ($event['recur_type'] != MCAL_RECUR_NONE)
      	{
      		$onclick =& $etpl->get_cell_attribute('button[delete]','onclick');
      		$onclick = str_replace('Delete this event','Delete this series of recuring events',$onclick);
    
  •   		// some fundamental values of an existing series should not be changed by the user
      		$readonlys['start'] = $readonlys['whole_day'] = true;
      		$readonlys['recur_type'] = $readonlys['recur_data'] = true;
    

@@ -1746,7 +1743,7 @@
‘owner’ => ‘select-account’,
‘cat_id’ => ‘select-cat’,
‘non_blocking’ => array(’’=>lang(‘No’), 1=>lang(‘Yes’)),

  •   		'start'		=>	'date-time',
      		'end'		=>	'date-time',
    

@@ -1770,11 +1767,11 @@
if($content[‘recur_type’] || $content[‘recurrence’]) {
$content[‘history’][‘filter’] = array(
’(history_status NOT LIKE ‘participants%’ OR (history_status LIKE ‘participants%’ AND (

  •   			history_new_value LIKE \'%' . bo_tracking::ONE2N_SEPERATOR . $content['recurrence'] . '\' OR 
    
  •   			history_new_value LIKE \'%' . bo_tracking::ONE2N_SEPERATOR . $content['recurrence'] . '\' OR
      			history_old_value LIKE \'%' . bo_tracking::ONE2N_SEPERATOR . $content['recurrence'] . '\')))'
      	);
      }
    
  •   // Translate labels
      $tracking = new calendar_tracking();
      foreach($tracking->field2label as $field => $label) {
    

Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs