|
From: <ji...@us...> - 2008-12-26 22:33:38
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25898/functions Modified Files: date_functions.php ical_parser.php init.inc.php template.php Log Message: revert event length display adjustment - messes up overlap calculations Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** date_functions.php 26 Dec 2008 19:32:41 -0000 1.43 --- date_functions.php 26 Dec 2008 22:33:33 -0000 1.44 *************** *** 146,150 **** function chooseOffset($time, $timezone = '') { ! global $tz_array; switch ($timezone) { case '': --- 146,150 ---- function chooseOffset($time, $timezone = '') { ! global $tz_array, $summary; switch ($timezone) { case '': *************** *** 156,160 **** default: if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) { ! $dlst = is_daylight($time, $timezone); $offset = $tz_array[$timezone][$dlst]; } else { --- 156,160 ---- default: if (is_array($tz_array) && array_key_exists($timezone, $tz_array)) { ! $dlst = is_daylight($time, $timezone); $offset = $tz_array[$timezone][$dlst]; } else { Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.232 retrieving revision 1.233 diff -C2 -d -r1.232 -r1.233 *** ical_parser.php 26 Dec 2008 17:07:52 -0000 1.232 --- ical_parser.php 26 Dec 2008 22:33:33 -0000 1.233 *************** *** 364,370 **** if (isset($recurrence_id['tzid'])) { ! $offset_tmp = chooseOffset($recur_unixtime, $recurrence_id['tzid']); } elseif (isset($calendar_tz)) { ! $offset_tmp = chooseOffset($recur_unixtime, $tz_array[$calendar_tz]); } else { $offset_tmp = $chooseOffset($recur_unixtime); --- 364,370 ---- if (isset($recurrence_id['tzid'])) { ! $offset_tmp = chooseOffset($recur_unixtime, $recurrence_id['tzid']); } elseif (isset($calendar_tz)) { ! $offset_tmp = chooseOffset($recur_unixtime, $calendar_tz); } else { $offset_tmp = $chooseOffset($recur_unixtime); Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** init.inc.php 12 Dec 2008 06:22:59 -0000 1.114 --- init.inc.php 26 Dec 2008 22:33:33 -0000 1.115 *************** *** 185,188 **** --- 185,190 ---- return ((float)$usec + (float)$sec); } + + $uid_list = array(); #uncomment for diagnostics #echo "after init.inc.ics<pre>"; Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** template.php 26 Dec 2008 16:59:10 -0000 1.102 --- template.php 26 Dec 2008 22:33:33 -0000 1.103 *************** *** 11,15 **** $this->page = str_replace('{DOWNLOAD_FILENAME}', $download_filename, $this->page); } else { ! $this->page = preg_replace('!<\!-- switch display_download on -->(.*)<\!-- switch display_download off -->!Uis', '', $this->page); } } --- 11,15 ---- $this->page = str_replace('{DOWNLOAD_FILENAME}', $download_filename, $this->page); } else { ! $this->page = preg_replace('!<\!-- switch display_download on -->.*<\!-- switch display_download off -->!Uis', '', $this->page); } } *************** *** 49,54 **** $this->page = str_replace('{DELETE_TABLE}', $delete_table, $this->page); } else { ! $this->page = preg_replace('!<\!-- switch logged_in on -->(.*)<\!-- switch logged_in off -->!Uis', '', $this->page); ! $this->page = preg_replace('!<\!-- switch logged_in2 on -->(.*)<\!-- switch logged_in2 off -->!Uis', '', $this->page); } --- 49,54 ---- $this->page = str_replace('{DELETE_TABLE}', $delete_table, $this->page); } else { ! $this->page = preg_replace('!<\!-- switch logged_in on -->.*<\!-- switch logged_in off -->!Uis', '', $this->page); ! $this->page = preg_replace('!<\!-- switch logged_in2 on -->.*<\!-- switch logged_in2 off -->!Uis', '', $this->page); } *************** *** 105,113 **** if ($description == '') { ! $events_tmp = preg_replace('!<\!-- switch description_events on -->(.*)<\!-- switch description_events off -->!Uis', '', $events_tmp); } if ($location == '') { ! $events_tmp = preg_replace('!<\!-- switch location_events on -->(.*)<\!-- switch location_events off -->!Uis', '', $events_tmp); } --- 105,113 ---- if ($description == '') { ! $events_tmp = preg_replace('!<\!-- switch description_events on -->.*<\!-- switch description_events off -->!Uis', '', $events_tmp); } if ($location == '') { ! $events_tmp = preg_replace('!<\!-- switch location_events on -->.*<\!-- switch location_events off -->!Uis', '', $events_tmp); } *************** *** 128,135 **** if ($events_week < 1) { ! $this->page = preg_replace('!<\!-- switch some_events on -->(.*)<\!-- switch some_events off -->!Uis', '', $this->page); } else { ! $this->page = preg_replace('!<\!-- switch some_events on -->(.*)<\!-- switch some_events off -->!Uis', $final, $this->page); ! $this->page = preg_replace('!<\!-- switch no_events on -->(.*)<\!-- switch no_events off -->!Uis', '', $this->page); } } --- 128,135 ---- if ($events_week < 1) { ! $this->page = preg_replace('!<\!-- switch some_events on -->.*<\!-- switch some_events off -->!Uis', '', $this->page); } else { ! $this->page = preg_replace('!<\!-- switch some_events on -->.*<\!-- switch some_events off -->!Uis', $final, $this->page); ! $this->page = preg_replace('!<\!-- switch no_events on -->.*<\!-- switch no_events off -->!Uis', '', $this->page); } } *************** *** 173,180 **** if ($description == '') { ! $events_tmp = preg_replace('!<\!-- switch description_events on -->(.*)<\!-- switch description_events off -->!Uis', '', $events_tmp); } if (!isset($val['exceptions'])) { ! $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!Uis', '', $events_tmp); }else{ $some_exceptions = ""; --- 173,180 ---- if ($description == '') { ! $events_tmp = preg_replace('!<\!-- switch description_events on -->.*<\!-- switch description_events off -->!Uis', '', $events_tmp); } if (!isset($val['exceptions'])) { ! $events_tmp = preg_replace('!<\!-- switch exceptions on -->.*<\!-- switch exceptions off -->!Uis', '', $events_tmp); }else{ $some_exceptions = ""; *************** *** 197,201 **** #is there a recur in the exception? if (!$except_val['recur']) { ! $except_tmp = preg_replace('!<\!-- switch except_recur on -->(.*)<\!-- switch except_recur off -->!Uis', '', $except_tmp); }else{ $except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp); --- 197,201 ---- #is there a recur in the exception? if (!$except_val['recur']) { ! $except_tmp = preg_replace('!<\!-- switch except_recur on -->.*<\!-- switch except_recur off -->!Uis', '', $except_tmp); }else{ $except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp); *************** *** 203,207 **** #is there a description in the exception? if (!$except_val['description']) { ! $except_tmp = preg_replace('!<\!-- switch except_description on -->(.*)<\!-- switch except_description off -->!Uis', '', $except_tmp); }else{ $except_description = stripslashes(urldecode($except_val['description'])); --- 203,207 ---- #is there a description in the exception? if (!$except_val['description']) { ! $except_tmp = preg_replace('!<\!-- switch except_description on -->.*<\!-- switch except_description off -->!Uis', '', $except_tmp); }else{ $except_description = stripslashes(urldecode($except_val['description'])); *************** *** 211,215 **** } ! $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!Uis', $some_exceptions,$events_tmp ); --- 211,215 ---- } ! $events_tmp = preg_replace('!<\!-- switch exceptions on -->.*<\!-- switch exceptions off -->!Uis', $some_exceptions,$events_tmp ); *************** *** 217,221 **** if (!$val['recur']) { ! $events_tmp = preg_replace('!<\!-- switch recur on -->(.*)<\!-- switch recur off -->!Uis', '', $events_tmp); $events_tmp = str_replace('{L_STARTING_ON}', '', $events_tmp); }else{ --- 217,221 ---- if (!$val['recur']) { ! $events_tmp = preg_replace('!<\!-- switch recur on -->.*<\!-- switch recur off -->!Uis', '', $events_tmp); $events_tmp = str_replace('{L_STARTING_ON}', '', $events_tmp); }else{ *************** *** 238,245 **** } if ($events_found < 1) { ! $this->page = preg_replace('!<\!-- switch results on -->(.*)<\!-- switch results off -->!Uis', '', $this->page); } else { ! $this->page = preg_replace('!<\!-- switch results on -->(.*)<\!-- switch results off -->!Uis', $final, $this->page); ! $this->page = preg_replace('!<\!-- switch no_results on -->(.*)<\!-- switch no_results off -->!Uis', '', $this->page); #echo "<hr>this->page: $this->page<br><hr>"; --- 238,245 ---- } if ($events_found < 1) { ! $this->page = preg_replace('!<\!-- switch results on -->.*<\!-- switch results off -->!Uis', '', $this->page); } else { ! $this->page = preg_replace('!<\!-- switch results on -->.*<\!-- switch results off -->!Uis', $final, $this->page); ! $this->page = preg_replace('!<\!-- switch no_results on -->.*<\!-- switch no_results off -->!Uis', '', $this->page); #echo "<hr>this->page: $this->page<br><hr>"; *************** *** 250,262 **** global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small; ! // Figure out colspans $dayborder = 0; $thisdate = $start_week_time; $swt = $start_week_time; ! for ($i=0;$i < 7;$i++) { $thisday = date("Ymd", $thisdate); $nbrGridCols[$thisday] = 1; if (isset($master_array[$thisday])) { foreach($master_array[($thisday)] as $ovlKey => $ovlValue) { if ($ovlKey != "-1") { foreach($ovlValue as $ovl2Value) { --- 250,263 ---- global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small; ! // Figure out colspans and initialize weekarray $dayborder = 0; $thisdate = $start_week_time; $swt = $start_week_time; ! for ($i=0;$i < $phpiCal_config->week_length;$i++) { $thisday = date("Ymd", $thisdate); $nbrGridCols[$thisday] = 1; if (isset($master_array[$thisday])) { foreach($master_array[($thisday)] as $ovlKey => $ovlValue) { + # ovlKey is a time slot; $ovlValue is an array with key=uid if ($ovlKey != "-1") { foreach($ovlValue as $ovl2Value) { *************** *** 266,277 **** } } $thisdate = ($thisdate + (25 * 60 * 60)); } ! ! for ($i=0; $i < $phpiCal_config->week_length; $i++) { ! $thisdate = date ('Ymd', $start_week_time); ! $weekarray[$i] = $thisdate; ! $start_week_time = strtotime('+1 day', $start_week_time); ! } // Replaces the allday events preg_match("!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis", $this->page, $match1); --- 267,274 ---- } } + $weekarray[$i] = $thisday; $thisdate = ($thisdate + (25 * 60 * 60)); } ! #echo "<pre>";print_r($nbrGridCols); // Replaces the allday events preg_match("!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis", $this->page, $match1); *************** *** 299,303 **** $weekreplace .= $replace; } ! $this->page = preg_replace('!<\!-- loop alldaysofweek on -->(.*)<\!-- loop alldaysofweek off -->!Uis', $weekreplace, $this->page); // Replaces the daysofweek --- 296,300 ---- $weekreplace .= $replace; } ! $this->page = preg_replace('!<\!-- loop alldaysofweek on -->.*<\!-- loop alldaysofweek off -->!Uis', $weekreplace, $this->page); // Replaces the daysofweek *************** *** 333,337 **** $weekday_loop .= $loop_tmp; } ! $this->page = preg_replace('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!Uis', $weekday_loop, $this->page); // Build the body --- 330,334 ---- $weekday_loop .= $loop_tmp; } ! $this->page = preg_replace('!<\!-- loop daysofweek on -->.*<\!-- loop daysofweek off -->!Uis', $weekday_loop, $this->page); // Build the body *************** *** 361,364 **** --- 358,362 ---- if (ereg("([0-9]{1,2}):00", $key)) { + # column of times colspan = 4 to cover navigation links at top $weekdisplay .= '<tr>'; $weekdisplay .= '<td colspan="4" rowspan="' . (60 / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; *************** *** 367,373 **** $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'; } else { $weekdisplay .= '<tr>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'; --- 365,372 ---- $size_tmp = 60 - (int)substr($cal_time,2,2); $weekdisplay .= '<tr>'; ! $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.' </td>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'; } else { + # empty row for each gridLength, to the right of times and left of first weekday $weekdisplay .= '<tr>'; $weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>'; *************** *** 405,411 **** // check for eventstart if (isset($this_time_arr) && sizeof($this_time_arr) > 0) { ! #print "<pre>"; ! #print_r ($this_time_arr); ! #print "</pre>"; foreach ($this_time_arr as $eventKey => $loopevent) { --- 404,408 ---- // check for eventstart if (isset($this_time_arr) && sizeof($this_time_arr) > 0) { ! #print "<pre>";print_r ($this_time_arr);print "</pre>"; foreach ($this_time_arr as $eventKey => $loopevent) { *************** *** 468,474 **** $event_temp = $loop_event; $event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps'); - # adjust length by rough guess to word wrapping - $event_text_lines = ceil((strlen(strip_tags(trim($event))) * 8)/$colspan_width) + 1; - if ($event_length[$thisday][$i]['length'] < $event_text_lines) $event_length[$thisday][$i]['length'] = $event_text_lines; $weekdisplay .= '<td width="'.$colspan_width.'" rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n"; --- 465,468 ---- *************** *** 514,518 **** } ! $this->page = preg_replace('!<\!-- loop row on -->(.*)<\!-- loop event off -->!Uis', $weekdisplay, $this->page); } --- 508,512 ---- } ! $this->page = preg_replace('!<\!-- loop row on -->.*<\!-- loop event off -->!Uis', $weekdisplay, $this->page); } *************** *** 535,539 **** } } ! $this->page = preg_replace('!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!Uis', $replace, $this->page); // Replaces the daysofweek --- 529,533 ---- } } ! $this->page = preg_replace('!<\!-- loop allday on -->.*<\!-- loop allday off -->!Uis', $replace, $this->page); // Replaces the daysofweek *************** *** 566,570 **** $weekday_loop .= $loop_tmp; } ! $this->page = preg_replace('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!Uis', $weekday_loop, $this->page); // Build the body --- 560,564 ---- $weekday_loop .= $loop_tmp; } ! $this->page = preg_replace('!<\!-- loop daysofweek on -->.*<\!-- loop daysofweek off -->!Uis', $weekday_loop, $this->page); // Build the body *************** *** 734,738 **** } ! $this->page = preg_replace('!<\!-- loop row on -->(.*)<\!-- loop event off -->!Uis', $daydisplay, $this->page); --- 728,732 ---- } ! $this->page = preg_replace('!<\!-- loop row on -->.*<\!-- loop event off -->!Uis', $daydisplay, $this->page); *************** *** 768,777 **** } ! $this->page = preg_replace('!<\!-- switch t_allday on -->(.*)<\!-- switch t_allday off -->!Uis', $replace_ad, $this->page); ! $this->page = preg_replace('!<\!-- switch t_event on -->(.*)<\!-- switch t_event off -->!Uis', $replace_e, $this->page); } else { ! $this->page = preg_replace('!<\!-- switch tomorrows_events on -->(.*)<\!-- switch tomorrows_events off -->!Uis', '', $this->page); } --- 762,771 ---- } ! $this->page = preg_replace('!<\!-- switch t_allday on -->.*<\!-- switch t_allday off -->!Uis', $replace_ad, $this->page); ! $this->page = preg_replace('!<\!-- switch t_event on -->.*<\!-- switch t_event off -->!Uis', $replace_e, $this->page); } else { ! $this->page = preg_replace('!<\!-- switch tomorrows_events on -->.*<\!-- switch tomorrows_events off -->!Uis', '', $this->page); } *************** *** 856,865 **** // If there are no TODO items, completely hide the TODO list. if (($nugget2 == '') || ($phpiCal_config->show_todos != 'yes')) { ! $this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!Uis', '', $this->page); } // Otherwise display the list of TODOs. else { ! $this->page = preg_replace('!<\!-- switch show_completed on -->(.*)<\!-- switch show_normal off -->!Uis', $nugget2, $this->page); } } --- 850,859 ---- // If there are no TODO items, completely hide the TODO list. if (($nugget2 == '') || ($phpiCal_config->show_todos != 'yes')) { ! $this->page = preg_replace('!<\!-- switch vtodo on -->.*<\!-- switch vtodo off -->!Uis', '', $this->page); } // Otherwise display the list of TODOs. else { ! $this->page = preg_replace('!<\!-- switch show_completed on -->.*<\!-- switch show_normal off -->!Uis', $nugget2, $this->page); } } *************** *** 991,995 **** $return = str_replace('<!-- loop weekday on -->'.$match1[1].'<!-- loop weekday off -->', $weekday_loop, $template_p); ! $return = preg_replace('!<\!-- loop monthweeks on -->(.*)<\!-- loop monthweeks off -->!Uis', $middle, $return); $return = str_replace('{MONTH_TITLE}', $month_title, $return); $return = str_replace('{CAL}', $cal, $return); --- 985,989 ---- $return = str_replace('<!-- loop weekday on -->'.$match1[1].'<!-- loop weekday off -->', $weekday_loop, $template_p); ! $return = preg_replace('!<\!-- loop monthweeks on -->.*<\!-- loop monthweeks off -->!Uis', $middle, $return); $return = str_replace('{MONTH_TITLE}', $month_title, $return); $return = str_replace('{CAL}', $cal, $return); *************** *** 1000,1008 **** function nomonthbottom() { ! $this->page = preg_replace('!<\!-- switch showbottom on -->(.*)<\!-- switch showbottom off -->!Uis','', $this->page); } function nosearch() { ! $this->page = preg_replace('!<\!-- switch show_search on -->(.*)<\!-- switch show_search off -->!Uis','', $this->page); } --- 994,1002 ---- function nomonthbottom() { ! $this->page = preg_replace('!<\!-- switch showbottom on -->.*<\!-- switch showbottom off -->!Uis','', $this->page); } function nosearch() { ! $this->page = preg_replace('!<\!-- switch show_search on -->.*<\!-- switch show_search off -->!Uis','', $this->page); } *************** *** 1065,1069 **** } while ($this_month == $check_month); ! $this->page = preg_replace('!<\!-- loop showbottomevents_odd on -->(.*)<\!-- loop showbottomevents_even off -->!Uis', $middle, $this->page); } --- 1059,1063 ---- } while ($this_month == $check_month); ! $this->page = preg_replace('!<\!-- loop showbottomevents_odd on -->.*<\!-- loop showbottomevents_even off -->!Uis', $middle, $this->page); } *************** *** 1104,1108 **** // This removes any unfilled tags if (!$data) { ! $this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->(.*)<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page); } --- 1098,1102 ---- // This removes any unfilled tags if (!$data) { ! $this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->.*<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page); } *************** *** 1124,1128 **** // This removes any unfilled tags if (!$data) { ! $this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->(.*)<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page); } --- 1118,1122 ---- // This removes any unfilled tags if (!$data) { ! $this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->.*<\!-- switch ' . $tag . ' off -->!Uis', '', $this->page); } *************** *** 1168,1172 **** $this->page = str_replace('{GENERATED2}', $generated2, $this->page); if ($phpiCal_config->enable_rss != 'yes') { ! $this->page = preg_replace('!<\!-- switch rss_powered on -->(.*)<\!-- switch rss_powered off -->!Uis', '', $this->page); } else { $this->page = str_replace('{BASE}', BASE, $this->page); --- 1162,1166 ---- $this->page = str_replace('{GENERATED2}', $generated2, $this->page); if ($phpiCal_config->enable_rss != 'yes') { ! $this->page = preg_replace('!<\!-- switch rss_powered on -->.*<\!-- switch rss_powered off -->!Uis', '', $this->page); } else { $this->page = str_replace('{BASE}', BASE, $this->page); |