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.18 --- 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 8 Aug 2006 21:26:18 -0000 1.18 @@ -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,25 +20,48 @@ set portlet_mode_p 1 } +set url_stub_callback "" +set page_num_urlvar "" + +if { [info exists calendar_id_list] } { + if {[llength $calendar_id_list] > 1} { + set force_calendar_id [calendar::have_private_p -return_id 1 -calendar_id_list $calendar_id_list -party_id [ad_conn user_id]] + } else { + set force_calendar_id [lindex $calendar_id_list 0] + } + + calendar::get -calendar_id $force_calendar_id -array force_calendar + set base_url [apm_package_url_from_id $force_calendar(package_id)] +} else { + 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 } +if { ![info exists show_calendar_name_p] } { + set show_calendar_name_p 1 +} + if {[exists_and_not_null calendar_id_list]} { set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] } else { @@ -76,6 +105,7 @@ # Create the multirow that holds the calendar information +# NOTE: added show_calendarname_p to determine if we want to show the calendar name in [ ] multirow create items \ event_name \ event_url \ @@ -114,7 +144,7 @@ t \ "" \ "" \ - "" + "" } set current_day $first_julian_date_of_month @@ -148,6 +178,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 +196,8 @@ 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 +223,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 +241,8 @@ 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 +253,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 +272,8 @@ 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 @@ -246,6 +294,7 @@ t \ 0 \ "" \ - "" + "" + } }