From 8821d96b7ea7c6c0a49d6e0b74ff1fb151029133 Mon Sep 17 00:00:00 2001 From: skeeter Date: Sun, 21 Jan 2001 04:16:15 +0000 Subject: [PATCH] now handles default calendar view --- calendar/index.php | 85 ++++------------------------------- calendar/month.php | 96 ++++++++++++++++++++++++++++++++++++++++ calendar/preferences.php | 6 +-- 3 files changed, 107 insertions(+), 80 deletions(-) create mode 100755 calendar/month.php diff --git a/calendar/index.php b/calendar/index.php index 9822d6e93e..1a41ab157e 100755 --- a/calendar/index.php +++ b/calendar/index.php @@ -14,83 +14,14 @@ /* $Id$ */ - $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); - - if (isset($friendly) && $friendly){ - $phpgw_info["flags"]["noheader"] = True; - $phpgw_info["flags"]["nonavbar"] = True; - $phpgw_info["flags"]["noappheader"] = True; - $phpgw_info["flags"]["noappfooter"] = True; - $phpgw_info["flags"]["nofooter"] = True; - } else { - $friendly = 0; - } - + $phpgw_info["flags"]["currentapp"] = "calendar"; + $phpgw_info["flags"]["noheader"] = True; + $phpgw_info["flags"]["nonavbar"] = True; + $phpgw_info["flags"]["noappheader"] = True; + $phpgw_info["flags"]["noappfooter"] = True; + $phpgw_info["flags"]["nofooter"] = True; include("../header.inc.php"); - if(isset($friendly) && $friendly) { - if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) - $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; - - if (isset($date) && strlen($date) > 0) { - $thisyear = intval(substr($date, 0, 4)); - $thismonth = intval(substr($date, 4, 2)); - $thisday = intval(substr($date, 6, 2)); - } else { - if (!isset($day) || !$day) - $thisday = $phpgw->calendar->today["day"]; - else - $thisday = $day; - if (!isset($month) || !$month) - $thismonth = $phpgw->calendar->today["month"]; - else - $thismonth = $month; - if (!isset($year) || !$year) - $thisyear = $phpgw->calendar->today["year"]; - else - $thisyear = $year; - } - } - - if(!isset($owner)) { $owner = $phpgw_info["user"]["account_id"]; } -// unset($owner); - - $next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear)); - - $prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear)); - - $view = "month"; - - $phpgw->template->set_file(array("index_t" => "index.tpl")); - - $phpgw->template->set_block("index_t","index"); - - if ($friendly) { - $phpgw->template->set_var("printer_friendly",""); - } else { - $phpgw->template->set_var("printer_friendly",""); - } - - $phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); - - $phpgw->template->set_var("small_calendar_prev",$phpgw->calendar->mini_calendar($thisday,$prev["month"],$prev["year"],"day.php")); - - $m = mktime(2,0,0,$thismonth,1,$thisyear); - $phpgw->template->set_var("month_identifier",lang(strftime("%B",$m)) . " " . $thisyear); - $phpgw->template->set_var("username",$phpgw->common->grab_owner_name($owner)); - $phpgw->template->set_var("small_calendar_next",$phpgw->calendar->mini_calendar($thisday,$next["month"],$next["year"],"day.php")); - flush(); - $phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner)); - if (!$friendly) { - $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter; - $phpgw->template->set_var("print","link("",$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." - . "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]"); - $phpgw->template->parse("out","index_t"); - $phpgw->template->pparse("out","index_t"); - } else { - $phpgw->template->set_var("print",""); - $phpgw->template->parse("out","index_t"); - $phpgw->template->pparse("out","index_t"); - } - $phpgw->common->phpgw_footer(); + Header("Location: ".$phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"]."?".$QUERY_STRING); + $phpgw->common->phpgw_exit(); ?> diff --git a/calendar/month.php b/calendar/month.php new file mode 100755 index 0000000000..9822d6e93e --- /dev/null +++ b/calendar/month.php @@ -0,0 +1,96 @@ + * + * http://www.radix.net/~cknudsen * + * Modified by Mark Peters * + * -------------------------------------------- * + * 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$ */ + + $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); + + if (isset($friendly) && $friendly){ + $phpgw_info["flags"]["noheader"] = True; + $phpgw_info["flags"]["nonavbar"] = True; + $phpgw_info["flags"]["noappheader"] = True; + $phpgw_info["flags"]["noappfooter"] = True; + $phpgw_info["flags"]["nofooter"] = True; + } else { + $friendly = 0; + } + + include("../header.inc.php"); + + if(isset($friendly) && $friendly) { + if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) + $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + + if (isset($date) && strlen($date) > 0) { + $thisyear = intval(substr($date, 0, 4)); + $thismonth = intval(substr($date, 4, 2)); + $thisday = intval(substr($date, 6, 2)); + } else { + if (!isset($day) || !$day) + $thisday = $phpgw->calendar->today["day"]; + else + $thisday = $day; + if (!isset($month) || !$month) + $thismonth = $phpgw->calendar->today["month"]; + else + $thismonth = $month; + if (!isset($year) || !$year) + $thisyear = $phpgw->calendar->today["year"]; + else + $thisyear = $year; + } + } + + if(!isset($owner)) { $owner = $phpgw_info["user"]["account_id"]; } +// unset($owner); + + $next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear)); + + $prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear)); + + $view = "month"; + + $phpgw->template->set_file(array("index_t" => "index.tpl")); + + $phpgw->template->set_block("index_t","index"); + + if ($friendly) { + $phpgw->template->set_var("printer_friendly",""); + } else { + $phpgw->template->set_var("printer_friendly",""); + } + + $phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); + + $phpgw->template->set_var("small_calendar_prev",$phpgw->calendar->mini_calendar($thisday,$prev["month"],$prev["year"],"day.php")); + + $m = mktime(2,0,0,$thismonth,1,$thisyear); + $phpgw->template->set_var("month_identifier",lang(strftime("%B",$m)) . " " . $thisyear); + $phpgw->template->set_var("username",$phpgw->common->grab_owner_name($owner)); + $phpgw->template->set_var("small_calendar_next",$phpgw->calendar->mini_calendar($thisday,$next["month"],$next["year"],"day.php")); + flush(); + $phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner)); + if (!$friendly) { + $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter; + $phpgw->template->set_var("print","link("",$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." + . "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]"); + $phpgw->template->parse("out","index_t"); + $phpgw->template->pparse("out","index_t"); + } else { + $phpgw->template->set_var("print",""); + $phpgw->template->parse("out","index_t"); + $phpgw->template->pparse("out","index_t"); + } + $phpgw->common->phpgw_footer(); +?> diff --git a/calendar/preferences.php b/calendar/preferences.php index e32335203a..f3dc1a69eb 100644 --- a/calendar/preferences.php +++ b/calendar/preferences.php @@ -110,12 +110,12 @@ - +