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.28 -r1.29
--- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 23 Jul 2005 13:29:35 -0000 1.28
+++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 25 Jul 2005 13:23:56 -0000 1.29
@@ -354,6 +354,9 @@
[_ dotlrn-ecommerce.application_pending]
+ <#_ (You are number @course_list.waiting_list_number@ on the wait list)#>
+
+
[_ dotlrn-ecommerce.awaiting_approval]
@@ -392,7 +395,7 @@
set grade_tree_id [parameter::get -package_id [ad_conn package_id] -parameter GradeCategoryTree -default 0]
-db_multirow -extend { fs_chunk section_folder_id section_pages_url category_name community_url course_edit_url section_add_url section_edit_url course_grades section_grades sections_url member_p sessions instructor_names prices shopping_cart_add_url attendees available_slots pending_p waiting_p approved_p instructor_p registration_approved_url button } course_list get_courses { } {
+db_multirow -extend { fs_chunk section_folder_id section_pages_url category_name community_url course_edit_url section_add_url section_edit_url course_grades section_grades sections_url member_p sessions instructor_names prices shopping_cart_add_url attendees available_slots pending_p waiting_p approved_p instructor_p registration_approved_url button waiting_list_number } course_list get_courses { } {
set button [_ dotlrn-ecommerce.add_to_cart]
@@ -431,7 +434,6 @@
set registration_approved_url [export_vars -base ecommerce/shopping-cart-add { user_id product_id }]
set member_p [dotlrn_community::member_p $community_id $user_id]
- set pending_p [dotlrn_community::member_pending_p -community_id $community_id -user_id $user_id]
set section_grades ""
set course_grades ""
@@ -527,12 +529,20 @@
set member_state [util_memoize [list dotlrn_ecommerce::section::member_state $user_id $community_id]]
+ set waiting_p 0
+ set pending_p 0
+ set approved_p 0
switch $member_state {
- "needs approval" -
- "awaiting payment" -
- "request approval" {
+ "needs approval" {
set waiting_p 1
+ set waiting_list_number [dotlrn_ecommerce::section::waiting_list_number $user_id $community_id]
}
+ "awaiting payment" {
+ set waiting_p 2
+ }
+ "request approval" {
+ set pending_p 2
+ }
"waitinglist approved" -
"payment received" -
"request approved" {
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.14 -r1.15
--- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 23 Jul 2005 15:07:37 -0000 1.14
+++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 25 Jul 2005 13:23:56 -0000 1.15
@@ -525,3 +525,36 @@
}]]]
}
+
+ad_proc -public dotlrn_ecommerce::section::waiting_list_number {
+ user_id
+ community_id
+} {
+ Return number in waiting list
+
+ @author Roel Canicula (roelmc@pldtdsl.net)
+ @creation-date 2005-07-25
+
+ @param user_id
+
+ @param community_id
+
+ @return
+
+ @error
+} {
+ return [db_string waitin_list_number {
+ select count(*)
+ from (select *
+ from dotlrn_member_rels_full rr,
+ acs_objects o
+ where rr.rel_id = o.object_id
+ and rr.rel_id <= (select rel_id
+ from dotlrn_member_rels_full
+ where community_id = :community_id
+ and user_id = :user_id)
+ and rr.community_id = :community_id
+ and rr.member_state = 'needs approval'
+ order by o.creation_date) r
+ } -default ""]
+}