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 -N -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