--- loncom/interface/selfenroll.pm 2008/06/03 03:07:38 1.4
+++ loncom/interface/selfenroll.pm 2008/07/08 01:55:52 1.7
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Allow users to self-enroll in a course
#
-# $Id: selfenroll.pm,v 1.4 2008/06/03 03:07:38 raeburn Exp $
+# $Id: selfenroll.pm,v 1.7 2008/07/08 01:55:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -92,9 +92,6 @@ sub handler {
foreach my $key (keys(%env)) {
if ($key =~ m-^user\.role\.st\./$cdom/$cnum/?(\w*)$-) {
my $sec = $1;
- if ($sec eq '') {
- $sec = &mt('none');
- }
my ($start,$end) = split(/\./,$env{$key});
my $status = 'active';
if (($end) && ($end<=$now)) {
@@ -106,6 +103,9 @@ sub handler {
if ($status eq 'active' || $status eq 'future') {
$curr_role{'status'} = $status;
$curr_role{'section'} = $sec;
+ if ($curr_role{'section'} eq '') {
+ $curr_role{'section'} = &mt('none');
+ }
$curr_role{'start'} = &Apache::lonlocal::locallocaltime($start);
$curr_role{'role'} = 'st./'.$cdom.'/'.$cnum;
if ($sec ne '') {
@@ -280,9 +280,12 @@ sub process_self_enroll {
my %userhash = &Apache::lonnet::userenvironment($udom,$uname,@info);
my ($enrolltypes,$longtypes,$alldoms) =
&get_selfenroll_filters($selfenroll_types,$udom);
- my @inststatuses = &unescape(split(/:/,$userhash{'inststatus'}));
- if (@inststatuses == 0) {
- push(@inststatuses,'other');
+ my @inststatuses;
+ if ($userhash{'inststatus'} eq '') {
+ push(@inststatuses,'other');
+ } else {
+ my @esc_statuses = split(/:/,$userhash{'inststatus'});
+ @inststatuses = map { &unescape($_); } (@esc_statuses);
}
my $selfenroll = 0;
if ($alldoms) {
@@ -310,7 +313,7 @@ sub process_self_enroll {
my ($registered,$instsec,$message) = &check_registered($cdom,$cnum);
$usec = $instsec;
if (!$registered) {
- $r->print(&mt('Self-enrollment is restricted to officially registered students.').'
');
+ $r->print(&mt('Self-enrollment is restricted to students officially registered for this course.').'
');
if ($message) {
$r->print($message);
} else {
@@ -321,7 +324,8 @@ sub process_self_enroll {
}
my $enrollresult =
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,
- undef,undef,$usec,$selfenroll_access_end,$selfenroll_access_start, 'manual',undef,$cdom.'_'.$cnum,$selfenroll);
+ undef,undef,$usec,$selfenroll_access_end,$selfenroll_access_start,
+ 'manual',undef,$cdom.'_'.$cnum,$selfenroll);
if ($enrollresult eq 'ok') {
my (%userroles,%newrole,%newgroups);
my $role = 'st';
@@ -431,7 +435,7 @@ sub print_selfenroll_types {
}
}
} else {
- $output = &mt('Self-enrollment in this course is only available to users in the following domains (with the following status): ').'