Index: openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl,v diff -u -r1.69 -r1.70 --- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 5 Feb 2006 01:49:21 -0000 1.69 +++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 24 Feb 2006 03:49:27 -0000 1.70 @@ -13,6 +13,9 @@ { orderby course_name } { groupby course_name } {show_hidden "f"} + + {active_calendar_id 0} + {all_sessions_p 0} } set memoize_max_age [parameter::get -parameter CatalogMemoizeAge -default 10800] @@ -588,7 +591,11 @@ # Build sessions set calendar_id [dotlrn_calendar::get_group_calendar_id -community_id $community_id] lappend calendar_id_list $calendar_id - set sessions [util_memoize [list dotlrn_ecommerce::section::sessions $calendar_id] $memoize_max_age] + if { $all_sessions_p && $calendar_id == $active_calendar_id } { + set sessions [dotlrn_ecommerce::section::sessions $calendar_id] + } else { + set sessions [util_memoize [list dotlrn_ecommerce::section::sessions $calendar_id] $memoize_max_age] + } set instructors [util_memoize [list dotlrn_ecommerce::section::instructors $community_id $__instructors] $memoize_max_age] Index: openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl,v diff -u -r1.35 -r1.36 --- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 23 Jan 2006 08:04:42 -0000 1.35 +++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 24 Feb 2006 03:49:26 -0000 1.36 @@ -74,8 +74,8 @@ ad_proc -public dotlrn_ecommerce::section::sessions { calendar_id } { + Return sessions - @author Roel Canicula (roelmc@pldtdsl.net) @creation-date 2005-05-20 @@ -93,6 +93,7 @@ } set days [list] + array set months [list Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12] foreach times [array names arr_sessions] { set times [split $times _] set month [lindex $times 0] @@ -126,10 +127,32 @@ set time "${start}${startampm}-${end}${endampm}" } - lappend text_sessions "$month [join [lsort -integer [set days_${month}_${start}_${end}_${startampm}_${endampm}]] ,] $time" + lappend text_sessions [list $month [join [lsort -integer [set days_${month}_${start}_${end}_${startampm}_${endampm}]] ,] $time $months($month)] } } + # Sort dates + set _text_sessions [lsort -index end -integer $text_sessions] + set text_sessions [list] + foreach _text_session $_text_sessions { + lappend text_sessions [join [lrange $_text_session 0 2]] + } + + set form [rp_getform] + set all_p_param [ns_set get $form all_sessions_p] + set active_calendar_id [ns_set get $form active_calendar_id] + + if { $all_p_param eq "" || $active_calendar_id != $calendar_id } { + # Just return 3 with more link + if { [llength $text_sessions] > 3 } { + set sessions [join [lrange $text_sessions 0 2] ",
"] + ns_set delkey $form all_sessions_p + ns_set delkey $form active_calendar_id + append sessions "
[expr [llength $text_sessions]-3] more" + return $sessions + } + } + set sessions [join $text_sessions ",
"] return $sessions