From ce74573eadf922eb58537da609ab5748354b705c Mon Sep 17 00:00:00 2001 From: skeeter Date: Sat, 18 Nov 2000 21:44:05 +0000 Subject: [PATCH] change of cal_create_by to cal_owner --- calendar/day.php | 86 ++++------- calendar/edit_entry.php | 215 +++++++++++---------------- calendar/edit_entry_handler.php | 5 +- calendar/view.php | 8 +- doc/CHANGELOG | 1 + setup/index.php | 2 +- setup/sql/mysql_newtables.inc.php | 2 +- setup/sql/mysql_upgrade_beta.inc.php | 7 +- setup/sql/pgsql_newtables.inc.php | 2 +- setup/sql/pgsql_upgrade_beta.inc.php | 7 +- 10 files changed, 143 insertions(+), 192 deletions(-) diff --git a/calendar/day.php b/calendar/day.php index 33aff26a28..1e5ee10297 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -14,13 +14,15 @@ /* $Id$ */ - if (isset($friendly) && $friendly){ + if (isset($friendly) && $friendly==1){ $phpgw_info["flags"]["noheader"] = True; + $phpgw_info["flags"]["nonavbar"] = True; + $phpgw_info["flags"]["nocalendarheader"] = True; } else { $friendly = 0; } - $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True); + $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True, "enable_template_class" => True); include("../header.inc.php"); $view = "day"; @@ -46,62 +48,38 @@ $now = $phpgw->calendar->splitdate(mktime (2, 0, 0, $thismonth, $thisday, $thisyear)); + $phpgw->template->set_file(array("day" => "day.tpl")); + + $phpgw->template->set_block("day"); + if ($friendly) { - echo ""; + $phpgw->template->set_var("printer_friendly",""); + } else { + $phpgw->template->set_var("printer_friendly",""); } -?> - - - - - - -
-
- - - - -
- "> - -template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); + $m = mktime(2,0,0,$thismonth,1,$thisyear); - echo lang(strftime("%B",$m)) . " " .$thisday . ", " . $thisyear; -?> - - - ">
-common->display_fullname($phpgw_info["user"]["userid"],$phpgw_info["user"]["firstname"],$phpgw_info["user"]["lastname"]); -?> -
-
- - - - -
"> - - calendar->print_day_at_a_glance($now); ?> - - -
-
-
-calendar->pretty_small_calendar($now["day"],$now["month"],$now["year"],"day.php"); ?> -
-template->set_var("date",lang(strftime("%B",$m))." ".$thisday.", ".$thisyear); + $phpgw->template->set_var("username",$phpgw->common->display_fullname($phpgw_info["user"]["userid"],$phpgw_info["user"]["firstname"],$phpgw_info["user"]["lastname"])); + $phpgw->template->set_var("daily_events",$phpgw->calendar->print_day_at_a_glance($now)); + $cal = $phpgw->calendar->pretty_small_calendar($now["day"],$now["month"],$now["year"],"day.php"); + $phpgw->template->set_var("small_calendar",$cal); - $param .= "friendly=1\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." - . "status = '" . lang("Generate printer-friendly version"). "'"; - echo "link($PHP_SELF,$param)."\">"; - echo "[". lang("Printer Friendly") . "]"; - $phpgw->common->phpgw_footer(); + if (!$friendly) { + $param = ""; + $param .= "year=".$now["year"]."&month=".$now["month"]."&day=".$now["day"]."&"; + + $param .= "friendly=1\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." + . "status = '" . lang("Generate printer-friendly version"). "'"; + $phpgw->template->set_var("print","link($PHP_SELF,$param)."\">[". lang("Printer Friendly") . "]"); + $phpgw->template->parse("out","day"); + $phpgw->template->pparse("out","day"); + $phpgw->common->phpgw_footer(); + } else { + $phpgw->template->set_var("print",""); + $phpgw->template->parse("out","day"); + $phpgw->template->pparse("out","day"); } ?> diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index a1343597ee..593ad1a4da 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -1,4 +1,4 @@ - + 0) { + $cal_info = new calendar_item; + + if ($id > 0) { $can_edit = false; $phpgw->db->query("SELECT cal_id FROM webcal_entry_user WHERE cal_login=" - . "'" . $phpgw_info["user"]["account_id"] . "' AND cal_id = $id"); + . $phpgw_info["user"]["account_id"] . " AND cal_id = $id"); $phpgw->db->next_record(); if ($phpgw->db->f("cal_id") > 0) $can_edit = true; - $phpgw->db->query("SELECT cal_create_by, cal_date, cal_time, cal_mod_date, " - . "cal_mod_time, cal_duration, cal_priority, cal_type, " - . "cal_access, cal_name, cal_description FROM webcal_entry " - . "WHERE cal_id=$id"); + $cal = $phpgw->calendar->getevent((int)$id); - $phpgw->db->next_record(); - $year = (int)($phpgw->db->f(1) / 10000); - $month = ($phpgw->db->f(1) / 100) % 100; - $day = $phpgw->db->f(1) % 100; - $time = $phpgw->db->f(2); - if ($time > 0) { - $hour = intval($time / 10000); - $minute = ($time / 100) % 100; - } - $duration = $phpgw->db->f(5); - $priority = $phpgw->db->f(6); - $type = $phpgw->db->f(7); - $access = $phpgw->db->f(8); - $name = $phpgw->db->f(9); - $description = $phpgw->db->f(10); + $cal_info = $cal[0]; - $name = stripslashes($name); - $name = htmlspecialchars($name); - $description = stripslashes($description); - $description = htmlspecialchars($description); + } else { - $phpgw->db->query("SELECT cal_login FROM webcal_entry_user WHERE cal_id=$id"); - while ($phpgw->db->next_record()) { - $participants[$phpgw->db->f("cal_login")] = 1; - } - $phpgw->db->query("select * from webcal_entry_repeats where cal_id=$id"); - - $phpgw->db->next_record(); - $rpt_type = $phpgw->db->f("cal_type"); - if ($phpgw->db->f("cal_end")) - $rpt_end = date_to_epoch($phpgw->db->f("cal_end")); + if (!isset($day) || !$day) + $thisday = (int)$phpgw->calendar->today["day"]; else - $rpt_end = 0; + $thisday = $day; + if (!isset($month) || !$month) + $thismonth = (int)$phpgw->calendar->today["month"]; + else + $thismonth = $month; + if (!isset($year) || !$year) + $thisyear = (int)$phpgw->calendar->today["year"]; + else + $thisyear = $year; - $rpt_freq = $phpgw->db->f("cal_frequency"); - $rpt_days = $phpgw->db->f("cal_days"); + if (!isset($hour)) + $thishour = 0; + else + $thishour = (int)$hour; + if (!isset($minute)) + $thisminute = 00; + else + $thisminute = (int)$minute; - $rpt_sun = (substr($rpt_days,0,1)=='y'); - $rpt_mon = (substr($rpt_days,1,1)=='y'); - $rpt_tue = (substr($rpt_days,2,1)=='y'); - $rpt_wed = (substr($rpt_days,3,1)=='y'); - $rpt_thu = (substr($rpt_days,4,1)=='y'); - $rpt_fri = (substr($rpt_days,5,1)=='y'); - $rpt_sat = (substr($rpt_days,6,1)=='y'); + $time = $phpgw->calendar->splittime_($phpgw->calendar->fixtime($thishour,$thisminute)); -} else { - $can_edit = true; -} + $cal_info->name = ""; + $cal_info->description = ""; - if ($year) - $thisyear = $year; - if ($month) - $thismonth = $month; - if (! $rpt_type) - $rpt_type = "none"; + $cal_info->day = $thisday; + $cal_info->month = $thismonth; + $cal_info->year = $thisyear; + + $cal_info->rpt_day = $thisday + 1; + $cal_info->rpt_month = $thismonth; + $cal_info->rpt_year = $thisyear; + + $cal_info->hour = (int)$time["hour"]; + $cal_info->minute = (!(int)$time["minute"]?"00":(int)$time["minute"]); + $cal_info->ampm = "am"; + if($cal_info->hour > 12 && $phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { + $cal_info["hour"] = $cal_info["hour"] - 12; + $cal_info["ampm"] = "pm"; + } + $can_edit = true; + } ?>