Index: openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl,v
diff -u -r1.21.2.5 -r1.21.2.6
--- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 18 Mar 2003 19:59:59 -0000 1.21.2.5
+++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 15 Apr 2003 12:55:18 -0000 1.21.2.6
@@ -14,7 +14,7 @@
# details.
#
-# www/calendar-portlet.tcl
+# www/calendar-full-portlet.tcl
ad_page_contract {
The display logic for the calendar portlet
Index: openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl,v
diff -u -r1.18.2.1 -r1.18.2.2
--- openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 6 Mar 2003 15:17:19 -0000 1.18.2.1
+++ openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 15 Apr 2003 12:55:18 -0000 1.18.2.2
@@ -20,10 +20,24 @@
@author Arjun Sanyal (arjun@openforce.net)
@cvs_id $Id$
+} {
+ {view ""}
+ {page_num ""}
+ {date ""}
+ {julian_date ""}
} -properties {
+} -validate {
+ valid_date -requires { date } {
+ if {![string equal $date ""]} {
+ if {[catch {set date [clock format [clock scan $date] -format "%Y-%m-%d"]} err]} {
+ ad_complain "Your input ($date) was not valid. It has to be in the form YYYYMMDD."
+ }
+ }
+ }
}
+
# get stuff out of the config array
array set config $cf
set view $config(default_view)
@@ -71,7 +85,32 @@
# big switch on the view var
if { $view == "day" } {
+ # Check that the previous and next days are in the tcl boundaries
+ # so that the calendar widget doesn't bomb when it creates the next/prev links
+ if {[catch {set yest [clock format [clock scan "1 day ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} {
+ set previous_link ""
+ } else {
+ if {[catch {clock scan $yest}]} {
+ set previous_link ""
+ } else {
+ set previous_link ""
+ }
+ }
+
+ if {[catch {set tomor [clock format [clock scan "1 day" -base [clock scan $date]] -format "%Y-%m-%d"]}]} {
+ set next_link ""
+ } else {
+ if {[catch {clock scan $tomor}]} {
+ set next_link ""
+ } else {
+ set next_link ""
+ }
+ }
+
+
set cal_stuff [calendar::one_day_display \
+ -prev_nav_template $previous_link \
+ -next_nav_template $next_link \
-item_template $item_template \
-hour_template $hour_template \
-date $current_date -start_hour 7 -end_hour 22 \
@@ -82,15 +121,64 @@
}
if {$view == "week"} {
+
+ # Check that the previous and next weeks are in the tcl boundaries
+ # so that the calendar widget doesn't bomb when it creates the next/prev links
+ if {[catch {set last_w [clock format [clock scan "1 week ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} {
+ set previous_link ""
+ } else {
+ if {[catch {clock scan $last_w}]} {
+ set previous_link ""
+ } else {
+ set previous_link ""
+ }
+ }
+
+ if {[catch {set next_w [clock format [clock scan "1 week" -base [clock scan $date]] -format "%Y-%m-%d"]}]} {
+ set next_link ""
+ } else {
+ if {[catch {clock scan $next_w}]} {
+ set next_link ""
+ } else {
+ set next_link ""
+ }
+ }
+
set cal_stuff [calendar::one_week_display \
-item_template $item_template \
-date $current_date \
-calendar_id_list $list_of_calendar_ids \
-url_stub_callback "calendar_portlet_display::get_url_stub" \
+ -prev_week_template $previous_link \
+ -next_week_template $next_link \
-show_calendar_name_p $show_calendar_name_p]
}
if {$view == "month"} {
+
+ # Check that the previous and next months are in the tcl boundaries
+ # so that the calendar widget doesn't bomb when it creates the next/prev links
+ if {[catch {set prev_m [clock format [clock scan "1 month ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} {
+ set previous_link ""
+ } else {
+ if {[catch {clock scan $prev_m}]} {
+ set previous_link ""
+ } else {
+ set previous_link ""
+ }
+ }
+
+ if {[catch {set next_m [clock format [clock scan "1 month" -base [clock scan $date]] -format "%Y-%m-%d"]}]} {
+ set next_link ""
+ } else {
+ if {[catch {clock scan $next_m}]} {
+ set next_link ""
+ } else {
+ set next_link ""
+ }
+ }
+
+
set cal_stuff [calendar::one_month_display \
-item_template $item_template \
-day_template "\$day_number" \
@@ -107,6 +195,8 @@
-date $current_date \
-calendar_id_list $list_of_calendar_ids \
-url_stub_callback "calendar_portlet_display::get_url_stub" \
+ -prev_month_template $previous_link \
+ -next_month_template $next_link \
-show_calendar_name_p $show_calendar_name_p]
}