_GET parameter to directly create an exception (for Stefan to add Outlook like questions "Do you want to edit the serie or just this event?"), parameter is exception=1 and works only for recuring events

This commit is contained in:
Ralf Becker 2008-02-07 02:38:55 +00:00
parent 1163804989
commit 0a716b3342

View File

@ -327,14 +327,7 @@ class uiforms extends uical
switch((string)$button) switch((string)$button)
{ {
case 'exception': // create an exception in a recuring event case 'exception': // create an exception in a recuring event
$event['end'] += $content['actual_date'] - $event['start']; $msg = $this->_create_exception($event,$preserv);
$event['start'] = $preserv['edit_single'] = $preserv['actual_date'];
$event['recur_type'] = MCAL_RECUR_NONE;
foreach(array('recur_enddate','recur_interval','recur_exception','recur_data') as $name)
{
unset($event[$name]);
}
$msg = lang('Exception created - you can now edit or delete it');
break; break;
case 'copy': // create new event with copied content, some content need to be unset to make a "new" event case 'copy': // create new event with copied content, some content need to be unset to make a "new" event
@ -538,6 +531,27 @@ class uiforms extends uical
} }
return $this->edit($event,$preserv,$msg,$js,$event['id'] ? $event['id'] : $content['link_to']['to_id']); return $this->edit($event,$preserv,$msg,$js,$event['id'] ? $event['id'] : $content['link_to']['to_id']);
} }
/**
* Create an exception from the clicked event
*
* It's not stored to the DB unless the user saves it!
*
* @param array &$event
* @param array &$preserv
* @return string message that exception was created
*/
function _create_exception(&$event,&$preserv)
{
$event['end'] += $preserv['actual_date'] - $event['start'];
$event['start'] = $preserv['edit_single'] = $preserv['actual_date'];
$event['recur_type'] = MCAL_RECUR_NONE;
foreach(array('recur_enddate','recur_interval','recur_exception','recur_data') as $name)
{
unset($event[$name]);
}
return lang('Exception created - you can now edit or delete it');
}
/** /**
* return javascript to open felamimail compose window with preset content to mail all participants * return javascript to open felamimail compose window with preset content to mail all participants
@ -668,6 +682,11 @@ class uiforms extends uical
{ {
$participants = array('participants' => $event['participants'], 'participant_types' => $event['participant_types']); // preserv participants of this event $participants = array('participants' => $event['participants'], 'participant_types' => $event['participant_types']); // preserv participants of this event
$event = array_merge($this->bo->read($cal_id,0,true), $participants); // recuring event --> read the series + concatenate with participants of the selected recurrence $event = array_merge($this->bo->read($cal_id,0,true), $participants); // recuring event --> read the series + concatenate with participants of the selected recurrence
// check if we should create an exception
if ($_GET['exception'])
{
$msg = $this->_create_exception($event,$preserv);
}
} }
} }
// set new start and end if given by $_GET // set new start and end if given by $_GET