Index: openacs-4/packages/calendar/www/view-month-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-month-display.tcl,v diff -u -r1.17 -r1.17.2.1 --- openacs-4/packages/calendar/www/view-month-display.tcl 6 May 2004 15:21:41 -0000 1.17 +++ openacs-4/packages/calendar/www/view-month-display.tcl 19 Jun 2005 07:49:35 -0000 1.17.2.1 @@ -1,8 +1,14 @@ +if {![info exists add_p] || [string equal "" $add_p]} { + set add_p t +} +if {![info exists link_day_p] || [string equal "" $link_day_p]} { + set link_day_p t +} if {![info exists date] || [empty_string_p $date]} { # Default to todays date in the users (the connection) timezone set server_now_time [dt_systime] set user_now_time [lc_time_system_to_conn $server_now_time] - set date [lc_time_fmt $user_now_time "%x"] + set date $user_now_time } dt_get_info $date @@ -14,20 +20,26 @@ set portlet_mode_p 1 } +set url_stub_callback "" +set page_num_urlvar "" +set base_url "" if {[info exists portlet_mode_p] && $portlet_mode_p} { set page_num_urlvar "&page_num=$page_num" set item_template "\${url_stub}cal-item-view?show_cal_nav=0&return_url=[ad_urlencode "../"]&action=edit&cal_item_id=\$item_id" set prev_month_template "?view=month&date=\[ad_urlencode \$prev_month\]&page_num=$page_num" set next_month_template "?view=month&date=\[ad_urlencode \$next_month\]&page_num=$page_num" set url_stub_callback "calendar_portlet_display::get_url_stub" -} else { +} elseif {![info exists item_template] || [string equal "" $item_template]} { + # allow item_template to be passed in as a parameter set item_template "cal-item-view?cal_item_id=\$item_id" - set prev_month_template "view?view=month&\date=[ad_urlencode $prev_month]" - set next_month_template "view?view=month&\date=[ad_urlencode $next_month]" - set url_stub_callback "" - set page_num_urlvar "" - set base_url "" +} +# allow prev_month_template and next_month_template to be passed in +if {![info exists prev_month_template] || [string equal "" $prev_month_template]} { + set prev_month_template "view?view=month&date=\[ad_urlencode \$prev_month\]" } +if {![info exists next_month_template] || [string equal "" $next_month_template]} { + set next_month_template "view?view=month&date=\[ad_urlencode \$next_month\]" +} if { ![info exists show_calendar_name_p] } { set show_calendar_name_p 1 @@ -148,6 +160,11 @@ -current_day $current_day \ -today_julian_date $today_julian_date \ -first_julian_date_of_month $first_julian_date_of_month] + if {$link_day_p} { + set day_link "?view=day&date=[dt_julian_to_ansi $current_day]&$page_num_urlvar" + } else { + set day_link "" + } multirow append items \ "" \ "" \ @@ -161,7 +178,7 @@ f \ 0 \ "${base_url}cal-item-new?date=[dt_julian_to_ansi $current_day]&start_time=&end_time" \ - "?view=day&date=[dt_julian_to_ansi $current_day]&$page_num_urlvar" + $day_link } } @@ -187,7 +204,11 @@ -current_day $current_day \ -today_julian_date $today_julian_date \ -first_julian_date_of_month $first_julian_date_of_month] - + if {$link_day_p} { + set day_link "?view=day&date=[dt_julian_to_ansi $current_day]&$page_num_urlvar" + } else { + set day_link "" + } multirow append items \ $name \ [subst $item_template] \ @@ -201,7 +222,7 @@ f \ $time_p \ "${base_url}cal-item-new?date=[dt_julian_to_ansi $current_day]&start_time=&end_time" \ - "?view=day&date=[dt_julian_to_ansi $current_day]&$page_num_urlvar" + $day_link } # Add cells for remaining days inside the month @@ -212,6 +233,12 @@ -today_julian_date $today_julian_date \ -first_julian_date_of_month $first_julian_date_of_month] + if {$link_day_p} { + set day_link "?view=day&date=[dt_julian_to_ansi $current_day]&$page_num_urlvar" + } else { + set day_link "" + } + multirow append items \ "" \ "" \ @@ -225,7 +252,7 @@ f \ 0 \ "${base_url}cal-item-new?date=[dt_julian_to_ansi $current_day]&start_time=&end_time" \ - "?view=day&date=[dt_julian_to_ansi $current_day]&$page_num_urlvar" + $day_link } # Add cells for remaining days outside the month