diff options
author | Chad Little <clittle@users.sourceforge.net> | 2003-11-20 05:18:38 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2003-11-20 05:18:38 +0000 |
commit | b941c90ce2d8f9a1248425087063257aacd615bc (patch) | |
tree | eb7512b970951143c189b7753d4154c52ead5f46 | |
parent | 4fb8c0746e8ab44a536be48107d7f56b00fa69a6 (diff) | |
download | phpicalendar-b941c90ce2d8f9a1248425087063257aacd615bc.tar.gz phpicalendar-b941c90ce2d8f9a1248425087063257aacd615bc.tar.bz2 phpicalendar-b941c90ce2d8f9a1248425087063257aacd615bc.zip |
Added URL support to popup, re-wrote event.php for less code.
-rw-r--r-- | day.php | 24 | ||||
-rw-r--r-- | functions/date_functions.php | 8 | ||||
-rw-r--r-- | functions/event.js | 4 | ||||
-rw-r--r-- | includes/event.php | 93 | ||||
-rw-r--r-- | includes/header.inc.php | 1 | ||||
-rw-r--r-- | includes/sidebar.php | 15 | ||||
-rw-r--r-- | month.php | 19 | ||||
-rw-r--r-- | week.php | 14 |
8 files changed, 66 insertions, 112 deletions
@@ -91,18 +91,11 @@ include (BASE.'includes/header.inc.php'); echo "<tr>\n"; $event_calno = $allday['calnumber']; $event_calna = $allday['calname']; + $event_url = $allday['url']; if ($event_calno < 1) $event_calno=1; if ($event_calno > 7) $event_calno=7; echo '<td valign="top" align="center" class="eventbg_'.$event_calno.'">'; - openevent("$event_calna", - "", - "", - $allday, - 0, - "", - '<font color="#ffffff"><i>', - "</i></font>", - "psf"); + openevent($event_calna, '', '', $allday, 0, '', '<font color="#ffffff"><i>', '</i></font>', 'psf', $url); echo "</td>\n</tr>\n"; } echo '</table>'."\n"; @@ -253,16 +246,9 @@ include (BASE.'includes/header.inc.php'); echo '<table width="100%" border="0" cellpadding="1" cellspacing="0">'."\n"; echo '<tr>'."\n"; echo '<td class="eventbg_'.$event_calno.'">'; - $event_calna = $this_time_arr[($event_length[$i]['key'])]['calname']; - openevent("$event_calna", - "$event_start", - "$event_end", - $this_time_arr[($event_length[$i]['key'])], - "", - 0, - "<font class=\"eventfont\">", - "</font>", - "psf"); + $event_calna = $this_time_arr[($event_length[$i]['key'])]['calname']; + $event_url = $this_time_arr[($event_length[$i]['key'])]['url']; + openevent($event_calna, $event_start, $event_end, $this_time_arr[($event_length[$i]['key'])], '', 0, '<font class="eventfont">', '</font>', 'psf', $event_url); echo '</td></tr>'."\n"; echo '</table>'."\n"; echo '</td>'."\n"; diff --git a/functions/date_functions.php b/functions/date_functions.php index 8745c1a..374752f 100644 --- a/functions/date_functions.php +++ b/functions/date_functions.php @@ -160,7 +160,7 @@ function chooseOffset($time) { return $offset; } -function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class) { +function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class, $url) { $event_text = stripslashes(urldecode($arr["event_text"])); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { @@ -190,6 +190,10 @@ function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, if (isset($arr["description"])) { $description = addslashes(stripslashes(urldecode($arr["description"]))); } + + if (isset($arr["url"])) { + $url = addslashes(stripslashes(urldecode($arr["url"]))); + } if (!empty($event_text)) { if ($lines > 0) { @@ -206,7 +210,7 @@ function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, echo <<<END <script language="Javascript" type="text/javascript"><!-- - var eventData = new EventData('$escaped_event', '$escaped_calendar', '$escaped_start', '$escaped_end', '$description', '$status', '$location', '$organizer', '$attendee'); + var eventData = new EventData('$escaped_event', '$escaped_calendar', '$escaped_start', '$escaped_end', '$description', '$status', '$location', '$organizer', '$attendee', '$url'); document.popup_data[$popup_data_index] = eventData; // --></script> diff --git a/functions/event.js b/functions/event.js index d04938c..adee336 100644 --- a/functions/event.js +++ b/functions/event.js @@ -13,6 +13,7 @@ function openEventWindow(num) { form.elements.location.value = data.location; form.elements.organizer.value = data.organizer; form.elements.attendee.value = data.attendee; + form.elements.url.value = data.url; // open a new window var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); @@ -20,7 +21,7 @@ function openEventWindow(num) { form.submit(); } -function EventData(event, cal, start, end, description, status, location, organizer, attendee) { +function EventData(event, cal, start, end, description, status, location, organizer, attendee, url) { this.event = event; this.cal = cal; this.start = start; @@ -30,6 +31,7 @@ function EventData(event, cal, start, end, description, status, location, organi this.location = location; this.organizer = organizer; this.attendee = attendee; + this.url = url; } document.popup_data = new Array(); diff --git a/includes/event.php b/includes/event.php index b847c5b..d4e7483 100644 --- a/includes/event.php +++ b/includes/event.php @@ -2,76 +2,25 @@ define('BASE', '../'); include (BASE.'functions/init.inc.php'); -// Load vars -if (isset($HTTP_POST_VARS['event']) && ($HTTP_POST_VARS['event'] !== '') ) { - $event=$HTTP_POST_VARS['event']; -} else { - $event=''; -} -if (isset($HTTP_POST_VARS['description']) && ($HTTP_POST_VARS['description'] !== '') ) { - $description=$HTTP_POST_VARS['description']; -} else { - $description=''; -} -if (isset($HTTP_POST_VARS['cal']) && ($HTTP_POST_VARS['cal'] !== '') ) { - $calendar_name=$HTTP_POST_VARS['cal']; -} else { - $calendar_name=''; -} -if (isset($HTTP_POST_VARS['start']) && ($HTTP_POST_VARS['start'] !== '') ) { - $start=$HTTP_POST_VARS['start']; -} else { - $start=''; -} -if (isset($HTTP_POST_VARS['end']) && ($HTTP_POST_VARS['end'] !== '') ) { - $end=$HTTP_POST_VARS['end']; -} else { - $end=''; -} -if (isset($HTTP_POST_VARS['status']) && ($HTTP_POST_VARS['status'] !== '') ) { - $status=$HTTP_POST_VARS['status']; -} else { - $status=''; -} -if (isset($HTTP_POST_VARS['location']) && ($HTTP_POST_VARS['location'] !== '') ) { - $location=$HTTP_POST_VARS['location']; -} else { - $location=''; -} -if (isset($HTTP_POST_VARS['organizer']) && ($HTTP_POST_VARS['organizer'] !== '') ) { - $organizer=$HTTP_POST_VARS['organizer']; -} else { - $organizer=''; -} -if (isset($HTTP_POST_VARS['attendee']) && ($HTTP_POST_VARS['attendee'] !== '') ) { - $attendee=$HTTP_POST_VARS['attendee']; -} else { - $attendee=''; +function decode_popup ($item) { + $item = stripslashes(rawurldecode($item)); + $item = str_replace('\\','',$item); + return $item; } -// Prep vars for HTML display -$event=stripslashes(rawurldecode($event)); -$event=str_replace('\\','',$event); -$description=stripslashes(rawurldecode($description)); -$description=str_replace('\\','',$description); -$organizer=stripslashes(rawurldecode($organizer)); -$organizer=str_replace('\\','',$organizer); -$organizer=unserialize($organizer); -$attendee=str_replace('\\','',$attendee); -$attendee=unserialize ($attendee); -$location=stripslashes(rawurldecode($location)); -$location=str_replace('\\','',$location); -$calendar_name=stripslashes(rawurldecode($calendar_name)); -$calendar_name=str_replace('\\','',$calendar_name); - -// Format calendar title -if ($calendar_name == $ALL_CALENDARS_COMBINED) { - $cal_title=$all_cal_comb_lang; - $cal_title_full=$all_cal_comb_lang; -} else { - $cal_title=$calendar_name; - $cal_title_full=$calendar_name . ' ' . $calendar_lang; -} +$event = (isset($_REQUEST['event'])) ? decode_popup($_REQUEST['event']) : ('unset'); +$description = (isset($_REQUEST['description'])) ? decode_popup($_REQUEST['description']) : ('unset'); +$cal = (isset($_REQUEST['cal'])) ? decode_popup($_REQUEST['cal']) : ('unset'); +$start = (isset($_REQUEST['start'])) ? decode_popup($_REQUEST['start']) : ('unset'); +$end = (isset($_REQUEST['end'])) ? decode_popup($_REQUEST['end']) : ('unset'); +$status = (isset($_REQUEST['status'])) ? decode_popup($_REQUEST['status']) : ('unset'); +$location = (isset($_REQUEST['location'])) ? decode_popup($_REQUEST['location']) : ('unset'); +$url = (isset($_REQUEST['url'])) ? decode_popup($_REQUEST['url']) : ('unset'); +$organizer = (isset($_REQUEST['organizer'])) ? ($_REQUEST['organizer']) : ('unset'); +$organizer = unserialize (decode_popup ($organizer)); +$attendee = (isset($_REQUEST['attendee'])) ? ($_REQUEST['attendee']) : ('unset'); +$attendee = unserialize (decode_popup ($attendee)); +$cal_title_full = $cal.' '.$calendar_lang; // Format event time if (($start) && ($end)) { @@ -129,6 +78,7 @@ if ($status) { $display.='</tr>'; } if ($location) { + if (isset($url)) $location = '<a href="'.$url.'" target="_blank">'.$location.'</a>'; $display.="<!-- Location -->\n"; $display.='<tr>' . "\n"; $display.='<td width="1%"><img src="images/spacer.gif" width="6" height="1" alt=" "></td>' . "\n"; @@ -142,7 +92,7 @@ if ($location) { <html> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> - <title><?php echo $cal_title; ?></title> + <title><?php echo $cal; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo BASE."styles/$style_sheet/default.css"; ?>"> </head> @@ -170,6 +120,11 @@ if ($location) { <td align="left" colspan="2" class="V12"><?php echo $event . ' ' . $event_times; ?><br><br></td> </tr> <?php echo $display; ?> + +</tr> +<tr> +<td colspan="3"><img src="../images/spacer.gif" width="1" height="6" alt=" "></td> +</tr> </table> </td> </tr> diff --git a/includes/header.inc.php b/includes/header.inc.php index 3c15bc5..3d4b7cc 100644 --- a/includes/header.inc.php +++ b/includes/header.inc.php @@ -27,4 +27,5 @@ <input type="hidden" name="location" id="location" value=""> <input type="hidden" name="organizer" id="organizer" value=""> <input type="hidden" name="attendee" id="attendee" value=""> + <input type="hidden" name="url" id="url" value=""> </form> diff --git a/includes/sidebar.php b/includes/sidebar.php index 0a08412..6f77a95 100644 --- a/includes/sidebar.php +++ b/includes/sidebar.php @@ -98,24 +98,23 @@ $search_box = '<form style="margin-bottom:0;" action="search.php" method="GET">< $event_text = stripslashes(urldecode($val["event_text"])); $event_text = strip_tags($event_text, '<b><i><u>'); if ($event_text != "") { - $event_text2 = rawurlencode(addslashes($val["event_text"])); - $description = addslashes(urlencode($val["description"])); + $event_text2 = rawurlencode(addslashes($val['event_text'])); + $description = addslashes(urlencode($val['description'])); $event_start = @$val["event_start"]; $event_end = @$val["event_end"]; $event_calna = @$val["calname"]; - $event_start = date ($timeFormat, @strtotime ("$event_start")); - $event_end = date ($timeFormat, @strtotime ("$event_end")); + $event_url = @$val["url"]; + $event_start = date ($timeFormat, @strtotime ($event_start)); + $event_end = date ($timeFormat, @strtotime ($event_end)); $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); if (!isset($val["event_start"])) { $event_start = $all_day_lang; $event_end = ''; - openevent($event_calna, $event_start, - $event_end, $val, $tomorrows_events_lines, 21, '<i>', '</i>', 'psf'); + openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '<i>', '</i>', 'psf', $event_url); echo "<br>\n"; } else { - openevent($event_calna, $event_start, - $event_end, $val, $tomorrows_events_lines, 21, '<font class="G10B">• ', '</font>', 'psf'); + openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '<font class="G10B">• ', '</font>', 'psf', $event_url); echo "<br>\n"; } @@ -114,15 +114,17 @@ include (BASE.'includes/header.inc.php'); foreach ($master_array[("$daylink")] as $event_times) { foreach ($event_times as $val) { $num_of_events2++; - $event_calno = $val['calnumber']; - $event_calna = $val['calname']; + $event_calno = $val['calnumber']; + $event_calna = $val['calname']; + $event_url = $val['url']; if (!isset($val["event_start"])) { echo '<div align="center" class="V10">'; openevent("$event_calna", "", "", $val, $month_event_lines, 15, "<i>", "</i>", - "psf"); + "psf", + $event_url); echo '</div>'; } else { echo '<div align="left" class="V9"> '; @@ -140,7 +142,8 @@ include (BASE.'includes/header.inc.php'); 11, "$start2 ", "", - "ps3"); + "ps3", + $event_url); echo '</div>'; } } @@ -196,8 +199,9 @@ include (BASE.'includes/header.inc.php'); // Pull out each time foreach ($new_val as $new_key2 => $new_val2) { - $event_calno = $new_val2['calnumber']; - $event_calna = $new_val2['calname']; + $event_calno = $new_val2['calnumber']; + $event_calna = $new_val2['calname']; + $event_url = $new_val2['url']; if ($new_val2["event_text"]) { if (isset($new_val2["event_start"])) { @@ -228,7 +232,8 @@ include (BASE.'includes/header.inc.php'); 65, "<font class=\"G10B\">", "</font>", - "psf"); + "psf", + $event_url); echo "</td>\n"; echo "</tr>\n"; } @@ -164,6 +164,7 @@ include (BASE.'includes/header.inc.php'); echo "<tr>\n"; $event_calno = $allday['calnumber']; $event_calna = $allday['calname']; + $event_url = $allday['url']; if ($event_calno < 1) $event_calno=1; if ($event_calno > 7) $event_calno=7; echo '<td valign="top" align="center" class="eventbg_'.$event_calno.'">'; @@ -175,7 +176,8 @@ include (BASE.'includes/header.inc.php'); 12, '<font color="#ffffff">', "</font>", - "psf"); + "psf", + $event_url); echo "</td></tr>\n"; } echo "</table>\n"; @@ -185,9 +187,7 @@ include (BASE.'includes/header.inc.php'); $i++; } while ($i < 7); echo "</tr>\n"; - } - // $master_array[($getdate)]["$day_time"] - + } $thisdate = $start_week_time; for ($i=0;$i<7;$i++) { $thisday = date("Ymd", $thisdate); @@ -308,7 +308,8 @@ include (BASE.'includes/header.inc.php'); if (isset($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end'])) $event_end = strtotime ($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end']); $event_end = date ($timeFormat, $event_end); - $event_calna = $this_time_arr[($event_length[$thisday][$i]["key"])]['calname']; + $event_calna = $this_time_arr[($event_length[$thisday][$i]["key"])]['calname']; + $event_url = $this_time_arr[($event_length[$thisday][$i]["key"])]['url']; openevent("$event_calna", "$event_start", "$event_end", @@ -317,7 +318,8 @@ include (BASE.'includes/header.inc.php'); 25, "<font class=\"V10W\">", "</font>", - "psf"); + "psf", + $event_url); echo "</td></tr>\n"; echo "</table>\n"; echo "</td>\n"; |