From 1564fffc27fabdb6d78e116957b467c9e52d73dc Mon Sep 17 00:00:00 2001 From: skeeter Date: Wed, 10 Jan 2001 17:37:57 +0000 Subject: [PATCH] fix for day view with spanning items across multiple time frames and printer firendly --- calendar/day.php | 4 +-- calendar/inc/functions.inc.php | 33 +++++++++++++++---- calendar/index.php | 4 +-- calendar/templates/default/day_row_event.tpl | 4 +++ calendar/templates/default/day_row_time.tpl | 4 +++ calendar/templates/verdilak/day_row_99.tpl | 2 +- calendar/templates/verdilak/day_row_event.tpl | 4 +++ calendar/templates/verdilak/day_row_time.tpl | 4 +++ calendar/templates/verdilak/mini_week.tpl | 3 +- calendar/week.php | 4 +-- 10 files changed, 51 insertions(+), 15 deletions(-) create mode 100755 calendar/templates/default/day_row_event.tpl create mode 100755 calendar/templates/default/day_row_time.tpl create mode 100755 calendar/templates/verdilak/day_row_event.tpl create mode 100755 calendar/templates/verdilak/day_row_time.tpl diff --git a/calendar/day.php b/calendar/day.php index 6ea2c9cd57..bb6acf1a30 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -88,8 +88,8 @@ $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&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")."]"); + $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","day_t"); $phpgw->template->pparse("out","day_t"); } else { diff --git a/calendar/inc/functions.inc.php b/calendar/inc/functions.inc.php index 6daf494610..c9e102446e 100755 --- a/calendar/inc/functions.inc.php +++ b/calendar/inc/functions.inc.php @@ -1169,9 +1169,11 @@ $p = new Template($phpgw->common->get_tpl_dir('calendar')); $p->set_unknowns("remove"); $p->set_file(array('day_cal' => 'day_cal.tpl', + 'mini_week' => 'mini_week.tpl', 'day_row_99' => 'day_row_99.tpl', - 'day_row' => 'day_row.tpl')); - $p->set_block('day_cal','day_row_99','day_row'); + 'day_row_event' => 'day_row_event.tpl', + 'day_row_time' => 'day_row_time.tpl')); + $p->set_block('day_cal','mini_week','day_row_99','day_row_event','day_row_time'); if (! $phpgw_info["user"]["preferences"]["calendar"]["workdaystarts"] && @@ -1222,11 +1224,13 @@ $p->set_var('text',$this->hour_arr[99]); $p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color()); $p->set_var('time',' '); - $p->parse('row','day_row',True); + $p->parse('mini_week','day_row_99',False); + $p->parse('row','mini_week',True); } $this->rowspan = 0; $p->set_var('bgcolor1',$phpgw_info["theme"]["cal_dayview"]); $p->set_var('font_color',$phpgw_info["theme"]["bg_text"]); + $times = 0; for ($i=$this->first_hour;$i<=$this->last_hour;$i++) { $p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color()); if(isset($this->hour_arr[$i])) $h = $this->hour_arr[$i]; else $h = ""; @@ -1236,17 +1240,28 @@ if ($this->rowspan > 1) { // this might mean there's an overlap, or it could mean one event // ends at 11:15 and another starts at 11:30. - if (strlen($h)) + if (strlen($h)) { $p->set_var('event',$this->hour_arr[$i]); + $p->parse('monthweek_day','day_row_event',False); + $rows = 1; + } $this->rowspan--; } else { - if (strlen($h)) { + if (!strlen($h)) { + $p->set_var('event',' '); + $p->parse('monthweek_day','day_row_event',False); + $rows = 1; + } else { $this->rowspan = isset($this->rowspan_arr[$i])?$this->rowspan_arr[$i]:0; if ($this->rowspan > 1) { - $p->set_var('extras','valign="top" rowspan="'.$this->rowspan.'"'); + $p->set_var('extras',' valign="top" rowspan="'.$this->rowspan.'"'); $p->set_var('event',$this->hour_arr[$i]); + $p->parse('monthweek_day','day_row_event',False); + $rows = $this->rowspan; } else { $p->set_var('event',$this->hour_arr[$i]); + $p->parse('monthweek_day','day_row_event',False); + $rows = 1; } } } @@ -1262,7 +1277,11 @@ if(!$this->printer_friendly) { $p->set_var('close_link',''); } - $p->parse('row','day_row',True); + $p->parse('monthweek_day','day_row_time',True); +// $times++; +// if ($times == $rows) { $p->set_var('monthweek_day',''); $times = 0; } + $p->parse('row','mini_week',True); + $p->set_var('monthweek_day',''); } // end for return $p->finish($p->parse('out','day_cal')); } // end function diff --git a/calendar/index.php b/calendar/index.php index 277ef7c152..2b6e99e2cc 100755 --- a/calendar/index.php +++ b/calendar/index.php @@ -78,8 +78,8 @@ $phpgw->template->set_var("small_calendar_next",$phpgw->calendar->mini_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&filter=".$filter; - $phpgw->template->set_var("print","link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." + $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"); diff --git a/calendar/templates/default/day_row_event.tpl b/calendar/templates/default/day_row_event.tpl new file mode 100755 index 0000000000..55eacdde9b --- /dev/null +++ b/calendar/templates/default/day_row_event.tpl @@ -0,0 +1,4 @@ + + + {event} + diff --git a/calendar/templates/default/day_row_time.tpl b/calendar/templates/default/day_row_time.tpl new file mode 100755 index 0000000000..a86f508fab --- /dev/null +++ b/calendar/templates/default/day_row_time.tpl @@ -0,0 +1,4 @@ + + + {open_link}{time}{close_link} + diff --git a/calendar/templates/verdilak/day_row_99.tpl b/calendar/templates/verdilak/day_row_99.tpl index 5f6524520d..ed5622bc8d 100755 --- a/calendar/templates/verdilak/day_row_99.tpl +++ b/calendar/templates/verdilak/day_row_99.tpl @@ -1,5 +1,5 @@ -{text}{time} +{text}{time} diff --git a/calendar/templates/verdilak/day_row_event.tpl b/calendar/templates/verdilak/day_row_event.tpl new file mode 100755 index 0000000000..55eacdde9b --- /dev/null +++ b/calendar/templates/verdilak/day_row_event.tpl @@ -0,0 +1,4 @@ + + + {event} + diff --git a/calendar/templates/verdilak/day_row_time.tpl b/calendar/templates/verdilak/day_row_time.tpl new file mode 100755 index 0000000000..a86f508fab --- /dev/null +++ b/calendar/templates/verdilak/day_row_time.tpl @@ -0,0 +1,4 @@ + + + {open_link}{time}{close_link} + diff --git a/calendar/templates/verdilak/mini_week.tpl b/calendar/templates/verdilak/mini_week.tpl index 5625f51e29..12974c64b3 100755 --- a/calendar/templates/verdilak/mini_week.tpl +++ b/calendar/templates/verdilak/mini_week.tpl @@ -1,5 +1,6 @@ - {monthweek_day} + + {monthweek_day} diff --git a/calendar/week.php b/calendar/week.php index f264ae11c9..8d573f5e1f 100755 --- a/calendar/week.php +++ b/calendar/week.php @@ -115,8 +115,8 @@ $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&filter=".$filter; - $phpgw->template->set_var("print","link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window." + $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","week_t"); $phpgw->template->pparse("out","week_t");