--- loncom/interface/selfenroll.pm 2010/01/18 15:58:25 1.25.2.1 +++ loncom/interface/selfenroll.pm 2012/05/25 03:04:59 1.27.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Allow users to self-enroll in a course # -# $Id: selfenroll.pm,v 1.25.2.1 2010/01/18 15:58:25 raeburn Exp $ +# $Id: selfenroll.pm,v 1.27.2.1 2012/05/25 03:04:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -54,9 +54,11 @@ sub handler { &Apache::lonlocal::get_language_handle($r); &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['courseid']); my $js = &Apache::createaccount::catreturn_js(); - my ($coursechk,$courseid) = &validate_course_id($env{'form.courseid'}); - if ($coursechk ne 'ok') { - &page_header($r,$courseid,$js); + + my $courseid = Apache::lonnet::is_course($env{'form.courseid'}); + + unless ($courseid) { + &page_header($r,$env{'form.courseid'},$js); $r->print('

'.&mt('Self-enrollment error').'

'. ''. &mt('Invalid domain or course number').''); @@ -359,17 +361,6 @@ sub page_footer { return; } -sub validate_course_id { - my ($courseid) = @_; - my ($cdom,$cnum) = ($env{'form.courseid'} =~ /^($match_domain)_($match_courseid)$/); - if ($cdom ne '' && $cnum ne '') { - if (&Apache::lonnet::is_course($cdom,$cnum)) { - return ('ok',$courseid); - } - } - return; -} - sub user_is_known { my $known = 0; if ($env{'user.name'} ne '' && $env{'user.name'} ne 'public' @@ -564,7 +555,7 @@ sub store_selfenroll_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('To access your LON-CAPA message, go to the Main Menu and click on "Send and Receive Messages".'); + &mt('To access your LON-CAPA message, go to the Main Menu and click on "Send and Receive Messages".').'
'; my %emails = &Apache::loncommon::getemails($uname,$udom); if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) { my $address = $emails{'permanentemail'}; @@ -577,7 +568,7 @@ sub store_selfenroll_request { $output .= ''.$warning.'
'; } - $output .= '
'.&Apache::loncoursequeueadmin::queued_selfenrollment(); + $output .= &Apache::loncoursequeueadmin::queued_selfenrollment(); if ($selfenroll_notifylist) { my $fullname = &Apache::loncommon::plainname($uname,$udom);