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.20 -r1.21 --- openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 28 Jul 2005 23:42:22 -0000 1.20 +++ openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 1 Aug 2005 00:06:57 -0000 1.21 @@ -66,6 +66,8 @@ 2. Complete this information. A space has opened up in %community_name%. A space has opened up in %community_name%. Please register via the website or call to get registered via phone. + Added to waiting list for %community_name% + You have been added to the waiting list for %community_name%. You will be notified by email if a space opens up. Alternately, you can use a Application approval (default <i>Note: this is customizable on a per section basis</i>) Application approval (granted spot from waiting list) @@ -118,6 +120,8 @@ Register for another course Registering for classes with %service_name% is quick and easy Reject waiver of prerequisites + Waiver of prerequites for %community_name% + You request for waiver of prerequisites for %community_name% has been received. Required %prereqs.field% was not met Return to course catalog Return to main course registration administration Index: openacs-4/packages/dotlrn-ecommerce/lib/section.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/section.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/dotlrn-ecommerce/lib/section.tcl 27 Jul 2005 23:04:42 -0000 1.18 +++ openacs-4/packages/dotlrn-ecommerce/lib/section.tcl 1 Aug 2005 00:06:57 -0000 1.19 @@ -559,7 +559,9 @@ # Map patron relationships set tree_id [parameter::get -package_id [ad_conn package_id] -parameter PatronRelationshipCategoryTree -default 0] - category_tree::map -tree_id $tree_id -object_id $community_id + if {!$tree_id == 0} { + category_tree::map -tree_id $tree_id -object_id $community_id + } # Prerequisites if { [info exists prerequisites] } { Index: openacs-4/packages/dotlrn-ecommerce/lib/user-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/user-new.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-ecommerce/lib/user-new.tcl 28 Jul 2005 23:43:43 -0000 1.8 +++ openacs-4/packages/dotlrn-ecommerce/lib/user-new.tcl 1 Aug 2005 00:06:57 -0000 1.9 @@ -106,14 +106,14 @@ if { $user_type == "participant" } { set tree_id [parameter::get -package_id [ad_conn package_id] -parameter GradeCategoryTree -default 0] - set grade_options [list {}] + set grade_options [list {"--" ""}] foreach tree [category_tree::get_tree $tree_id] { lappend grade_options [list [lindex $tree 1] [lindex $tree 0]] } if { [llength $grade_options] > 0 } { ad_form -extend -name register -form { - {grade:text(select) + {grade:text(select),optional {label "[_ dotlrn-ecommerce.Grade]"} {options {$grade_options}} } Index: openacs-4/packages/dotlrn-ecommerce/tcl/course-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/course-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn-ecommerce/tcl/course-procs.tcl 16 Jul 2005 12:51:06 -0000 1.6 +++ openacs-4/packages/dotlrn-ecommerce/tcl/course-procs.tcl 1 Aug 2005 00:06:58 -0000 1.7 @@ -50,4 +50,59 @@ -title $name] return [content::item::get_live_revision -item_id $item_id] +} + +ad_proc -private dotlrn_ecommerce::copy_course_default_email { + -community_id +} { + Copy default email templates into the template community +} { + set var_list [list community_name [dotlrn_community::get_community_name $community_id]] + db_transaction { + foreach type [list "on join" "awaiting payment" "on approval"] { + set from_addr "" + set email [_ [email_type_message_key -type $type -key body] $var_list] + set subject [_ [email_type_message_key -type $type -key subject] $var_list] + db_dml add_email "insert into dotlrn_member_emails + (community_id,subject,from_addr,email,type) + values + (:community_id,:subject,:from_addr,:email,:type)" + } + } +} + +ad_proc -private dotlrn_ecommerce::active_email_types { + {-package_id ""} +} { + list of valid email types for this dotlrn_ecommerce +} { + return [list "on join" "awaiting payment" "on approval"] +} +ad_proc -private dotlrn_ecommerce::email_type_message_key { + -type + -key +} { + Get the message key for an email type + + @param type email type + @param key message key, can by subject or body +} { + if {[string equal "subject" $key]} { + return [string map \ + [list \ + submit_app dotlrn-ecommerce.Application_submitted \ + approve_app dotlrn-ecommerce.Application_approved \ + "on join" "some stuff"] \ + $type] + } elseif {[string equal "body" $key]} { + return [string map \ + [list \ + submit_app dotlrn-ecommerce.lt_Your_application_has_been_submitted \ + approve_app dotlrn-ecommerce.lt_Your_application_to_j \ + "on join" "some stuff"] \ + $type] + } else { + error "Key must be 'subject' or 'body'" + } + } \ No newline at end of file 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 -r1.7 -r1.8 --- openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 23 Jul 2005 15:07:45 -0000 1.7 +++ openacs-4/packages/dotlrn-ecommerce/www/application-approve.tcl 1 Aug 2005 00:06:58 -0000 1.8 @@ -163,14 +163,23 @@ set actor_email [cc_email_from_party $actor_id] set community_name [dotlrn_community::get_community_name $community_id] -if {![dotlrn_community::send_member_email -community_id $community_id -to_user $user_id -type "on approval"]} { +# could be from waiting list +if {$new_member_state eq "waitinglist approved"} { + # site wide template acs_mail_lite::send \ - -to_addr $applicant_email \ - -from_addr $actor_email \ - -subject [subst "[_ dotlrn-ecommerce.Application_approved]"] \ - -body [subst "[_ dotlrn-ecommerce.lt_Your_application_to_j]"] + -to_addr $applicant_email \ + -from_addr $actor_email \ + -subject [subst "[_ dotlrn-ecommerce.lt_A_space_has_opened_up]"] \ + -body [subst "[_ dotlrn-ecommerce.lt_A_space_has_opened_up_1]"] +} else { + if {![dotlrn_community::send_member_email -community_id $community_id -to_user $user_id -type "on approval"]} { + acs_mail_lite::send \ + -to_addr $applicant_email \ + -from_addr $actor_email \ + -subject [subst "[_ dotlrn-ecommerce.Application_approved]"] \ + -body [subst "[_ dotlrn-ecommerce.lt_Your_application_to_j]"] + } } - ad_returnredirect $return_url } } \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/course-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/course-add-edit.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn-ecommerce/www/admin/course-add-edit.tcl 22 Jul 2005 00:25:16 -0000 1.5 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/course-add-edit.tcl 1 Aug 2005 00:06:58 -0000 1.6 @@ -162,6 +162,10 @@ if { ![string equal $category_ids "-1"] } { category::map_object -object_id $revision_id $category_ids } + + # add email template defaults + dotlrn_ecommerce::copy_course_default_email -community_id $community_id + } -edit_data { # New revision in the CR catch { Index: openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.adp 20 Jul 2005 04:33:20 -0000 1.3 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.adp 1 Aug 2005 00:06:58 -0000 1.4 @@ -117,4 +117,8 @@

