Index: openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info,v diff -u -r1.33 -r1.34 --- openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 1 Sep 2005 20:58:54 -0000 1.33 +++ openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 6 Sep 2005 03:23:00 -0000 1.34 @@ -22,6 +22,7 @@ + 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.52 -r1.53 --- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 6 Sep 2005 01:12:10 -0000 1.52 +++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 6 Sep 2005 03:23:00 -0000 1.53 @@ -469,7 +469,20 @@ } } +# these are the communities that will have patron information +# only check these for patron information + +set patron_communities [db_list patron_communities { + select r.community_id from + dotlrn_member_rels_full r, + acs_objects o + where o.object_id = r.rel_id + and r.member_state in ('request approval', 'request approved', 'needs approval', 'waitinglist approved') + and o.creation_user=:user_id + and r.user_id <> o.creation_user +}] + set grade_tree_id [parameter::get -package_id [ad_conn package_id] -parameter GradeCategoryTree -default 0] if { $offer_code_p } { @@ -693,43 +706,13 @@ # Get the patron information set patron_message "" - # get waiting list requests - db_multirow -extend {waiting_list_number} waiting_lists waiting_lists { - select r.user_id as participant_id, - acs_object__name(r.user_id) as name, r.member_state - from - dotlrn_member_rels_full r, - acs_objects o - where o.object_id = r.rel_id - and r.community_id = :community_id - and r.member_state in ('request approval', 'request approved', 'needs approval', 'waitinglist approved') - and o.creation_user=:user_id - and r.user_id <> o.creation_user - } { + + if {[lsearch $patron_communities $community_id] >= 0} { + - set waiting_list_number [util_memoize [list dotlrn_ecommerce::section::waiting_list_number $participant_id $community_id] $memoize_max_age] - - set registration_approved_url [export_vars -base ecommerce/shopping-cart-add { user_id product_id participant_id}] - - switch $member_state { - "request approval" { - append patron_message "$name has a prerequisite application pending." - } - "request approved" { - append patron_message "$name has been accepted.
- [_ dotlrn-ecommerce.lt_Continue_Registration]
" - - } - "needs approval" { - append patron_message "$name is number $waiting_list_number on waiting list" - } - "waitinglist approved" { - append patron_message "There is a place for $name.
[_ dotlrn-ecommerce.lt_Continue_Registration]
" - } - } + set patron_message [util_memoize [list dotlrn_ecommerce::patron_catalog_message $community_id $user_id $product_id] $memoize_max_age] } - # HAM : if we don't have an instructor id set instructor_p -1 if { [exists_and_not_null instructor_ids] } { Index: openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 5 Sep 2005 03:10:27 -0000 1.8 +++ openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 6 Sep 2005 03:25:21 -0000 1.9 @@ -248,6 +248,58 @@ } } + + +ad_proc -public dotlrn_ecommerce::patron_catalog_message { + community_id + user_id + product_id +} { + Return a string to put into a patron's catalog for a given + section/community +} { + set memoize_max_age [parameter::get -parameter CatalogMemoizeAge -default 10800] + set patron_message "" + # get waiting list requests + db_multirow -extend {waiting_list_number} waiting_lists waiting_lists { + select r.user_id as participant_id, + acs_object__name(r.user_id) as name, r.member_state + from + dotlrn_member_rels_full r, + acs_objects o + where o.object_id = r.rel_id + and r.community_id = :community_id + and r.member_state in ('request approval', 'request approved', 'needs approval', 'waitinglist approved') + and o.creation_user=:user_id + and r.user_id <> o.creation_user + } { + + set waiting_list_number [util_memoize [list dotlrn_ecommerce::section::waiting_list_number $participant_id $community_id] $memoize_max_age] + + set registration_approved_url [export_vars -base ecommerce/shopping-cart-add { user_id product_id participant_id}] + + switch $member_state { + "request approval" { + append patron_message "$name has a prerequisite application pending." + } + "request approved" { + append patron_message "$name has been accepted.
+ [_ dotlrn-ecommerce.lt_Continue_Registration]
" + + } + "needs approval" { + append patron_message "$name is number $waiting_list_number on waiting list" + } + "waitinglist approved" { + append patron_message "There is a place for $name.
[_ dotlrn-ecommerce.lt_Continue_Registration]
" + } + } + } + return $patron_message +} + + + ad_proc -public dotlrn_ecommerce::disallow_access_to_approved_users { } { Don't allow approved users who haven't completed the registration to access the dotLRN community 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.27 -r1.28 --- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 6 Sep 2005 02:48:28 -0000 1.27 +++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 6 Sep 2005 03:23:00 -0000 1.28 @@ -178,7 +178,10 @@ util_memoize_flush [list dotlrn_ecommerce::section::member_price $section_id] util_memoize_flush [list dotlrn_ecommerce::section::application_assessment $section_id] util_memoize_flush [list dotlrn_ecommerce::section::section_zones $community_id] + util_memoize_flush [list dotlrn_ecommerce::section::patron_catalog_message $community_id] util_memoize_flush [list dotlrn_ecommerce::section::has_discount_p $product_id] + util_memoize_flush [list dotlrn_ecommerce::section::has_discount_p $product_id] + # not exactly flushing cache, but is in involved in keeping # section ifno up to date dotlrn_ecommerce::section::approve_next_in_waiting_list $community_id