diff options
author | Chad Little <clittle@users.sourceforge.net> | 2003-05-28 04:19:25 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2003-05-28 04:19:25 +0000 |
commit | 015920d1d0228907f9815c02f388021fb3a5bfc5 (patch) | |
tree | 4558f14e170c51f706603dc63e9936bbdae77458 | |
parent | 9e07f4f2019973e0a42d6b1e21534572efee8013 (diff) | |
download | phpicalendar-015920d1d0228907f9815c02f388021fb3a5bfc5.tar.gz phpicalendar-015920d1d0228907f9815c02f388021fb3a5bfc5.tar.bz2 phpicalendar-015920d1d0228907f9815c02f388021fb3a5bfc5.zip |
Started migration of javascript to function, added improved event.php for location, status, organizer, and attendees.
Updated english language include.
-rw-r--r-- | day.php | 98 | ||||
-rw-r--r-- | functions/date_functions.php | 43 | ||||
-rw-r--r-- | functions/ical_parser.php | 4 | ||||
-rw-r--r-- | includes/event.php | 84 | ||||
-rw-r--r-- | languages/english.inc.php | 14 |
5 files changed, 182 insertions, 61 deletions
@@ -58,8 +58,8 @@ if (is_array($master_array[($getdate)])) { echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$default_path."/rss/rss.php?cal=".$cal."&rssview=day\">"; } ?> - <?php include (BASE.'functions/event.js'); ?> - <?php if (is_array($master_array['-2'])) include (BASE.'functions/todo.js'); ?> + +<?php if (is_array($master_array['-2'])) include (BASE.'functions/todo.js'); ?> </head> <body bgcolor="#FFFFFF"> <?php include (BASE.'includes/header.inc.php'); ?> @@ -102,23 +102,25 @@ if (is_array($master_array[($getdate)])) { <?php // The all day events returned here. if ($master_array[($getdate)]['-1']) { - echo '<tr>'."\n"; - echo '<td colspan="3" height="24">'."\n"; - echo '<table width="100%" border="0" cellspacing="1" cellpadding="4">'."\n"; - foreach($master_array[($getdate)]['-1'] as $allday) { - $event_text = stripslashes(urldecode($allday['event_text'])); - $description = addslashes(urlencode($allday['description'])); - $event_text2 = rawurlencode(addslashes($allday['event_text'])); - $status = $allday['status']; - $event_start = ''; - $event_end = ''; - echo '<tr>'."\n"; - echo '<td valign="top" align="center" class="eventbg"><a class="psf" href="javascript:openEventInfo(\''.$event_text2.'\', \''.$calendar_name.'\', \''.$event_start.'\', \''.$event_end.'\', \''.$description.'\', \''.$status.'\')"><font color="#ffffff"><i>'.$event_text.'</i></font></a></td>'."\n"; - echo '</tr>'."\n"; - } - echo '</table>'."\n"; - echo '</td>'."\n"; - echo '</tr>'."\n"; + echo "<tr>\n"; + echo '<td colspan="3" height="24">'."\n"; + echo '<table width="100%" border="0" cellspacing="1" cellpadding="4">'."\n"; + foreach($master_array[($getdate)]['-1'] as $allday) { + echo "<tr>\n"; + echo '<td valign="top" align="center" class="eventbg">'; + openevent("$calendar_name", + "", + "", + $allday, + 0, + "", + '<font color="#ffffff"><i>', + "</i></font>"); + echo "</td>\n</tr>\n"; + } + echo '</table>'."\n"; + echo '</td>'."\n"; + echo '</tr>'."\n"; } if ($daysofweek_dayview == 'yes') { ?> @@ -238,33 +240,37 @@ if (is_array($master_array[($getdate)])) { $emptyWidth = $emptyWidth - $drawWidth; switch ($event_length[$i]['state']) { case 'begin': - $event_length[$i]['state'] = 'started'; - $event_text = stripslashes(urldecode($this_time_arr[($event_length[$i]['key'])]['event_text'])); - $event_text2 = rawurlencode(addslashes($this_time_arr[($event_length[$i]['key'])]['event_text'])); - $event_start = strtotime ($this_time_arr[($event_length[$i]['key'])]['event_start']); - $event_end = strtotime ($this_time_arr[($event_length[$i]['key'])]['event_end']); - $description = addslashes(urlencode($this_time_arr[($event_length[$i]['key'])]['description'])); - $event_start = date ($timeFormat, $event_start); - $event_end = date ($timeFormat, $event_end); - $calendar_name2 = rawurlencode(addslashes($calendar_name)); - $status = $this_time_arr[($event_length[$i]['key'])]['status']; - echo '<td rowspan="' . $event_length[$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2">'."\n"; - echo '<table width="100%" border="0" cellspacing="0" cellpadding="2">'."\n"; - echo '<tr>'."\n"; - echo '<td class="eventborder"><font class="eventfont"><b>'.$event_start.'</b> - '.$event_end.'</font></td>'."\n"; - echo '</tr>'."\n"; - echo '<tr>'."\n"; - echo '<td>'."\n"; - echo '<table width="100%" border="0" cellpadding="1" cellspacing="0">'."\n"; - echo '<tr>'."\n"; - echo '<td class="eventbg"><a class="psf" href="javascript:openEventInfo(\''.$event_text2.'\', \''.$calendar_name2.'\', \''.$event_start.'\', \''.$event_end.'\', \''.$description.'\', \''.$status.'\')"><font class="eventfont">'.$event_text.'</font></a></td>'."\n"; - echo '</tr>'."\n"; - echo '</table>'."\n"; - echo '</td>'."\n"; - echo '</tr>'."\n"; - echo '</table>'."\n"; - echo '</td>'."\n"; - break; + $event_length[$i]['state'] = 'started'; + $event_start = strtotime ($this_time_arr[($event_length[$i]['key'])]['event_start']); + $event_end = strtotime ($this_time_arr[($event_length[$i]['key'])]['event_end']); + $event_start = date ($timeFormat, $event_start); + $event_end = date ($timeFormat, $event_end); + + echo '<td rowspan="' . $event_length[$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2">'."\n"; + echo '<table width="100%" border="0" cellspacing="0" cellpadding="2">'."\n"; + echo '<tr>'."\n"; + echo '<td class="eventborder"><font class="eventfont"><b>'.$event_start.'</b> - '.$event_end.'</font></td>'."\n"; + echo '</tr>'."\n"; + echo '<tr>'."\n"; + echo '<td>'."\n"; + echo '<table width="100%" border="0" cellpadding="1" cellspacing="0">'."\n"; + echo '<tr>'."\n"; + echo '<td class="eventbg">'; + openevent("$calendar_name", + "$event_start", + "$event_end", + $this_time_arr[($event_length[$i]['key'])], + "", + 0, + "<font class=\"eventfont\">", + "</font>"); + echo '</td></tr>'."\n"; + echo '</table>'."\n"; + echo '</td>'."\n"; + echo '</tr>'."\n"; + echo '</table>'."\n"; + echo '</td>'."\n"; + break; case 'started': break; case 'ended': diff --git a/functions/date_functions.php b/functions/date_functions.php index 9f6cb15..e8abe2c 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -160,5 +160,48 @@ function chooseOffset($time) { return $offset; } +function openevent($cal, $st, $end, $arr, $lines, $wrap, $clic, $fclic) { + $event_text = stripslashes(urldecode($arr["event_text"])); + # for iCal pseudo tag <http> comptability + if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$reg)) { + $ev = $reg[1] . $reg[2]; + $event_text = $reg[2]; + } else { + $ev = $arr["event_text"]; + $event_text = strip_tags($event_text, '<b><i><u>'); + } + if ($arr["organizer"]) { + $organizer = urlencode(addslashes($arr["organizer"])); + } + if ($arr["attendee"]) { + $attendee = urlencode(addslashes($arr["attendee"])); + } + if ($arr["location"]) { + $organizer = $arr["location"]; + } + if ($arr["status"]) { + $organizer = $arr["status"]; + } + if ($event_text != "") { + if ($lines) $event_text = word_wrap($event_text, $wrap, $lines); + $dsc =urlencode(addslashes($arr["description"])); + echo "<a class=\"psf\" href=\""; + if ((!(ereg("([[:alpha:]]+://[^<>[:space:]]+)", $ev, $res))) || ($dsc)) { + echo "javascript:w=window.open('"; + echo "includes/event.php?event="; + echo urlencode(addslashes($ev)); + echo "&cal="; + echo urlencode(addslashes($cal)); + echo "&start=$st&end=$end&description=$dsc&status=$status&location=$location&organizer=$organizer&attendee=$attendee"; + echo "','Popup','"; + echo "scrollbars=yes,width=460,height=275"; + echo "');w.focus()"; + } else { + echo $res[1]; + } + echo "\">$clic$event_text</a>"; + } +} + ?>
\ No newline at end of file diff --git a/functions/ical_parser.php b/functions/ical_parser.php index 8b340a0..2c193b4 100644 --- a/functions/ical_parser.php +++ b/functions/ical_parser.php @@ -227,13 +227,13 @@ if ($parse_file) { $end_time_tmp = '2400'; } $nbrOfOverlaps = checkOverlap($start_date_tmp, $start_time_tmp, $end_time_tmp, $uid); - $master_array[$start_date_tmp][$time_tmp][$uid] = array ('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => $nbrOfOverlaps, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true); + $master_array[$start_date_tmp][$time_tmp][$uid] = array ('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => $nbrOfOverlaps, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee) ); $start_tmp = strtotime('+1 day',$start_tmp); } if (!$write_processed) $master_array[$start_date][($hour.$minute)][$uid]['exception'] = true; } else { $nbrOfOverlaps = checkOverlap($start_date, $start_time, $end_time, $uid); - $master_array[($start_date)][($hour.$minute)][$uid] = array ('event_start' => $start_time, 'event_end' => $end_time, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => $nbrOfOverlaps, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false); + $master_array[($start_date)][($hour.$minute)][$uid] = array ('event_start' => $start_time, 'event_end' => $end_time, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => $nbrOfOverlaps, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee) ); if (!$write_processed) $master_array[($start_date)][($hour.$minute)][$uid]['exception'] = true; } } diff --git a/includes/event.php b/includes/event.php index bccce01..8cc84fb 100644 --- a/includes/event.php +++ b/includes/event.php @@ -34,6 +34,24 @@ if (isset($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] !== '') ) { $status = ''; } +if (isset($HTTP_GET_VARS['location']) && ($HTTP_GET_VARS['location'] !== '') ) { + $location = $HTTP_GET_VARS['location']; +} else { + $location = ''; +} + +if (isset($HTTP_GET_VARS['organizer']) && ($HTTP_GET_VARS['organizer'] !== '') ) { + $organizer = $HTTP_GET_VARS['organizer']; +} else { + $organizer = ''; +} + +if (isset($HTTP_GET_VARS['attendee']) && ($HTTP_GET_VARS['attendee'] !== '') ) { + $attendee = $HTTP_GET_VARS['attendee']; +} else { + $attendee = ''; +} + $event = rawurldecode($event); $event = stripslashes($event); $event = str_replace('\\', '', $event); @@ -41,6 +59,17 @@ $event = htmlspecialchars($event); $description = rawurldecode($description); $description = stripslashes($description); $description = str_replace('\\', '', $description); +$organizer = rawurldecode($organizer); +$organizer = stripslashes($organizer); +$organizer = str_replace('\\', '', $organizer); +$organizer = unserialize ($organizer); +$attendee = rawurldecode($attendee); +$attendee = stripslashes($attendee); +$attendee = str_replace('\\', '', $attendee); +$attendee = unserialize ($attendee); +$location = rawurldecode($location); +$location = stripslashes($location); +$location = str_replace('\\', '', $location); //$description = htmlspecialchars($description); $calendar_name2 = rawurldecode($calendar_name); $calendar_name2 = stripslashes($calendar_name2); @@ -85,14 +114,55 @@ $calendar_name2 = str_replace('\\', '', $calendar_name2); '<a target="_new" href="\0">\0</a>', $description); ?></td> </tr> <?php } ?> + + <?php + + if ($organizer) { + $i = 0; + echo '<tr>'; + echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; + echo '<td align="left" colspan="2" class="V12">'; + echo $organizer_lang.' - '; + foreach ($organizer as $val) { + $organizers .= $organizer[$i]["name"].', '; + $i++; + } + $organizers = substr ($organizers, 0, -2); + echo $organizers.'</td></tr>'; + } + + if ($attendee) { + $i = 0; + echo '<tr>'; + echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; + echo '<td align="left" colspan="2" class="V12">'; + echo $attendee_lang.' - '; + foreach ($attendee as $val) { + $attendees .= $attendee[$i]["name"].', '; + $i++; + } + $attendees = substr ($attendees, 0, -2); + echo $attendees.'</td></tr>'; + } - <?php if ($status) { ?> - <tr> - <td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td> - <td align="left" colspan="2" class="V12"> - <?php echo "$status"; ?></td> - </tr> - <?php } ?> + if ($status) { + echo '<tr>'; + echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; + echo '<td align="left" colspan="2" class="V12">'; + echo $status_lang.' - '.$status.'</td>'; + echo '</tr>'; + } + + if ($location) { + echo '<tr>'; + echo '<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>'; + echo '<td align="left" colspan="2" class="V12">'; + echo $location_lang.' - '.$location.'</td>'; + echo '</tr>'; + } + + + ?> </table> </td> diff --git a/languages/english.inc.php b/languages/english.inc.php index 5a1daa6..f1d441e 100644 --- a/languages/english.inc.php +++ b/languages/english.inc.php @@ -84,14 +84,16 @@ $priority_none_lang = 'None'; $status_lang = 'Status:'; $todo_lang = 'To do items'; $unfinished_lang = 'Unfinished'; +$prefs_set_lang = 'Your preferences have been set.'; +$prefs_unset_lang = 'Preferences unset. Changes will take place next page load.'; +$unset_prefs_lang = 'Unset preferences:'; -// ----- New for 0.9.1 +// ----- New for 0.9.2 -$prefs_set_lang = 'Your preferences have been set.'; -$prefs_unset_lang = 'Preferences unset. Changes will take place next page load.'; -$unset_prefs_lang = 'Unset preferences:'; - -// - administration +$organizer_lang = 'Organizer'; +$attendee_lang = 'Attendee'; +$status_lang = 'Status'; +$location_lang = 'Location'; $admin_header_lang = 'PHP iCalendar Administration'; $username_lang = 'Username'; $password_lang = 'Password'; |