diff options
author | jwangen <jwangen> | 2002-10-05 00:07:19 +0000 |
---|---|---|
committer | jwangen <jwangen> | 2002-10-05 00:07:19 +0000 |
commit | 7856c7ea0ed134c4dfee5c9ae2b4e7e2f9ab8b79 (patch) | |
tree | 47c4606d9fab5aedc732de796bf517b9d381f8d7 | |
parent | ce4d8be46ccefe642883253544a4ec81bdde8cc5 (diff) | |
download | phpicalendar-7856c7ea0ed134c4dfee5c9ae2b4e7e2f9ab8b79.tar.gz phpicalendar-7856c7ea0ed134c4dfee5c9ae2b4e7e2f9ab8b79.tar.bz2 phpicalendar-7856c7ea0ed134c4dfee5c9ae2b4e7e2f9ab8b79.zip |
Minor changes, implemented use configable number of lines for line wrappings
-rw-r--r-- | config.inc.php | 2 | ||||
-rw-r--r-- | functions/draw_functions.php | 23 | ||||
-rw-r--r-- | functions/init.inc.php | 2 | ||||
-rw-r--r-- | languages/english.inc.php | 10 | ||||
-rw-r--r-- | month.php | 5 | ||||
-rw-r--r-- | month_bottom.php | 6 | ||||
-rw-r--r-- | sidebar.php | 5 |
7 files changed, 42 insertions, 11 deletions
diff --git a/config.inc.php b/config.inc.php index 46a4f8a..45cb61b 100644 --- a/config.inc.php +++ b/config.inc.php @@ -8,6 +8,8 @@ $language = 'english'; // Language support - 'English', 'Polish', 'German', $week_start_day = 'sunday'; // Day of the week your week starts on $day_start = '0700'; // Start time for day grid $gridLength = '15'; // grid distance in minutes for day view, multiples of 15 preferred +$month_event_lines = '1'; // number of lines to wrap each event title in month view, 0 means display all lines. +$tomorrows_events_lines = '1'; // number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines. // Yes/No questions --- 'yes' means Yes, anything else means no. 'yes' must be lowercase. $use_sessions = 'yes'; // For speedy performance on web servers, not good for localhost use. This has not yet been implemented. diff --git a/functions/draw_functions.php b/functions/draw_functions.php index 52f6d47..d54c250 100644 --- a/functions/draw_functions.php +++ b/functions/draw_functions.php @@ -34,4 +34,27 @@ function drawEventTimes ($start, $end) { return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } + +// word wrap function that returns specified number of lines +// when lines is 0, it returns the entire string as wordwrap() does it +function word_wrap($str, $length, $lines=0) { + $str = wordwrap($str, $length); + if ($lines > 0) { + $str_arr = explode("\n", $str); + if (count($str_arr) < $lines) $lines = count($str_arr); + $str = ''; + for ($i=0; $i<($lines-1);$i++) { + $str .= $str_arr[$i].'<br>'; + } + if (count($str_arr) > ($lines)) { + $tmp_str = substr($str_arr[$i], 0, ($length-2)); + $str .= $tmp_str . '...'; + } else { + $str .= $str_arr[$i]; + } + } else { + $str = nl2br(trim($str)); + } + return $str; +} ?>
\ No newline at end of file diff --git a/functions/init.inc.php b/functions/init.inc.php index c5f3a60..5da8a3c 100644 --- a/functions/init.inc.php +++ b/functions/init.inc.php @@ -26,7 +26,7 @@ $lang_file = './languages/'.$language.'.inc.php'; if (file_exists($lang_file)) { include($lang_file); } else { - exit(error('Requested lanugage "'.$language.'" is not a supported language. Please consult the configuration file to choose a supported language.')); + exit(error('Requested lanugage "'.$language.'" is not a supported language. Please use the configuration file to choose a supported language.')); } if (isset($HTTP_GET_VARS['getdate']) && ($HTTP_GET_VARS['getdate'] !== '')) { diff --git a/languages/english.inc.php b/languages/english.inc.php index 0bd71b7..dfd7f6c 100644 --- a/languages/english.inc.php +++ b/languages/english.inc.php @@ -83,4 +83,14 @@ Notes about dateFormat_* us know. We will be happy to modify this if needed. */ +// Error messages - %s will be replaced with a variable +$error_title_lang = 'Error!'; +$error_window_lang = 'There was an error!'; +$error_calendar_lang = 'The calendar %s caused this error.'; +$error_path_lang = 'Unable to open the path: %s'; +$error_back_lang = 'Please use the "Back" button to return.'; +$error_remotecal_lang = 'You cannot view remote calendars on this server which are not approved.'; +$error_restrictedcal_lang = 'You have tried to access calendar that is restricted on this server.'; +$error_invalidcal_lang = 'Invalid calendar file. Please try a different calendar.'; + ?>
\ No newline at end of file @@ -143,10 +143,7 @@ $event_end = date ($timeFormat, @strtotime ("$event_end")); $calendar_name2 = addslashes($calendar_name); $calendar_name2 = urlencode($calendar_name2); - if (strlen($event_text) > 12) { - $event_text = substr("$event_text", 0, 10); - $event_text = $event_text . "..."; - } + $event_text = word_wrap($event_text, 12, $month_event_lines); echo "<tr>\n"; echo "<td>\n"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; diff --git a/month_bottom.php b/month_bottom.php index de75a14..9726c24 100644 --- a/month_bottom.php +++ b/month_bottom.php @@ -44,7 +44,8 @@ <?php $start_day = strtotime($week_start_day); for ($i=0; $i<7; $i++) { - $day = substr(date("D", $start_day), 0, 2); + $day_num = date("w", $start_day); + $day = $daysofweekreallyshort_lang[$day_num]; print "<td align=\"center\" class=\"G10B\"><b>$day</b></td>\n"; $start_day = ($start_day + (24.5 * 60 * 60)); } @@ -250,7 +251,8 @@ <?php $start_day = strtotime($week_start_day); for ($i=0; $i<7; $i++) { - $day = substr(date("D", $start_day), 0, 2); + $day_num = date("w", $start_day); + $day = $daysofweekreallyshort_lang[$day_num]; print "<td align=\"center\" class=\"G10B\"><b>$day</b></td>\n"; $start_day = ($start_day + (24.5 * 60 * 60)); } diff --git a/sidebar.php b/sidebar.php index 4654512..c231a9f 100644 --- a/sidebar.php +++ b/sidebar.php @@ -168,10 +168,7 @@ $event_end = date ($timeFormat, @strtotime ("$event_end")); $calendar_name2 = addslashes($calendar_name); $calendar_name2 = urlencode($calendar_name2); - if (strlen($event_text) > 21) { - $event_text = substr("$event_text", 0, 18); - $event_text = $event_text . "..."; - } + $event_text = word_wrap($event_text, 21, $tomorrows_events_lines); echo "<tr>\n"; echo "<td width=\"1%\"><img src=\"images/spacer.gif\" width=\"4\" height=\"1\"></td>"; echo "<td colspan=\"6\" class=\"G10B\">\n"; |