Index: openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 8 Jul 2005 11:50:41 -0000 1.6 +++ openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 8 Jul 2005 15:51:44 -0000 1.7 @@ -30,6 +30,7 @@ Back to shopping cart Completing Your Order: Verify and submit order Completing Your Order + Continue Registration. for %first_names% %last_name% (if you're not %first_names% %last_name% for the current purchases Hold slot and wait for confirmation @@ -61,7 +62,10 @@ To complete your order, submit this form, and confirm the information on the following page. to send us your order! + User requests for approval + Users in waiting list Users related to the %patron_name% + Your application was approved. Your Shopping Cart is empty. Order list Paid By 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.10 -r1.11 --- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 8 Jul 2005 11:06:50 -0000 1.10 +++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 8 Jul 2005 15:51:44 -0000 1.11 @@ -302,7 +302,7 @@ actions { label "" display_template { - + [_ dotlrn-ecommerce.add_to_cart] @@ -320,6 +320,13 @@ [_ dotlrn-ecommerce.awaiting_approval] + +

+

+ [_ dotlrn-ecommerce.lt_Your_application_was_]

+ [_ dotlrn-ecommerce.lt_Continue_Registration] +

+
} html { width 40% nowrap } } @@ -345,7 +352,7 @@ set grade_tree_id [parameter::get -package_id [ad_conn package_id] -parameter GradeCategoryTree -default 0] -db_multirow -extend { category_name community_url course_edit_url section_add_url section_edit_url course_grades section_grades sections_url member_p sessions instructors prices shopping_cart_add_url attendees available_slots pending_p waiting_p } course_list get_courses { } { +db_multirow -extend { category_name community_url course_edit_url section_add_url section_edit_url course_grades section_grades sections_url member_p sessions instructors prices shopping_cart_add_url attendees available_slots pending_p waiting_p approved_p } course_list get_courses { } { # set mapped [category::get_mapped_categories $course_id] # foreach element $mapped { @@ -462,4 +469,15 @@ and r.object_id_two = :user_id and m.member_state = 'request approval') } -default 0] + + set approved_p [db_string approved { + select 1 + where exists (select * + from acs_rels r, + membership_rels m + where r.rel_id = m.rel_id + and r.object_id_one = :community_id + and r.object_id_two = :user_id + and m.member_state = 'request approved') + } -default 0] } Index: openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 8 Jul 2005 15:51:44 -0000 1.1 @@ -0,0 +1,32 @@ +# packages/dotlrn-ecommerce/www/admin/application-approve.tcl + +ad_page_contract { + + + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-06-23 + @arch-tag: 93f47ba6-c04e-419a-bcd6-60bb95553236 + @cvs-id $Id: application-approve.tcl,v 1.1 2005/07/08 15:51:44 roelc Exp $ +} { + community_id:integer,notnull + user_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + +# Check for security +db_dml approve_request { + update membership_rels + set member_state = 'request approved' + where rel_id in (select r.rel_id + from acs_rels r, + membership_rels m + where r.rel_id = m.rel_id + and r.object_id_one = :community_id + and r.object_id_two = :user_id + and m.member_state = 'request approval') +} + +ad_returnredirect applications Index: openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl 8 Jul 2005 15:51:44 -0000 1.1 @@ -0,0 +1,21 @@ +# packages/dotlrn-ecommerce/www/admin/application-reject.tcl + +ad_page_contract { + + + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-07-01 + @arch-tag: 93f47ba6-c04e-419a-bcd6-60bb95553236 + @cvs-id $Id: application-reject.tcl,v 1.1 2005/07/08 15:51:44 roelc Exp $ +} { + community_id:integer,notnull + user_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + +dotlrn_community::membership_reject -community_id $community_id -user_id $user_id + +ad_returnredirect applications Index: openacs-4/packages/dotlrn-ecommerce/www/applications.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/applications.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/applications.adp 8 Jul 2005 15:51:44 -0000 1.1 @@ -0,0 +1,14 @@ + + Pending Applications + {Pending Applications} + + +

#dotlrn-ecommerce.lt_Users_in_waiting_list#

+

+ +

+ + +

#dotlrn-ecommerce.lt_User_requests_for_app#

+

+ Index: openacs-4/packages/dotlrn-ecommerce/www/applications.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/applications.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 8 Jul 2005 15:51:44 -0000 1.1 @@ -0,0 +1,195 @@ +# packages/dotlrn-ecommerce/www/admin/applications.tcl + +ad_page_contract { + + + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-06-23 + @arch-tag: 47e50b22-750a-4337-98ed-747058310624 + @cvs-id $Id: applications.tcl,v 1.1 2005/07/08 15:51:44 roelc Exp $ +} { + +} -properties { +} -validate { +} -errors { +} + +template::list::create \ + -name "applications" \ + -multirow "applications" \ + -no_data "No pending applications" \ + -page_flush_p 1 \ + -elements { + community_name { + label "Section" + } + person_name { + label "Participant" + } + member_state { + label "Member Request" + display_template { + User is in waiting list + } + } + assessment_result { + label "Application" + display_template { + + View + + + N/A + + } + html { align center } + } + actions { + label "" + display_template { + Approve + Reject + } + html { align center } + } + } + +db_multirow -extend { approve_url reject_url asm_url } applications applications { + select pretty_name as community_name, person__name(user_id) as person_name, member_state, c.community_id, user_id + from dotlrn_member_rels_full r, dotlrn_communities_all c + where r.community_id = c.community_id + and member_state = 'needs approval' +} { + set approve_url [export_vars -base application-approve { community_id user_id }] + set reject_url [export_vars -base application-reject { community_id user_id }] + + # Get associated assessment + if { [db_0or1row assessment { + select ss.session_id + + from dotlrn_ecommerce_section s, + (select c.* + from dotlrn_catalogi c, + cr_items i + where c.course_id = i.live_revision) c, + (select a.* + from as_assessmentsi a, + cr_items i + where a.assessment_id = i.latest_revision) a, + as_sessions ss + + where s.community_id = :community_id + and s.course_id = c.item_id + and c.assessment_id = a.item_id + and a.assessment_id = ss.assessment_id + and ss.subject_id = :user_id + + order by creation_datetime desc + + limit 1 + }] } { + set asm_url [export_vars -base /assessment/asm-admin/results-session { session_id }] + } +} + + +template::list::create \ + -name "for_approval" \ + -multirow "for_approval" \ + -no_data "No requests for approval" \ + -page_flush_p 1 \ + -elements { + community_name { + label "Section" + } + person_name { + label "Participant" + } + member_state { + label "Member Request" + display_template { + User is holding a spot and waiting for approval + } + } + assessment_result { + label "Application" + display_template { + + View + + + N/A + + } + html { align center } + } + actions { + label "" + display_template { + Approve + Reject + } + html { align center } + } + } + +set user_id [ad_conn user_id] + +set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set admin_p [permission::permission_p -object_id $cc_package_id -privilege "admin"] + +if { $admin_p } { + set user_clause "" +} else { + set user_clause [subst { + and c.community_id in (select community_id + from dotlrn_member_rels_full + where user_id = $user_id + and rel_type = 'dotlrn_admin_rel') + }] +} + +db_multirow -extend { approve_url reject_url asm_url } for_approval for_approval [subst { + select pretty_name as community_name, + person__name(user_id) as person_name, + member_state, + c.community_id, + user_id + from dotlrn_member_rels_full r, dotlrn_communities_all c + where r.community_id = c.community_id + and member_state = 'request approval' + + $user_clause +}] { + set approve_url [export_vars -base application-approve { community_id user_id }] + set reject_url [export_vars -base application-reject { community_id user_id }] + + # Get associated assessment + if { [db_0or1row assessment { + select ss.session_id + + from dotlrn_ecommerce_section s, + (select c.* + from dotlrn_catalogi c, + cr_items i + where c.course_id = i.live_revision) c, + (select a.* + from as_assessmentsi a, + cr_items i + where a.assessment_id = i.latest_revision) a, + as_sessions ss + + where s.community_id = :community_id + and s.course_id = c.item_id + and c.assessment_id = a.item_id + and a.assessment_id = ss.assessment_id + and ss.subject_id = :user_id + + order by creation_datetime desc + + limit 1 + }] } { + set asm_url [export_vars -base /assessment/asm-admin/results-session { session_id }] + } +} Index: openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp 4 Jul 2005 13:39:47 -0000 1.5 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/index.adp 8 Jul 2005 15:51:43 -0000 1.6 @@ -26,7 +26,7 @@

  • Instructors - Community List
  • Assistant Instuctors - Community List
  • Manage Category Trees -
  • Pending Applications +
  • Pending Applications Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl 8 Jul 2005 11:03:52 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/prerequisite-confirm.tcl 8 Jul 2005 15:51:43 -0000 1.3 @@ -35,41 +35,57 @@ # See if we need to check for prerequisites set shopping_cart_add_url [export_vars -base shopping-cart-add { user_id participant_id product_id item_count }] -template::multirow create prereqs field section user -db_foreach prereqs { - select m.tree_id, m.user_field, s.community_id - from dotlrn_ecommerce_prereqs p, - dotlrn_ecommerce_prereq_map m, - dotlrn_ecommerce_section s - where p.tree_id = m.tree_id - and p.section_id = s.section_id - and s.section_id = :section_id -} { - set section_prereqs [db_list section_prereqs { - select category_id - from category_object_map_tree - where tree_id = :tree_id - and object_id = :community_id - }] - set user_prereqs [db_list participant_prereqs { - select category_id - from category_object_map_tree - where tree_id = :tree_id - and object_id = :participant_id - }] +set approved_p [db_string approved { + select 1 + where exists (select * + from acs_rels r, + membership_rels m + where r.rel_id = m.rel_id + and r.object_id_one = :community_id + and r.object_id_two = :participant_id + and m.member_state = 'request approved') +} -default 0] - # Check if prereq is met - if { [llength $user_prereqs] > 0 } { - foreach user_prereq $user_prereqs { - if { [llength $section_prereqs] > 0 && [lsearch $section_prereqs $user_prereq] == -1 } { - # Prereq not met - template::multirow append prereqs [category_tree::get_name $tree_id] +if { ! $approved_p } { + + template::multirow create prereqs field section user + db_foreach prereqs { + select m.tree_id, m.user_field, s.community_id + from dotlrn_ecommerce_prereqs p, + dotlrn_ecommerce_prereq_map m, + dotlrn_ecommerce_section s + where p.tree_id = m.tree_id + and p.section_id = s.section_id + and s.section_id = :section_id + } { + set section_prereqs [db_list section_prereqs { + select category_id + from category_object_map_tree + where tree_id = :tree_id + and object_id = :community_id + }] + + set user_prereqs [db_list participant_prereqs { + select category_id + from category_object_map_tree + where tree_id = :tree_id + and object_id = :participant_id + }] + + # Check if prereq is met + if { [llength $user_prereqs] > 0 } { + foreach user_prereq $user_prereqs { + if { [llength $section_prereqs] > 0 && [lsearch $section_prereqs $user_prereq] == -1 } { + # Prereq not met + template::multirow append prereqs [category_tree::get_name $tree_id] + } } + } else { + template::multirow append prereqs [category_tree::get_name $tree_id] [join $section_prereqs ", "] [join $user_prereqs ", "] } - } else { - template::multirow append prereqs [category_tree::get_name $tree_id] [join $section_prereqs ", "] [join $user_prereqs ", "] } + } if { [template::multirow size prereqs] == 0 } { Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp 8 Jul 2005 11:03:52 -0000 1.5 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp 8 Jul 2005 15:51:43 -0000 1.6 @@ -19,8 +19,10 @@ - - + + + + @@ -31,28 +33,30 @@ - - - + + + + + + + + + - - - - @@ -70,7 +74,7 @@ - + @@ -147,6 +151,6 @@ Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl 8 Jul 2005 11:03:52 -0000 1.4 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.tcl 8 Jul 2005 15:51:43 -0000 1.5 @@ -55,6 +55,12 @@ set user_session_id [ec_get_user_session_id] ec_create_new_session_if_necessary [export_url_vars user_id] +set viewing_user_id [ad_conn user_id] + +if { $viewing_user_id } { + source [acs_root_dir]/packages/dotlrn-ecommerce/www/ecommerce/check-shopping-cart.tcl +} + # This is not being used anywhere #set n_items_in_cart [db_string get_n_items " # select count(*)
    #dotlrn-ecommerce.Item_Description##dotlrn-ecommerce.Paid_By##dotlrn-ecommerce.Participant##dotlrn-ecommerce.Paid_By##dotlrn-ecommerce.Participant# #dotlrn-ecommerce.Quantity# #dotlrn-ecommerce.PriceItem# #dotlrn-ecommerce.Subtotal_1# @in_cart.product_name@ - @in_cart.patron_name@ - - #dotlrn-ecommerce.lt_Participant_pays_for_# (#dotlrn-ecommerce.change#) - + @in_cart.patron_name@ + + #dotlrn-ecommerce.lt_Participant_pays_for_# (#dotlrn-ecommerce.change#) + + @in_cart.patron_name@ + + + Group: @in_cart.participant_name@ + + + @in_cart.participant_name@ + + (#dotlrn-ecommerce.change#) + - @in_cart.patron_name@ - - - Group: @in_cart.participant_name@ - - - @in_cart.participant_name@ - - (#dotlrn-ecommerce.change#) - @in_cart.quantity@
    #dotlrn-ecommerce.Total#colspan="3" align="right">#dotlrn-ecommerce.Total# @product_counter@