diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php
index ac2f3d0fe6..04f613d68d 100755
--- a/calendar/inc/class.uicalendar.inc.php
+++ b/calendar/inc/class.uicalendar.inc.php
@@ -36,6 +36,7 @@
'mini_calendar' => True,
'index' => True,
'month' => True,
+ 'get_month' => True,
'week' => True,
'year' => True,
'view' => True,
@@ -246,6 +247,19 @@
}
function month()
+ {
+ if (!$this->bo->printer_friendly)
+ {
+ unset($GLOBALS['phpgw_info']['flags']['noheader']);
+ unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+ unset($GLOBALS['phpgw_info']['flags']['noappheader']);
+ unset($GLOBALS['phpgw_info']['flags']['noappfooter']);
+ $GLOBALS['phpgw']->common->phpgw_header();
+ }
+ echo $this->get_month();
+ }
+
+ function get_month()
{
$this->bo->read_holidays();
@@ -300,15 +314,6 @@
'print' => $print
);
- if (!$this->bo->printer_friendly)
- {
- unset($GLOBALS['phpgw_info']['flags']['noheader']);
- unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
- unset($GLOBALS['phpgw_info']['flags']['noappheader']);
- unset($GLOBALS['phpgw_info']['flags']['noappfooter']);
- $GLOBALS['phpgw']->common->phpgw_header();
- }
-
$p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_unknowns('remove');
$p->set_file(
@@ -317,10 +322,21 @@
)
);
$p->set_var($var);
- $p->pparse('out','index_t');
+ return $p->fp('out','index_t');
}
function week()
+ {
+ if (!$this->bo->printer_friendly)
+ {
+ unset($GLOBALS['phpgw_info']['flags']['noheader']);
+ unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+ $GLOBALS['phpgw']->common->phpgw_header();
+ }
+ echo $this->get_week();
+ }
+
+ function get_week()
{
$this->bo->read_holidays();
@@ -403,13 +419,6 @@
'print' => $print
);
- if (!$this->bo->printer_friendly)
- {
- unset($GLOBALS['phpgw_info']['flags']['noheader']);
- unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
- $GLOBALS['phpgw']->common->phpgw_header();
- }
-
$p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_file(
Array(
@@ -417,7 +426,7 @@
)
);
$p->set_var($var);
- $p->pparse('out','week_t');
+ return $p->fp('out','week_t');
}
function year()
@@ -427,6 +436,19 @@
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
+ }
+ else
+ {
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = True;
+ }
+ echo $this->get_year();
+ }
+
+
+ functiong get_year()
+ {
+ if(!$this->bo->printer_friendly)
+ {
$print = '';
$left_link = '<<';
$right_link = '>>';
@@ -440,7 +462,6 @@
$right_link = '';
$link = '';
$printer = '';
- $GLOBALS['phpgw_info']['flags']['nofooter'] = True;
}
$var = Array(
@@ -483,7 +504,7 @@
$p->parse('row','month_sep',True);
}
}
- $p->pparse('out','year_t');
+ return $p->fp('out','year_t');
}
function view($vcal_id=0,$cal_date=0)
@@ -998,7 +1019,7 @@
$var = Array(
'printer_friendly' => $printer,
- 'bg_text' => $GLOBALS['phpgw_info']['theme']['bg_text'],
+ 'bg_text' => $this->theme['bg_text'],
'daily_events' => $this->print_day(
Array(
'year' => $this->bo->year,
diff --git a/calendar/inc/hook_home.inc.php b/calendar/inc/hook_home.inc.php
index b25289c323..97d85a390b 100755
--- a/calendar/inc/hook_home.inc.php
+++ b/calendar/inc/hook_home.inc.php
@@ -26,27 +26,29 @@
{
$time = time() - ((60*60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
$GLOBALS['date'] = $GLOBALS['phpgw']->common->show_date($time,'Ymd');
+ $GLOBALS['g_year'] = substr($GLOBALS['date'],0,4);
+ $GLOBALS['g_month'] = substr($GLOBALS['date'],4,2);
+ $GLOBALS['g_day'] = substr($GLOBALS['date'],6,2);
$GLOBALS['owner'] = $GLOBALS['phpgw_info']['user']['account_id'];
- $cal = CreateObject('calendar.uicalendar');
- $extra_data = "\n".'
'."\n".''
- . $cal->mini_calendar(
- Array(
- 'day' => $cal->bo->day,
- 'month' => $cal->bo->month,
- 'year' => $cal->bo->year,
- 'link' => 'day'
- )
- ).' | '
- . ''.lang($GLOBALS['phpgw']->common->show_date($time,'F')).' '.$cal->bo->day.', '
- .$cal->bo->year.' | '.$cal->print_day(
- Array(
- 'year' => $cal->bo->year,
- 'month' => $cal->bo->month,
- 'day' => $cal->bo->day
- )
- ).' | '."\n".' | '."\n".' '."\n".' '."\n".' | '."\n";
-
+ $GLOBALS['css'] = "\n".'';
+
+ $page_ = explode('.',$GLOBALS['phpgw_info']['user']['preferences']['calendar']['defaultcalendar']);
+ $_page = $page_[0];
+ if ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year'))
+ {
+ $_page = 'month';
+// $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month');
+// $GLOBALS['phpgw']->preferences->save_repository();
+ }
+
+ if(!@file_exists(PHPGW_INCLUDE_ROOT.'/calendar/inc/hook_home_'.$_page.'.inc.php'))
+ {
+ $_page = 'day';
+ }
+ include(PHPGW_INCLUDE_ROOT.'/calendar/inc/hook_home_'.$_page.'.inc.php');
+
+
$title = ''.lang('Calendar').'';
$portalbox = CreateObject('phpgwapi.listbox',
@@ -78,7 +80,7 @@
$portalbox->data = Array();
- echo "\n".''."\n".$portalbox->draw($extra_data)."\n".''."\n";
+ echo "\n".''."\n".$portalbox->draw($GLOBALS['extra_data'])."\n".''."\n";
unset($cal);
}
flush();
diff --git a/calendar/inc/hook_home_day.inc.php b/calendar/inc/hook_home_day.inc.php
new file mode 100755
index 0000000000..0bcf11f2dd
--- /dev/null
+++ b/calendar/inc/hook_home_day.inc.php
@@ -0,0 +1,43 @@
+ *
+ * http://www.radix.net/~cknudsen *
+ * Written by Mark Peters *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+
+ $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
+ if($d1 == 'htt' || $d1 == 'ftp' )
+ {
+ echo 'Failed attempt to break in via an old Security Hole!
'."\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ unset($d1);
+
+ $GLOBALS['extra_data'] = $GLOBALS['css']."\n".''."\n".''
+ . ExecMethod('calendar.uicalendar.mini_calendar',
+ Array(
+ 'day' => $GLOBALS['g_day'],
+ 'month' => $GLOBALS['g_month'],
+ 'year' => $GLOBALS['g_year'],
+ 'link' => 'day'
+ )
+ ).' | '
+ . ''.lang($GLOBALS['phpgw']->common->show_date($time,'F')).' '.$GLOBALS['g_day'].', '
+ .$GLOBALS['g_year'].' | '.ExecMethod('calendar.uicalendar.print_day',
+ Array(
+ 'year' => $GLOBALS['g_year'],
+ 'month' => $GLOBALS['g_month'],
+ 'day' => $GLOBALS['g_day']
+ )
+ ).' | '."\n".' | '."\n".' '."\n".' '."\n".' | '."\n";
+?>
diff --git a/calendar/inc/hook_home_month.inc.php b/calendar/inc/hook_home_month.inc.php
new file mode 100755
index 0000000000..8e1c0bc356
--- /dev/null
+++ b/calendar/inc/hook_home_month.inc.php
@@ -0,0 +1,28 @@
+ *
+ * http://www.radix.net/~cknudsen *
+ * Written by Mark Peters *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+
+ $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
+ if($d1 == 'htt' || $d1 == 'ftp' )
+ {
+ echo 'Failed attempt to break in via an old Security Hole!
'."\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ unset($d1);
+
+ $GLOBALS['extra_data'] = $GLOBALS['css']."\n".''."\n".''
+ . ExecMethod('calendar.uicalendar.get_month')
+ .' | '."\n".' '."\n".' '."\n".' | '."\n";
+?>
diff --git a/calendar/inc/hook_home_week.inc.php b/calendar/inc/hook_home_week.inc.php
new file mode 100755
index 0000000000..22c5334047
--- /dev/null
+++ b/calendar/inc/hook_home_week.inc.php
@@ -0,0 +1,28 @@
+ *
+ * http://www.radix.net/~cknudsen *
+ * Written by Mark Peters *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+
+ $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
+ if($d1 == 'htt' || $d1 == 'ftp' )
+ {
+ echo 'Failed attempt to break in via an old Security Hole!
'."\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ unset($d1);
+
+ $GLOBALS['extra_data'] = $GLOBALS['css']."\n".''."\n".''
+ . ExecMethod('calendar.uicalendar.get_week')
+ .' | '."\n".' '."\n".' '."\n".' | '."\n";
+?>
diff --git a/calendar/inc/hook_home_year.inc.php b/calendar/inc/hook_home_year.inc.php
new file mode 100755
index 0000000000..ce157329be
--- /dev/null
+++ b/calendar/inc/hook_home_year.inc.php
@@ -0,0 +1,28 @@
+ *
+ * http://www.radix.net/~cknudsen *
+ * Written by Mark Peters *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+
+ $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
+ if($d1 == 'htt' || $d1 == 'ftp' )
+ {
+ echo 'Failed attempt to break in via an old Security Hole!
'."\n";
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ unset($d1);
+
+ $GLOBALS['extra_data'] = $GLOBALS['css']."\n".''."\n".''
+ . ExecMethod('calendar.uicalendar.get_year')
+ .' | '."\n".' '."\n".' '."\n".' | '."\n";
+?>