From 3abcd4897c71a8bfec80694a2310b7746e87c3a3 Mon Sep 17 00:00:00 2001 From: skeeter Date: Thu, 14 Dec 2000 02:37:58 +0000 Subject: [PATCH] fixed 12 am/pm problem and added defaultfilter preference --- calendar/day.php | 2 +- calendar/edit_entry_handler.php | 33 +++++++++++++++++++++++++++------ calendar/inc/header.inc.php | 2 ++ calendar/index.php | 2 +- calendar/preferences.php | 25 +++++++++++++++++++++++++ calendar/view.php | 24 +++++------------------- calendar/week.php | 2 +- doc/CHANGELOG | 2 ++ 8 files changed, 64 insertions(+), 28 deletions(-) diff --git a/calendar/day.php b/calendar/day.php index 7072232f2b..65e0b07eeb 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -89,7 +89,7 @@ $phpgw->template->set_var("small_calendar",$phpgw->calendar->pretty_small_calendar($now["day"],$now["month"],$now["year"],"day.php")); if (!$friendly) { - $param = "year=".$now["year"]."&month=".$now["month"]."&day=".$now["day"]."&friendly=1"; + $param = "year=".$now["year"]."&month=".$now["month"]."&day=".$now["day"]."&friendly=1&filter=".$filter; $phpgw->template->set_var("print","link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang("Generate printer-friendly version")."'\">[".lang("Printer Friendly")."]"); $phpgw->template->parse("out","day_t"); $phpgw->template->pparse("out","day_t"); diff --git a/calendar/edit_entry_handler.php b/calendar/edit_entry_handler.php index f69b864d99..5f30b711fb 100755 --- a/calendar/edit_entry_handler.php +++ b/calendar/edit_entry_handler.php @@ -57,9 +57,30 @@ if(!$participating && count($cal_info->participants) == 1) { $cal_info->owner = $cal_info->participants[0]; } + if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { + if ($cal_info->ampm == "pm" && $cal_info->hour <> 12) { + $cal_info->hour += 12; + } + if ($cal_info->end_ampm == "pm" && $cal_info->end_hour <> 12) { + $cal_info->end_hour += 12; + } + } + $cal_info->datetime = mktime($cal_info->hour,$cal_info->minute,0,$cal_info->month,$cal_info->day,$cal_info->year) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); + $cal_info->edatetime = mktime($cal_info->end_hour,$cal_info->end_minute,0,$cal_info->end_month,$cal_info->end_day,$cal_info->end_year) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); + $cal_info->rpt_end = mktime(12,0,0,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_year) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); $phpgw->common->appsession($cal_info); $datetime_check = validate($cal_info); - $overlapping_events = $phpgw->calendar->overlap($cal_info->month,$cal_info->day,$cal_info->year,$cal_info->hour,$cal_info->minute,$cal_info->ampm,$cal_info->end_month,$cal_info->end_day,$cal_info->end_year,$cal_info->end_hour,$cal_info->end_minute,$cal_info->end_ampm,$cal_info->participants,$cal_info->owner,$cal_info->id); + 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 = ""; + } + } + $cal_info->datetime += ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); + $cal_info->edatetime += ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); + $overlapping_events = $phpgw->calendar->overlap($cal_info->datetime,$cal_info->edatetime,$cal_info->participants,$cal_info->groups,$cal_info->owner,$cal_info->id); } else { $cal_info = $phpgw->common->appsession(); } @@ -76,13 +97,13 @@ $phpgw->template->set_var("color",$phpgw_info["theme"]["bg_text"]); - $time = $phpgw->calendar->fixtime($cal_info->hour,$cal_info->minute,$cal_info->ampm); $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"; + $format .= "h:i:s a"; } else { - $format = "H:i:s"; + $format .= "H:i:s"; } $overlap = ""; @@ -94,11 +115,11 @@ $overlap .= "(PRIVATE)"; else $overlap .= $phpgw->calendar->link_to_entry($cal_over->id,"circle.gif",$cal_over->name); - $overlap .= " (".$phpgw->common->show_date($cal_over->datetime,$format)." - ".$phpgw->common->show_date($cal_over->edatetime,$format).")
"; + $overlap .= " (".$phpgw->common->show_date($cal_over->datetime)." - ".$phpgw->common->show_date($cal_over->edatetime).")
"; } } if(strlen($overlap)) { - $phpgw->template->set_var("overlap_text",lang("Your suggested time of x - x conflicts with the following existing calendar entries:",$phpgw->calendar->build_time_for_display($time),$phpgw->calendar->build_time_for_display($phpgw->calendar->addduration($cal_info->hour,$cal_info->minute,$cal_info->ampm,$cal_info->duration)))); + $phpgw->template->set_var("overlap_text",lang("Your suggested time of x - x conflicts with the following existing calendar entries:",date($format,$cal_info->datetime),date($format,$cal_info->edatetime))); $phpgw->template->set_var("overlap_list",$overlap); } else { $phpgw->template->set_var("overlap_text",""); diff --git a/calendar/inc/header.inc.php b/calendar/inc/header.inc.php index c5ffde87f1..be0a542a68 100644 --- a/calendar/inc/header.inc.php +++ b/calendar/inc/header.inc.php @@ -6,6 +6,8 @@ if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + if(!isset($filter) || !$filter) + $filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]; if (isset($date) && strlen($date) > 0) { $thisyear = substr($date, 0, 4); $thismonth = substr($date, 4, 2); diff --git a/calendar/index.php b/calendar/index.php index ca0db9463d..e5d2611b51 100755 --- a/calendar/index.php +++ b/calendar/index.php @@ -78,7 +78,7 @@ $phpgw->template->set_var("small_calendar_next",$phpgw->calendar->pretty_small_calendar($thisday,$next["month"],$next["year"],"day.php")); $phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner)); if (!$friendly) { - $param = "year=".$now["year"]."&month=".$now["month"]."&friendly=1"; + $param = "year=".$now["year"]."&month=".$now["month"]."&friendly=1&filter=".$filter; $phpgw->template->set_var("print","link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." . "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]"); $phpgw->template->parse("out","index_t"); diff --git a/calendar/preferences.php b/calendar/preferences.php index 9a8e98ab7f..bc22f88b6e 100644 --- a/calendar/preferences.php +++ b/calendar/preferences.php @@ -22,6 +22,7 @@ $phpgw->preferences->change($phpgw_info["user"]["account_id"],"workdaystarts","calendar"); $phpgw->preferences->change($phpgw_info["user"]["account_id"],"workdayends","calendar"); $phpgw->preferences->change($phpgw_info["user"]["account_id"],"defaultcalendar","common"); + $phpgw->preferences->change($phpgw_info["user"]["account_id"],"defaultfilter","calendar"); if ($mainscreen_showevents) { $phpgw->preferences->change($phpgw_info["user"]["account_id"],"mainscreen_showevents","calendar"); } else { @@ -123,6 +124,30 @@ + nextmatchs->alternate_row_color($tr_color); + ?> + + + + + + "> diff --git a/calendar/view.php b/calendar/view.php index 96b9c02b49..e530aa668a 100755 --- a/calendar/view.php +++ b/calendar/view.php @@ -67,8 +67,8 @@ $phpgw->template->parse("output","list",True); } - $phpgw->template->set_var("field",lang("Date")); - $phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime,$phpgw_info["user"]["preferences"]["common"]["dateformat"])); + $phpgw->template->set_var("field",lang("Start Date/Time")); + $phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime)); $phpgw->template->parse("output","list",True); // save date so the trailer links are for the same time period @@ -76,23 +76,9 @@ $thismonth = (int)$cal_info->month; $thisday = (int)$cal_info->day; - if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { - $format = "h:i:s a"; - } else { - $format = "H:i:s"; - } - - if(intval($phpgw->common->show_date($cal_info->datetime,"H")) || intval($phpgw->common->show_date($cal_info->datetime,"i"))) { - $phpgw->template->set_var("field",lang("Time")); - $phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime,$format)); - $phpgw->template->parse("output","list",True); - } - - if(($cal_info->datetime <> $cal_info->edatetime) && (intval($phpgw->common->show_date($cal_info->datetime,"Hi")) <> 0 && intval($phpgw->common->show_date($cal_info->edatetime,"Hi")) <> 2359)) { - $phpgw->template->set_var("field",lang("End Time")); - $phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->edatetime,$format)); - $phpgw->template->parse("output","list",True); - } + $phpgw->template->set_var("field",lang("End Date/Time")); + $phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->edatetime)); + $phpgw->template->parse("output","list",True); $phpgw->template->set_var("field",lang("Priority")); $phpgw->template->set_var("data",$pri[$cal_info->priority]); diff --git a/calendar/week.php b/calendar/week.php index b0d27d029e..fda8dd74e3 100755 --- a/calendar/week.php +++ b/calendar/week.php @@ -116,7 +116,7 @@ $phpgw->template->set_var("week_display",$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner)); if (!$friendly) { - $param = "year=".$thisyear."&month=".$thismonth."&day=".$thisday."&friendly=1"; + $param = "year=".$thisyear."&month=".$thismonth."&day=".$thisday."&friendly=1&filter=".$filter; $phpgw->template->set_var("print","link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." . "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]"); $phpgw->template->parse("out","week_t"); diff --git a/doc/CHANGELOG b/doc/CHANGELOG index c32c6a4c65..5c7f7f37b5 100755 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -28,6 +28,8 @@ - Added in a few preformace tweaks that will use serialize() and unserialize() for preferences, config - Changed a few of the icons to our news ones. + - Fixed 12 am/pm problem in calendar. + - Added default filter to calendar preferences. [0.9.7] - Fixed SQL error in tts - Fixed table locking in admin -> edit account