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.24 -r1.25 --- openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 26 Sep 2003 06:54:44 -0000 1.24 +++ openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 26 Sep 2003 09:46:42 -0000 1.25 @@ -24,6 +24,7 @@ {view ""} {page_num ""} {date ""} + {period_days 30} {julian_date ""} } -properties { @@ -81,11 +82,9 @@ set item_add_template "" } -# big switch on the view var +set url_stub_callback "calendar_portlet_display::get_url_stub" + 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 { @@ -105,16 +104,9 @@ set next_link "\"forward" } } - -# -url_stub_callback "calendar_portlet_display::get_url_stub" \ -# -show_calendar_name_p $show_calendar_name_p] - } 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 { @@ -134,21 +126,11 @@ set next_link "\"forward" } } - - 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] + set prev_week_template "\"back" + set next_week_template "\"forward" } 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 { @@ -168,27 +150,17 @@ set next_link "\"forward" } } - - - set cal_stuff [calendar::one_month_display \ - -item_template $item_template \ - -day_template "\$day_number" \ - -date $current_date \ - -item_add_template $item_add_template \ - -calendar_id_list $list_of_calendar_ids \ - -url_stub_callback "calendar_portlet_display::get_url_stub" \ - -show_calendar_name_p $show_calendar_name_p] } if {$view == "list"} { - set cal_stuff [calendar::list_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_month_template $previous_link \ - -next_month_template $next_link \ - -show_calendar_name_p $show_calendar_name_p] + set sort_by [ns_queryget sort_by] + + set thirty_days [expr 60*60*24*30] + + set start_date [ns_fmttime [expr [ns_time] - $thirty_days] "%Y-%m-%d 00:00"] + set end_date [ns_fmttime [expr [ns_time] + $thirty_days] "%Y-%m-%d 00:00"] + + set url_template "?view=list&sort_by=\$order_by&page_num=$page_num" }