aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-01-31 22:59:28 +0000
committerChad Little <clittle@users.sourceforge.net>2004-01-31 22:59:28 +0000
commit7cade3b04274ecc2d3583a0602cc5de3643e81a6 (patch)
treeec2b28c307671a3d19f421f1b9cbe42762b2dfc7
parentc143f2891418cb0f0ae0f80f7d2d58e69879a722 (diff)
downloadphpicalendar-7cade3b04274ecc2d3583a0602cc5de3643e81a6.tar.gz
phpicalendar-7cade3b04274ecc2d3583a0602cc5de3643e81a6.tar.bz2
phpicalendar-7cade3b04274ecc2d3583a0602cc5de3643e81a6.zip
More template work.
-rw-r--r--functions/error.php96
-rw-r--r--functions/list_functions.php2
-rw-r--r--functions/list_icals.php12
-rw-r--r--functions/template.php2
-rw-r--r--languages/english.inc.php16
-rw-r--r--month.php3
-rw-r--r--preferences.php3
-rw-r--r--templates/default/error.tpl43
-rw-r--r--templates/default/header.tpl3
-rw-r--r--year.php184
10 files changed, 133 insertions, 231 deletions
diff --git a/functions/error.php b/functions/error.php
index 9633eb0..81c2013 100644
--- a/functions/error.php
+++ b/functions/error.php
@@ -1,69 +1,49 @@
<?php
if (!defined('BASE')) define('BASE','../');
+require_once(BASE.'config.inc.php');
+require_once(BASE.'functions/init.inc.php');
+require_once(BASE.'functions/template.php');
function error($error_msg='There was an error processing the request.', $file='NONE') {
- global $style_sheet, $powered_by_lang, $version_lang, $error_title_lang, $error_window_lang, $error_calendar_lang, $error_back_lang, $enable_rss, $this_site_is_lang;
- if (!isset($style_sheet)) $style_sheet = 'silver';
- if (!isset($powered_by_lang)) $powered_by_lang = 'Powered by';
- if (!isset($error_title_lang)) $error_title_lang = 'Error!';
- if (!isset($error_window_lang)) $error_window_lang = 'There was an error!';
- if (!isset($error_calendar_lang)) $error_calendar_lang = 'The calendar "%s" was being processed when this error occurred.';
- if (!isset($error_back_lang)) $error_back_lang = 'Please use the "Back" button to return.';
- if (!isset($enable_rss)) $enable_rss = 'no';
- if (!isset($this_site_is_lang)) $this_site_is_lang = 'This site is';
+ global $template, $language, $enable_rss, $lang;
+ if (!isset($template)) $template = 'default';
+ if (!isset($lang['l_powered_by'])) $lang['l_powered_by'] = 'Powered by';
+ if (!isset($lang['l_error_title'])) $lang['l_error_title'] = 'Error!';
+ if (!isset($lang['l_error_window'])) $lang['l_error_window'] = 'There was an error!';
+ if (!isset($lang['l_error_calendar'])) $lang['l_error_calendar'] = 'The calendar "%s" was being processed when this error occurred.';
+ if (!isset($lang['l_error_back'])) $lang['l_error_back'] = 'Please use the "Back" button to return.';
+ if (!isset($lang['l_this_site_is'])) $lang['l_this_site_is'] = 'This site is';
+ if (!isset($enable_rss)) $enable_rss = 'no';
- $error_calendar = sprintf($error_calendar_lang, $file);
- $current_view = 'error';
- $display_date = $error_title_lang;
- $calendar_name = $error_title_lang;
- include (BASE.'includes/header.inc.php');
+ $error_calendar = sprintf($lang['l_error_calendar'], $file);
+ $current_view = 'error';
+ $display_date = $lang['l_error_title'];
+ $calendar_name = $lang['l_error_title'];
-?>
+ $page = new Page(BASE.'templates/'.$template.'/error.tpl');
-<center>
-<table border="0" width="700" cellspacing="0" cellpadding="0">
- <tr>
- <td width="520" valign="top" align="center">
- <table width="520" border="0" cellspacing="0" cellpadding="0" class="calborder">
- <tr>
- <td align="center" valign="middle">
- <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B">
- <tr>
- <td align="left" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
- <td align="center" valign="middle" width="98%" class="sideback"><b><?php echo $error_window_lang; ?></b></td>
- <td class="sideback" width="1%"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B">
- <tr>
- <td align="center" valign="top">
- <br>
- <?php echo $error_msg; ?>
- <br>
- <br>
- <?php echo $error_calendar; ?>
- <br>
- <br>
- <?php echo $error_back_lang; ?>
- <br>
- <br>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-</center>
-<?php
+ $page->replace_tags(array(
+ 'header' => BASE.'templates/'.$template.'/header.tpl',
+ 'footer' => BASE.'templates/'.$template.'/footer.tpl',
+ 'calendar_nav' => BASE.'templates/'.$template.'/calendar_nav.tpl',
+ 'template' => $template,
+ 'cal' => $cal,
+ 'getdate' => $getdate,
+ 'calendar_name' => $calendar_name,
+ 'display_date' => $display_date,
+ 'rss_powered' => $rss_powered,
+ 'rss_available' => '',
+ 'todo_available' => '',
+ 'rss_valid' => '',
+ 'error_msg' => $error_msg,
+ 'error_calendar' => $error_calendar,
+ 'generated' => $generated
+
+ ));
+
+ $page->output();
- include (BASE.'includes/footer.inc.php');
+
}
diff --git a/functions/list_functions.php b/functions/list_functions.php
index 8d4d3a6..c9ae6fd 100644
--- a/functions/list_functions.php
+++ b/functions/list_functions.php
@@ -1,5 +1,7 @@
<?php
+
+
function list_months() {
global $getdate, $this_year, $cal, $dateFormat_month;
$month_time = strtotime("$this_year-01-01");
diff --git a/functions/list_icals.php b/functions/list_icals.php
deleted file mode 100644
index 81984f7..0000000
--- a/functions/list_icals.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-if ($display_ical_list == "yes") {
- echo "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value+'";
- if (isset($query)) echo $query;
- echo "');\">";
-
- // List the calendars.
- display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
-
- print "</select>";
-}
-?>
diff --git a/functions/template.php b/functions/template.php
index 856d926..0a6d0cb 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -130,7 +130,7 @@ class Page {
$data = (file_exists($data)) ? $this->parse($data) : $data;
// This removes any unfilled tags
- if ($data == '') {
+ if (!$data) {
$this->page = ereg_replace('<!-- switch ' . $tag . ' on -->(.*)<!-- switch ' . $tag . ' off -->', '', $this->page);
}
diff --git a/languages/english.inc.php b/languages/english.inc.php
index 4c8127b..2db3532 100644
--- a/languages/english.inc.php
+++ b/languages/english.inc.php
@@ -182,13 +182,13 @@ Notes about dateFormat_*
*/
// 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" was being processed when this error occurred.';
-$error_path_lang = 'Unable to open the path: "%s"';
-$error_back_lang = 'Please use the "Back" button to return.';
-$error_remotecal_lang = 'This server blocks remote calendars which have not been approved.';
-$error_restrictedcal_lang = 'You have tried to access a calendar that is restricted on this server.';
-$error_invalidcal_lang = 'Invalid calendar file. Please try a different calendar.';
+$lang['l_error_title'] = 'Error!';
+$lang['l_error_window'] = 'There was an error!';
+$lang['l_error_calendar'] = 'The calendar "%s" was being processed when this error occurred.';
+$lang['l_error_path'] = 'Unable to open the path: "%s"';
+$lang['l_error_back'] = 'Please use the "Back" button to return.';
+$lang['l_error_remotecal'] = 'This server blocks remote calendars which have not been approved.';
+$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.';
?>
diff --git a/month.php b/month.php
index b87d662..9fb2cb1 100644
--- a/month.php
+++ b/month.php
@@ -50,6 +50,7 @@ $page->replace_tags(array(
'header' => BASE.'templates/'.$template.'/header.tpl',
'footer' => BASE.'templates/'.$template.'/footer.tpl',
'calendar_nav' => BASE.'templates/'.$template.'/calendar_nav.tpl',
+ 'event_js' => BASE.'functions/event.js',
'template' => $template,
'cal' => $cal,
'getdate' => $getdate,
@@ -58,7 +59,7 @@ $page->replace_tags(array(
'rss_powered' => $rss_powered,
'rss_available' => '',
'rss_valid' => '',
- 'todo_available' => '',
+ 'todo_js' => '',
'show_search' => '',
'next_month' => $next_month,
'prev_month' => $prev_month,
diff --git a/preferences.php b/preferences.php
index 6520331..7fa0e01 100644
--- a/preferences.php
+++ b/preferences.php
@@ -143,7 +143,8 @@ $page->replace_tags(array(
'rss_powered' => $rss_powered,
'rss_available' => '',
'rss_valid' => '',
- 'todo_available' => '',
+ 'todo_js' => '',
+ 'event_js' => '',
'language_select' => $language_select,
'calendar_select' => $calendar_select,
'view_select' => $view_select,
diff --git a/templates/default/error.tpl b/templates/default/error.tpl
new file mode 100644
index 0000000..7cd193a
--- /dev/null
+++ b/templates/default/error.tpl
@@ -0,0 +1,43 @@
+{HEADER}
+<center>
+<table border="0" width="700" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="520" valign="top" align="center">
+ <table width="520" border="0" cellspacing="0" cellpadding="0" class="calborder">
+ <tr>
+ <td align="center" valign="middle">
+ <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B">
+ <tr>
+ <td align="left" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
+ <td align="center" valign="middle" width="98%" class="sideback"><b>{L_ERROR_WINDOW}</b></td>
+ <td class="sideback" width="1%"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B">
+ <tr>
+ <td align="center" valign="top">
+ <br>
+ {ERROR_MSG}
+ <br>
+ <br>
+ {ERROR_CALENDAR}
+ <br>
+ <br>
+ {L_ERROR_BACK}
+ <br>
+ <br>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</center>
+{FOOTER} \ No newline at end of file
diff --git a/templates/default/header.tpl b/templates/default/header.tpl
index 9f680e1..59aae9a 100644
--- a/templates/default/header.tpl
+++ b/templates/default/header.tpl
@@ -8,6 +8,9 @@
<!-- switch rss_available on -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="{DEFAULT_VIEW}/rss/rss.php?cal={CAL}&amp;rssview={CURRENT_VIEW}">
<!-- switch rss_available off -->
+ <!-- switch event_js on -->
+ {EVENT_JS}
+ <!-- switch event_js off -->
<!-- switch todo_available on -->
{TODO_JS}
<!-- switch todo_available off -->
diff --git a/year.php b/year.php
index 13755f7..60401cd 100644
--- a/year.php
+++ b/year.php
@@ -1,7 +1,9 @@
<?php
-$current_view = 'year';
+
define('BASE', './');
-include(BASE.'functions/ical_parser.php');
+include_once(BASE.'functions/ical_parser.php');
+require_once(BASE.'functions/template.php');
+$current_view = 'year';
ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
@@ -20,152 +22,34 @@ $prev_year = date ("Ymd", $prev_year);
$thisday2 = localizeDate($dateFormat_week_list, $unix_time);
-include (BASE.'includes/header.inc.php');
+$page = new Page(BASE.'templates/'.$template.'/year.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' => '',
+ 'show_search' => '',
+ 'next_month' => $next_month,
+ 'prev_month' => $prev_month,
+ 'show_goto' => '',
+ 'is_logged_in' => '',
+ 'list_icals' => $list_icals,
+ 'list_years' => $list_years,
+ 'list_months' => $list_months,
+ 'list_weeks' => $list_weeks,
+ 'style_select' => $style_select,
+ 'generated' => $generated
+
+ ));
+
+$page->output();
-?>
-<center>
-<table width="676" border="0" cellspacing="0" cellpadding="0" class="calborder">
- <tr>
- <td align="center" valign="middle" bgcolor="white">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="left" width="120" class="navback">&nbsp;</td>
- <td class="navback">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="right" width="45%" class="navback"><?php echo "<a class=\"psf\" href=\"year.php?cal=$cal&amp;getdate=$prev_year\"><img src=\"styles/$style_sheet/left_day.gif\" alt=\"[$last_year_lang]\" border=\"0\" align=\"right\"></a>"; ?></td>
- <td align="center" width="10%" class="navback" nowrap valign="middle"><font class="H20"><?php echo $display_date; ?></font></td>
- <td align="left" width="45%" class="navback"><?php echo "<a class=\"psf\" href=\"year.php?cal=$cal&amp;getdate=$next_year\"><img src=\"styles/$style_sheet/right_day.gif\" alt=\"[$next_year_lang]\" border=\"0\" align=\"left\"></a>"; ?></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="day.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/day_on.gif" alt="'.$day_view_lang.'" border="0"></a></td>'; ?>
- <td><?php echo '<a class="psf" href="week.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/week_on.gif" alt="'.$week_view_lang.'" border="0"></a></td>'; ?>
- <td><?php echo '<a class="psf" href="month.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/month_on.gif" alt="'.$month_view_lang.'" border="0"></a></td>'; ?>
- <td><?php echo '<a class="psf" href="year.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/year_on.gif" alt="'.$year_view_lang.'" border="0"></a></td>'; ?>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<br>
-<table border="0" width="670" cellspacing="0" cellpadding="0">
- <tr>
- <?php
- $m=0;
- $n=0;
- do {
-
- ?>
- <td width="210" valign="top" align="left">
- <table border="0" width="210" cellspacing="0" cellpadding="0" class="calborder">
- <tr>
- <td colspan="7">
- <table border="0" width="210" cellspacing="0" cellpadding="0">
- <tr>
- <td width="1" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
- <?php
- $monthlink = date("Ym", $startYear);
- $monthlink = $monthlink . $this_day;
- ?>
- <td align="center" class="sideback"><?php echo '<a class="ps3" href="month.php?cal=' . $cal . '&amp;getdate=' . $monthlink . '">'; ?><font class="G10BOLD"><?php print (localizeDate ($dateFormat_month, $startYear)); ?></font></a></td>
- <td width="1" class="sideback"></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <?php
- $start_day = strtotime($week_start_day);
- for ($i=0; $i<7; $i++) {
- $day_num = date("w", $start_day);
- $day = $daysofweekshort_lang[$day_num];
- print '<td width="30" height="14" class="dateback" align="center"><font class="V9BOLD">' . $day . '</font></td>' . "\n";
- $start_day = strtotime("+1 day", $start_day);
- }
- ?>
- </tr>
- <tr>
- <td colspan="7">
- <table border="0" width="210" cellspacing="1" cellpadding="0" class="yearmonth">
- <?php
- $minical_time = $startYear;
- $minical_month = date("m", $minical_time);
- $minical_year = date("Y", $minical_time);
- $first_of_month = $minical_year.$minical_month."01";
- $start_day = strtotime(dateOfWeek($first_of_month, $week_start_day));
- $i = 0;
- $whole_month = TRUE;
- $num_of_events = 0;
- do {
- $day = date ("j", $start_day);
- $daylink = date ("Ymd", $start_day);
- $check_month = date ("m", $start_day);
- if ($check_month != $minical_month) $day= "<font class=\"V9G\">$day</font>";
- if ($i == 0) echo '<tr height="30">';
- if (isset($master_array[("$daylink")]) && ($check_month == $minical_month)) {
- foreach ($master_array[("$daylink")] as $event_times) {
- foreach ($event_times as $val) {
- if (!isset($val["event_start"])) $image1 = '<img src="styles/'. $style_sheet . '/allday_dot.gif" alt=" " width="11" height="10" border="0">';
- if (isset($val["event_start"])) $image2 = '<img src="styles/'. $style_sheet . '/event_dot.gif" alt=" " width="11" height="10" border="0">';
- }
- }
- if (isset($master_array[("$daylink")][-1])) $image2 = '<img src="styles/silver/allday_dot.gif" alt=" " border="0">';
- echo '<td width="30" height="30" align="right" valign="top" class="monthreg" onMouseOver=this.style.backgroundColor="#DDDDDD" onMouseOut=this.style.backgroundColor="#FFFFFF" onclick="window.location.href=\'day.php?cal=' . $cal . '&amp;getdate=' . $daylink . '\'">' . "\n";
- echo '<table width="100%" border="0" cellspacing="0" cellpadding="1">' . "\n";
- echo '<tr>' . "\n";
- echo '<td align="right" valign="top" class="V9">' . "\n";
- echo '<a class="psf" href="day.php?cal=' . $cal . '&amp;getdate=' . $daylink . '">' . $day . '</a>' . "\n";
- echo '</td>' . "\n";
- echo '</tr>' . "\n";
- echo '<tr>' . "\n";
- echo '<td align="center" valign="top">' . $image1 . $image2 . '</td>' . "\n";
- echo '</tr>' . "\n";
- echo '</table>' . "\n";
- } elseif ($check_month == $minical_month) {
- echo '<td width="30" height="30" align="right" valign="top" class="monthreg" onMouseOver=this.style.backgroundColor="#DDDDDD" onMouseOut=this.style.backgroundColor="#FFFFFF" onclick="window.location.href=\'day.php?cal=' . $cal . '&amp;getdate=' . $daylink . '\'">' . "\n";
- echo '<font class="V9"><a class="psf" href="day.php?cal=' . $cal . '&amp;getdate=' . $daylink . '">' . $day . '</a></font></td>' . "\n";
- } else {
- echo '<td width="30" height="30" align="right" valign="top" class="monthoff" onMouseOver=this.style.backgroundColor="#DDDDDD" onMouseOut=this.style.backgroundColor="#F2F2F2" onclick="window.location.href=\'day.php?cal=' . $cal . '&amp;getdate=' . $daylink . '\'">' . "\n";
- echo '<a class="psf" href="day.php?cal=' . $cal . '&amp;getdate=' . $daylink . '">' . $day . '</a></td>' . "\n";
- }
- $start_day = strtotime("+1 day", $start_day);
- $i++;
- $image1 = '';
- $image2 = '';
- if ($i == 7) {
- echo '</tr>';
- $i = 0;
- $checkagain = date ("m", $start_day);
- if ($checkagain != $minical_month) $whole_month = FALSE;
- }
- } while ($whole_month == TRUE);
- $startYear = strtotime ("+1 month", $startYear);
- ?>
- </table>
- </td>
- </tr>
- </table>
- </td>
- <?php
- if ($m < 2) echo '<td width="20"><img src="images/spacer.gif" width="20" height="1" alt=" "></td>';
- $m++;
- $n++;
- if (($m == 3) && ($n < 12)) {
- $m = 0;
- echo '</tr><tr>';
- echo '<td colspan="5"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>';
- echo '</tr><tr>';
- }
- } while (($m < 3) && ($n < 12));
- ?>
-</tr>
-</table>
-</center>
-<?php include (BASE.'includes/footer.inc.php'); ?>
+?> \ No newline at end of file

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