This commit is contained in:
skeeter 2002-09-21 21:50:30 +00:00
parent cfccb40de2
commit 2cc532c42b
5 changed files with 101 additions and 190 deletions

View File

@ -238,7 +238,7 @@
{ {
$this->year = $year; $this->year = $year;
} }
else // if($this->year == 0) else
{ {
$this->year = date('Y',$GLOBALS['phpgw']->datetime->users_localtime); $this->year = date('Y',$GLOBALS['phpgw']->datetime->users_localtime);
} }
@ -246,7 +246,7 @@
{ {
$this->month = $month; $this->month = $month;
} }
else // if($this->month == 0) else
{ {
$this->month = date('m',$GLOBALS['phpgw']->datetime->users_localtime); $this->month = date('m',$GLOBALS['phpgw']->datetime->users_localtime);
} }
@ -254,7 +254,7 @@
{ {
$this->day = $day; $this->day = $day;
} }
else // if($this->day == 0) else
{ {
$this->day = date('d',$GLOBALS['phpgw']->datetime->users_localtime); $this->day = date('d',$GLOBALS['phpgw']->datetime->users_localtime);
} }
@ -272,11 +272,8 @@
$this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime);
if($this->debug) print_debug('BO Filter','('.$this->filter.')');
{ print_debug('Owner',$this->owner);
echo '<!-- BO Filter : ('.$this->filter.') -->'."\n";
echo '<!-- Owner : '.$this->owner.' -->'."\n";
}
} }
function list_methods($_type='xmlrpc') function list_methods($_type='xmlrpc')
@ -724,10 +721,9 @@
$event['description'] = $GLOBALS['phpgw']->db->db_addslashes($event['description']); $event['description'] = $GLOBALS['phpgw']->db->db_addslashes($event['description']);
$this->store_to_appsession($event); $this->store_to_appsession($event);
$datetime_check = $this->validate_update($event); $datetime_check = $this->validate_update($event);
if($this->debug)
{ print_debug('bo->validate_update() returnval',$datetime_check);
echo '<!-- bo->validate_update() returned : '.$datetime_check.' -->'."\n";
}
if($datetime_check) if($datetime_check)
{ {
ExecMethod('calendar.uicalendar.edit', ExecMethod('calendar.uicalendar.edit',
@ -780,24 +776,15 @@
{ {
if(!$event['id']) if(!$event['id'])
{ {
if($this->debug) print_debug('Creating a new event.');
{
echo '<!-- Creating a new event. -->'."\n";
}
$this->so->cal->event = $event; $this->so->cal->event = $event;
$this->so->add_entry($event); $this->so->add_entry($event);
$this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event()); $this->send_update(MSG_ADDED,$event['participants'],'',$this->get_cached_event());
if($this->debug) print_debug('New Event ID',$event['id']);
{
echo '<!-- New event ID = '.$event['id'].' -->'."\n";
}
} }
else else
{ {
if($this->debug) print_debug('Updating an existing event.');
{
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);
@ -927,10 +914,6 @@
$temp_cache_events = $this->cached_events; $temp_cache_events = $this->cached_events;
} }
// $temp_start = intval($GLOBALS['phpgw']->common->show_date($starttime,'Ymd'));
// $temp_start_time = intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi'));
// $temp_end = intval($GLOBALS['phpgw']->common->show_date($endtime,'Ymd'));
// $temp_end_time = intval($GLOBALS['phpgw']->common->show_date($endtime,'Hi'));
$temp_start = intval(date('Ymd',$starttime)); $temp_start = intval(date('Ymd',$starttime));
$temp_start_time = intval(date('Hi',$starttime)); $temp_start_time = intval(date('Hi',$starttime));
$temp_end = intval(date('Ymd',$endtime)); $temp_end = intval(date('Ymd',$endtime));
@ -1043,99 +1026,8 @@
} }
return $retval; return $retval;
// if($starttime == $endtime && $GLOBALS['phpgw']->common->show_date($starttime,'Hi') == 0)
// {
// $endtime = mktime(23,59,59,$GLOBALS['phpgw']->common->show_date($starttime,'m'),$GLOBALS['phpgw']->common->show_date($starttime,'d') + 1,$GLOBALS['phpgw']->common->show_date($starttime,'Y')) - $GLOBALS['phpgw']->datetime->tz_offset;
// }
//
// - $sql = 'AND ((('.$starttime.' <= phpgw_cal.datetime) AND ('.$endtime.' >= phpgw_cal.datetime) AND ('.$endtime.' <= phpgw_cal.edatetime)) '
// . 'OR (('.$starttime.' >= phpgw_cal.datetime) AND ('.$starttime.' < phpgw_cal.edatetime) AND ('.$endtime.' >= phpgw_cal.edatetime)) '
// - . 'OR (('.$starttime.' <= phpgw_cal.datetime) AND ('.$endtime.' >= phpgw_cal.edatetime)) '
// - . 'OR (('.$starttime.' >= phpgw_cal.datetime) AND ('.$endtime.' <= phpgw_cal.edatetime))) ';
//
// if(count($participants) > 0)
// {
// $p_g = '';
// if(count($participants))
// {
// $users = Array();
// while(list($user,$status) = each($participants))
// {
// $users[] = $user;
// }
// if($users)
// {
// $p_g .= 'phpgw_cal_user.cal_login IN ('.implode(',',$users).')';
// }
// }
// if($p_g)
// {
// $sql .= ' AND (' . $p_g . ')';
// }
// }
//
// if(count($id) >= 1)
// {
// @reset($id);
// $sql .= ' AND phpgw_cal.cal_id NOT IN ('.(count($id)==1?$id[0]:implode(',',$id)).')';
// }
//
// $sql .= ' ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC';
//
// $events = $this->so->get_event_ids(False,$sql);
// if($events == False)
// {
// return false;
// }
//
// $db2 = $GLOBALS['phpgw']->db;
//
// for($i=0;$i<count($events);$i++)
// {
// $db2->query('SELECT recur_type FROM phpgw_cal_repeats WHERE cal_id='.$events[$i],__LINE__,__FILE__);
// if($db2->num_rows() == 0)
// {
// $retval[] = $events[$i];
// $ok = True;
// }
// else
// {
// $db2->next_record();
// if($db2->f('recur_type') <> MCAL_RECUR_MONTHLY_MDAY)
// {
// $retval[] = $events[$i];
// $ok = True;
// }
// }
// }
// if($ok == True)
// {
// return $retval;
// }
// else
// {
// return False;
// }
} }
// function check_perms($needed,$user=0)
// {
// if($user == 0)
// {
// $allowed = !!($this->grants[$this->owner] & $needed);
// if($this->debug)
// {
// echo '<!-- Grantor: '.$this->owner.' Rights: '.$this->grants[$this->owner].' Allowed: '.$allowed.'-->'."\n";
// }
// return $allowed;
// }
// else
// {
// return !!($this->grants[intval($user)] & $needed);
// }
// }
function check_perms($needed,$event=0) function check_perms($needed,$event=0)
{ {
if (is_int($event) && $event == 0) if (is_int($event) && $event == 0)
@ -1371,10 +1263,9 @@
$event_time = mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset; $event_time = mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset;
while($inserted == False && list($key,$exception_time) = each($event['recur_exception'])) while($inserted == False && list($key,$exception_time) = each($event['recur_exception']))
{ {
if($this->debug) print_debug('Checking Exception DateTime',$exception_time);
{ print_debug('Checking Event DateTime',$event_time);
echo '<!-- checking exception datetime '.$exception_time.' to event datetime '.$event_time.' -->'."\n";
}
if($exception_time == $event_time) if($exception_time == $event_time)
{ {
$inserted = True; $inserted = True;
@ -1384,28 +1275,21 @@
if($this->cached_events[$date] && $inserted == False) if($this->cached_events[$date] && $inserted == False)
{ {
if($this->debug) print_debug('Cached Events Found',$date);
{
echo '<!-- Cached Events found for '.$date.' -->'."\n";
}
$year = substr($date,0,4); $year = substr($date,0,4);
$month = substr($date,4,2); $month = substr($date,4,2);
$day = substr($date,6,2); $day = substr($date,6,2);
if($this->debug) print_debug('Date',$date);
{ print_debug('Count',count($this->cached_events[$date]));
echo '<!-- Date : '.$date.' Count : '.count($this->cached_events[$date]).' -->'."\n";
}
for($i=0;$i<count($this->cached_events[$date]);$i++) for($i=0;$i<count($this->cached_events[$date]);$i++)
{ {
$events = $this->cached_events[$date][$i]; $events = $this->cached_events[$date][$i];
if($this->cached_events[$date][$i]['id'] == $event['id'] || $this->cached_events[$date][$i]['reference'] == $event['id']) if($this->cached_events[$date][$i]['id'] == $event['id'] || $this->cached_events[$date][$i]['reference'] == $event['id'])
{ {
if($this->debug) print_debug('Item Already Inserted!');
{
echo '<!-- Item already inserted! -->'."\n";
}
$inserted = True; $inserted = True;
break; break;
} }
@ -1423,10 +1307,7 @@
{ {
$this->cached_events[$date][$j] = $this->cached_events[$date][$j-1]; $this->cached_events[$date][$j] = $this->cached_events[$date][$j-1];
} }
if($this->debug) print_debug('Adding to cached events:ID',$event['id']);
{
echo '<!-- Adding event ID: '.$event['id'].' to cached_events -->'."\n";
}
$inserted = True; $inserted = True;
$this->cached_events[$date][$i] = $event; $this->cached_events[$date][$i] = $event;
break; break;
@ -1435,10 +1316,7 @@
} }
if(!$inserted) if(!$inserted)
{ {
if($this->debug) print_debug('Adding to cached events:ID',$event['id']);
{
echo '<!-- Adding event ID: '.$event['id'].' to cached_events -->'."\n";
}
$this->cached_events[$date][] = $event; $this->cached_events[$date][] = $event;
} }
} }
@ -1452,10 +1330,9 @@
$search_date_day = date('d',$datetime); $search_date_day = date('d',$datetime);
$search_date_dow = date('w',$datetime); $search_date_dow = date('w',$datetime);
$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year); $search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
if($this->debug)
{ print_debug('Search Date Full',$search_date_full);
echo '<!-- Search Date Full = '.$search_date_full.' -->'."\n";
}
$repeated = $this->repeating_events; $repeated = $this->repeating_events;
$r_events = count($repeated); $r_events = count($repeated);
for ($i=0;$i<$r_events;$i++) for ($i=0;$i<$r_events;$i++)
@ -1474,11 +1351,8 @@
$end_recur_date = date('Ymd',$event_recur_time); $end_recur_date = date('Ymd',$event_recur_time);
$full_event_date = date('Ymd',$event_beg_day); $full_event_date = date('Ymd',$event_beg_day);
if($this->debug) print_debug('check_repeating_events:Processing ID',$id);
{ print_debug('check_repeating_events:Recurring End Date',$end_recur_date);
echo '<!-- check_repeating_events - Processing ID - '.$id.' -->'."\n";
echo '<!-- check_repeating_events - Recurring End Date - '.$end_recur_date.' -->'."\n";
}
// only repeat after the beginning, and if there is an rpt_end before the end date // only repeat after the beginning, and if there is an rpt_end before the end date
if (($search_date_full > $end_recur_date) || ($search_date_full < $full_event_date)) if (($search_date_full > $end_recur_date) || ($search_date_full < $full_event_date))
@ -1605,10 +1479,7 @@
{ {
unset($owner_id); unset($owner_id);
$owner_id = $this->g_owner; $owner_id = $this->g_owner;
if($this->debug) print_debug('owner_id in','('.implode($owner_id).')');
{
echo '<!-- owner_id in ('.implode($owner_id,',').') -->'."\n";
}
} }
if(!$eyear && !$emonth && !$eday) if(!$eyear && !$emonth && !$eday)
@ -1640,11 +1511,8 @@
$edate = mktime(23,59,59,$emonth,$eday,$eyear); $edate = mktime(23,59,59,$emonth,$eday,$eyear);
} }
if($this->debug) print_debug('Start Date',sprintf("%04d%02d%02d",$syear,$smonth,$sday));
{ print_debug('End Date',sprintf("%04d%02d%02d",$eyear,$emonth,$eday));
echo '<!-- Start Date : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
echo '<!-- End Date : '.sprintf("%04d%02d%02d",$eyear,$emonth,$eday).' -->'."\n";
}
if($owner_id) if($owner_id)
{ {
@ -1660,11 +1528,9 @@
$c_cached_ids = count($cached_event_ids); $c_cached_ids = count($cached_event_ids);
$c_cached_ids_repeating = count($cached_event_ids_repeating); $c_cached_ids_repeating = count($cached_event_ids_repeating);
if($this->debug) print_debug('Date',sprintf("%04d%02d%02d",$syear,$smonth,$sday));
{ print_debug('Events Cached',$c_cached_ids);
echo '<!-- events cached : '.$c_cached_ids.' : for : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n"; print_debug('Repeating Events Cached',$c_cached_ids_repeating);
echo '<!-- repeating events cached : '.$c_cached_ids_repeating.' : for : '.sprintf("%04d%02d%02d",$syear,$smonth,$sday).' -->'."\n";
}
$this->cached_events = Array(); $this->cached_events = Array();
@ -1693,16 +1559,11 @@
{ {
$c_evt_day = 0; $c_evt_day = 0;
} }
if($this->debug) print_debug('Date',$j);
{ print_debug('Count',$c_evt_day);
echo '<!-- Date: '.$j.' Count : '.$c_evt_day.' -->'."\n";
}
if($this->cached_events[$j][$c_evt_day]['id'] != $event['id']) if($this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
{ {
if($this->debug) print_debug('Adding Event For Date',$j);
{
echo '<!-- Adding Event for Date: '.$j.' -->'."\n";
}
$this->cached_events[$j][] = $event; $this->cached_events[$j][] = $event;
} }
} }
@ -2037,6 +1898,21 @@
$new_event_datetime = $this->maketime($new_event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $new_event_datetime = $this->maketime($new_event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
} }
//Added to construct the participant's list to an event
$event_participants = '';
reset($participants);
$ac=CreateObject('phpgwapi.accounts');
while(list($userid,$statid)=each($participants))
{
$event_participants .= ($event_participants?"\n":'');
$ac->account_id=$userid;
$ac->read_repository();
$event_participants .= '<'.$ac->data['account_lid'].'> '.$ac->data['fullname'];
}
//End
reset($participants);
while($participants && list($userid,$statusid) = each($participants)) while($participants && list($userid,$statusid) = each($participants))
{ {
if((intval($userid) != $GLOBALS['phpgw_info']['user']['account_id']) && if((intval($userid) != $GLOBALS['phpgw_info']['user']['account_id']) &&
@ -2071,7 +1947,7 @@
$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat']; $GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat'];
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat']; $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat'];
$new_tz_offset = ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])); $GLOBALS['phpgw']->datetime->tz_offset = ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
if($old_event != False) if($old_event != False)
{ {
@ -2088,23 +1964,40 @@
case MSG_DELETED: case MSG_DELETED:
$action_date = $old_event_date; $action_date = $old_event_date;
$body = lang ('Your meeting scheduled for') .' '. $old_event_date .' '. lang('has been canceled'); $body = lang ('Your meeting scheduled for') .' '. $old_event_date .' '. lang('has been canceled');
$event_head=$old_event['title'];
$event_description=$old_event['description'];
break; break;
case MSG_MODIFIED: case MSG_MODIFIED:
$action_date = $new_event_date; $action_date = $new_event_date;
$body = lang ('Your meeting that had been scheduled for').' '.$old_event_date.' '. lang('has been rescheduled to') .' '.$new_event_date; $body = lang ('Your meeting that had been scheduled for').' '.$old_event_date.' '. lang('has been rescheduled to') .' '.$new_event_date;
$event_head=$old_event['title'];
$event_description=$old_event['description'];
break; break;
case MSG_ADDED: case MSG_ADDED:
$action_date = $new_event_date; $action_date = $new_event_date;
$body = lang ('You have a meeting scheduled for').' '. $new_event_date; $body = lang ('You have a meeting scheduled for').' '. $new_event_date;
$event_head=$new_event['title'];
$event_description=$new_event['description'];
break; break;
case MSG_REJECTED: case MSG_REJECTED:
case MSG_TENTATIVE: case MSG_TENTATIVE:
case MSG_ACCEPTED: case MSG_ACCEPTED:
$action_date = $old_event_date; $action_date = $old_event_date;
$body = 'On '.$GLOBALS['phpgw']->common->show_date(time() - $new_tz_offset).' '.$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']).' '.$action.' your meeting request for '.$old_event_date; $body = 'On '.$GLOBALS['phpgw']->common->show_date(time() - $GLOBALS['phpgw']->datetime->tz_offset).' '.$GLOBALS['phpgw']->common->grab_owner_name($GLOBALS['phpgw_info']['user']['account_id']).' '.$action.' your meeting request for '.$old_event_date;
$event_head=$old_event['title'];
$event_description=$old_event['description'];
break; break;
} }
$subject = lang('Calendar Event') . ' ('. lang($action) .') #'.$event_id.': '.$action_date.' (L)'; $subject = lang('Calendar Event') . ' ('. lang($action) .') #'.$event_id.': '.$action_date.' (L)';
if(isset($part_prefs['calendar']['send_extra']) && $part_prefs['calendar']['send_extra'])
{
$body .= "\n\n".'***'.lang('Please confirm,accept,reject or examine changes in the corresponding entry in your calendar').'***'."\n\n"
. '----'.lang('Event Details Follow').'----';
$body .= ($event_head?"\n\n".lang('TITLE').':'."\n".' '.$event_head:'');
$body .= ($event_description?"\n\n".lang('DESCRIPTION').':'."\n".' '.$event_description:'');
$body .= ($event_participants?"\n\n".lang('Participants').':'."\n".' '.$event_participants:'');
}
$returncode = $send->msg('email',$to,$subject,$body,$msgtype,'','','',$sender); $returncode = $send->msg('email',$to,$subject,$body,$msgtype,'','','',$sender);
} }
} }
@ -2117,6 +2010,7 @@
} }
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $temp_tz_offset; $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $temp_tz_offset;
$GLOBALS['phpgw']->datetime->tz_offset = ((60 * 60) * $temp_tz_offset);
$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $temp_timeformat; $GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $temp_timeformat;
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat; $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
} }

