--- loncom/interface/selfenroll.pm 2016/08/07 01:40:55 1.27.2.5
+++ loncom/interface/selfenroll.pm 2021/06/15 20:52:26 1.37
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Allow users to self-enroll in a course
#
-# $Id: selfenroll.pm,v 1.27.2.5 2016/08/07 01:40:55 raeburn Exp $
+# $Id: selfenroll.pm,v 1.37 2021/06/15 20:52:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -350,8 +350,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);
@@ -456,7 +455,7 @@ sub process_self_enroll {
}
if ($selfenroll_approval) {
my $outcome =
- &store_selfenroll_request($udom,$uname,$usec,$cdom,$cnum,
+ &store_selfenroll_request($r,$udom,$uname,$usec,$cdom,$cnum,
$selfenroll_notifylist,$owner,
$selfenroll_approval,$crstype,$lonhost,$handle);
$r->print($outcome);
@@ -536,7 +535,7 @@ sub user_can_selfenroll {
}
sub store_selfenroll_request {
- my ($udom,$uname,$usec,$cdom,$cnum,$selfenroll_notifylist,$owner,
+ my ($r,$udom,$uname,$usec,$cdom,$cnum,$selfenroll_notifylist,$owner,
$selfenroll_approval,$crstype,$lonhost,$handle) = @_;
my $namespace = 'selfenrollrequests';
my $output;
@@ -552,7 +551,7 @@ sub store_selfenroll_request {
}
if ($status eq 'pending') {
my $token = $info{$cdom.'_'.$cnum}{'token'};
- my ($statusupdate,$pendingform) = &pending_selfenrollment_form($cdom,$cnum,$crstype,$token,$lonhost);
+ my ($statusupdate,$pendingform) = &pending_selfenrollment_form($r,$cdom,$cnum,$crstype,$token,$lonhost);
if ($statusupdate eq 'pending') {
$output .= $pendingform;
}
@@ -590,7 +589,7 @@ sub store_selfenroll_request {
}
$output = &mt('Your request for self-enrollment has been recorded.').'
';
if ($status eq 'pending') {
- my ($statusupdate,$pendingform) = &pending_selfenrollment_form($cdom,$cnum,$crstype,$token,$lonhost);
+ my ($statusupdate,$pendingform) = &pending_selfenrollment_form($r,$cdom,$cnum,$crstype,$token,$lonhost);
if ($statusupdate eq 'request') {
$status = $statusupdate;
} else {
@@ -631,7 +630,7 @@ sub store_selfenroll_request {
}
sub pending_selfenrollment_form {
- my ($cdom,$cnum,$crstype,$token,$lonhost) = @_;
+ my ($r,$cdom,$cnum,$crstype,$token,$lonhost) = @_;
my ($status,$output);
my $coursetype = &Apache::lonuserutils::get_extended_type($cdom,$cnum,$crstype);
my %postvalues = (
@@ -665,9 +664,12 @@ sub pending_selfenrollment_form {
if ($buttontext eq '') {
$buttontext = &mt('Complete my enrollment');
}
+ my $hostname = &Apache::lonnet::hostname($lonhost);
my $protocol = $Apache::lonnet::protocol{$lonhost};
$protocol = 'http' if ($protocol ne 'https');
- my $enroller = $protocol.'://'.&Apache::lonnet::hostname($lonhost).'/cgi-bin/enrollqueued.pl';
+ my $alias = &Apache::lonnet::use_proxy_alias($r,$lonhost);
+ $hostname = $alias if ($alias ne '');
+ my $enroller = $protocol.'://'.$hostname.'/cgi-bin/enrollqueued.pl';
$output .= ''."\n".
''."\n".
''."\n".
@@ -792,7 +794,7 @@ sub check_registered {
'internal.sectionnums',
'internal.crosslistings'],$cdom,$cnum);
my (@allcourses,%LC_code,%affiliates,%reply);
- &Apache::loncommon::get_institutional_codes(\%settings,\@allcourses,\%LC_code);
+ &Apache::loncommon::get_institutional_codes($cdom,$cnum,\%settings,\@allcourses,\%LC_code);
if (@allcourses > 0) {
@{$affiliates{$cnum}} = @allcourses;
my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$cdom,$cnum);