aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-08-08 05:55:17 +0000
committerChad Little <clittle@users.sourceforge.net>2004-08-08 05:55:17 +0000
commit24757cf84fd2e4642ed68a0d48bb8ff75cc8d938 (patch)
treedaa4acf1d1e92ed71fd0ae72eaebd8414476d8f2
parent0b3393545875f1442ea270bd54ced763b6fe54ba (diff)
downloadphpicalendar-24757cf84fd2e4642ed68a0d48bb8ff75cc8d938.tar.gz
phpicalendar-24757cf84fd2e4642ed68a0d48bb8ff75cc8d938.tar.bz2
phpicalendar-24757cf84fd2e4642ed68a0d48bb8ff75cc8d938.zip
Cleaned up calendar colors and added error message for caching.
-rw-r--r--config.inc.php7
-rw-r--r--functions/ical_parser.php10
-rw-r--r--functions/list_functions.php7
-rw-r--r--functions/template.php25
-rw-r--r--languages/english.inc.php1
5 files changed, 29 insertions, 21 deletions
diff --git a/config.inc.php b/config.inc.php
index a65b92e..4192d10 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -57,6 +57,13 @@ $auth_internal_password = 'default'; // Only used if $auth_method='internal'. T
$ftp_server = 'localhost'; // Only used if $auth_method='ftp'. The ftp server name. 'localhost' will work for most servers.
$ftp_calendar_path = ''; // Only used if $auth_method='ftp'. The full path to the calendar directory on the ftp server. If = '', will attempt to deduce the path based on $calendar_path, but may not be accurate depending on ftp server config.
+// Calendar colors
+//
+// You can increase the number of unique colors by adding additional images (monthdot_n.gif)
+// and in the css file (default.css) classes .alldaybg_n, .eventbg_n and .eventbg2_n
+// Colors will rotate to double the number listed below. (That's 14 colors, 2 calendars per color).
+$unique_colors = '7';
+
$blacklisted_cals[] = ''; // Fill in between the quotes the name of the calendars
$blacklisted_cals[] = ''; // you wish to 'blacklist' or that you don't want to show up in your calendar
$blacklisted_cals[] = ''; // list. This should be the exact calendar filename without .ics
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 6eece29..9dd8e8f 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -1153,11 +1153,11 @@ if ($parse_file) {
// write the new master array to the file
if (isset($master_array) && is_array($master_array) && $save_parsed_cals == 'yes') {
$write_me = serialize($master_array);
- $fd = fopen($parsedcal, 'w');
- fwrite($fd, $write_me);
- fclose($fd);
- touch($parsedcal, $realcal_mtime);
- //echo 'writing file';
+ $fd = @fopen($parsedcal, 'w');
+ if ($fd == FALSE) exit(error($lang['l_error_cache'], $filename));
+ @fwrite($fd, $write_me);
+ @fclose($fd);
+ @touch($parsedcal, $realcal_mtime);
}
}
diff --git a/functions/list_functions.php b/functions/list_functions.php
index cfc1745..1927a68 100644
--- a/functions/list_functions.php
+++ b/functions/list_functions.php
@@ -11,9 +11,12 @@ function list_jumps() {
}
function list_calcolors() {
- global $template, $master_array;
+ global $template, $master_array, $unique_colors;
+ $i = 1;
foreach ($master_array['-3'] as $key => $val) {
- $return .= '<img src="templates/'.$template.'/images/monthdot_'.$key.'.gif" alt="" /> '.$val.'<br />';
+ if ($i > $unique_colors) $i = 1;
+ $return .= '<img src="templates/'.$template.'/images/monthdot_'.$i.'.gif" alt="" /> '.$val.'<br />';
+ $i++;
}
return $return;
}
diff --git a/functions/template.php b/functions/template.php
index 78ad822..f376bab 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -116,7 +116,7 @@ class Page {
}
function draw_week($template_p) {
- global $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small, $day_start;
+ global $unique_colors, $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small, $day_start;
// Figure out colspans
$dayborder = 0;
@@ -159,8 +159,7 @@ class Page {
$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;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
$event = openevent($event_calna, '', '', $allday, 1, 11, '', '', 'psf', $event_url);
$loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad);
$loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
@@ -317,8 +316,7 @@ class Page {
$event_calna = $this_time_arr[($event_length[$thisday][$i]['key'])]['calname'];
$event_url = $this_time_arr[($event_length[$thisday][$i]['key'])]['url'];
$event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']);
- if ($event_calno < 1) $event_calno = 1;
- if ($event_calno > 7) $event_calno = 7;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
}
@@ -372,7 +370,7 @@ class Page {
}
function draw_day($template_p) {
- global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $day_start;
+ global $template, $getdate, $cal, $master_array, $unique_colors, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $day_start;
// Replaces the allday events
$replace = '';
@@ -383,8 +381,7 @@ class Page {
$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;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
$event = openevent($event_calna, '', '', $allday, 0, '', '', '', '', $event_url);
$loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad);
$loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
@@ -531,8 +528,7 @@ class Page {
$event_calno = $this_time_arr[($event_length[$i]['key'])]['calnumber'];
$event_recur = $this_time_arr[($event_length[$i]['key'])]['recur'];
$event_status = strtolower($this_time_arr[($event_length[$i]['key'])]['status']);
- if ($event_calno < 1) $event_calno = 1;
- if ($event_calno > 7) $event_calno = 7;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
} elseif (is_array($event_recur)) {
@@ -706,7 +702,7 @@ class Page {
}
function draw_month($template_p, $offset = '+0', $type) {
- global $template, $getdate, $master_array, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat;
+ global $template, $getdate, $master_array, $this_year, $this_month, $unique_colors, $dateFormat_month, $week_start_day, $cal, $minical_view, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat;
preg_match("!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is", $template_p, $match1);
preg_match("!<\!-- loop monthdays on -->(.*)<\!-- loop monthdays off -->!is", $template_p, $match2);
preg_match("!<\!-- switch notthismonth on -->(.*)<\!-- switch notthismonth off -->!is", $template_p, $match3);
@@ -774,12 +770,13 @@ class Page {
if ($type != 'small') {
foreach ($master_array[$daylink] as $event_times) {
foreach ($event_times as $val) {
- $calno = $val['calnumber'];
+ $event_calno = $val['calnumber'];
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
$event_calna = $val['calname'];
$event_url = $val['url'];
if (!isset($val['event_start'])) {
if ($type == 'large') {
- $switch['ALLDAY'] .= '<div class="V10"><img src="templates/'.$template.'/images/monthdot_'.$calno.'.gif" alt="" width="9" height="9" border="0" />';
+ $switch['ALLDAY'] .= '<div class="V10"><img src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
$switch['ALLDAY'] .= openevent($event_calna, '', '', $val, $month_event_lines, 15, '', '', 'psf', $event_url);
$switch['ALLDAY'] .= '</div>';
} else {
@@ -792,7 +789,7 @@ class Page {
$start2 = date($timeFormat_small, $val['start_unixtime']);
$event_end = date($timeFormat, @strtotime ($event_end));
if ($type == 'large') {
- $switch['EVENT'] .= '<div class="V9"><img src="templates/'.$template.'/images/monthdot_'.$calno.'.gif" alt="" width="9" height="9" border="0" />';
+ $switch['EVENT'] .= '<div class="V9"><img src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
$switch['EVENT'] .= openevent($event_calna, $event_start, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', $event_url).'<br />';
$switch['EVENT'] .= '</div>';
} else {
diff --git a/languages/english.inc.php b/languages/english.inc.php
index 608c439..5124b54 100644
--- a/languages/english.inc.php
+++ b/languages/english.inc.php
@@ -200,5 +200,6 @@ $lang['l_error_remotecal'] = 'This server blocks remote calendars which have n
$lang['l_error_restrictedcal'] = 'You have tried to access a calendar that is restricted on this server.';
$lang['l_error_invalidcal'] = 'Invalid calendar file. Please try a different calendar.';
$lang['l_error_cantopen'] = 'Unable to open calendar.';
+$lang['l_error_cache'] = 'Unable to write to cache directory. Please check your config.';
?>

© 2014-2024 Faster IT GmbH | imprint | privacy policy