Update of /cvsroot/phpicalendar/phpicalendar/functions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23648/phpicalendar/functions
Modified Files:
calendar_functions.php ical_parser.php init.inc.php
Log Message:
Display real calendar names where possible
Index: calendar_functions.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/calendar_functions.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** calendar_functions.php 18 Mar 2006 01:04:15 -0000 1.21
--- calendar_functions.php 20 Mar 2006 01:08:29 -0000 1.22
***************
*** 206,211 ****
// $cals = The calendars (entire path, e.g. from availableCalendars).
function display_ical_list($cals, $pick=FALSE) {
! global $cal, $ALL_CALENDARS_COMBINED, $current_view, $getdate, $calendar_lang, $all_cal_comb_lang;
!
// Print each calendar option.
foreach ($cals as $cal_tmp) {
--- 206,210 ----
// $cals = The calendars (entire path, e.g. from availableCalendars).
function display_ical_list($cals, $pick=FALSE) {
! global $cal, $ALL_CALENDARS_COMBINED, $current_view, $getdate, $calendar_lang, $all_cal_comb_lang, $cal_filelist, $cal_displaynames;
// Print each calendar option.
foreach ($cals as $cal_tmp) {
***************
*** 216,219 ****
--- 215,246 ----
$cal_displayname_tmp = getCalendarName($cal_tmp);
$cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp);
+ #overwrite the display name if we already have a real name
+ if (is_numeric(array_search($cal_tmp, $cal_filelist))){
+ $cal_displayname_tmp = $cal_displaynames[array_search($cal_tmp,$cal_filelist)];
+ }else{
+ # pull the name from the $cal_tmp file
+ $ifile = @fopen($cal_tmp, "r");
+ if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $cal_tmp));
+ while (!feof($ifile)) {
+ $line = fgets($ifile, 1024);
+ $line = trim($line);
+ if (ereg ("([^:]+):(.*)", $line, $regs)){
+ $field = $regs[1];
+ $data = $regs[2];
+ $property = $field;
+ $prop_pos = strpos($property,';');
+ if ($prop_pos !== false) $property = substr($property,0,$prop_pos);
+ $property = strtoupper($property);
+ if ($property == "X-WR-CALNAME"){
+ $cal_displayname_tmp = $data;
+ break;
+ }
+ }
+ #stop reading if we find an event or timezone before there's a name
+ if ($line == "BEGIN:VTIMEZONE" ||$line == "BEGIN:VEVENT") break;
+ }
+ echo "</pre>";
+
+ }
// If this is a webcal, add 'Webcal' to the display name.
Index: ical_parser.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v
retrieving revision 1.206
retrieving revision 1.207
diff -C2 -d -r1.206 -r1.207
*** ical_parser.php 19 Mar 2006 08:17:19 -0000 1.206
--- ical_parser.php 20 Mar 2006 01:08:29 -0000 1.207
***************
*** 1131,1134 ****
--- 1131,1142 ----
}
+
+ // Set a calender name for all calenders combined
+ if ($cal == $ALL_CALENDARS_COMBINED) {
+ $calendar_name = $all_cal_comb_lang;
+ }
+ $cal_displayname = implode(', ', $cal_displaynames); #reset this with the correct names
+ $template_started = getmicrotime();
+
//If you want to see the values in the arrays, uncomment below.
***************
*** 1139,1150 ****
//print_r($rrule_array);
//print_r($recurrence_delete);
//print '</pre>';
-
- // Set a calender name for all calenders combined
- if ($cal == $ALL_CALENDARS_COMBINED) {
- $calendar_name = $all_cal_comb_lang;
- }
- $cal_displayname = implode(', ', $cal_displaynames); #reset this with the correct names
- $template_started = getmicrotime();
-
?>
--- 1147,1152 ----
//print_r($rrule_array);
//print_r($recurrence_delete);
+ //print_r($cal_displaynames);
+ //print_r($cal_filelist);
//print '</pre>';
?>
Index: init.inc.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -d -r1.90 -r1.91
*** init.inc.php 18 Mar 2006 07:39:01 -0000 1.90
--- init.inc.php 20 Mar 2006 01:08:29 -0000 1.91
***************
*** 106,110 ****
// Grab the calendar filenames off the cal value array.
! $cal_filenames = array_map("urldecode", $_GET['cal']);
} else {
if (isset($default_cal_check)) {
--- 106,110 ----
// Grab the calendar filenames off the cal value array.
! $cal_filenames = $_GET['cal'];
} else {
if (isset($default_cal_check)) {
|