Sections

- \ No newline at end of file + + +

Email Templates

+

Default email templates for new sections

+ \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.tcl 20 Jul 2005 04:33:20 -0000 1.6 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/course-info.tcl 1 Aug 2005 00:06:58 -0000 1.7 @@ -307,3 +307,17 @@ set template_calendar_url [export_vars -base ${template_community_url}calendar/cal-item-new { {item_type_id $template_item_type_id} {calendar_id $template_calendar_id} {view day} }] } } + +set return_url [ad_return_url] + +db_multirow -extend {edit_url} email_templates get_email_templates "select * from dotlrn_member_emails where community_id=:template_community_id" { + set edit_url [export_vars -base email-template {{community_id $template_community_id} {action $type} return_url}] +} + +template::list::create \ + -name email_templates \ + -multirow email_templates \ + -elements { + subject {label "Email subject" link_url_col edit_url} + type {label "Type"} + } \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/email-template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/email-template.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/www/admin/email-template.tcl 21 Jul 2005 22:10:24 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/email-template.tcl 1 Aug 2005 00:06:58 -0000 1.2 @@ -9,7 +9,8 @@ @arch-tag: cb528bf6-f4e5-4c87-bbe9-e987780a6709 @cvs-id $Id$ } { - section_id:notnull + {section_id ""} + {community_id ""} {action ""} {return_url ""} } -properties { @@ -28,6 +29,9 @@ "approve_app" { set type "on approval" } + "on join" { + set type $action + } default { set type "" } @@ -39,10 +43,12 @@ set title "Add/edit email template" -set community_id [db_string get_community_id { - select community_id - from dotlrn_ecommerce_section - where section_id = :section_id -}] +if {![exists_and_not_null community_id]} { + set community_id [db_string get_community_id { + select community_id + from dotlrn_ecommerce_section + where section_id = :section_id + }] +} set extra_vars [list [list action $action] [list section_id $section_id]] \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp 23 Jul 2005 15:07:58 -0000 1.8 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp 1 Aug 2005 00:06:58 -0000 1.9 @@ -46,8 +46,8 @@

#dotlrn-ecommerce.Email_templates#

#dotlrn-ecommerce.Email_t_submit_application#
-#dotlrn-ecommerce.Email_t_approve_application# - +#dotlrn-ecommerce.Email_t_approve_application#
+Welcome Message

#dotlrn-ecommerce.Related_Items#

#dotlrn-ecommerce.Product#
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl 26 Jul 2005 23:11:22 -0000 1.7 +++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/application-request.tcl 1 Aug 2005 00:06:58 -0000 1.8 @@ -43,14 +43,32 @@ ]} errmsg]} { ad_return_complaint "There was a problem with your request" $errmsg } else { - switch $member_state { + switch -- $member_state { "awaiting payment" { dotlrn_community::send_member_email -community_id $community_id -to_user $participant_id -type "awaiting payment" } + "needs approval" - + "request approval" { + set mail_from [parameter::get -package_id [ad_acs_kernel_id] -parameter OutgoingSender] + if {$member_state eq "needs approval"} { + set subject [_ dotlrn-ecommerce.lt_Added_to_waiting_list] + set body [_ dotlrn-ecommerce.lt_Added_to_waiting_list_1] + } else { + set subject [_ dotlrn-ecommerce.lt_Requested_waiver_of_prereq] + set body [_ dotlrn-ecommerce.lt_Requested_waiver_of_prereq_1] + } + + acs_mail_lite::send \ + -to_addr [cc_email_from_user_id $participant_id] \ + -from_addr $mail_from \ + -subject $subject \ + -body $body + } } ns_log notice "DEBUG:: RELATION $participant_id, $community_id, $rel_id" set wait_list_notify_email [parameter::get -package_id [ad_acs_kernel_id] -parameter AdminOwner] set mail_from [parameter::get -package_id [ad_acs_kernel_id] -parameter OutgoingSender] + ns_log notice "application-request: wait list notify: potential community is $community_id" if {[db_0or1row get_nwn { select s.notify_waiting_number,