email updates, need to do preferences and email receiver -- NOT IMPLEMENTED, link() fixes

This commit is contained in:
skeeter 2001-03-09 12:23:12 +00:00
parent a4b37d1f37
commit 6f695b6997
7 changed files with 356 additions and 203 deletions

View File

@ -51,14 +51,14 @@
if ($id > 0)
{
$cal = $phpgw->calendar->getevent(intval($id));
$cal_info = $cal[0];
$cal_stream = $phpgw->calendar->open('INBOX',intval($cal_info->owner),'');
$event = $phpgw->calendar->fetch_event($cal_stream,intval($id));
$can_edit = False;
if(($cal_info->owner == $owner) && ($phpgw->calendar->check_perms(PHPGW_ACL_EDIT) == True))
if(($event->owner == $owner) && ($phpgw->calendar->check_perms(PHPGW_ACL_EDIT) == True))
{
if($cal_info->access=='private')
if($event->public != True)
{
if($phpgw->calendar->check_perms(16) == True)
{
@ -73,22 +73,21 @@
if($can_edit == False)
{
header('Location: '.$phpgw->link('view.php','id='.$id.'&owner='.$owner));
header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/view.php','id='.$id.'&owner='.$owner));
}
if($cal_info->rpt_end_use == False)
if($event->rpt_end_use == False)
{
$cal_info->rpt_end = $cal_info->datetime + 86400;
$event->rpt_end = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) + 86400;
}
}
elseif(isset($readsess))
{
// $cal_info = ;
$cal_info = $phpgw->session->appsession('entry','calendar');
$event = $phpgw->session->appsession('entry','calendar');
if($cal_info->owner == 0)
if($event->owner == 0)
{
$cal_info->owner = $owner;
$event->owner = $owner;
}
$can_edit = True;
@ -97,11 +96,13 @@
{
if($phpgw->calendar->check_perms(PHPGW_ACL_ADD) == False)
{
header('Location: '.$phpgw->link('view.php','id='.$id.'&owner='.$owner));
header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/view.php','id='.$id.'&owner='.$owner));
}
$cal_info->id = 0;
$cal_info->owner = $owner;
$cal_stream = $phpgw->calendar->open('INBOX',intval($cal_info->owner),'');
$phpgw->calendar->event_init($cal_stream);
$phpgw->calendar->event->id = 0;
$can_edit = True;
if (!isset($hour))
@ -122,14 +123,13 @@
$thisminute = (int)$minute;
}
$datetime = $phpgw->calendar->makegmttime($thishour,$thisminute,0,$thismonth,$thisday,$thisyear);
$cal_info->datetime = $datetime['raw'];
$cal_info->edatetime = $cal_info->datetime;
$cal_info->name = "";
$cal_info->description = "";
$cal_info->priority = 2;
$phpgw->calendar->event_set_start($cal_stream,$thisyear,$thismonth,$thisday,$thishour,$this->minute,0);
$phpgw->calendar->event_set_end($cal_stream,$thisyear,$thismonth,$thisday,$thishour,$this->minute,0);
$phpgw->calendar->event_set_title($cal_stream,'');
$phpgw->calendar->event_set_description($cal_stream,'');
$phpgw->calendar->event->priority = 2;
$cal_info->rpt_end = $cal_info->datetime + 86400;
$phpgw->calendar->event_set_recur_none($cal_stream);
}
$phpgw->common->phpgw_header();
@ -137,16 +137,14 @@
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$templates = Array(
'edit_entry_begin'=> 'edit.tpl',
'list' => 'list.tpl',
'hr' => 'hr.tpl',
'edit_entry_end' => 'edit.tpl',
'form_button' => 'form_button_script.tpl'
'edit_entry_begin'=> 'edit.tpl',
'list' => 'list.tpl',
'hr' => 'hr.tpl',
'edit_entry_end' => 'edit.tpl',
'form_button' => 'form_button_script.tpl'
);
$p->set_file($templates);
// $p->set_block('edit_entry_begin','list','hr','edit_entry_end','form_button');
if($id > 0)
{
$action = lang('Calendar - Edit');
@ -156,14 +154,14 @@
$action = lang('Calendar - Add');
}
$common_hidden = '<input type="hidden" name="cal[id]" value="'.$cal_info->id.'">'."\n"
. '<input type="hidden" name="cal[owner]" value="'.$owner.'">'."\n"
$common_hidden = '<input type="hidden" name="cal[id]" value="'.$phpgw->calendar->event->id.'">'."\n"
. '<input type="hidden" name="cal[owner]" value="'.$phpgw->calendar->event->owner.'">'."\n"
. '<input type="hidden" name="owner" value="'.$owner.'">'."\n";
$vars = Array(
'bg_color' => $phpgw_info['theme']['bg_text'],
'calendar_action' => $action,
'action_url' => $phpgw->link('edit_entry_handler.php'),
'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry_handler.php'),
'common_hidden' => $common_hidden
);
@ -171,27 +169,27 @@
$p->parse('out','edit_entry_begin');
// Brief Description
display_item(lang('Brief Description'),'<input name="cal[name]" size="25" value="'.$cal_info->name.'">');
display_item(lang('Brief Description'),'<input name="cal[name]" size="25" value="'.$phpgw->calendar->event->title.'">');
// Full Description
display_item(lang('Full Description'),'<textarea name="cal[description]" rows="5" cols="40" wrap="virtual">'.$cal_info->description.'</textarea>');
display_item(lang('Full Description'),'<textarea name="cal[description]" rows="5" cols="40" wrap="virtual">'.$phpgw->calendar->event->description.'</textarea>');
// Date
$day_html = $sb->getDays('cal[day]',intval($phpgw->common->show_date($cal_info->datetime,'d')));
$month_html = $sb->getMonthText('cal[month]',intval($phpgw->common->show_date($cal_info->datetime,'n')));
$year_html = $sb->getYears('cal[year]',intval($phpgw->common->show_date($cal_info->datetime,'Y')),intval($phpgw->common->show_date($cal_info->datetime,'Y')));
$day_html = $sb->getDays('cal[day]',intval($phpgw->common->show_date($phpgw->calendar->event->datetime,'d')));
$month_html = $sb->getMonthText('cal[month]',intval($phpgw->common->show_date($phpgw->calendar->event->datetime,'n')));
$year_html = $sb->getYears('cal[year]',intval($phpgw->common->show_date($phpgw->calendar->event->datetime,'Y')),intval($phpgw->common->show_date($phpgw->calendar->event->datetime,'Y')));
display_item(lang('Start Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
// Time
$amsel = ' checked'; $pmsel = '';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
if ($cal_info->ampm == 'pm')
if ($phpgw->calendar->event->start->hour >= 12)
{
$amsel = ''; $pmsel = ' checked';
}
}
$str = '<input name="cal[hour]" size="2" VALUE="'.$phpgw->common->show_date($cal_info->datetime,$hourformat).'" maxlength="2">:<input name="cal[minute]" size="2" value="'.$phpgw->common->show_date($cal_info->datetime,'i').'" maxlength="2">';
$str = '<input name="cal[hour]" size="2" VALUE="'.$phpgw->common->show_date($phpgw->calendar->event->datetime,$hourformat).'" maxlength="2">:<input name="cal[minute]" size="2" value="'.$phpgw->common->show_date($phpgw->calendar->event->datetime,'i').'" maxlength="2">';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
$str .= '<input type="radio" name="cal[ampm]" value="am"'.$amsel.'>am';
@ -201,22 +199,22 @@
display_item(lang('Start Time'),$str);
// End Date
$day_html = $sb->getDays('cal[end_day]',intval($phpgw->common->show_date($cal_info->edatetime,'d')));
$month_html = $sb->getMonthText('cal[end_month]',intval($phpgw->common->show_date($cal_info->edatetime,'n')));
$year_html = $sb->getYears('cal[end_year]',intval($phpgw->common->show_date($cal_info->edatetime,'Y')),intval($phpgw->common->show_date($cal_info->edatetime,'Y')));
$day_html = $sb->getDays('cal[end_day]',intval($phpgw->common->show_date($phpgw->calendar->event->edatetime,'d')));
$month_html = $sb->getMonthText('cal[end_month]',intval($phpgw->common->show_date($phpgw->calendar->event->edatetime,'n')));
$year_html = $sb->getYears('cal[end_year]',intval($phpgw->common->show_date($phpgw->calendar->event->edatetime,'Y')),intval($phpgw->common->show_date($phpgw->calendar->event->edatetime,'Y')));
display_item(lang('End Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
// End Time
$amsel = ' checked'; $pmsel = '';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
if ($cal_info->end_ampm == 'pm')
if ($phpgw->calendar->event->end->hour >= 12)
{
$amsel = ''; $pmsel = ' checked';
}
}
$str = '<input name="cal[end_hour]" size="2" VALUE="'.$phpgw->common->show_date($cal_info->edatetime,$hourformat).'" maxlength="2">:<input name="cal[end_minute]" size="2" value="'.$phpgw->common->show_date($cal_info->edatetime,'i').'" maxlength="2">';
$str = '<input name="cal[end_hour]" size="2" VALUE="'.$phpgw->common->show_date($phpgw->calendar->event->edatetime,$hourformat).'" maxlength="2">:<input name="cal[end_minute]" size="2" value="'.$phpgw->common->show_date($phpgw->calendar->event->edatetime,'i').'" maxlength="2">';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
$str .= '<input type="radio" name="cal[end_ampm]" value="am"'.$amsel.'>am';
@ -226,11 +224,11 @@
display_item(lang("End Time"),$str);
// Priority
display_item(lang('Priority'),$sb->getPriority('cal[priority]',$cal_info->priority));
display_item(lang('Priority'),$sb->getPriority('cal[priority]',$phpgw->calendar->event->priority));
// Access
$str = '<input type="checkbox" name="cal[access]" value="private"';
if($cal_info->access=='private')
if($phpgw->calendar->event->public != True)
{
$str .= ' checked';
}
@ -281,9 +279,9 @@
$size = $num_users;
}
$str = "\n".' <select name="cal[participants][]" multiple size="5">'."\n";
for ($l=0;$l<count($cal_info->participants);$l++)
for ($l=0;$l<count($phpgw->calendar->event->participants);$l++)
{
$parts[$cal_info->participants[$l]] = ' selected';
$parts[$phpgw->calendar->event->participants[$l]] = ' selected';
}
@asort($users);
@ -302,9 +300,9 @@
$participate = False;
if($id)
{
for($i=0;$i<count($cal_info->participants);$i++)
for($i=0;$i<count($phpgw->calendar->event->participants);$i++)
{
if($cal_info->participants[$i] == $owner)
if($phpgw->calendar->event->participants[$i] == $owner)
{
$participate = True;
}
@ -324,68 +322,71 @@
$p->set_var('hr_text','<center><b>'.lang('Repeating Event Information').'</b></center><br>');
$p->parse('output','hr',True);
$str = '<select name="cal[rpt_type]">';
$rpt_type_str = Array(
'none',
'daily',
'weekly',
'monthlybyday',
'monthlybydate',
'yearly'
$rpt_type = Array(
RECUR_NONE,
RECUR_DAILY,
RECUR_WEEKLY,
RECUR_MONTHLY_WDAY,
RECUR_MONTHLY_MDAY,
RECUR_YEARLY
);
$rpt_type_out = Array(
'none' => 'None',
'daily' => 'Daily',
'weekly' => 'Weekly',
'monthlybyday' => 'Monthly (by day)',
'monthlybydate' => 'Monthly (by date)',
'yearly' => 'Yearly'
RECUR_NONE => 'None',
RECUR_DAILY => 'Daily',
RECUR_WEEKLY => 'Weekly',
RECUR_MONTHLY_WDAY => 'Monthly (by day)',
RECUR_MONTHLY_MDAY => 'Monthly (by date)',
RECUR_YEARLY => 'Yearly'
);
for($l=0;$l<count($rpt_type_str);$l++)
for($l=0;$l<count($rpt_type);$l++)
{
$str .= '<option value="'.$rpt_type_str[$l].'"';
if(!strcmp($cal_info->rpt_type,$rpt_type_str[$l]))
$str .= '<option value="'.$rpt_type[$l].'"';
if($phpgw->calendar->event->recur_type == $rpt_type[$l])
{
$str .= ' selected';
}
$str .= '>'.lang($rpt_type_out[$rpt_type_str[$l]]).'</option>';
$str .= '>'.lang($rpt_type_out[$rpt_type[$l]]).'</option>';
}
$str .= '</select>';
display_item(lang('Repeat Type'),$str);
$p->set_var('field',lang('Repeat End Date'));
$str = '<input type="checkbox" name="cal[rpt_use_end]" value="y"';
if($cal_info->rpt_use_end)
if($phpgw->calendar->event->recur_enddate->year != 0 && $phpgw->calendar->event->recur_enddate->month != 0 && $phpgw->calendar->event->recur_enddate->mday != 0)
{
$str .= ' checked';
}
$str .= '>'.lang('Use End Date').' ';
$day_html = $sb->getDays('cal[rpt_day]',intval($phpgw->common->show_date($cal_info->rpt_end,'d')));
$month_html = $sb->getMonthText('cal[rpt_month]',intval($phpgw->common->show_date($cal_info->rpt_end,'n')));
$year_html = $sb->getYears('cal[rpt_year]',intval($phpgw->common->show_date($cal_info->rpt_end,'Y')),intval($phpgw->common->show_date($cal_info->rpt_end,'Y')));
$recur_end = mktime($phpgw->calendar->recur_enddate->hour,$phpgw->calendar->recur_enddate->min,$phpgw->calendar->recur_enddate->sec,$phpgw->calendar->recur_enddate->month,$phpgw->calendar->recur_enddate->mday,$phpgw->calendar->recur_enddate->year);
$recur_end -= ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$day_html = $sb->getDays('cal[rpt_day]',intval($phpgw->common->show_date($recur_end,'d')));
$month_html = $sb->getMonthText('cal[rpt_month]',intval($phpgw->common->show_date($recur_end,'n')));
$year_html = $sb->getYears('cal[rpt_year]',intval($phpgw->common->show_date($recur_end,'Y')),intval($phpgw->common->show_date($recur_end,'Y')));
$str .= $phpgw->common->dateformatorder($year_html,$month_html,$day_html);
display_item(lang('Repeat End Date'),$str);
$str = '<input type="checkbox" name="cal[rpt_sun]" value="1"'.($cal_info->rpt_sun?' checked':'').'> '.lang('Sunday').' ';
$str .= '<input type="checkbox" name="cal[rpt_mon]" value="1"'.($cal_info->rpt_mon?' checked':'').'> '.lang('Monday').' ';
$str .= '<input type="checkbox" name="cal[rpt_tue]" value="1"'.($cal_info->rpt_tue?' checked':'').'> '.lang('Tuesday').' ';
$str .= '<input type="checkbox" name="cal[rpt_wed]" value="1"'.($cal_info->rpt_wed?' checked':'').'> '.lang('Wednesday').' ';
$str .= '<input type="checkbox" name="cal[rpt_thu]" value="1"'.($cal_info->rpt_thu?' checked':'').'> '.lang('Thursday').' ';
$str .= '<input type="checkbox" name="cal[rpt_fri]" value="1"'.($cal_info->rpt_fri?' checked':'').'> '.lang('Friday').' ';
$str .= '<input type="checkbox" name="cal[rpt_sat]" value="1"'.($cal_info->rpt_sat?' checked':'').'> '.lang('Saturday').' ';
$str = '<input type="checkbox" name="cal[rpt_sun]" value="'.M_SUNDAY.'"'.(($phpgw->calendar->event->recur_data & M_SUNDAY) ?' checked':'').'> '.lang('Sunday').' ';
$str .= '<input type="checkbox" name="cal[rpt_mon]" value="'.M_MONDAY.'"'.(($phpgw->calendar->event->recur_data & M_MONDAY) ?' checked':'').'> '.lang('Monday').' ';
$str .= '<input type="checkbox" name="cal[rpt_tue]" value="'.M_TUESDAY.'"'.(($phpgw->calendar->event->recur_data & M_TUESDAY) ?' checked':'').'> '.lang('Tuesday').' ';
$str .= '<input type="checkbox" name="cal[rpt_wed]" value="'.M_WEDNESDAY.'"'.(($phpgw->calendar->event->recur_data & M_WEDNESDAY) ?' checked':'').'> '.lang('Wednesday').' ';
$str .= '<input type="checkbox" name="cal[rpt_thu]" value="'.M_THURSDAY.'"'.(($phpgw->calendar->event->recur_data & M_THURSDAY) ?' checked':'').'> '.lang('Thursday').' ';
$str .= '<input type="checkbox" name="cal[rpt_fri]" value="'.M_FRIDAY.'"'.(($phpgw->calendar->event->recur_data & M_FRIDAY) ?' checked':'').'> '.lang('Friday').' ';
$str .= '<input type="checkbox" name="cal[rpt_sat]" value="'.M_SATURDAY.'"'.(($phpgw->calendar->event->recur_data & M_SATURDAY) ?' checked':'').'> '.lang('Saturday').' ';
display_item(lang('Repeat Day').'<br>'.lang('(for weekly)'),$str);
display_item(lang('Frequency'),'<input name="cal[rpt_freq]" size="4" maxlength="4" value="'.$cal_info->rpt_freq.'">');
display_item(lang('Frequency'),'<input name="cal[rpt_freq]" size="4" maxlength="4" value="'.$phpgw->calendar->event->recur_interval.'">');
$p->set_var('submit_button',lang('Submit'));
if ($id > 0)
{
$p->set_var('action_url_button',$phpgw->link('delete.php','id='.$id));
$p->set_var('action_url_button',$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/delete.php','id='.$id));
$p->set_var('action_text_button',lang('Delete'));
$p->set_var('action_confirm_button',"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"");
$p->parse('delete_button','form_button');

View File

@ -169,7 +169,7 @@
if($datetime_check)
{
Header('Location: '.$phpgw->link('edit_entry.php','readsess='.$cal_info->id.'&cd='.$datetime_check));
Header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry.php','readsess='.$cal_info->id.'&cd='.$datetime_check));
$phpgw->common->phpgw_exit();
}
elseif($overlapping_events)
@ -238,7 +238,7 @@
$p->set_var($var);
$var = Array(
'action_url_button' => $phpgw->link('','readsess='.$cal_info->id.'&year='.$cal_info->year.'&month='.$cal_info->month.'&day='.$cal_info->day),
'action_url_button' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry_handler.php','readsess='.$cal_info->id.'&year='.$cal_info->year.'&month='.$cal_info->month.'&day='.$cal_info->day),
'action_text_button' => lang('Ignore Conflict'),
'action_confirm_button' => ''
);
@ -247,7 +247,7 @@
$p->parse('resubmit_button','form_button');
$var = Array(
'action_url_button' => $phpgw->link('edit_entry.php','readsess='.$cal_info->id.'&year='.$cal_info->year.'&month='.$cal_info->month.'&day='.$cal_info->day),
'action_url_button' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry.php','readsess='.$cal_info->id.'&year='.$cal_info->year.'&month='.$cal_info->month.'&day='.$cal_info->day),
'action_text_button' => lang('Re-Edit Event'),
'action_confirm_button' => ''
);
@ -297,7 +297,7 @@
break;
}
$phpgw->calendar->store_event($cal_stream);
Header('Location: '.$phpgw->link('index.php','year='.$cal_info->year.'&month='.$cal_info->month.'&cd=14&owner='.$owner));
Header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/index.php','year='.$cal_info->year.'&month='.$cal_info->month.'&cd=14&owner='.$owner));
}
$phpgw->common->phpgw_footer();
?>

View File

@ -43,6 +43,7 @@ if($phpgw_info['server']['calendar_type'] == 'mcal' && extension_loaded('mcal')
}
// The following line can be removed when vCalendar is implemented....
$phpgw_info['server']['calendar_type'] = 'sql';
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar__.inc.php');
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_'.$phpgw_info['server']['calendar_type'].'.inc.php');
class calendar extends calendar_
@ -126,35 +127,6 @@ class calendar extends calendar_
}
}
function send_update($event)
{
global $phpgw, $phpgw_info;
$msg = CreateObject('email.send');
$subject = 'Calendar Event #'.$event->id.': '.$event->start->year.' '.lang(date(mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year),'F')).' '.$event->start->mday.' '.$event->start->hour.':'.$event->start->min.':'.$event->start->sec.'Z';
$body = 'An event in your calendar @ '.$phpgw_info['server']['site_title'].' has been altered. Please review it now.';
$msgtype = 'phpGW-calendar-'.$event->id;
$to = '';
for($i=0;$i<count($event->participants);$i++)
{
if($event->participants[$i] != $phpgw_info['user']['account_id'])
{
if($to != '')
{
$to .= ', ';
}
$preferences = CreateObject('phpgwapi.preferences',$event->participants[$i]);
$part_prefs = $preferences->read_repository();
$part_prefs = $phpgw->common->create_emailpreferences($part_prefs,$event->participants[$i]);
$to .= $part_prefs['email']['address'];
}
}
$msg->msg('email',$to,$subject,$body,$msgtype);
unset($msg);
}
function set_filter()
{
global $phpgw_info, $phpgw, $filter;
@ -588,7 +560,7 @@ class calendar extends calendar_
if($this->printer_firendly == False)
{
$month = '<a href="' . $phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/month.php','month='.date('m',$date['raw']).'&year='.date('Y',$date['raw']).'&owner='.$this->owner) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . '</a>';
$month = '<a href="' . $phpgw->link('/calendar/month.php','month='.date('m',$date['raw']).'&year='.date('Y',$date['raw']).'&owner='.$this->owner) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . '</a>';
}
else
{
@ -601,8 +573,8 @@ class calendar extends calendar_
'bgcolor' => $phpgw_info['theme']['bg_color'],
'bgcolor1' => $phpgw_info['theme']['bg_color'],
'month' => $month,
'prevmonth' => $phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/month.php','date='.$month_ago.'&owner='.$this->owner),
'nextmonth' => $phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/month.php','date='.$month_ahead.'&owner='.$this->owner),
'prevmonth' => $phpgw->link('/calendar/month.php','date='.$month_ago.'&owner='.$this->owner),
'nextmonth' => $phpgw->link('/calendar/month.php','date='.$month_ahead.'&owner='.$this->owner),
'bgcolor2' => $phpgw_info['theme']['cal_dayview']
);
@ -634,7 +606,7 @@ class calendar extends calendar_
if(!$this->printer_friendly)
{
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/'.$link,'year='.$cal['year'].'&month='.$cal['month'].'&day='.$cal['day'].'&owner='.$this->owner).'" class="minicalendar">';
$str .= '<a href="'.$phpgw->link('/calendar/'.$link,'year='.$cal['year'].'&month='.$cal['month'].'&day='.$cal['day'].'&owner='.$this->owner).'" class="minicalendar">';
}
$str .= $cal['day'];
@ -848,13 +820,13 @@ class calendar extends calendar_
if($this->check_perms(PHPGW_ACL_ADD) == True)
{
$new_event_link .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$date_year.'&month='.$date['month'].'&day='.$date['day'].'&owner='.$this->owner).'">';
$new_event_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php','year='.$date_year.'&month='.$date['month'].'&day='.$date['day'].'&owner='.$this->owner).'">';
$new_event_link .= '<img src="'.$this->image_dir.'/new.gif" width="10" height="10" ';
$new_event_link .= 'alt="'.lang('New Entry').'" ';
$new_event_link .= 'border="0" align="right">';
$new_event_link .= '</a>';
}
$day_number = '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/day.php','month='.$date['month'].'&day='.$date['day'].'&year='.$date['year'].'&owner='.$this->owner).'">'.$date['day'].'</a>';
$day_number = '<a href="'.$phpgw->link('/calendar/day.php','month='.$date['month'].'&day='.$date['day'].'&year='.$date['year'].'&owner='.$this->owner).'">'.$date['day'].'</a>';
}
else
{
@ -899,7 +871,7 @@ class calendar extends calendar_
if (($this->printer_friendly == False) && (($description == 'private' && $this->check_perms(16)) || ($description != 'private')) && $this->check_perms(PHPGW_ACL_EDIT))
{
$var = Array(
'link_link' => $phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/view.php','id='.$lr_events->id.'&owner='.$owner),
'link_link' => $phpgw->link('/calendar/view.php','id='.$lr_events->id.'&owner='.$owner),
'lang_view' => lang('View this entry'),
'pic_image' => $this->image_dir.'/'.$pict,
'description' => $description
@ -974,7 +946,7 @@ class calendar extends calendar_
{
if(!$this->printer_friendly)
{
$str = '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/week.php','date='.$date['full'].'&owner='.$this->owner).'">week ' .(int)((date('z',($startdate+(24*3600*4)))+7)/7).'</a>';
$str = '<a href="'.$phpgw->link('/calendar/week.php','date='.$date['full'].'&owner='.$this->owner).'">week ' .(int)((date('z',($startdate+(24*3600*4)))+7)/7).'</a>';
}
else
{
@ -1119,8 +1091,8 @@ class calendar extends calendar_
if (($this->printer_friendly == False) && (($description == 'private' && $this->check_perms(16)) || ($description != 'private')) && $this->check_perms(PHPGW_ACL_EDIT))
{
$time[$ind] .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url']
.'/calendar/view.php','id='.$event->id.'&owner='.$this->owner)
$time[$ind] .= '<a href="'.$phpgw->link('/calendar/view.php',
'id='.$event->id.'&owner='.$this->owner)
. "\" onMouseOver=\"window.status='"
. lang('View this entry')."'; return true;\">";
}
@ -1359,9 +1331,9 @@ class calendar extends calendar_
if(($this->printer_friendly == False) && ($this->check_perms(PHPGW_ACL_EDIT) == True))
{
$open_link .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url']
. '/calendar/edit_entry.php','year='.$date['year']
. '&month='.$date['month'].'&day='.$date['day']
$open_link .= '<a href="'.$phpgw->link('/calendar/edit_entry.php',
'year='.$date['year'].'&month='.$date['month']
. '&day='.$date['day']
. '&hour='.substr($dtime,0,strpos($dtime,':'))
. '&minute='.substr($dtime,strpos($dtime,':')+1,2).'&owner='.$this->owner).'">';

View File

@ -0,0 +1,224 @@
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.phpgroupware.org *
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> *
* http://www.radix.net/~cknudsen *
* Modified by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
define('MSG_DELETED',0);
define('MSG_MODIFIED',1);
define('MSG_ADDED',2);
class calendar__
{
var $event;
var $stream;
var $user;
var $modified;
var $deleted;
var $added;
function send_update($msg_type,$participants,$old_event=False,$new_event=False)
{
global $phpgw, $phpgw_info;
$temp_tz_offset = $phpgw_info['user']['preferences']['common']['tz_offset'];
$temp_timeformat = $phpgw_info['user']['preferences']['common']['timeformat'];
$temp_dateformat = $phpgw_info['user']['preferences']['common']['dateformat'];
$tz_offset = ((60 * 60) * intval($temp_tz_offset));
$send = CreateObject('phpgwapi.send');
switch($msg_type)
{
case MSG_DELETED:
$action = 'Deleted ';
$event_id = $old_event->id;
$msgtype = '';
break;
case MSG_MODIFIED:
$action = 'Modified ';
$event_id = $old_event->id;
$msgtype = 'Calendar-Version: '.$phpgw_info['server']['versions']['calendar'].'; Calendar-Id: '.$new_event->id;
break;
case MSG_ADDED:
$action = 'Added ';
$event_id = $old_event->id;
$msgtype = 'Calendar-Version: '.$phpgw_info['server']['versions']['calendar'].'; Calendar-Id: '.$new_event->id;
break;
}
if($old_event != False)
{
$old_event_datetime = mktime($old_event->start->hour,$old_event->start->min,$old_event->start->sec,$old_event->start->month,$old_event->start->mday,$old_event->start->year) - $tz_offset;
}
if($new_event != False)
{
$new_event_datetime = mktime($new_event->start->hour,$new_event->start->min,$new_event->start->sec,$new_event->start->month,$new_event->start->mday,$new_event->start->year) - $tz_offset;
}
for($i=0;$i<count($participants);$i++)
{
if($participants[$i] != $phpgw_info['user']['account_id'])
{
$preferences = CreateObject('phpgwapi.preferences',$participants[$i]);
$part_prefs = $preferences->read_repository();
if(!isset($part_prefs['calendar']['send_updates']) || $part_prefs['calendar']['send_updates'] == False)
{
continue;
}
$part_prefs = $phpgw->common->create_emailpreferences($part_prefs,$participants[$i]);
$to = $part_prefs['email']['address'];
$phpgw_info['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset'];
$phpgw_info['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat'];
$phpgw_info['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat'];
if($old_event != False)
{
$old_event_date = $phpgw->common->show_date($old_event_datetime);
}
if($new_event != False)
{
$new_event_date = $phpgw->common->show_date($new_event_datetime);
}
switch($msg_type)
{
case MSG_DELETED:
$action_date = $old_event_date;
$body = 'Your meeting scehduled for '.$old_event_date.' has been canceled';
break;
case MSG_MODIFIED:
$action_date = $new_event_date;
$body = 'Your meeting that had been scheduled for '.$old_event_date.' has been rescheduled to '.$new_event_date;
break;
case MSG_ADDED:
$action_date = $new_event_date;
$body = 'You have a meeting scheduled for '.$new_event_date;
break;
}
$subject = 'Calendar Event ('.$action.') #'.$event_id.': '.$action_date.' L';
$send->msg('email',$to,$subject,$body,$msgtype);
}
}
unset($send);
$phpgw_info['user']['preferences']['common']['tz_offset'] = $temp_tz_offset;
$phpgw_info['user']['preferences']['common']['timeformat'] = $temp_timeformat;
$phpgw_info['user']['preferences']['common']['dateformat'] = $temp_dateformat;
}
function prepare_recipients($new_event,$old_event)
{
for($i=0;$i<count($old_event->participants);$i++)
{
$delete = True;
for($k=0;$k<count($new_event->participants);$k++)
{
if($new_event->participants[$k] == $old_event->participants[$i])
{
$delete = False;
$this->modified[] = $new_event->participants[$k];
}
}
if($delete == True)
{
$this->deleted[] = $old_event->participants[$i];
}
}
for($i=0;$i<count($new_event->participants);$i++)
{
$add = True;
for($k=0;$k<count($old_event->participants);$k++)
{
if($new_event->participants[$i] == $old_event->participants[$k])
{
$add = False;
}
}
if($add == True)
{
$this->added[] = $new_event->participants[$i];
}
}
if(count($this->added) > 0 || count($this->modified) > 0 || count($this->deleted) > 0)
{
if(count($this->added) > 0)
{
$this->send_update(MSG_ADDED,$this->added,'',$new_event);
}
if(count($this->modified) > 0)
{
$this->send_update(MSG_MODIFIED,$this->modified,$old_event,$new_event);
}
if(count($this->deleted) > 0)
{
$this->send_update(MSG_DELETED,$this->deleted,$old_event);
}
}
}
function set_common_recur($year,$month,$day)
{
if(intval($day) == 0 && intval($month) == 0 && intval($year) == 0)
{
$this->event->rpt_end_use = 0;
$this->event->rpt_end = 0;
$this->event->rpt_end_day = 0;
$this->event->rpt_end_month = 0;
$this->event->rpt_end_year = 0;
}
else
{
$this->event->rpt_end_use = 1;
$this->event->rpt_end = mktime(0,0,0,intval($month),intval($day),intval($year));
$this->event->rpt_end -= ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$this->event->rpt_end_day = intval($day);
$this->event->rpt_end_month = intval($month);
$this->event->rpt_end_year = intval($year);
}
$this->event->rpt_sun = 0;
$this->event->rpt_mon = 0;
$this->event->rpt_tue = 0;
$this->event->rpt_wed = 0;
$this->event->rpt_thu = 0;
$this->event->rpt_fri = 0;
$this->event->rpt_sat = 0;
$this->event->rpt_days = 'nnnnnnn';
$this->event->rpt_freq = intval($interval);
// Legacy Support (New)
$this->event->recur_interval = intval($interval);
if(intval($day) == 0 && intval($month) == 0 && intval($year) == 0)
{
$this->event->recur_enddate->year = 0;
$this->event->recur_enddate->month = 0;
$this->event->recur_enddate->mday = 0;
}
else
{
$this->event->recur_enddate->year = intval($year);
$this->event->recur_enddate->month = intval($month);
$this->event->recur_enddate->mday = intval($day);
}
$this->event->recur_enddate->hour = 0;
$this->event->recur_enddate->min = 0;
$this->event->recur_enddate->sec = 0;
$this->event->recur_enddate->alarm = 0;
$this->event->recur_data = 0;
}
}

View File

@ -11,12 +11,9 @@
\**************************************************************************/
/* $Id$ */
class calendar_
{
var $stream;
var $user;
var $event;
class calendar_ extends calendar__
{
function open($calendar='',$user='',$passwd='',$options='')
{
global $phpgw, $phpgw_info;
@ -258,7 +255,7 @@ class calendar_
// Legacy Support (New)
$this->event->start->year = $year;
$this->event->start->month = $month;
$this->event->start->day = $day;
$this->event->start->mday = $day;
$this->event->start->hour = $hour;
$this->event->start->min = $min;
$this->event->start->sec = $sec;
@ -308,7 +305,7 @@ class calendar_
// Legacy Support (New)
$this->event->end->year = $year;
$this->event->end->month = $month;
$this->event->end->day = $day;
$this->event->end->mday = $day;
$this->event->end->hour = $hour;
$this->event->end->min = $min;
$this->event->end->sec = $sec;
@ -352,6 +349,7 @@ class calendar_
function event_set_class($stream,$class)
{
$this->event->public = $class;
return mcal_event_set_class($stream,$class);
}

View File

@ -14,12 +14,8 @@
/* $Id$ */
class calendar_
class calendar_ extends calendar__
{
var $stream;
var $user;
var $event;
var $cal_event;
var $today = Array('raw','day','month','year','full','dow','dm','bd');
@ -388,11 +384,23 @@ class calendar_
function append_event($mcal_stream)
{
$this->save_event($this->event);
$this->send_update(MSG_ADDED,$this->event->participants,'',$this->event);
return $this->event->id;
}
function store_event($mcal_stream)
{
if($this->event->id != 0)
{
$new_event = $this->event;
$old_event = $this->fetch_event($this->stream,$new_event->id);
$this->prepare_recipients($new_event,$old_event);
$this->event = $new_event;
}
else
{
$this->send_update(MSG_ADDED,$this->event->participants,'',$this->event);
}
return $this->save_event($this->event);
}
@ -720,56 +728,6 @@ class calendar_
/***************** Local functions for SQL based Calendar *****************/
function set_common_recur($year,$month,$day)
{
if(intval($day) == 0 && intval($month) == 0 && intval($year) == 0)
{
$this->event->rpt_end_use = 0;
$this->event->rpt_end = 0;
$this->event->rpt_end_day = 0;
$this->event->rpt_end_month = 0;
$this->event->rpt_end_year = 0;
}
else
{
$this->event->rpt_end_use = 1;
$this->event->rpt_end = mktime(0,0,0,intval($month),intval($day),intval($year));
$this->event->rpt_end -= ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$this->event->rpt_end_day = intval($day);
$this->event->rpt_end_month = intval($month);
$this->event->rpt_end_year = intval($year);
}
$this->event->rpt_sun = 0;
$this->event->rpt_mon = 0;
$this->event->rpt_tue = 0;
$this->event->rpt_wed = 0;
$this->event->rpt_thu = 0;
$this->event->rpt_fri = 0;
$this->event->rpt_sat = 0;
$this->event->rpt_days = 'nnnnnnn';
$this->event->rpt_freq = intval($interval);
// Legacy Support (New)
$this->event->recur_interval = intval($interval);
if(intval($day) == 0 && intval($month) == 0 && intval($year) == 0)
{
$this->event->recur_enddate->year = 0;
$this->event->recur_enddate->month = 0;
$this->event->recur_enddate->mday = 0;
}
else
{
$this->event->recur_enddate->year = intval($year);
$this->event->recur_enddate->month = intval($month);
$this->event->recur_enddate->mday = intval($day);
}
$this->event->recur_enddate->hour = 0;
$this->event->recur_enddate->min = 0;
$this->event->recur_enddate->sec = 0;
$this->event->recur_enddate->alarm = 0;
$this->event->recur_data = 0;
}
function get_event_ids($search_repeats=False,$extra='')
{
$retval = Array();
@ -823,18 +781,18 @@ class calendar_
$event->id = $this->stream->f('cal_id');
}
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
if ($event->ampm == 'pm' && ($event->hour < 12 && $event->hour <> 12))
{
$event->hour += 12;
}
if ($event->end_ampm == 'pm' && ($event->end_hour < 12 && $event->end_hour <> 12))
{
$event->end_hour += 12;
}
}
// if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
// {
// if ($event->ampm == 'pm' && ($event->hour < 12 && $event->hour <> 12))
// {
// $event->hour += 12;
// }
//
// if ($event->end_ampm == 'pm' && ($event->end_hour < 12 && $event->end_hour <> 12))
// {
// $event->end_hour += 12;
// }
// }
$tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$date = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
$enddate = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;

View File

@ -131,7 +131,7 @@
if($cal_info->owner == $phpgw_info['user']['account_id'] && $participate)
{
display_item(lang('Created by'),'<a href="'
.$phpgw->link('viewmatrix.php','participants='.$cal_info->owner.'&date='.$cal_info->year.$cal_info->month.$cal_info->day.'&matrixtype=free/busy&owner='.$owner)
.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/viewmatrix.php','participants='.$cal_info->owner.'&date='.$cal_info->year.$cal_info->month.$cal_info->day.'&matrixtype=free/busy&owner='.$owner)
.'">'.$phpgw->common->grab_owner_name($cal_info->owner).'</a>');
}
else
@ -235,7 +235,7 @@
if (($cal_info->owner == $owner) && ($rights & PHPGW_ACL_EDIT))
{
$p->set_var('action_url_button',$phpgw->link('edit_entry.php','id='.$id.'&owner='.$owner));
$p->set_var('action_url_button',$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry.php','id='.$id.'&owner='.$owner));
$p->set_var('action_text_button',' '.lang('Edit').' ');
$p->set_var('action_confirm_button','');
$p->parse('edit_button','form_button');
@ -247,7 +247,7 @@
if (($cal_info->owner == $owner) && ($rights & PHPGW_ACL_DELETE))
{
$p->set_var('action_url_button',$phpgw->link('delete.php','id='.$id.'&owner='.$owner));
$p->set_var('action_url_button',$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/delete.php','id='.$id.'&owner='.$owner));
$p->set_var('action_text_button',lang('Delete'));
$p->set_var('action_confirm_button',"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"");
$p->parse('delete_button','form_button');