Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/www/register-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn/www/register-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn/www/register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/register.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/dotlrn/www/register.tcl 17 Oct 2002 12:58:16 -0000 1.7.2.1 +++ openacs-4/packages/dotlrn/www/register.tcl 13 Mar 2003 18:35:01 -0000 1.7.2.2 @@ -50,75 +50,51 @@ # This should prevent most double clicks, leaving # the catch below to trap the rest. -if {[dotlrn_community::member_p $community_id $user_id]} { +if { [dotlrn_community::member_p $community_id $user_id] || \ + ([string equal $join_policy "needs approval"] && [dotlrn_community::member_pending_p -community_id $community_id -user_id $user_id]) } { ad_returnredirect $referer ad_script_abort } if {[catch { switch -exact $join_policy { - "open" { - dotlrn_community::add_user -member_state approved $community_id $user_id - } - "needs approval" { - dotlrn_community::add_user -member_state "needs approval" $community_id $user_id - - # Following the same proccess as spam.tcl to email - # admins in bulk. - - set segment_id [db_string select_admin_rel_segment_id {}] - set community_name [dotlrn_community::get_community_name $community_id] - set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]" - - set query "select parties.email, - decode(acs_objects.object_type, - 'user', - (select first_names - from persons - where person_id = parties.party_id), - 'group', - (select group_name - from groups - where group_id = parties.party_id), - 'rel_segment', - (select segment_name - from rel_segments - where segment_id = parties.party_id), - '') as first_names, - decode(acs_objects.object_type, - 'user', - (select last_name - from persons - where person_id = parties.party_id), - '') as last_name - from party_approved_member_map, - parties, - acs_objects - where party_approved_member_map.party_id = $segment_id - and party_approved_member_map.member_id <> $segment_id - and party_approved_member_map.member_id = parties.party_id - and parties.party_id = acs_objects.object_id" + "open" { + dotlrn_community::add_user -member_state approved $community_id $user_id + } + "needs approval" { + dotlrn_community::add_user -member_state "needs approval" $community_id $user_id + + + # Following the same proccess as spam.tcl to email + # admins in bulk. + + set segment_id [db_string select_admin_rel_segment_id {}] + set community_name [dotlrn_community::get_community_name $community_id] + set community_url "[ad_parameter -package_id [ad_acs_kernel_id] SystemURL][dotlrn_community::get_community_url $community_id]" + + set query [db_map bulk_mail_query] - - set full_name "[dotlrn::get_user_name $user_id]" - set email "[cc_email_from_party $user_id]" - set subject "$full_name ($email) has requested to join $community_name." - - set message "$full_name ($email) has requested to join $community_name. - + set full_name "[dotlrn::get_user_name $user_id]" + set email "[cc_email_from_party $user_id]" + set subject "$full_name ($email) has requested to join $community_name." + + set message "$full_name ($email) has requested to join $community_name. + Visit this link to approve or reject this request: $community_url/members " - bulk_mail::new \ - -package_id [site_node_apm_integration::get_child_package_id -package_id [dotlrn_community::get_package_id $community_id] -package_key [bulk_mail::package_key]] \ - -from_addr [ad_system_owner] \ - -subject $subject \ - -message $message \ - -query $query + set package_id [site_node_apm_integration::get_child_package_id -package_id [dotlrn_community::get_package_id $community_id] -package_key [bulk_mail::package_key]] + bulk_mail::new \ + -package_id $package_id \ + -from_addr [ad_system_owner] \ + -subject $subject \ + -message $message \ + -query $query + } } } errmsg]} { @@ -127,12 +103,13 @@ # (in which case this was likely a double click) if {[dotlrn_community::member_p $community_id $user_id]} { - ad_returnredirect $referer - ad_script_abort + ad_returnredirect $referer + ad_script_abort } else { - ns_log Error "register.tcl failed: $errmsg" - - ad_return_error "Error adding user to community" "An error occured while trying to add a user to a community. This error has been logged." + global errorInfo + ns_log Error "register.tcl failed: $errmsg\n$errorInfo" + + ad_return_error "Error adding user to community" "An error occured while trying to add a user to a community. This error has been logged." } }