--- loncom/enrollment/Enrollment.pm 2006/08/11 21:55:15 1.32 +++ loncom/enrollment/Enrollment.pm 2007/05/11 01:48:23 1.34 @@ -1,5 +1,5 @@ # Automated Enrollment manager -# $Id: Enrollment.pm,v 1.32 2006/08/11 21:55:15 albertel Exp $ +# $Id: Enrollment.pm,v 1.34 2007/05/11 01:48:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -147,7 +147,7 @@ sub update_LC { my @okusers = (); foreach my $uname (@reg_students) { if (grep/^$uname$/,@excludedstudents) { - $$logmsg .= "No re-enrollment for $uname - user was previously manually unenrolled and locked.".$linefeed; + $$logmsg .= &mt('No re-enrollment for [_1] - user was previously manually unenrolled and locked.',$uname).$linefeed; } elsif (@{$allenrolled{$uname}} > 1) { my @sections = (); my $saved; @@ -170,12 +170,12 @@ sub update_LC { push @okusers, $uname; } elsif (@sections > 1) { - $$logmsg .= "$uname appears in classlists for more than one section of this course, i.e. in sections: "; + $$logmsg .= &mt('[_1] appears in classlists for more than one section of this course, i.e. in sections: ',$uname); foreach (@sections) { $$logmsg .= " $_,"; } chop($$logmsg); - $$logmsg .= ". Because of this ambiguity, no enrollment action was taken for this student.".$linefeed; + $$logmsg .= '. '.&mt('Because of this ambiguity, no enrollment action was taken for this student.').$linefeed; } } else { @{$enrollinfo{$uname}} = @{$allenrolled{$uname}[0]}; @@ -211,7 +211,7 @@ sub update_LC { # Check for studentID changes if ( ($uidhash{$uname}) && ($uidhash{$uname} !~ /error\:/) ) { unless ( ($uidhash{$uname}) eq ($stuinfo[ $place{studentID} ]) ) { - $$logmsg .= "Change in ID for $uname. StudentID in LON-CAPA system is $uidhash{$uname}; StudentID in institutional data is $stuinfo[ $place{studentID} ]".$linefeed; + $$logmsg .= &mt('Change in ID for [_1]. StudentID in LON-CAPA system is [_2]; StudentID in institutional data is [_3].',$uname,$uidhash{$uname},$stuinfo[ $place{studentID} ]).$linefeed; } } # Check for switch from manual to auto @@ -220,15 +220,23 @@ sub update_LC { my $drop_reply = &Apache::lonnet::modifystudent($dom,$uname,'','','',undef,undef,undef,undef,$$currlist{$uname}[$sec],time,undef,undef,undef,undef,'auto','',$cid); # re-enroll as auto student if ($drop_reply !~ /^ok/) { - $$logmsg .= "An error occured during the attempt to convert $uname from a manual type to an auto type student - $drop_reply.".$linefeed; + $$logmsg .= &mt('An error occured during the attempt to convert [_1] from a manual type to an auto type student - [_2].',$uname,$drop_reply).$linefeed; } else { # re-enroll as auto student my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc); &prepare_add($authtype,$autharg,$enddate,$startdate,\@stuinfo,\%place,\$dom,\$uname,\$auth,\$authparam,\$first,\$middle,\$last,\$gene,\$usec,\$end,\$start,\$emailaddr,\$pid,\$emailenc); if ($$currlist{$uname}[$sec] ne $usec) { - $switchresult .= "Section for $uname switched from $$currlist{$uname}[$sec] to ".$usec.$linefeed; + my $showoldsec = $$currlist{$uname}[$sec]; + if ($$currlist{$uname}[$sec] eq '') { + $showoldsec = &mt('none'); + } + my $showsec = $usec; + if ($usec eq '') { + $showsec = &mt('none'); + } + $switchresult .= &mt("Section for [_1] switched from '[_2]' to '[_3]'.",$uname,$showoldsec,$showsec).$linefeed; if ($context eq 'automated') { - $$logmsg .= "Section switch for $uname from $$currlist{$uname}[$sec] to ".$usec.$linefeed; ; + $$logmsg .= &mt("Section switch for [_1] from '[_2]' to '[_3]'.",$uname,$showoldsec,$usec).$linefeed; } $switchcount ++; } @@ -244,9 +252,9 @@ sub update_LC { my $modify_access_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$enddate,$startdate,'auto','',$cid); $access = &showaccess($enddate,$startdate); if ($modify_access_result =~ /^ok/) { - $$logmsg .= "Change in access dates for $uname.".$access.$linefeed; + $$logmsg .= &mt('Change in access dates for [_1].',$uname).$access.$linefeed; } else { - $$logmsg .= "Error when attempting to change start and/or end access dates for $uname in section: ".$stuinfo[ $place{groupID} ]." -error $modify_access_result".$linefeed; + $$logmsg .= &mt('Error when attempting to change start and/or end access dates for [_1] in section: [_2] -error [_3].',$uname,$stuinfo[$place{groupID}],$modify_access_result).$linefeed; } } } @@ -269,16 +277,16 @@ sub update_LC { $access = &showaccess($enddate,$startdate); } if ($modify_section_result =~ /^ok/) { - $switchresult .= "Section for $uname switched from old section: ".$$currlist{$uname}[$sec] ." to new section: ".$stuinfo[ $place{groupID} ].".".$access.$linefeed; + $switchresult .= &mt("Section for [_1] switched from old section: '[_2]' to new section: '[_3]'.",$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ]).$access.$linefeed; if ($context eq 'automated') { - $$logmsg .= "Section switch for $uname from $$currlist{$uname}[$sec] to $stuinfo[ $place{groupID} ]".$linefeed; + $$logmsg .= &mt('Section switch for [_1] from [_2] to [_3]',$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ]).$linefeed; } $switchcount ++; } else { - $$logmsg .= "Error when attempting section change for $uname from old section ".$$currlist{$uname}[$sec]." to new section: ".$stuinfo[ $place{groupID} ]." -error: $modify_section_result".$linefeed; + $$logmsg .= &mt("Error when attempting section change for [_1], from old section: '[_2]' to new section: '[_3]' -error: [_4]",$uname,$$currlist{$uname}[$sec],$stuinfo[ $place{groupID} ],$modify_section_result).$linefeed; } } else { - $$logmsg .= "Error when attempting to expire role for $uname in old section" .$$currlist{$uname}[$sec]." -error: $expire_role_result".$linefeed; + $$logmsg .= &mt("Error when attempting to expire role for [_1] in old section: '[_2]' -error: '[_3]'.",$uname,$$currlist{$uname}[$sec],$expire_role_result).$linefeed; } } } @@ -286,15 +294,15 @@ sub update_LC { # Check for changed usernames by checking studentIDs if ( ($stuinfo[ $place{studentID} ] ne '') && (grep/^$stuinfo[ $place{studentID} ]$/,@LCids) ) { foreach my $match ( @{ $unameFromLCid{ $stuinfo[ $place{studentID} ] } } ) { - $$logmsg .= "A possible change in username has been detected for a student enrolled in this course. The existing LON-CAPA classlist contains user: $match and student ID: ".$stuinfo[ $place{studentID} ].". "; + $$logmsg .= &mt('A possible change in username has been detected for a student enrolled in this course.').' '.&mt('The existing LON-CAPA classlist contains user: [_1] and student ID: [_2].',$match,$stuinfo[ $place{studentID} ]); if (grep/^$match$/,@okusers) { - $$logmsg .= "The username $match remains in the institutional classlist, but the same student ID is used for new user: $uname now found in the institutional classlist. You may need to contact your Domain Coordinator to determine how to reolve this issue and whether to move student data files for user: $match to $uname. "; + $$logmsg .= &mt('The username [_1] remains in the institutional classlist, but the same student ID is used for new user: [_2] now found in the institutional classlist.',$match,$uname).' '.&mt('You may need to contact your Domain Coordinator to determine how to resolve this issue and whether to move student data files for user: [_1] to [_2].',$match,$uname).' '; } else { unless ($drops == 1) { - $$logmsg .= "This username - $match - has been dropped from the institutional classlist, but the student ID of this user is also used by $uname who now appears in the institutional classlist. You may need to contact your Domain Coordinator to request a move of the student data files for user: $match to $uname. "; + $$logmsg .= &mt('This username - [_1] - has been dropped from the institutional classlist, but the student ID of this user is also used by [_2] who now appears in the institutional classlist.',$match,$uname).' '.&mt('You may need to contact your Domain Coordinator to request a move of the student data files for user: [_1] to [_2].',$match,$uname).' '; } } - $$logmsg .= "Because of this student ID conflict, the new username - $uname - has not been added to the LON-CAPA classlist.".$linefeed; + $$logmsg .= &mt('Because of this student ID conflict, the new username - [_1] - has not been added to the LON-CAPA classlist',$uname).$linefeed; } } elsif ($adds == 1) { my ($auth,$authparam,$first,$middle,$last,$gene,$usec,$end,$start,$emailaddr,$pid,$emailenc); @@ -349,7 +357,7 @@ sub update_LC { &mt('For [_1] students, photos ',$numphoto). $lt{$type}.'