aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2009-06-05 14:20:40 +0000
committerJason Oster <parasytic@users.sourceforge.net>2009-06-05 14:20:40 +0000
commit0af7a80d9b273051bad96024369d72a74b20eadb (patch)
tree37f19eaee0283dad16c7a5c3d57ad56613a1e26c /functions
parentaa19cb6558989cd6edb962d27b9d222dce4db9e7 (diff)
downloadphpicalendar-0af7a80d9b273051bad96024369d72a74b20eadb.tar.gz
phpicalendar-0af7a80d9b273051bad96024369d72a74b20eadb.tar.bz2
phpicalendar-0af7a80d9b273051bad96024369d72a74b20eadb.zip
Fix default selections in display_ical_list()
Diffstat (limited to 'functions')
-rw-r--r--functions/calendar_functions.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php
index 25ec8ed..2c5cd69 100644
--- a/functions/calendar_functions.php
+++ b/functions/calendar_functions.php
@@ -187,6 +187,7 @@ function display_ical_list($cals, $pick=FALSE) {
global $cal, $current_view, $getdate, $lang, $calendar_lang, $all_cal_comb_lang, $cal_filelist, $cal_displaynames, $list_webcals, $phpiCal_config;
// Print each calendar option.
$return = '';
+ $all_cals = true;
foreach ($cals as $cal_tmp) {
// Format the calendar path for display.
//
@@ -244,6 +245,10 @@ function display_ical_list($cals, $pick=FALSE) {
if(in_array($cal_tmp, $list_webcals)){
$cal_encoded_tmp = md5($phpiCal_config->salt.$cal_tmp);;
}
+
+ // Try to detect unselected calendars
+ if (!in_array($cal_encoded_tmp, explode(",", $cal))) $all_cals = false;
+
// Display the option.
//
// The submitted calendar will be encoded, and always use http://
@@ -256,22 +261,23 @@ function display_ical_list($cals, $pick=FALSE) {
$return .= "<option value=\"$cal_encoded_tmp\">$cal_displayname_tmp</option>\n";
}
} else {
- $cal_httpPrefix_tmp = str_replace('webcal://', 'http://', $cal_tmp);
- if ($cal_encoded_tmp == urldecode($cal)) {
- $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\" selected=\"selected\">$cal_displayname_tmp</option>";
- } else {
- $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\">$cal_displayname_tmp</option>";
+ $cal_httpPrefix_tmp = str_replace('webcal://', 'http://', $cal_tmp);
+ if ($cal_encoded_tmp == $cal || $cal_encoded_tmp == urldecode($cal)) {
+ $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\" selected=\"selected\">$cal_displayname_tmp</option>";
+ } else {
+ $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\">$cal_displayname_tmp</option>";
+ }
}
- }
}
// option to open all (non-web) calenders together
if (!$pick) {
- if ($cal == $phpiCal_config->ALL_CALENDARS_COMBINED) {
+ if ($all_cals || $cal == $phpiCal_config->ALL_CALENDARS_COMBINED) {
$return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>";
} else {
$return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\">$all_cal_comb_lang</option>";
}
}
+
return $return;
} \ No newline at end of file

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