Fix to allow for saving new calendar events.

This commit is contained in:
skeeter 2001-11-18 23:01:09 +00:00
parent 5d4eb42476
commit 96f535e483
3 changed files with 43 additions and 22 deletions

View File

@ -547,6 +547,10 @@
$GLOBALS['phpgw']->common->phpgw_exit(); $GLOBALS['phpgw']->common->phpgw_exit();
} }
if($this->debug)
{
echo '<!-- Prior to fix_update_time() -->'."\n";
}
$this->fix_update_time($l_start); $this->fix_update_time($l_start);
$this->fix_update_time($l_end); $this->fix_update_time($l_end);
@ -709,28 +713,26 @@
} }
$overlapping_events = $this->overlap( $overlapping_events = $this->overlap(
// $this->maketime($event['start']) - $this->datetime->tz_offset, $this->maketime($event['start']),
// $this->maketime($event['end']) - $this->datetime->tz_offset, $this->maketime($event['end']),
$this->maketime($event['start']), $event['participants'],
$this->maketime($event['end']), $event['owner'],
$event['participants'], $event_ids
$event['owner'],
$event_ids
); );
} }
if($overlapping_events) if($overlapping_events)
{ {
if($send_to_ui) if($send_to_ui)
{ {
unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
ExecMethod('calendar.uicalendar.overlap', ExecMethod('calendar.uicalendar.overlap',
Array( Array(
'o_events' => $overlapping_events, 'o_events' => $overlapping_events,
'this_event' => $event 'this_event' => $event
) )
); );
$GLOBALS['phpgw']->common->phpgw_exit(True); $GLOBALS['phpgw']->common->phpgw_exit(True);
} }
else else
@ -742,21 +744,34 @@
{ {
if(!$event['id']) if(!$event['id'])
{ {
$this->so->add_entry($event); if($this->debug)
$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event()); {
echo '<!-- Creating a new event. -->'."\n";
}
$this->so->cal->event = $event;
$this->so->add_entry($event);
$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event());
if($this->debug)
{
echo '<!-- New event ID = '.$event['id'].' -->'."\n";
}
} }
else else
{ {
if($this->debug)
{
echo '<!-- Updating an existing event. -->'."\n";
}
$new_event = $event; $new_event = $event;
$old_event = $this->read_entry($event['id']); $old_event = $this->read_entry($event['id']);
$this->prepare_recipients($new_event,$old_event); $this->prepare_recipients($new_event,$old_event);
$this->so->cal->event = $event; $this->so->cal->event = $event;
$this->so->add_entry($event); $this->so->add_entry($event);
} }
$date = sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']); $date = sprintf("%04d%02d%02d",$event['start']['year'],$event['start']['month'],$event['start']['mday']);
if($send_to_ui) if($send_to_ui)
{ {
Execmethod('calendar.uicalendar.index'); Execmethod('calendar.uicalendar.index');
$GLOBALS['phpgw']->common->phpgw_exit(); $GLOBALS['phpgw']->common->phpgw_exit();
} }
} }

View File

@ -65,6 +65,7 @@ class socalendar__
var $users_status; var $users_status;
var $datetime; var $datetime;
var $debug = False; var $debug = False;
// var $debug = True;
function socalendar__() function socalendar__()
{ {

View File

@ -538,6 +538,11 @@ class socalendar_ extends socalendar__
$this->stream->query('DELETE FROM phpgw_cal_repeats WHERE cal_id='.$event['id'],__LINE__,__FILE__); $this->stream->query('DELETE FROM phpgw_cal_repeats WHERE cal_id='.$event['id'],__LINE__,__FILE__);
} }
if($this->debug)
{
echo '<!-- Event ID #'.$event['id'].' saved! -->'."\n";
}
$this->stream->unlock(); $this->stream->unlock();
return True; return True;
} }