updated link() and finalized email updates

This commit is contained in:
skeeter 2001-03-10 04:48:19 +00:00
parent f63a01ce6b
commit 4cef072493
15 changed files with 396 additions and 396 deletions

View File

@ -53,7 +53,7 @@
{ {
$printer = ''; $printer = '';
$param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner; $param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner;
$print = '<a href="'.$phpgw->link('',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; $print = '<a href="'.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/day.php',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
} }
else else
{ {

View File

@ -27,10 +27,11 @@
{ {
$thisyear = $event->start->year; $thisyear = $event->start->year;
$thismonth = $event->start->month; $thismonth = $event->start->month;
$thisday = $event->start->mday;
$phpgw->calendar->delete_event($cal_stream,intval($id)); $phpgw->calendar->delete_event($cal_stream,intval($id));
$phpgw->calendar->expunge($cal_stream); $phpgw->calendar->expunge($cal_stream);
} }
Header('Location: ' . $phpgw->link('index.php','year='.$thisyear.'&month='.$thismonth.'&owner='.$owner)); Header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/index.php','year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&owner='.$owner));
?> ?>

View File

@ -51,7 +51,7 @@
if ($id > 0) if ($id > 0)
{ {
$cal_stream = $phpgw->calendar->open('INBOX',intval($cal_info->owner),''); $cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
$event = $phpgw->calendar->fetch_event($cal_stream,intval($id)); $event = $phpgw->calendar->fetch_event($cal_stream,intval($id));
$can_edit = False; $can_edit = False;
@ -75,11 +75,6 @@
{ {
header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/view.php','id='.$id.'&owner='.$owner)); header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/view.php','id='.$id.'&owner='.$owner));
} }
if($event->rpt_end_use == False)
{
$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)) elseif(isset($readsess))
{ {
@ -130,12 +125,17 @@
$phpgw->calendar->event->priority = 2; $phpgw->calendar->event->priority = 2;
$phpgw->calendar->event_set_recur_none($cal_stream); $phpgw->calendar->event_set_recur_none($cal_stream);
$event = $phpgw->calendar->event;
} }
$tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
$end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$templates = Array( $templates = Array(
'edit_entry_begin'=> 'edit.tpl', 'edit_entry_begin'=> 'edit.tpl',
'list' => 'list.tpl', 'list' => 'list.tpl',
@ -154,8 +154,7 @@
$action = lang('Calendar - Add'); $action = lang('Calendar - Add');
} }
$common_hidden = '<input type="hidden" name="cal[id]" value="'.$phpgw->calendar->event->id.'">'."\n" $common_hidden = '<input type="hidden" name="id" value="'.$event->id.'">'."\n"
. '<input type="hidden" name="cal[owner]" value="'.$phpgw->calendar->event->owner.'">'."\n"
. '<input type="hidden" name="owner" value="'.$owner.'">'."\n"; . '<input type="hidden" name="owner" value="'.$owner.'">'."\n";
$vars = Array( $vars = Array(
@ -169,78 +168,73 @@
$p->parse('out','edit_entry_begin'); $p->parse('out','edit_entry_begin');
// Brief Description // Brief Description
display_item(lang('Brief Description'),'<input name="cal[name]" size="25" value="'.$phpgw->calendar->event->title.'">'); display_item(lang('Brief Description'),'<input name="title" size="25" value="'.$event->title.'">');
// Full Description // Full Description
display_item(lang('Full Description'),'<textarea name="cal[description]" rows="5" cols="40" wrap="virtual">'.$phpgw->calendar->event->description.'</textarea>'); display_item(lang('Full Description'),'<textarea name="description" rows="5" cols="40" wrap="virtual">'.$event->description.'</textarea>');
// Date // Date
$day_html = $sb->getDays('cal[day]',intval($phpgw->common->show_date($phpgw->calendar->event->datetime,'d'))); $day_html = $sb->getDays('start[mday]',intval($phpgw->common->show_date($start,'d')));
$month_html = $sb->getMonthText('cal[month]',intval($phpgw->common->show_date($phpgw->calendar->event->datetime,'n'))); $month_html = $sb->getMonthText('start[month]',intval($phpgw->common->show_date($start,'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'))); $year_html = $sb->getYears('start[year]',intval($phpgw->common->show_date($start,'Y')),intval($phpgw->common->show_date($start,'Y')));
display_item(lang('Start Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); display_item(lang('Start Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
// Time // Time
$amsel = ' checked'; $pmsel = ''; $amsel = ' checked'; $pmsel = '';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12') if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{ {
if ($phpgw->calendar->event->start->hour >= 12) if ($event->start->hour >= 12)
{ {
$amsel = ''; $pmsel = ' checked'; $amsel = ''; $pmsel = ' checked';
} }
} }
$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">'; $str = '<input name="start[hour]" size="2" VALUE="'.$phpgw->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" size="2" value="'.$phpgw->common->show_date($start,'i').'" maxlength="2">';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12') if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{ {
$str .= '<input type="radio" name="cal[ampm]" value="am"'.$amsel.'>am'; $str .= '<input type="radio" name="start[ampm]" value="am"'.$amsel.'>am';
$str .= '<input type="radio" name="cal[ampm]" value="pm"'.$pmsel.'>pm'; $str .= '<input type="radio" name="start[ampm]" value="pm"'.$pmsel.'>pm';
} }
display_item(lang('Start Time'),$str); display_item(lang('Start Time'),$str);
// End Date // End Date
$day_html = $sb->getDays('cal[end_day]',intval($phpgw->common->show_date($phpgw->calendar->event->edatetime,'d'))); $day_html = $sb->getDays('end[mday]',intval($phpgw->common->show_date($end,'d')));
$month_html = $sb->getMonthText('cal[end_month]',intval($phpgw->common->show_date($phpgw->calendar->event->edatetime,'n'))); $month_html = $sb->getMonthText('end[month]',intval($phpgw->common->show_date($end,'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'))); $year_html = $sb->getYears('end[year]',intval($phpgw->common->show_date($end,'Y')),intval($phpgw->common->show_date($end,'Y')));
display_item(lang('End Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); display_item(lang('End Date'),$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
// End Time // End Time
$amsel = ' checked'; $pmsel = ''; $amsel = ' checked'; $pmsel = '';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12') if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{ {
if ($phpgw->calendar->event->end->hour >= 12) if ($event->end->hour >= 12)
{ {
$amsel = ''; $pmsel = ' checked'; $amsel = ''; $pmsel = ' checked';
} }
} }
$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">'; $str = '<input name="end[hour]" size="2" VALUE="'.$phpgw->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" size="2" value="'.$phpgw->common->show_date($end,'i').'" maxlength="2">';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12') if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{ {
$str .= '<input type="radio" name="cal[end_ampm]" value="am"'.$amsel.'>am'; $str .= '<input type="radio" name="end[ampm]" value="am"'.$amsel.'>am';
$str .= '<input type="radio" name="cal[end_ampm]" value="pm"'.$pmsel.'>pm'; $str .= '<input type="radio" name="end[ampm]" value="pm"'.$pmsel.'>pm';
} }
display_item(lang("End Time"),$str); display_item(lang("End Time"),$str);
// Priority // Priority
display_item(lang('Priority'),$sb->getPriority('cal[priority]',$phpgw->calendar->event->priority)); display_item(lang('Priority'),$sb->getPriority('priority',$event->priority));
// Access // Access
$str = '<input type="checkbox" name="cal[access]" value="private"'; $str = '<input type="checkbox" name="private" value="private"';
if($phpgw->calendar->event->public != True) if($event->public != True)
{ {
$str .= ' checked'; $str .= ' checked';
} }
$str .= '>'; $str .= '>';
display_item(lang('Private'),$str); display_item(lang('Private'),$str);
// Groups
// $user_groups = $phpgw->accounts->memberships(intval($owner));
// display_item(lang('Groups'),$sb->getGroups($user_groups,$cal_info->groups,'cal[groups][]'));
// Participants // Participants
// Start Here.....
$accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar'); $accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar');
$users = Array(); $users = Array();
for($i=0;$i<count($accounts);$i++) for($i=0;$i<count($accounts);$i++)
@ -278,10 +272,10 @@
{ {
$size = $num_users; $size = $num_users;
} }
$str = "\n".' <select name="cal[participants][]" multiple size="5">'."\n"; $str = "\n".' <select name="participants[]" multiple size="5">'."\n";
for ($l=0;$l<count($phpgw->calendar->event->participants);$l++) for ($l=0;$l<count($event->participants);$l++)
{ {
$parts[$phpgw->calendar->event->participants[$l]] = ' selected'; $parts[$event->participants[$l]] = ' selected';
} }
@asort($users); @asort($users);
@ -300,15 +294,15 @@
$participate = False; $participate = False;
if($id) if($id)
{ {
for($i=0;$i<count($phpgw->calendar->event->participants);$i++) for($i=0;$i<count($event->participants);$i++)
{ {
if($phpgw->calendar->event->participants[$i] == $owner) if($event->participants[$i] == $owner)
{ {
$participate = True; $participate = True;
} }
} }
} }
$str = '<input type="checkbox" name="cal[participants][]" value="'.$owner.'"'; $str = '<input type="checkbox" name="participants[]" value="'.$owner.'"';
if((($id > 0) && ($participate == True)) || !isset($id)) if((($id > 0) && ($participate == True)) || !isset($id))
{ {
$str .= ' checked'; $str .= ' checked';
@ -321,7 +315,7 @@
$p->parse('output','hr',True); $p->parse('output','hr',True);
$p->set_var('hr_text','<center><b>'.lang('Repeating Event Information').'</b></center><br>'); $p->set_var('hr_text','<center><b>'.lang('Repeating Event Information').'</b></center><br>');
$p->parse('output','hr',True); $p->parse('output','hr',True);
$str = '<select name="cal[rpt_type]">'; $str = '<select name="recur_type">';
$rpt_type = Array( $rpt_type = Array(
RECUR_NONE, RECUR_NONE,
RECUR_DAILY, RECUR_DAILY,
@ -341,7 +335,7 @@
for($l=0;$l<count($rpt_type);$l++) for($l=0;$l<count($rpt_type);$l++)
{ {
$str .= '<option value="'.$rpt_type[$l].'"'; $str .= '<option value="'.$rpt_type[$l].'"';
if($phpgw->calendar->event->recur_type == $rpt_type[$l]) if($event->recur_type == $rpt_type[$l])
{ {
$str .= ' selected'; $str .= ' selected';
} }
@ -351,36 +345,40 @@
display_item(lang('Repeat Type'),$str); display_item(lang('Repeat Type'),$str);
$p->set_var('field',lang('Repeat End Date')); $p->set_var('field',lang('Repeat End Date'));
$str = '<input type="checkbox" name="cal[rpt_use_end]" value="y"'; $str = '<input type="checkbox" name="rpt_use_end" value="y"';
if($phpgw->calendar->event->recur_enddate->year != 0 && $phpgw->calendar->event->recur_enddate->month != 0 && $phpgw->calendar->event->recur_enddate->mday != 0) if($event->recur_enddate->year != 0 && $event->recur_enddate->month != 0 && $event->recur_enddate->mday != 0)
{ {
$str .= ' checked'; $str .= ' checked';
$recur_end = mktime($event->recur_enddate->hour,$event->recur_enddate->min,$event->recur_enddate->sec,$event->recur_enddate->month,$event->recur_enddate->mday,$event->recur_enddate->year) - $tz_offset;
}
else
{
$recur_end = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->sec) + 86400 - $tz_offset;
} }
$str .= '>'.lang('Use End Date').' '; $str .= '>'.lang('Use End Date').' ';
$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'))); $day_html = $sb->getDays('recur_enddate[mday]',intval($phpgw->common->show_date($recur_end,'d')));
$year_html = $sb->getYears('cal[rpt_year]',intval($phpgw->common->show_date($recur_end,'Y')),intval($phpgw->common->show_date($recur_end,'Y'))); $month_html = $sb->getMonthText('recur_enddate[month]',intval($phpgw->common->show_date($recur_end,'n')));
$year_html = $sb->getYears('recur_enddate[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); $str .= $phpgw->common->dateformatorder($year_html,$month_html,$day_html);
display_item(lang('Repeat End Date'),$str); display_item(lang('Repeat End Date'),$str);
$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_sun]" value="'.M_SUNDAY.'"'.(($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_mon]" value="'.M_MONDAY.'"'.(($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_tue]" value="'.M_TUESDAY.'"'.(($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_wed]" value="'.M_WEDNESDAY.'"'.(($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_thu]" value="'.M_THURSDAY.'"'.(($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_fri]" value="'.M_FRIDAY.'"'.(($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').' '; $str .= '<input type="checkbox" name="cal[rpt_sat]" value="'.M_SATURDAY.'"'.(($event->recur_data & M_SATURDAY) ?' checked':'').'> '.lang('Saturday').' ';
display_item(lang('Repeat Day').'<br>'.lang('(for weekly)'),$str); display_item(lang('Repeat Day').'<br>'.lang('(for weekly)'),$str);
display_item(lang('Frequency'),'<input name="cal[rpt_freq]" size="4" maxlength="4" value="'.$phpgw->calendar->event->recur_interval.'">'); display_item(lang('Frequency'),'<input name="recur_interval" size="4" maxlength="4" value="'.$event->recur_interval.'">');
$p->set_var('submit_button',lang('Submit')); $p->set_var('submit_button',lang('Submit'));

View File

@ -28,27 +28,27 @@
$cal_info = CreateObject('calendar.calendar_item'); $cal_info = CreateObject('calendar.calendar_item');
function validate($cal_info) function validate($event)
{ {
global $phpgw; global $phpgw;
$error = 0; $error = 0;
// do a little form verifying // do a little form verifying
if ($cal_info->name == '') if ($event->title == '')
{ {
$error = 40; $error = 40;
} }
elseif (($phpgw->calendar->time_valid($cal_info->hour,$cal_info->minute,0) == False) || ($phpgw->calendar->time_valid($cal_info->end_hour,$cal_info->end_minute,0) == False)) elseif (($phpgw->calendar->time_valid($event->start->hour,$event->start->min,0) == False) || ($phpgw->calendar->time_valid($event->end->hour,$event->end->min,0) == False))
{ {
$error = 41; $error = 41;
} }
elseif (($phpgw->calendar->date_valid($cal_info->year,$cal_info->month,$cal_info->day) == False) || ($phpgw->calendar->date_valid($cal_info->end_year,$cal_info->end_month,$cal_info->end_day) == False) || ($phpgw->calendar->date_compare($cal_info->year,$cal_info->month,$cal_info->day,$cal_info->end_year,$cal_info->end_month,$cal_info->end_day) == -1)) elseif (($phpgw->calendar->date_valid($event->start->year,$event->start->month,$event->start->mday) == False) || ($phpgw->calendar->date_valid($event->end->year,$event->end->month,$event->end->mday) == False) || ($phpgw->calendar->date_compare($event->start->year,$event->start->month,$event->start->mday,$event->end->year,$event->end->month,$event->end->mday) == -1))
{ {
$error = 42; $error = 42;
} }
elseif ($phpgw->calendar->date_compare($cal_info->year,$cal_info->month,$cal_info->day,$cal_info->end_year,$cal_info->end_month,$cal_info->end_day) == 0) elseif ($phpgw->calendar->date_compare($event->start->year,$event->start->month,$event->start->mday,$event->end->year,$event->end->month,$event->end->mday) == 0)
{ {
if ($phpgw->calendar->time_compare($cal_info->hour,$cal_info->minute,0,$cal_info->end_hour,$cal_info->end_minute,0) == 1) if ($phpgw->calendar->time_compare($event->start->hour,$event->start->min,0,$event->end->hour,$event->end->min,0) == 1)
{ {
$error = 42; $error = 42;
} }
@ -59,15 +59,76 @@
if(!isset($readsess)) if(!isset($readsess))
{ {
$cal_info->set('access',''); if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
for(reset($cal);$key=key($cal);next($cal))
{ {
$data = $cal[$key]; if ($start[ampm] == 'pm')
$cal_info->set($key,$data); {
if ($start[hour] <> 12)
{
$start[hour] += 12;
}
}
elseif ($start[ampm] == 'am')
{
if ($start[hour] == 12)
{
$start[hour] -= 12;
}
}
if ($end[ampm] == 'pm')
{
if ($end[hour] <> 12)
{
$end[hour] += 12;
}
}
elseif ($end[ampm] == 'am')
{
if ($end[hour] == 12)
{
$end[hour] -= 12;
}
}
} }
$cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
$phpgw->calendar->event_init($cal_stream);
$phpgw->calendar->event_set_category($cal_stream,'');
$phpgw->calendar->event_set_title($cal_stream,$title);
$phpgw->calendar->event_set_description($cal_stream,$description);
$phpgw->calendar->event_set_start($cal_stream,$start[year],$start[month],$start[mday],$start[hour],$start[min],0);
$phpgw->calendar->event_set_end($cal_stream,$end[year],$end[month],$end[mday],$end[hour],$end[min],0);
$phpgw->calendar->event_set_class($cal_stream,(private != 'private'));
$parts = $cal_info->participants; if($id != 0)
{
$phpgw->calendar->event->id = $id;
}
switch($recur_type)
{
case RECUR_NONE:
$phpgw->calendar->event_set_recur_none($cal_stream);
break;
case RECUR_DAILY:
$phpgw->calendar->event_set_recur_daily($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
break;
case RECUR_WEEKLY:
$phpgw->calendar->event_set_recur_weekly($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval,$recur_data);
break;
case RECUR_MONTHLY_MDAY:
$phpgw->calendar->event_set_recur_mday($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
break;
case RECUR_MONTHLY_WDAY:
$phpgw->calendar->event_set_recur_wday($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
break;
case RECUR_YEARLY:
$phpgw->calendar->event_set_recur_yearly($cal_stream,$recur_enddate[year],$recur_enddate[month],$recur_enddate[mday],$recur_interval);
break;
}
$parts = $participants;
$part = Array(); $part = Array();
for($i=0;$i<count($parts);$i++) for($i=0;$i<count($parts);$i++)
{ {
@ -92,79 +153,29 @@
} }
} }
$cal_info->participants = Array(); $participants = Array();
while($parts = each($part)) while($parts = each($part))
{ {
$cal_info->participants[] = $parts[0]; $participants[] = $parts[0];
} }
$cal_info->owner=$owner; $phpgw->calendar->event_set_participants($cal_stream,$participants);
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12') $event = $phpgw->calendar->event;
{
if ($cal_info->ampm == 'pm')
{
if ($cal_info->hour <> 12)
{
$cal_info->hour += 12;
}
}
elseif ($cal_info->ampm == 'am')
{
if ($cal_info->hour == 12)
{
$cal_info->hour -= 12;
}
}
if ($cal_info->end_ampm == 'pm')
{
if ($cal_info->end_hour <> 12)
{
$cal_info->end_hour += 12;
}
}
elseif ($cal_info->end_ampm == 'am')
{
if ($cal_info->end_hour == 12)
{
$cal_info->end_hour -= 12;
}
}
}
$datetime = $phpgw->calendar->makegmttime($cal_info->hour,$cal_info->minute,0,$cal_info->month,$cal_info->day,$cal_info->year); $phpgw->session->appsession('entry','calendar',$event);
$cal_info->datetime = $datetime['raw'];
$datetime = $phpgw->calendar->makegmttime($cal_info->end_hour,$cal_info->end_minute,0,$cal_info->end_month,$cal_info->end_day,$cal_info->end_year);
$cal_info->edatetime = $datetime['raw'];
$datetime = $phpgw->calendar->makegmttime(0,0,0,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_year);
$cal_info->rpt_end = $datetime['raw'];
$phpgw->session->appsession('entry','calendar',$cal_info);
$datetime_check = validate($cal_info);
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
if ($cal_info->hour >= 12)
{
$cal_info->ampm = '';
}
if ($cal_info->end_hour >= 12)
{
$cal_info->end_ampm = '';
}
}
$tz_offset = intval(((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']))); $datetime_check = validate($event);
$cal_info->datetime += $tz_offset; $tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$cal_info->edatetime += $tz_offset; $start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
$overlapping_events = $phpgw->calendar->overlap($cal_info->datetime,$cal_info->edatetime,$cal_info->participants,$cal_info->owner,$cal_info->id); $end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;
$overlapping_events = $phpgw->calendar->overlap($start,$end,$event->participants,$event->owner,$event->id);
} }
else else
{ {
$cal_info = $phpgw->session->appsession('entry','calendar'); $event = $phpgw->session->appsession('entry','calendar');
// $cal_info = unserialize($phpgw->session->appsession('entry','calendar'));
} }
if($datetime_check) if($datetime_check)
@ -186,44 +197,30 @@
$p->set_var('color',$phpgw_info['theme']['bg_text']); $p->set_var('color',$phpgw_info['theme']['bg_text']);
$calendar_overlaps = $phpgw->calendar->getevent($overlapping_events);
$format = $phpgw_info['user']['preferences']['common']['dateformat'] . ' - ';
if ($phpgw_info['user']['preferences']['common']['timeformat'] == '12')
{
$format .= 'h:i:s a';
}
else
{
$format .= 'H:i:s';
}
$overlap = ''; $overlap = '';
for($i=0;$i<count($calendar_overlaps);$i++) for($i=0;$i<count($overlapping_events);$i++)
{ {
$cal_over = $calendar_overlaps[$i]; $over = $phpgw->calendar->fetch_event($overlapping_events[$i]);
if($cal_over) $overlap .= '<li>';
$private = $phpgw->calendar->is_private($over,$over->owner);
if(strtoupper($private) == 'PRIVATE')
{ {
$overlap .= '<li>'; $overlap .= '(PRIVATE)';
$private = $phpgw->calendar->is_private($cal_over,$cal_over->owner);
if(strtoupper($private) == 'PRIVATE')
{
$overlap .= '(PRIVATE)';
}
else
{
$overlap .= $phpgw->calendar->link_to_entry($cal_over->id,'circle.gif',$cal_over->description).$cal_over->name;
}
$overlap .= ' ('.$phpgw->common->show_date($cal_over->datetime).' - '.$phpgw->common->show_date($cal_over->edatetime).')<br>';
} }
else
{
$overlap .= $phpgw->calendar->link_to_entry($over->id,'circle.gif',$over->description).$over->title;
}
$over_start = mktime($over->start->hour,$over->start->min,$over->start->sec,$over->start->month,$over->start->mday,$over->start->year);
$over_end = mktime($over->end->hour,$over->end->min,$over->end->sec,$over->end->month,$over->end->mday,$over->end->year);
$overlap .= ' ('.$phpgw->common->show_date($over_start).' - '.$phpgw->common->show_date($over_end).')<br>';
} }
if(strlen($overlap)) if(strlen($overlap) > 0)
{ {
$var = Array( $var = Array(
'overlap_text' => lang('Your suggested time of <B> x - x </B> conflicts with the following existing calendar entries:',date($format,$cal_info->datetime),date($format,$cal_info->edatetime)), 'overlap_text' => lang('Your suggested time of <B> x - x </B> conflicts with the following existing calendar entries:',$phpgw->common->show_date($start),$phpgw->common->show_date($end)),
'overlap_list' => $overlap 'overlap_list' => $overlap
); );
} }
@ -237,8 +234,10 @@
$p->set_var($var); $p->set_var($var);
$phpgw->calendar->event = $event;
$var = Array( $var = Array(
'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_url_button' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry_handler.php','readsess='.$event->id.'&year='.$event->year.'&month='.$event->month.'&day='.$event->mday),
'action_text_button' => lang('Ignore Conflict'), 'action_text_button' => lang('Ignore Conflict'),
'action_confirm_button' => '' 'action_confirm_button' => ''
); );
@ -247,7 +246,7 @@
$p->parse('resubmit_button','form_button'); $p->parse('resubmit_button','form_button');
$var = Array( $var = Array(
'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_url_button' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/edit_entry.php','readsess='.$event->id.'&year='.$event->start->year.'&month='.$event->start->month.'&day='.$event->start->day),
'action_text_button' => lang('Re-Edit Event'), 'action_text_button' => lang('Re-Edit Event'),
'action_confirm_button' => '' 'action_confirm_button' => ''
); );
@ -260,44 +259,9 @@
} }
else else
{ {
$cal_stream = $phpgw->calendar->open('INBOX',intval($cal_info->owner),''); $cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
$phpgw->calendar->event_init($cal_stream);
$phpgw->calendar->event_set_category($cal_stream,'');
$phpgw->calendar->event_set_title($cal_stream,$cal_info->name);
$phpgw->calendar->event_set_description($cal_stream,$cal_info->description);
$phpgw->calendar->event_set_start($cal_stream,$cal_info->year,$cal_info->month,$cal_info->day,$cal_info->hour,$cal_info->minute,0);
$phpgw->calendar->event_set_end($cal_stream,$cal_info->end_year,$cal_info->end_month,$cal_info->end_day,$cal_info->end_hour,$cal_info->end_minute,0);
$phpgw->calendar->event_set_class($cal_stream,($cal_info->access != 'private'));
$phpgw->calendar->event_set_participants($cal_stream,$cal_info->participants);
if($cal_info->id != 0)
{
$phpgw->calendar->event->id = $cal_info->id;
}
switch($cal_info->rpt_type)
{
case 'none':
$phpgw->calendar->event_set_recur_none($cal_stream);
break;
case 'daily':
$phpgw->calendar->event_set_recur_daily($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
case 'weekly':
$phpgw->calendar->event_set_recur_weekly($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq,$cal_freq->rpt_days);
break;
case 'monthlybydate':
$phpgw->calendar->event_set_recur_mday($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
case 'monthlybyday':
$phpgw->calendar->event_set_recur_wday($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
case 'yearly':
$phpgw->calendar->event_set_recur_yearly($cal_stream,$cal_info->rpt_year,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_freq);
break;
}
$phpgw->calendar->store_event($cal_stream); $phpgw->calendar->store_event($cal_stream);
Header('Location: '.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/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='.$event->start->year.'&month='.$event->start->month.'&day='.$event->start->mday.'&cd=14&owner='.$owner));
} }
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -16,6 +16,8 @@
class calendar_ extends calendar__ class calendar_ extends calendar__
{ {
var $deleted_events = Array();
var $cal_event; var $cal_event;
var $today = Array('raw','day','month','year','full','dow','dm','bd'); var $today = Array('raw','day','month','year','full','dow','dm','bd');
@ -406,11 +408,7 @@ class calendar_ extends calendar__
function delete_event($mcal_stream,$event_id) function delete_event($mcal_stream,$event_id)
{ {
$this->stream->lock(array('calendar_entry','calendar_entry_user','calendar_entry_repeats')); $this->deleted_events[] = $event_id;
$this->stream->query('DELETE FROM calendar_entry_user WHERE cal_id='.$event_id,__LINE__,__FILE__);
$this->stream->query('DELETE FROM calendar_entry_repeats WHERE cal_id='.$event_id,__LINE__,__FILE__);
$this->stream->query('DELETE FROM calendar_entry WHERE cal_id='.$event_id,__LINE__,__FILE__);
$this->stream->unlock();
} }
function snooze($mcal_stream,$event_id) function snooze($mcal_stream,$event_id)
@ -723,6 +721,25 @@ class calendar_ extends calendar__
function expunge($stream) function expunge($stream)
{ {
if(count($this->deleted_events) <= 0)
{
return 1;
}
$this_event = $this->event;
$this->stream->lock(array('calendar_entry','calendar_entry_user','calendar_entry_repeats'));
for($i=0;$i<count($this->deleted_events);$i++)
{
$event_id = $this->deleted_events[$i];
$event = $this->fetch_event($event_id);
$this->send_update(MSG_DELETED,$event->participants,$event);
$this->stream->query('DELETE FROM calendar_entry_user WHERE cal_id='.$event_id,__LINE__,__FILE__);
$this->stream->query('DELETE FROM calendar_entry_repeats WHERE cal_id='.$event_id,__LINE__,__FILE__);
$this->stream->query('DELETE FROM calendar_entry WHERE cal_id='.$event_id,__LINE__,__FILE__);
}
$this->stream->unlock();
$this->event = $this_event;
return 1; return 1;
} }

View File

@ -63,7 +63,7 @@
} }
$var = Array( $var = Array(
'action_url' => $phpgw->link('month.php','owner='.$owner), 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/month.php','owner='.$owner),
'form_name' => 'SelectMonth', 'form_name' => 'SelectMonth',
'label' => lang('Month'), 'label' => lang('Month'),
'form_label' => 'date', 'form_label' => 'date',
@ -117,7 +117,7 @@
} }
$var = Array( $var = Array(
'action_url' => $phpgw->link('week.php','owner='.$owner), 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/week.php','owner='.$owner),
'form_name' => 'SelectWeek', 'form_name' => 'SelectWeek',
'label' => lang('Week'), 'label' => lang('Week'),
'form_label' => 'date', 'form_label' => 'date',
@ -150,7 +150,7 @@
} }
$var = Array( $var = Array(
'action_url' => $phpgw->link('year.php','owner='.$owner), 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/year.php','owner='.$owner),
'form_name' => 'SelectYear', 'form_name' => 'SelectYear',
'label' => lang('Year'), 'label' => lang('Year'),
'form_label' => 'year', 'form_label' => 'year',

View File

@ -26,31 +26,31 @@
&nbsp; &nbsp;
</td> </td>
<td width="2%"> <td width="2%">
<a href="<?php echo $phpgw->link('day.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>"> <a href="<?php echo $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/day.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/today.gif" alt="<?php echo lang('Today'); ?>" border="0"> <img src="<?php echo $phpgw_info['server']['app_images']; ?>/today.gif" alt="<?php echo lang('Today'); ?>" border="0">
</a> </a>
</td> </td>
<td width="2%" align="left"> <td width="2%" align="left">
<a href="<?php echo $phpgw->link('week.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>"> <a href="<?php echo $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/week.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/week.gif" alt="<?php echo lang('This week'); ?>" border="0"> <img src="<?php echo $phpgw_info['server']['app_images']; ?>/week.gif" alt="<?php echo lang('This week'); ?>" border="0">
</a> </a>
</td> </td>
<td width="2%" align="left"> <td width="2%" align="left">
<a href="<?php echo $phpgw->link('month.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>"> <a href="<?php echo $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/month.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/month.gif" alt="<?php echo lang('This month'); ?>" border="0"> <img src="<?php echo $phpgw_info['server']['app_images']; ?>/month.gif" alt="<?php echo lang('This month'); ?>" border="0">
</a> </a>
</td> </td>
<td width="2%" align="left"> <td width="2%" align="left">
<a href="<?php echo $phpgw->link('year.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>"> <a href="<?php echo $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/year.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/year.gif" alt="<?php echo lang('This year'); ?>" border="0"> <img src="<?php echo $phpgw_info['server']['app_images']; ?>/year.gif" alt="<?php echo lang('This year'); ?>" border="0">
</a> </a>
</td> </td>
<td width="2%" align="left"> <td width="2%" align="left">
<a href="<?php echo $phpgw->link('matrixselect.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>"> <a href="<?php echo $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/matrixselect.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/view.gif" alt="<?php echo lang('Daily Matrix View'); ?>" border="0"> <img src="<?php echo $phpgw_info['server']['app_images']; ?>/view.gif" alt="<?php echo lang('Daily Matrix View'); ?>" border="0">
</a> </a>
</td> </td>
<form action="<?php echo $phpgw->link('','owner='.$owner); ?>" method="POST" name="filtermethod"> <form action="<?php echo $phpgw->link($PHP_SELF,'owner='.$owner); ?>" method="POST" name="filtermethod">
<td width="45%" align="center" valign="center"> <td width="45%" align="center" valign="center">
<b><?php echo lang('Filter'); ?>:</b> <b><?php echo lang('Filter'); ?>:</b>
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>"> <input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
@ -89,7 +89,7 @@
if(count($grants) > 0) if(count($grants) > 0)
{ {
?> ?>
<form action="<?php echo $phpgw->link(); ?>" method="POST" name="setowner"> <form action="<?php echo $phpgw->link($PHP_SELF); ?>" method="POST" name="setowner">
<td width="20%" align="center" valign="center"> <td width="20%" align="center" valign="center">
<b><?php echo lang('User'); ?>:</b> <b><?php echo lang('User'); ?>:</b>
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>"> <input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
@ -121,7 +121,7 @@
<?php <?php
} }
?> ?>
<form action="<?php echo $phpgw->link('search.php','owner='.$owner); ?>" method="POST"> <form action="<?php echo $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/search.php','owner='.$owner); ?>" method="POST">
<td align="right" valign="center"> <td align="right" valign="center">
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>"> <input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
<?php if(isset($date) && $date) { ?> <?php if(isset($date) && $date) { ?>

View File

@ -12,23 +12,29 @@
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"]["currentapp"] = "calendar"; $phpgw_flags = Array(
$phpgw_info["flags"]["noheader"] = True; 'currentapp' => 'calendar',
$phpgw_info["flags"]["nonavbar"] = True; 'noheader' => True,
$phpgw_info["flags"]["noappheader"] = True; 'nonavbar' => True,
$phpgw_info["flags"]["noappfooter"] = True; 'noappheader => True,
$phpgw_info["flags"]["nofooter"] = True; 'noappfooter' => True,
include("../header.inc.php"); 'nofooter' => True
);
$newpage = $phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"]; $phpgw_info['flags'] = $phpgw_flags;
if ($newpage=="index.php" || ($newpage!="day.php" && $newpage!="week.php" && $newpage!="month.php" && $newpage!="year.php")) {
$newpage = "month.php"; include('../header.inc.php');
$phpgw->preferences->change("calendar","defaultcalendar","month.php");
$phpgw->preferences->commit();
}
Header("Location: ".$newpage."?".$QUERY_STRING); $newpage = $phpgw_info['user']['preferences']['calendar']['defaultcalendar'];
$phpgw->common->phpgw_exit(); if ($newpage=='index.php' || ($newpage != 'day.php' && $newpage != 'week.php' && $newpage != 'month.php' && $newpage != 'year.php'))
{
$newpage = 'month.php';
$phpgw->preferences->add('calendar','defaultcalendar','month.php');
$phpgw->preferences->save_repository();
}
Header('Location: '.$newpage.'?'.$QUERY_STRING);
$phpgw->common->phpgw_exit();
?> ?>

View File

@ -23,7 +23,11 @@
include('../header.inc.php'); include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $datetime = mktime(0,0,0,$thismonth,$thisday,$thisyear) - ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$sb = CreateObject('phpgwapi.sbox');
$p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$templates = Array( $templates = Array(
'matrix_query_begin' => 'matrix_query.tpl', 'matrix_query_begin' => 'matrix_query.tpl',
@ -36,34 +40,16 @@
$var = Array( $var = Array(
'matrix_action' => lang('Daily Matrix View'), 'matrix_action' => lang('Daily Matrix View'),
'action_url' => $phpgw->link('viewmatrix.php') 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/viewmatrix.php')
); );
$p->set_var($var); $p->set_var($var);
$p->parse('out','matrix_query_begin'); $p->parse('out','matrix_query_begin');
// Date // Date
$day_html = '<select name="day">'; $day_html = $sb->getDays('day',intval($phpgw->common->show_date($datetime,'d')));
for($i=1;$i<=31;$i++) $month_html = $sb->getMonthText('month',intval($phpgw->common->show_date($datetime,'n')));
{ $year_html = $sb->getYears('year',intval($phpgw->common->show_date($datetime,'Y')),intval($phpgw->common->show_date($datetime,'Y')));
$day_html .= '<option value="'.$i.'"'.($i==$thisday?' selected':'').'>'.$i.'</option>'."\n";
}
$day_html .= '</select>';
$month_html = '<select name="month">';
for($i=1;$i<=12;$i++)
{
$m = lang(date('F', mktime(0,0,0,$i,1,$thisyear)));
$month_html .= '<option value="'.$i.'"'.($i==$thismonth?' selected':'').'>'.$m.'</option>'."\n";
}
$month_html .= '</select>';
$year_html = '<select name="year">';
for($i=($thisyear - 1);$i<($thisyear + 5);$i++)
{
$year_html .= '<option value="'.$i.'"'.($i==$thisyear?' selected':'').'>'.$i.'</option>'."\n";
}
$year_html .= '</select>';
$var = Array( $var = Array(
'field' => lang('Date'), 'field' => lang('Date'),

View File

@ -39,9 +39,9 @@
$phpgw_info['flags'] = $phpgw_flags; $phpgw_info['flags'] = $phpgw_flags;
include('../header.inc.php'); include('../header.inc.php');
$view = "month"; $view = 'month';
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$templates = Array( $templates = Array(
'index_t' => 'index.tpl' 'index_t' => 'index.tpl'
@ -55,7 +55,7 @@
{ {
$printer = ''; $printer = '';
$param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter.'&owner='.$owner; $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter.'&owner='.$owner;
$print = '<a href="'.$phpgw->link('',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; $print = '<a href="'.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/month.php',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
} }
else else
{ {

View File

@ -39,6 +39,15 @@
{ {
$phpgw->preferences->delete('calendar','mainscreen_showevents'); $phpgw->preferences->delete('calendar','mainscreen_showevents');
} }
if ($send_updates)
{
$phpgw->preferences->add('calendar','send_updates');
}
else
{
$phpgw->preferences->delete('calendar','send_updates');
}
$phpgw->preferences->save_repository(True); $phpgw->preferences->save_repository(True);
Header('Location: '.$phpgw->link('/preferences/index.php')); Header('Location: '.$phpgw->link('/preferences/index.php'));
@ -147,6 +156,10 @@
. '</select>'; . '</select>';
display_item(lang('default calendar filter'),$str); display_item(lang('default calendar filter'),$str);
$str = '<input type="checkbox" name="send_updates" value="Y"'.($phpgw_info['user']['preferences']['calendar']['send_updates'] == 'Y'?' checked':'').'>';
display_item(lang('send updates via email'),$str);
$p->pparse('out','pref'); $p->pparse('out','pref');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -12,114 +12,125 @@
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); $phpgw_flags = Array(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True
);
$phpgw_info['flags'] = $phpgw_flags;
if (! $keywords) { if (! $keywords)
// If we reach this, it is because they didn't search for anything, {
// attempt to send them back to where they where. // If we reach this, it is because they didn't search for anything,
Header("Location: " . $phpgw->link($from,"date=$datemonth=$month&day=$day&year=$year")); // attempt to send them back to where they where.
} Header('Location: ' . $phpgw->link($from,'month='.$month.'&day='.$day.'&year='.$year));
}
include("../header.inc.php"); include('../header.inc.php');
$error = ""; $error = '';
if (strlen($keywords) == 0) { if (strlen($keywords) == 0)
echo "<b>".lang("Error").":</b>"; {
echo lang("You must enter one or more search keywords."); echo '<b>'.lang('Error').':</b>';
$phpgw->common->phpgw_footer(); echo lang('You must enter one or more search keywords.');
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_footer();
} $phpgw->common->phpgw_exit();
$matches = 0; }
$matches = 0;
$phpgw->calendar->set_filter(); $phpgw->calendar->set_filter();
// There is currently a problem searching in with repeated events. // There is currently a problem searching in with repeated events.
// It spits back out the date it was entered. I would like to to say that // It spits back out the date it was entered. I would like to to say that
// it is a repeated event. // it is a repeated event.
$ids = array(); $ids = array();
$words = split(" ", $keywords); $words = split(' ',$keywords);
for ($i = 0; $i < count($words); $i++) { for ($i=0;$i<count($words);$i++)
$sql = "SELECT DISTINCT calendar_entry.cal_id, calendar_entry.cal_name, " {
. "calendar_entry.cal_datetime " $sql = "AND (UPPER(calendar_entry.cal_name) LIKE UPPER('%".$words[$i]."%') OR "
. "FROM calendar_entry, calendar_entry_user " . " UPPER(calendar_entry.cal_description) LIKE UPPER('%".$words[$i]."%')) ";
. "WHERE "
. "(UPPER(calendar_entry.cal_name) LIKE UPPER('%".$words[$i]."%') OR "
. " UPPER(calendar_entry.cal_description) LIKE UPPER('%".$words[$i]."%')) AND "
. "calendar_entry_user.cal_id=calendar_entry.cal_id AND ";
$sqlfilter = "";
// Private // Private
if($phpgw->calendar->filter==" all " || strpos($phpgw->calendar->filter,"private")) { if(strpos($phpgw->calendar->filter,'private'))
$sqlfilter .= "(calendar_entry_user.cal_login = ".$phpgw_info["user"]["account_id"]." AND calendar_entry.cal_access='private') "; {
} $sql .= "AND calendar_entry.cal_access='private' ";
}
$sql .= 'ORDER BY calendar_entry.cal_datetime ASC, calendar_entry.cal_edatetime ASC, calendar_entry.cal_priority ASC';
// Group Public $events = $phpgw->calendar->get_event_ids(True,$sql);
if($phpgw->calendar->filter==" all " || strpos($phpgw->calendar->filter,"group")) {
if($sqlfilter)
$sqlfilter .= "OR ";
$sqlfilter .= $phpgw->calendar->group_search($phpgw_info["user"]["account_id"])." ";
}
// Global Public if($events == False)
if($phpgw->calendar->filter==" all " || strpos($phpgw->calendar->filter,"public")) { {
if($sqlfilter) $matches = 0;
$sqlfilter .= "OR "; }
$sqlfilter .= "calendar_entry.cal_access='public' "; else
} {
$orderby = " ORDER BY calendar_entry.cal_datetime ASC"; $cal_stream = $phpgw->calendar->open('INBOX',intval($owner),'');
for($i=0;$i<count($events);$i++)
{
$event = $phpgw->calendar->fetch_event($cal_stream,$events[$i]);
$datetime = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$ids[strval($event->id)]++;
$info[strval($event->id)] = $event->name.' ('
. $phpgw->common->show_date($datetime).')';
}
$matches = count($events);
}
}
if($sqlfilter) $sql .= "(".$sqlfilter.") "; if ($matches > 0)
$sql .= $orderby; {
$matches = count($ids);
}
$phpgw->db->query($sql,__LINE__,__FILE__); if ($matches == 1)
while ($phpgw->db->next_record()) { {
$matches++; $quantity = '1 match found.';
$ids[strval( $phpgw->db->f(0) )]++; }
$info[strval( $phpgw->db->f(0) )] = $phpgw->db->f(1) . " (" elseif ($matches > 0)
. $phpgw->common->show_date($phpgw->db->f(2)) . ")"; {
} $quantity = lang('x matches found',$matches).'.';
} }
else
{
echo '<b>'.lang('Error').':</b>';
echo lang('no matches found.');
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
if ($matches > 0) $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$matches = count($ids); $templates = Array(
'search' => 'search.tpl',
'search_list' => 'search_list.tpl',
);
$p->set_file($templates);
if ($matches == 1) $var = Array(
$quantity = "1 match found."; 'color' => $phpgw_info['theme']['bg_text'],
else if ($matches > 0) 'search_text' => lang('Search Results'),
$quantity = lang("x matches found",$matches)."."; 'quantity' => $quantity
else );
$error = lang("no matches found.");
if($error) { $p->set_var($var);
echo "<b>".lang("Error").":</b>";
echo $error;
$phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit();
}
$phpgw->template->set_file(array("search_t" => "search.tpl", // now sort by number of hits
"search_list" => "search_list.tpl")); arsort($ids);
for(reset($ids);$key=key($ids);next($ids))
{
$p->set_var('url_result',$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/view.php','id='.$key.'&owner='.$owner));
$p->set_var('result_desc',$info[$key]);
$p->parse('output','search_list',True);
}
$p->pparse('out','search');
$phpgw->template->set_block("search_t","search_list"); $phpgw->common->phpgw_footer();
$phpgw->template->set_var("color",$phpgw_info["theme"]["bg_text"]);
$phpgw->template->set_var("search_text",lang("Search Results"));
$phpgw->template->set_var("quantity",$quantity);
// now sort by number of hits
if (! strlen($error)) {
arsort ($ids);
for (reset($ids); $key = key($ids); next($ids)) {
$phpgw->template->set_var("url_result",$phpgw->link("view.php","id=$key"));
$phpgw->template->set_var("result_desc",$info[$key]);
$phpgw->template->parse("output","search_list",True);
}
}
$phpgw->template->pparse("out","search_t");
$phpgw->common->phpgw_footer();
?> ?>

View File

@ -65,13 +65,13 @@
$unapproved = FALSE; $unapproved = FALSE;
$cal_stream = $phpgw->calendar->open('INBOX',$owner,''); $cal_stream = $phpgw->calendar->open('INBOX',$owner,'');
$cal_info = $phpgw->calendar->fetch_event($cal_stream,$id); $event = $phpgw->calendar->fetch_event($cal_stream,$id);
reset($cal_info->participants); reset($event->participants);
$participating = False; $participating = False;
for($j=0;$j<count($cal_info->participants);$j++) for($j=0;$j<count($event->participants);$j++)
{ {
if($cal_info->participants[$j] == $owner) if($event->participants[$j] == $owner)
{ {
$participating = True; $participating = True;
} }
@ -83,7 +83,7 @@
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
$description = nl2br($description); // $description = nl2br($event->description);
$p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir); $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
@ -97,72 +97,76 @@
$var = Array( $var = Array(
'bg_text' => $phpgw_info['theme']['bg_text'], 'bg_text' => $phpgw_info['theme']['bg_text'],
'name' => $cal_info->name 'name' => $event->name
); );
$p->set_var($var); $p->set_var($var);
$p->parse('out','view_begin'); $p->parse('out','view_begin');
// Some browser add a \n when its entered in the database. Not a big deal // Some browser add a \n when its entered in the database. Not a big deal
// this will be printed even though its not needed. // this will be printed even though its not needed.
if (nl2br($cal_info->description)) if (nl2br($event->description))
{ {
display_item(lang("Description"),nl2br($cal_info->description)); display_item(lang('Description'),nl2br($event->description));
} }
display_item(lang('Start Date/Time'),$phpgw->common->show_date($cal_info->datetime)); $tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
$start = mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year) - $tz_offset;
display_item(lang('Start Date/Time'),$phpgw->common->show_date($start));
// save date so the trailer links are for the same time period // save date so the trailer links are for the same time period
$thisyear = $cal_info->start->year; $thisyear = $cal_info->start->year;
$thismonth = $cal_info->start->month; $thismonth = $cal_info->start->month;
$thisday = $cal_info->start->mday; $thisday = $cal_info->start->mday;
display_item(lang('End Date/Time'),$phpgw->common->show_date($cal_info->edatetime)); $end = mktime($event->end->hour,$event->end->min,$event->end->sec,$event->end->month,$event->end->mday,$event->end->year) - $tz_offset;
display_item(lang('End Date/Time'),$phpgw->common->show_date($end));
display_item(lang('Priority'),$pri[$cal_info->priority]); display_item(lang('Priority'),$pri[$event->priority]);
$participate = False; $participate = False;
for($i=0;$i<count($cal_info->participants);$i++) for($i=0;$i<count($event->participants);$i++)
{ {
if($cal_info->participants[$i] == $phpgw_info['user']['account_id']) if($event->participants[$i] == $phpgw_info['user']['account_id'])
{ {
$participate = True; $participate = True;
} }
} }
if($cal_info->owner == $phpgw_info['user']['account_id'] && $participate) if($event->owner == $phpgw_info['user']['account_id'] && $participate)
{ {
display_item(lang('Created by'),'<a href="' display_item(lang('Created by'),'<a href="'
.$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->link('/'.$phpgw_info['flags']['currentapp'].'/viewmatrix.php','participants='.$event->owner.'&month='.$event->start->month.'&day='.$event->start->mday.'&year='.$event->start->year.'&matrixtype=free/busy&owner='.$owner)
.'">'.$phpgw->common->grab_owner_name($cal_info->owner).'</a>'); .'">'.$phpgw->common->grab_owner_name($event->owner).'</a>');
} }
else else
{ {
display_item(lang('Created by'),$phpgw->common->grab_owner_name($cal_info->owner)); display_item(lang('Created by'),$phpgw->common->grab_owner_name($event->owner));
} }
display_item(lang('Updated'),$phpgw->common->show_date($cal_info->mdatetime)); display_item(lang('Updated'),$phpgw->common->show_date($event->mdatetime));
if($cal_info->groups[0]) if($event->groups[0])
{ {
$cal_grps = ''; $cal_grps = '';
for($i=0;$i<count($cal_info->groups);$i++) for($i=0;$i<count($event->groups);$i++)
{ {
if($i>0) if($i>0)
{ {
$cal_grps .= '<br>'; $cal_grps .= '<br>';
} }
$cal_grps .= $phpgw->accounts->id2name($cal_info->groups[$i]); $cal_grps .= $phpgw->accounts->id2name($event->groups[$i]);
} }
display_item(lang('Groups'),$cal_grps); display_item(lang('Groups'),$cal_grps);
} }
$str = ''; $str = '';
for($i=0;$i<count($cal_info->participants);$i++) for($i=0;$i<count($event->participants);$i++)
{ {
if($i) if($i)
{ {
$str .= '<br>'; $str .= '<br>';
} }
switch ($cal_info->status[$i]) switch ($event->status[$i])
{ {
case 'A': case 'A':
$status = 'Accepted'; $status = 'Accepted';
@ -177,63 +181,63 @@
$status = 'No Repsonse'; $status = 'No Repsonse';
break; break;
} }
$str .= $phpgw->common->grab_owner_name($cal_info->participants[$i]).' ('.$status.')'; $str .= $phpgw->common->grab_owner_name($event->participants[$i]).' ('.$status.')';
} }
display_item(lang('Participants'),$str); display_item(lang('Participants'),$str);
// Repeated Events // Repeated Events
$str = $cal_info->rpt_type; $str = $event->rpt_type;
if($str <> 'none' || $cal_info->rpt_use_end) if($event->recur_type <> RECUR_NONE || ($event->recur_enddate->mday != 0 && $event->recur_enddate->month != 0 && $event->recur_enddate->year != 0))
{ {
$str .= ' ('; $str .= ' (';
$recur_end = mktime(0,0,0,$cal_info->recur_enddate->month,$cal_info->recur_enddate->mday,$cal_info->recur_enddate->year); $recur_end = mktime(0,0,0,$event->recur_enddate->month,$event->recur_enddate->mday,$event->recur_enddate->year);
if($recur_end != 0) if($recur_end != 0)
{ {
$str .= lang('ends').': '.$phpgw->common->show_date($recur_end,'l, F d, Y').' '; $str .= lang('ends').': '.$phpgw->common->show_date($recur_end,'l, F d, Y').' ';
} }
if($cal_info->recur_type == RECUR_WEEKLY || $cal_info->recur_type == RECUR_DAILY) if($event->recur_type == RECUR_WEEKLY || $event->recur_type == RECUR_DAILY)
{ {
$repeat_days = ''; $repeat_days = '';
if ($cal_info->recur_data & M_SUNDAY) if ($event->recur_data & M_SUNDAY)
{ {
add_day($repeat_days,lang('Sunday ')); add_day($repeat_days,lang('Sunday '));
} }
if ($cal_info->recur_data & M_MONDAY) if ($event->recur_data & M_MONDAY)
{ {
add_day($repeat_days,lang('Monday ')); add_day($repeat_days,lang('Monday '));
} }
if ($cal_info->recur_data & M_TUESDAY) if ($event->recur_data & M_TUESDAY)
{ {
add_day($repeat_days,lang('Tuesay ')); add_day($repeat_days,lang('Tuesay '));
} }
if ($cal_info->recur_data & M_WEDNESDAY) if ($event->recur_data & M_WEDNESDAY)
{ {
add_day($repeat_days,lang('Wednesday ')); add_day($repeat_days,lang('Wednesday '));
} }
if ($cal_info->recur_data & M_THURSDAY) if ($event->recur_data & M_THURSDAY)
{ {
add_day($repeat_days,lang('Thursday ')); add_day($repeat_days,lang('Thursday '));
} }
if ($cal_info->recur_data & M_FRIDAY) if ($event->recur_data & M_FRIDAY)
{ {
add_day($repeat_days,lang('Friday ')); add_day($repeat_days,lang('Friday '));
} }
if ($cal_info->recur_data & M_SATURDAY) if ($event->recur_data & M_SATURDAY)
{ {
add_day($repeat_days,lang('Saturday ')); add_day($repeat_days,lang('Saturday '));
} }
$str .= lang('days repeated').': '.$repeat_days; $str .= lang('days repeated').': '.$repeat_days;
} }
if($cal_info->recur_interval) if($event->recur_interval)
{ {
$str .= lang('frequency').' '.$cal_info->recur_interval; $str .= lang('frequency').' '.$event->recur_interval;
} }
$str .= ')'; $str .= ')';
display_item(lang('Repetition'),$str); display_item(lang('Repetition'),$str);
} }
if (($cal_info->owner == $owner) && ($rights & PHPGW_ACL_EDIT)) if (($event->owner == $owner) && ($rights & PHPGW_ACL_EDIT))
{ {
$p->set_var('action_url_button',$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/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_text_button',' '.lang('Edit').' ');
@ -245,7 +249,7 @@
$p->set_var('edit_button',''); $p->set_var('edit_button','');
} }
if (($cal_info->owner == $owner) && ($rights & PHPGW_ACL_DELETE)) if (($event->owner == $owner) && ($rights & PHPGW_ACL_DELETE))
{ {
$p->set_var('action_url_button',$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/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_text_button',lang('Delete'));

View File

@ -61,7 +61,7 @@
} }
$week_id .= $last['day'].', '.$last['year']; $week_id .= $last['day'].', '.$last['year'];
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir);
$templates = Array( $templates = Array(
'week_t' => 'week.tpl' 'week_t' => 'week.tpl'
); );
@ -71,10 +71,10 @@
if ($friendly == 0) if ($friendly == 0)
{ {
$printer = ''; $printer = '';
$prev_week_link = '<a href="'.$phpgw->link('week.php','year='.$prev['year'].'&month='.$prev['month'].'&day='.$prev['day']).'">&lt;&lt;</a>'; $prev_week_link = '<a href="'.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/week.php','year='.$prev['year'].'&month='.$prev['month'].'&day='.$prev['day']).'">&lt;&lt;</a>';
$next_week_link = '<a href="'.$phpgw->link('week.php','year='.$next['year'].'&month='.$next['month'].'&day='.$next['day']).'">&gt;&gt;</a>'; $next_week_link = '<a href="'.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/week.php','year='.$next['year'].'&month='.$next['month'].'&day='.$next['day']).'">&gt;&gt;</a>';
$param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner; $param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner;
$print = '<a href="'.$phpgw->link('',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; $print = '<a href="'.$phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/week.php',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
} }
else else
{ {

View File

@ -37,7 +37,7 @@
<tr> <tr>
<?php <?php
if (!$friendly) if (!$friendly)
echo "<td align=\"left\"><A HREF=\"" . $phpgw->link("year.php","year=" . ($year - 1)) . "\">&lt;&lt;</A>"; echo "<td align=\"left\"><A HREF=\"" . $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/year.php',"year=" . ($year - 1)) . "\">&lt;&lt;</A>";
?> ?>
</td> </td>
</td> </td>
@ -46,7 +46,7 @@
</td> </td>
<?php <?php
if (! $friendly) if (! $friendly)
echo "<td align=\"right\"><A HREF=\"" . $phpgw->link("year.php","year=" . ($year + 1)) . "\">&gt;&gt;</A>"; echo "<td align=\"right\"><A HREF=\"" . $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/year.php',"year=" . ($year + 1)) . "\">&gt;&gt;</A>";
?> ?>
</td> </td>
</tr> </tr>