--- loncom/interface/selfenroll.pm 2009/02/05 12:27:21 1.15 +++ loncom/interface/selfenroll.pm 2009/02/09 04:11:11 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network # Allow users to self-enroll in a course # -# $Id: selfenroll.pm,v 1.15 2009/02/05 12:27:21 raeburn Exp $ +# $Id: selfenroll.pm,v 1.16 2009/02/09 04:11:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -550,16 +550,31 @@ sub store_selfenroll_request { ); my $putresult = &Apache::lonnet::put($namespace,\%selfenroll,$cdom,$cnum); if ($putresult eq 'ok') { + my %userenroll = ( + $cdom.'_'.$cnum => { + timestamp => $now, + section => $usec, + status => 'request', + }); + my $warning; + my $userresult = &Apache::lonnet::put($namespace,\%userenroll,$udom,$uname); + if ($userresult ne 'ok') { + $warning = &mt('An error occurred saving a personal record of your request.'); + } $output = &mt('Your request for self-enrollment has been recorded.').'
'. - &mt('A message will be sent to your LON-CAPA account when the course coordinator takes action on your request').'
'; + &mt('A message will be sent to your LON-CAPA account when the course coordinator takes action on your request.').'
'; my %emails = &Apache::loncommon::getemails($uname,$udom); if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) { my $address = $emails{'permanentemail'}; if ($address eq '') { $address = $emails{'notification'}; } - $output.= &mt('An e-mail will also be sent to: [_1] when this occurs.',$address); + $output.= &mt('An e-mail will also be sent to: [_1] when this occurs.',$address).'
'; + } + if ($warning) { + $output .= ''.$warning.'
'; } + if ($selfenroll_notifylist) { my $fullname = &Apache::loncommon::plainname($uname,$udom); my %courseinfo = &Apache::lonnet::coursedescription($cdom.'_'.$cnum); @@ -589,13 +604,14 @@ sub send_notification { $rawsubj = 'Self-enrollment requests processed'; push(@rawmsg,{ mt => 'Enrollment requests in the following course: [_1] have been processed.', - args => [$coursedesc], + args => ["\n$coursedesc\n"], }); } elsif ($context eq 'enroller') { $rawsubj = 'Enrollment request'; push(@rawmsg,{ mt => 'Your request for enrollment in the following course: [_1], requested on [_2], has been reviewed by a Course Coordinator.', - args => [$coursedesc,$timestamp], + args => ["\n$coursedesc\n","$timestamp\n"], + }); if (ref($textstr) eq 'ARRAY') { push(@rawmsg,@{$textstr}); @@ -604,10 +620,11 @@ sub send_notification { $rawsubj = 'Self-enrollment request'; push(@rawmsg,{ mt => 'Enrollment in the following course: [_1] was requested by [_2] on [_3].', - args => [$coursedesc,$textstr,$timestamp], + args => ["\n$coursedesc\n",$textstr,$timestamp], }, { - mt =>'As Course Coordinator, use Main Menu -> Manage Couse Users -> "Enrollment Requests" to display a list of pending enrollment requests which you can either approve or reject.' + mt =>'As Course Coordinator, use: [_1]Main Menu -> Manage Couse Users -> Enrollment Requests[_1] to display a list of pending enrollment requests,[_1] which you can either approve or reject.', + args => ["\n"], }); } my @to_notify = split(/,/,$notifylist);