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.7 -r1.8 --- openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 4 Jul 2005 13:39:47 -0000 1.7 +++ openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 7 Jul 2005 00:35:32 -0000 1.8 @@ -31,6 +31,7 @@ + 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.3 -r1.4 --- openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 6 Jul 2005 16:51:08 -0000 1.3 +++ openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 7 Jul 2005 00:35:32 -0000 1.4 @@ -52,6 +52,7 @@ Price/Item Push Quantity + Register for this Course Subtotal: Subtotal Tax: 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.7 -r1.8 --- openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 4 Jul 2005 14:28:32 -0000 1.7 +++ openacs-4/packages/dotlrn-ecommerce/lib/tree-chunk.tcl 7 Jul 2005 00:35:32 -0000 1.8 @@ -302,9 +302,13 @@ actions { label "" display_template { - + [_ dotlrn-ecommerce.add_to_cart] + + + [_ dotlrn-ecommerce.register] + [_ dotlrn-ecommerce.edit] @@ -353,7 +357,14 @@ set section_edit_url [export_vars -base admin/section-add-edit { course_id section_id return_url }] set sections_url [export_vars -base sections { course_id }] - set shopping_cart_add_url [export_vars -base ecommerce/shopping-cart-add { user_id product_id }] + # HAM : check NoPayment parameter + # if we're not asking for payment, change shopping cart url + # to dotlrn-ecommerce/register + if { [parameter::get -package_id [ad_conn package_id] -parameter NoPayment -default 0] } { + set shopping_cart_add_url [export_vars -base register/ { community_id product_id}] + } else { + set shopping_cart_add_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] @@ -431,5 +442,10 @@ } set prices \$$prices + + # HAM : if the NoPayment parameter is set to "1" don't show the + if { [parameter::get -package_id [ad_conn package_id] -parameter NoPayment -default 0] } { + set prices "" + } } } \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl 6 Jul 2005 04:58:13 -0000 1.8 +++ openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl 7 Jul 2005 00:35:33 -0000 1.9 @@ -25,8 +25,14 @@ @error } { - rel_types::new -supertype dotlrn_member_rel -role_two student dc_student_rel "dotLRN Club Student" "dotLRN Club Students" dotlrn_club 0 "" user 0 "" - + # add new rel types for student and instructors + # Roel: Figure out why this is failing but dc_student_rel + # is being created + catch { + rel_types::new -supertype dotlrn_member_rel -role_two instructor dc_instructor_rel "dotLRN Club Instructor" "dotLRN Club Instructors" dotlrn_club 0 "" user 0 "" + rel_types::new -supertype dotlrn_member_rel -role_two student dc_student_rel "dotLRN Club Student" "dotLRN Club Students" dotlrn_club 0 "" user 0 "" + } + rel_types::new -role_one user -role_two user patron_rel "Patron" "Patrons" user 0 65535 user 0 65535 # Associate a dotlrn_catalog course to an assessment session result @@ -40,13 +46,6 @@ set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog] set sort_order [expr [llength $attribute_list] + 1] - # add new rel types for student and instructors - # Roel: Figure out why this is failing but dc_student_rel - # is being created - catch { - rel_types::new -supertype dotlrn_member_rel -role_two instructor dc_instructor_rel "dotLRN Club Instructor" "dotLRN Club Instructors" dotlrn_club 0 "" user 0 "" - } - content::type::attribute::new \ -content_type "dotlrn_catalog" \ -attribute_name "community_id" \ Index: openacs-4/packages/dotlrn-ecommerce/www/register/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/register/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/register/index.adp 7 Jul 2005 00:35:33 -0000 1.1 @@ -0,0 +1,4 @@ + +@title;noquote@ + +@reg_message;noquote@ \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/register/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/register/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/register/index.tcl 7 Jul 2005 00:35:33 -0000 1.1 @@ -0,0 +1,45 @@ +# packages/dotlrn-ecommerce/register/index.tcl + +ad_page_contract { + + This is where users should register for a course + only IF the dotlrn-ecommerce parameter NoPayment + is set to "1" which means the site + does not ask for payment when users register for a course + thus totally bypassing shopping cart and the checkout process. + + @author Hamilton Chua (hamilton.chua@gmail.com) + @creation-date 2005-05-19 +} { + community_id + product_id +} + +set title "Course Registration" + +# verify that NoPayment is set to "1" +# if it's not set to "1", redirect to shopping cart +if { ![parameter::get -package_id [ad_conn package_id] -parameter NoPayment -default 0] } { + ad_returnredirect "/dotlrn-ecommerce/ecommerce/shopping-cart" +} + +# put other checks here +# e.g check for Max Participants etc. + +# make sure user is logged in and registered +set user_id [ad_verify_and_get_user_id] + +if { $user_id == 0 } { + set register_url "../ecommerce/login?return_url=[ns_urlencode [ad_conn url]?community_id=$community_id&product_id=$product_id]" + ad_returnredirect $register_url + ad_script_abort +} else { + if { [exists_and_not_null community_id] } { + # register the user + dotlrn_community::add_user $community_id $user_id + set reg_message "Thank you for registering....
Placeholder for complete message" + } else { + set reg_message "Invalid community id" + } + +}