From 015920d1d0228907f9815c02f388021fb3a5bfc5 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 28 May 2003 04:19:25 +0000 Subject: Started migration of javascript to function, added improved event.php for location, status, organizer, and attendees. Updated english language include. --- day.php | 98 +++++++++++++++++++++++--------------------- functions/date_functions.php | 43 +++++++++++++++++++ functions/ical_parser.php | 4 +- includes/event.php | 84 +++++++++++++++++++++++++++++++++---- languages/english.inc.php | 14 ++++--- 5 files changed, 182 insertions(+), 61 deletions(-) diff --git a/day.php b/day.php index fc1a5b2..dbd3bf1 100644 --- a/day.php +++ b/day.php @@ -58,8 +58,8 @@ if (is_array($master_array[($getdate)])) { echo ""; } ?> - - + + @@ -102,23 +102,25 @@ if (is_array($master_array[($getdate)])) { '."\n"; - echo ''."\n"; - echo ''."\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 ''."\n"; - echo ''."\n"; - echo ''."\n"; - } - echo '
'.$event_text.'
'."\n"; - echo ''."\n"; - echo ''."\n"; + echo "\n"; + echo ''."\n"; + echo ''."\n"; + foreach($master_array[($getdate)]['-1'] as $allday) { + echo "\n"; + echo '\n\n"; + } + echo '
'; + openevent("$calendar_name", + "", + "", + $allday, + 0, + "", + '', + ""); + echo "
'."\n"; + echo ''."\n"; + echo ''."\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 ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo '
'.$event_start.' - '.$event_end.'
'."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo '
'.$event_text.'
'."\n"; - echo '
'."\n"; - echo ''."\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 ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo '
'.$event_start.' - '.$event_end.'
'."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo '
'; + openevent("$calendar_name", + "$event_start", + "$event_end", + $this_time_arr[($event_length[$i]['key'])], + "", + 0, + "", + ""); + echo '
'."\n"; + echo '
'."\n"; + echo ''."\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 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, ''); + } + 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 "[: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"; + } +} + ?> \ 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); '\0', $description); ?> + + '; + echo ' '; + echo ''; + echo $organizer_lang.' - '; + foreach ($organizer as $val) { + $organizers .= $organizer[$i]["name"].', '; + $i++; + } + $organizers = substr ($organizers, 0, -2); + echo $organizers.''; + } + + if ($attendee) { + $i = 0; + echo ''; + echo ' '; + echo ''; + echo $attendee_lang.' - '; + foreach ($attendee as $val) { + $attendees .= $attendee[$i]["name"].', '; + $i++; + } + $attendees = substr ($attendees, 0, -2); + echo $attendees.''; + } - - -  - - - - + if ($status) { + echo ''; + echo ' '; + echo ''; + echo $status_lang.' - '.$status.''; + echo ''; + } + + if ($location) { + echo ''; + echo ' '; + echo ''; + echo $location_lang.' - '.$location.''; + echo ''; + } + + + ?> 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'; -- cgit v1.2.3