From: <jo...@us...> - 2004-05-14 22:37:13
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21629 Modified Files: template.php Log Message: Fixed a bug where TODOs would be shown even if they did not fall into one of the following categories: 1. Completed & flag to show completed is TRUE 2. Important 3. Normal (i.e. Completed TODOs that showed up after parsing an important or normal TODO would still be shown.) Fixed a bug where if there are zero TODO items in the included calendars, the TODO list would still be shown, with incorrect contents. Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** template.php 14 May 2004 21:09:16 -0000 1.34 --- template.php 14 May 2004 22:36:52 -0000 1.35 *************** *** 566,569 **** --- 566,570 ---- $important = trim($match2[1]); $normal = trim($match3[1]); + $nugget2 = ''; if (is_array($master_array['-2'])) { *************** *** 598,601 **** --- 599,604 ---- $rep = array ($vtodo_text, $vtodo_array); + // Reset this TODO's category. + $temp = ''; if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) { if ($show_completed == 'yes') { *************** *** 607,617 **** $temp = $normal; } ! $nugget1 = str_replace($data, $rep, $temp); ! $nugget2 .= $nugget1; } } - $this->page = preg_replace('!<\!-- switch show_completed on -->(.*)<\!-- switch show_normal off -->!is', $nugget2, $this->page); } } } --- 610,634 ---- $temp = $normal; } ! ! // Do not include TODOs which do not have the ! // category set. ! if ($temp != '') { ! $nugget1 = str_replace($data, $rep, $temp); ! $nugget2 .= $nugget1; ! } } } } } + + // If there are no TODO items, completely hide the TODO list. + if ($nugget2 == '') { + $this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!is', '', $this->page); + } + + // Otherwise display the list of TODOs. + else { + $this->page = preg_replace('!<\!-- switch show_completed on -->(.*)<\!-- switch show_normal off -->!is', $nugget2, $this->page); + } } *************** *** 870,872 **** } } ! ?> \ No newline at end of file --- 887,889 ---- } } ! ?> |