View File

@ -53,8 +53,30 @@
} }
$pref_list = Array( $pref_list = Array(
'mainscreen_showevents',
'send_updates', 'send_updates',
'send_extra'
);
if($prefs[$pref_list[1] == True)
{
$GLOBALS['phpgw']->preferences->add('calendar',$pref_list[1],$prefs[$pref_list[1]]);
if($prefs[$pref_list[2] == True)
{
$GLOBALS['phpgw']->preferences->add('calendar',$pref_list[2],$prefs[$pref_list[2]]);
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[2]);
}
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[1]);
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[2]);
}
$pref_list = Array(
'mainscreen_showevents',
'display_status', 'display_status',
'default_private', 'default_private',
'display_minicals', 'display_minicals',

View File

@ -85,10 +85,7 @@
$this->bo = CreateObject('calendar.bocalendar',1); $this->bo = CreateObject('calendar.bocalendar',1);
if($this->debug) print_debug('BO Owner',$this->bo->owner);
{
echo "BO Owner : ".$this->bo->owner."<br>\n";
}
$this->template = $GLOBALS['phpgw']->template; $this->template = $GLOBALS['phpgw']->template;
$this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar'); $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar');
@ -116,10 +113,7 @@
$this->save_sessiondata(); $this->save_sessiondata();
} }
if($this->debug) print_debug('UI',$this->_debug_sqsof());
{
$this->_debug_sqsof();
}
} }
/* Public functions */ /* Public functions */
@ -2171,8 +2165,7 @@
'sortby' => $this->bo->sortby, 'sortby' => $this->bo->sortby,
'num_months' => $this->bo->num_months 'num_months' => $this->bo->num_months
); );
echo '<br>UI:'; return _debug_array($data,False);
_debug_array($data);
} }
/* Called only by get_list(), just prior to page footer. */ /* Called only by get_list(), just prior to page footer. */

View File

@ -171,6 +171,7 @@
$checkboxes = Array( $checkboxes = Array(
'send_updates' => lang('Send/receive updates via email'), 'send_updates' => lang('Send/receive updates via email'),
'send_extra' => lang('Receive extra information in event mails'),
'weekdays_only' => lang('Display week days only in Month/Week View'), 'weekdays_only' => lang('Display week days only in Month/Week View'),
'display_status' => lang('Display status of events'), 'display_status' => lang('Display status of events'),
'default_private' => lang('When creating new events default set to private'), 'default_private' => lang('When creating new events default set to private'),

View File

@ -78,6 +78,7 @@ private and global public calendar en Private and Global Public
private and group public calendar en Private and Group Public private and group public calendar en Private and Group Public
private only calendar en Private Only private only calendar en Private Only
re-edit event calendar en Re-Edit Event re-edit event calendar en Re-Edit Event
receive extra information in event mails calendar en Receive extra information in event mails
refresh calendar en Refresh refresh calendar en Refresh
rejected calendar en Rejected rejected calendar en Rejected
repeat day calendar en Repeat day repeat day calendar en Repeat day