diff options
author | Chad Little <clittle@users.sourceforge.net> | 2004-01-28 07:27:23 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2004-01-28 07:27:23 +0000 |
commit | c5e73fa883662edaeef6da6a308f6631b6f0eca5 (patch) | |
tree | 42d148f0935a961f8bcc02514c0f04f946dfc5ea /preferences.php | |
parent | 603060dd7b43d47ac4637fee17b818cba6dff3c8 (diff) | |
download | phpicalendar-c5e73fa883662edaeef6da6a308f6631b6f0eca5.tar.gz phpicalendar-c5e73fa883662edaeef6da6a308f6631b6f0eca5.tar.bz2 phpicalendar-c5e73fa883662edaeef6da6a308f6631b6f0eca5.zip |
Major checkin, modified english to new language style. Preferences now
template driven along with event and todo. Header and footer seem to work
as well.
Diffstat (limited to 'preferences.php')
-rw-r--r-- | preferences.php | 316 |
1 files changed, 94 insertions, 222 deletions
diff --git a/preferences.php b/preferences.php index 2aa7ba0..b791212 100644 --- a/preferences.php +++ b/preferences.php @@ -1,7 +1,8 @@ <?php define('BASE','./'); -include(BASE.'functions/ical_parser.php'); +include_once(BASE.'functions/ical_parser.php'); +require_once(BASE.'functions/template.php'); $display_date = $preferences_lang; if ($cookie_uri == '') { @@ -50,10 +51,6 @@ if (isset($HTTP_COOKIE_VARS['phpicalendar'])) { unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday); } } -#echo "$cookie_uri"; -#print_r(unserialize($HTTP_COOKIE_VARS['phpicalendar'])); -#print_r($phpicalendar); - if ((!isset($HTTP_COOKIE_VARS['phpicalendar'])) || ($cookie_unset)) { # No cookie set -> use defaults from config file. @@ -65,222 +62,97 @@ if ((!isset($HTTP_COOKIE_VARS['phpicalendar'])) || ($cookie_unset)) { $cookie_time = $day_start; } -include (BASE.'includes/header.inc.php'); +if ($action == 'setcookie') { + if (!$cookie_unset) { + $message = $lang['l_prefs_set']; + } else { + $message = $lang['l_prefs_unset']; + } +} else { + $message = ''; +} -?> -<center> -<table border="0" width="700" cellspacing="0" cellpadding="0"> - <tr> - <td width="520" valign="top" align="center"> - <table width="640" border="0" cellspacing="0" cellpadding="0" class="calborder"> - <tr> - <td align="center" valign="middle"> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td align="left" width="120" class="navback"><?php echo '<a href="'.$back_page.'"><img src="'.BASE.'styles/'.$style_sheet.'/back.gif" alt=" " border="0" align="left"></a>'; ?></td> - <td class="navback"> - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td align="center" class="navback" nowrap valign="middle"><font class="H20"><?php echo "$preferences_lang"; ?></font></td> - </tr> - </table> - </td> - <td align="right" width="120" class="navback"> - <table width="120" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td><?php echo '<a class="psf" href="'.BASE.'day.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/day_on.gif" alt=" " border="0"></a></td>'; ?> - <td><?php echo '<a class="psf" href="'.BASE.'week.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/week_on.gif" alt=" " border="0"></a></td>'; ?> - <td><?php echo '<a class="psf" href="'.BASE.'month.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/month_on.gif" alt=" " border="0"></a></td>'; ?> - <td><?php echo '<a class="psf" href="'.BASE.'year.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'styles/'.$style_sheet.'/year_on.gif" alt=" " border="0"></a></td>'; ?> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td class="dayborder"><img src="images/spacer.gif" width="1" height="5" alt=" "></td> - </tr> - <tr> - <td> - <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B"> - <?php - if ($action == 'setcookie') { - if (!$cookie_unset) { - $message = $prefs_set_lang; - } else { - $message = $prefs_unset_lang; - } - ?> - <tr> - <td colspan="2" align="center"><font class="G10BOLD"><?php echo "$message"; ?></font></td> - </tr> - <?php } ?> - <tr> - <td width="2%"></td> - <td width="98%" valign="top" align="left"> - <form action="preferences.php?action=setcookie" METHOD="post"> - <table border="0" width="620" cellspacing="2" cellpadding="2" align="center"> - <tr> - <td align="left" valign="top" width="300" nowrap><?php echo "$select_lang_lang"; ?></td> - <td align="left" valign="top" width="20"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top" width="300"> - <?php - - // Begin Language Selection - // - print "<select name=\"cookie_language\" class=\"query_style\">\n"; - $dir_handle = @opendir(BASE.'languages/'); - $tmp_pref_language = urlencode(ucfirst($language)); - while ($file = readdir($dir_handle)) { - if (substr($file, -8) == ".inc.php") { - $language_tmp = urlencode(ucfirst(substr($file, 0, -8))); - if ($language_tmp == $cookie_language) { - print "<option value=\"$language_tmp\" selected>$language_tmp</option>\n"; - } else { - print "<option value=\"$language_tmp\">$language_tmp</option>\n"; - } - } - } - closedir($dir_handle); - print "</select>\n"; - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" width="300" nowrap><?php echo "$select_cal_lang"; ?></td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"> - <?php - - // Begin Calendar Selection - // - print "<select name=\"cookie_calendar\" class=\"query_style\">\n"; - display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED)); - print "</select>\n"; - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" width="300" nowrap><?php echo "$select_view_lang"; ?></td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"> - <?php - - // Begin View Selection - // - print "<select name=\"cookie_view\" class=\"query_style\">\n"; - print "<option value=\"day\""; - if ($cookie_view == "day") print " selected"; - print ">$day_lang</option>\n"; - print "<option value=\"week\""; - if ($cookie_view == "week") print " selected"; - print ">$week_lang</option>\n"; - print "<option value=\"month\""; - if ($cookie_view == "month") print " selected"; - print ">$month_lang</option>\n"; - //print "<option value=\"print\""; - //if ($cookie_view == "print") print " selected"; - //print ">$printer_lang</option>\n"; - print "</select>\n"; - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" width="300" nowrap><?php echo "$select_time_lang"; ?></td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"> - <?php - - // Begin Time Selection - // - print "<select name=\"cookie_time\" class=\"query_style\">\n"; - for ($i = 500; $i <= 900; $i += 100) { - $s = sprintf("%04d", $i); - print "<option value=\"$s\""; - if ($s == $cookie_time) { - print " selected"; - } - print ">$s</option>\n"; - } - print "</select>\n"; - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" width="300" nowrap><?php echo "$select_day_lang"; ?></td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"> - <?php - - // Begin Day Start Selection - // - print "<select name=\"cookie_startday\" class=\"query_style\">\n"; - $i=0; - foreach ($daysofweek_lang as $daysofweek) { - if ($startdays[$i] == "$cookie_startday") { - print "<option value=\"$startdays[$i]\" selected>$daysofweek</option>\n"; - } else { - print "<option value=\"$startdays[$i]\">$daysofweek</option>\n"; - } - $i++; - } - print "</select>\n"; - ?> - </td> - </tr> - <tr> - <td align="left" valign="top" width="300" nowrap><?php echo "$select_style_lang"; ?></td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"> - <?php - - // Begin Style Selection - // - print "<select name=\"cookie_style\" class=\"query_style\">\n"; - $dir_handle = @opendir(BASE.'styles/'); - while ($file = readdir($dir_handle)) { - if (($file != ".") && ($file != "..") && ($file != "CVS")) { - if (!is_file($file)) { - $file_disp = ucfirst($file); - if ($file == "$cookie_style") { - print "<option value=\"$file\" selected>$file_disp</option>\n"; - } else { - print "<option value=\"$file\">$file_disp</option>\n"; - } - } - } - } - closedir($dir_handle); - print "</select>\n"; - ?> - </td> - </tr> - <?php if (isset($HTTP_COOKIE_VARS['phpicalendar'])) { ?> - <tr> - <td align="left" valign="top" nowrap><?php echo "$unset_prefs_lang"; ?></td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"><INPUT TYPE="checkbox" NAME="unset" VALUE="true"></td> - </tr> - <?php } ?> - <tr> - <td align="left" valign="top" nowrap> </td> - <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> - <td align="left" valign="top"><input type="submit" name="set" value="<?php echo "$set_prefs_lang"; ?>"></button></td> - </tr> - </table> - </form> - <br> - </td> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> -</table> -</center> -<?php include (BASE.'includes/footer.inc.php'); ?> +// select for languages +$dir_handle = @opendir(BASE.'languages/'); +$tmp_pref_language = urlencode(ucfirst($language)); +while ($file = readdir($dir_handle)) { + if (substr($file, -8) == ".inc.php") { + $language_tmp = urlencode(ucfirst(substr($file, 0, -8))); + if ($language_tmp == $cookie_language) { + $language_select .= "<option value=\"$language_tmp\" selected>$language_tmp</option>\n"; + } else { + $language_select .= "<option value=\"$language_tmp\">$language_tmp</option>\n"; + } + } +} +closedir($dir_handle); + +// select for calendars +$calendar_select = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED)); + +// select for dayview +$view_select = ($cookie_view == 'day') ? '<option value="day" selected>{L_DAY}</option>' : '<option value="day">{L_DAY}</option>'; +$view_select .= ($cookie_view == 'week') ? '<option value="week" selected>{L_WEEK}</option>' : '<option value="week">{L_WEEK}</option>'; +$view_select .= ($cookie_view == 'month') ? '<option value="month" selected>{L_MONTH}</option>' : '<option value="month">{L_MONTH}</option>'; + +// select for time +for ($i = 000; $i <= 1200; $i += 100) { + $s = sprintf("%04d", $i); + $time_select .= "<option value=\"$s\""; + if ($s == $cookie_time) { + $time_select .= " selected"; + } + $time_select .= ">$s</option>\n"; +} +// select for day of week +$i=0; +foreach ($daysofweek_lang as $daysofweek) { + if ($startdays[$i] == "$cookie_startday") { + $startday_select .= "<option value=\"$startdays[$i]\" selected>$daysofweek</option>\n"; + } else { + $startday_select .= "<option value=\"$startdays[$i]\">$daysofweek</option>\n"; + } + $i++; +} + +$dir_handle = @opendir(BASE.'templates/'); +while ($file = readdir($dir_handle)) { + if (($file != ".") && ($file != "..") && ($file != "CVS")) { + if (!is_file($file)) { + $file_disp = ucfirst($file); + $style_select .= ($file == "$cookie_style") ? "<option value=\"$file\" selected>$file_disp</option>\n" : "<option value=\"$file\">$file_disp</option>\n"; + } + } +} +closedir($dir_handle); + +$page = new Page(BASE.'templates/'.$template.'/preferences.tpl'); + +$page->replace_tags(array( + 'header' => BASE.'templates/'.$template.'/header.tpl', + 'footer' => BASE.'templates/'.$template.'/footer.tpl', + 'template' => $template, + 'cal' => $cal, + 'getdate' => $getdate, + 'calendar_name' => $calendar_name, + 'display_date' => $display_date, + 'rss_powered' => $rss_powered, + 'rss_available' => '', + 'rss_valid' => '', + 'todo_available' => '', + 'language_select' => $language_select, + 'calendar_select' => $calendar_select, + 'view_select' => $view_select, + 'time_select' => $time_select, + 'startday_select' => $startday_select, + 'style_select' => $style_select, + 'message' => $message + + )); + +$page->replace_langs($lang); + +$page->output(); + +?> |