--- loncom/interface/selfenroll.pm 2010/01/18 15:58:25 1.25.2.1 +++ loncom/interface/selfenroll.pm 2012/05/16 21:19:39 1.27 @@ -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 2012/05/16 21:19:39 droeschl 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').''); @@ -342,8 +344,7 @@ sub enrollment_limit_check { sub page_header { my ($r,$courseid,$js,$desc) = @_; my $start_page = - &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course',$js, - {'no_inline_link' => 1,}); + &Apache::loncommon::start_page('Self-enroll in a LON-CAPA course',$js); $r->print($start_page); &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::createaccount::selfenroll_crumbs($r,$courseid,$desc); @@ -359,17 +360,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 +554,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 +567,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);