--- loncom/interface/Attic/londropadd.pm 2003/12/08 23:13:17 1.93 +++ loncom/interface/Attic/londropadd.pm 2003/12/12 18:04:38 1.94 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.93 2003/12/08 23:13:17 albertel Exp $ +# $Id: londropadd.pm,v 1.94 2003/12/12 18:04:38 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -211,10 +211,7 @@ sub print_upload_manager_header { &mt('Total number of records found in file: [_1].',$distotal). "\n". "


\n"); - $r->print(&mt('Enter as many fields as you can. '. - 'The system will inform you and bring you back to '. - 'this page if the data selected is insufficient to '. - 'enroll students in your class.')."
\n"); + $r->print(&mt('Enter as many fields as you can. The system will inform you and bring you back to this page if the data selected is insufficient to enroll students in your class.')."
\n"); $r->print(&hidden_input('action','upload'). &hidden_input('state','got_file'). &hidden_input('associate',''). @@ -625,8 +622,8 @@ sub enroll_single_student { $r->print(&make_dates_default($startdate,$enddate)); } - $r->print('

Enrolling Student

'); - $r->print('

Enrolling '.$ENV{'form.cuname'}." \@ ". + $r->print('

'.&mt('Enrolling Student').'

'); + $r->print('

'.&mt('Enrolling').' '.$ENV{'form.cuname'}." \@ ". $ENV{'form.lcdomain'}.'

'); if (($ENV{'form.cuname'})&&($ENV{'form.cuname'}!~/\W/)&& ($ENV{'form.lcdomain'})&&($ENV{'form.lcdomain'}!~/\W/)) { @@ -638,12 +635,12 @@ sub enroll_single_student { } else { my %home_servers =&Apache::loncommon::get_library_servers($domain); if (! exists($home_servers{$desiredhost})) { - $r->print('Error:'. - 'Invalid home server specified'); + $r->print(''.&mt('Error').':'. + &mt('Invalid home server specified')); return; } } - $r->print(" with server $desiredhost :") if (defined($desiredhost)); + $r->print(" ".&mt('with server')." $desiredhost :") if (defined($desiredhost)); # End of home server selection logic my $amode=''; my $genpwd=''; @@ -676,22 +673,21 @@ sub enroll_single_student { $desiredhost); if ($login_result =~ /^ok/) { $r->print($login_result); - $r->print("

If active, the new role will be available ". - "when the student next logs in to LON-CAPA.

"); + $r->print("

".&mt('If active, the new role will be available when the student next logs in to LON-CAPA.')."

"); } else { - $r->print("unable to enroll: ".$login_result); + $r->print(&mt('unable to enroll').": ".$login_result); } } else { - $r->print('

ERROR '); + $r->print('

'.&mt('ERROR').' '); if ($amode =~ /^krb/) { - $r->print('Missing Kerberos domain information. '); + $r->print(&mt('Missing Kerberos domain information.').' '); } else { - $r->print('Invalid login mode or password. '); + $r->print(&mt('Invalid login mode or password.').' '); } - $r->print('Unable to enroll '.$ENV{'form.cuname'}.'.

'); + $r->print(''.&mt('Unable to enroll').' '.$ENV{'form.cuname'}.'.

'); } } else { - $r->print('Invalid username or domain'); + $r->print(&mt('Invalid username or domain')); } } @@ -747,8 +743,8 @@ sub date_setting_table { my ($starttime,$endtime,$mode) = @_; my ($startform,$endform)=&setup_date_selectors($starttime,$endtime,$mode); my $dateDefault = ''. - ''. - ' make these dates the default for future enrollment'; + ' '. + &mt('make these dates the default for future enrollment'); if ($mode eq 'createcourse') { $dateDefault = ' '; } @@ -756,13 +752,13 @@ sub date_setting_table { if (defined($endtime) && $endtime == 0) { $perpetual .= ' checked'; } - $perpetual.= ' />'.' no ending date'; + $perpetual.= ' /> '.&mt('no ending date').''; my $result = ''; $result .= "\n"; - $result .= ''. + $result .= ''. ''. ''."\n"; - $result .= ''. + $result .= ''. ''. ''."\n"; $result .= "
Starting Date
'.&mt('Starting Date').''.$startform.''.$dateDefault.'
Ending Date
'.&mt('Ending Date').''.$endform.''.$perpetual.'
\n"; @@ -783,7 +779,7 @@ sub make_dates_default { # Refresh the course environment &Apache::lonnet::coursedescription($ENV{'request.course.id'}); } else { - $result .= "Unable to set default dates for course:".$put_result. + $result .= &mt('Unable to set default dates for course').":".$put_result. '
'; } return $result; @@ -796,18 +792,24 @@ sub get_student_username_domain_form { my $r = shift; my $domform = &Apache::loncommon::select_dom_form ($ENV{'course.'.$ENV{'request.course.id'}.'.domain'},'cudomain',0); + my %lt=&Apache::lonlocal::texthash( + 'eos' => "Enroll One Student", + 'usr' => "Username", + 'dom' => "Domain", + 'been' => "Begin Enrollment", + ); $r->print(< -

Enroll One Student

+

$lt{'eos'}

- + - +
Username:
$lt{'usr'}:
Domain:
$lt{'dom'}: $domform
  - +
END @@ -816,7 +818,7 @@ END sub print_enroll_single_student_form { my $r=shift; - $r->print("

Enroll One Student

"); + $r->print("

".&mt('Enroll One Student')."

"); # my $username = $ENV{'form.cuname'}; my $domain = $ENV{'form.cudomain'}; @@ -855,22 +857,32 @@ sub print_enroll_single_student_form { $homeserver_form .= "\n"; # # + my %lt=&Apache::lonlocal::texthash( + 'udf' => "User Data for", + 'fn' => "First Name", + 'mn' => "Middle Name", + 'ln' => "Last Name", + 'gen' => "Generation", + 'hs' => "Home Server", + 'pswd' => "Password", + 'psam' => "Please select an authentication mechanism", + ); $user_data_html = <User Data for $username\@$domain +

$lt{'udf'} $username\@$domain

- + - + - + - + - +
First Name:
$lt{'fn'}:
Middle Name:
$lt{'mn'}:
Last Name:
$lt{'ln'}:
Generation:
$lt{'gen'}:
Home Server:
$lt{'hs'}: $homeserver_form
-

Password

-Please select an authentication mechanism +

$lt{'pswd'}

+$lt{'psam'}

$krbform @@ -884,23 +896,30 @@ END # User already exists. Do not worry about authentication my %uenv = &Apache::lonnet::dump('environment',$domain,$username); $javascript_validations = &javascript_validations('noauth'); + my %lt=&Apache::lonlocal::texthash( + 'udf' => "User Data for", + 'fn' => "First Name", + 'mn' => "Middle Name", + 'ln' => "Last Name", + 'gen' => "Generation", + ); $user_data_html = <User Data for $username\@$domain +

$lt{'udf'} $username\@$domain

- + - + - + - + @@ -909,6 +928,13 @@ END } my $date_table = &date_setting_table(); # Print it all out + my %lt=&Apache::lonlocal::texthash( + 'cd' => "Course Data", + 'gs' => "Group/Section", + 'idsn' => "ID/Student Number", + 'disn' => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)", + 'eas' => "Enroll as student", + ); $r->print(< @@ -953,21 +979,20 @@ function clearpwd(vf) { $user_data_html -

Course Data

+

$lt{'cd'}

-

Group/Section: +

$lt{'gs'}:

$date_table

-

ID/Student Number

+

$lt{'idsn'}

-ID/Student Number: +$lt{'idsn'}:

-Disable ID/Student Number Safeguard and Force Change of Conflicting IDs -(only do if you know what you are doing) +$lt{'disn'}

- +

END return; @@ -980,7 +1005,7 @@ sub print_drop_menu { my $cid=$ENV{'request.course.id'}; my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist(); if (! defined($classlist)) { - $r->print("There are no students currently enrolled.\n"); + $r->print(&mt('There are no students currently enrolled.')."\n"); return; } # Print out the available choices @@ -999,29 +1024,34 @@ sub print_html_classlist { } my $status_select = &Apache::lonhtmlcommon::StatusOptions ($ENV{'form.Status'},'studentform'); + my $CCL=&mt('Current Class List'); $r->print(<

-Current Class List +$CCL       END if ($ENV{'form.action'} ne 'modifystudent') { + my %lt=&Apache::lonlocal::texthash( + 'ef' => "Excel format", + 'ss' => "Student Status", + ); $r->print(< CSV format          -Excel format +$lt{'ef'}       -Student Status: +$lt{'ss'}: END } $r->print($status_select."

\n"); my $cid=$ENV{'request.course.id'}; my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist(); if (! defined($classlist)) { - $r->print("There are no students currently enrolled.\n"); + $r->print(&mt('There are no students currently enrolled.')."\n"); } else { # Print out the available choices if ($ENV{'form.action'} eq 'modifystudent') { @@ -1041,7 +1071,7 @@ sub print_formatted_classlist { my $cid=$ENV{'request.course.id'}; my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist(); if (! defined($classlist)) { - $r->print("There are no students currently enrolled.\n"); + $r->print(&mt('There are no students currently enrolled.')."\n"); } else { &show_class_list($r,$mode,'nolink','csv', $ENV{'form.Status'},$classlist,$keylist); @@ -1063,10 +1093,16 @@ sub show_class_list { # Print out header if ($mode eq 'view') { if ($linkto eq 'aboutme') { - $r->print('Select a user name to view the users personal page.'); + $r->print(&mt('Select a user name to view the users personal page.')); } elsif ($linkto eq 'modify') { - $r->print('Select a user name to modify the students information'); + $r->print(&mt('Select a user name to modify the students information')); } + my %lt=&Apache::lonlocal::texthash( + 'usrn' => "username", + 'dom' => "domain", + 'sn' => "student name", + 'sec' => "section", + ); $r->print(< @@ -1075,28 +1111,29 @@ sub show_class_list {

First Name:
$lt{'fn'}:
Middle Name:
$lt{'mn'}:
Last Name:
$lt{'ln'}:
Generation:
$lt{'gen'}:
END } elsif ($mode eq 'csv') { if($statusmode eq 'Expired') { - $r->print('"Students with expired roles"'); + $r->print(&mt('Students with expired roles')); } if ($statusmode eq 'Any') { - $r->print('"'.join('","',("username","domain","ID","student name", - "section","status")).'"'."\n"); + $r->print('"'.join('","',(&mt("username"),&mt("domain"),"ID", + &mt("student name"),&mt("section"),&mt("status"))). + '"'."\n"); } else { - $r->print('"'.join('","',(&mt("username"),"domain","ID","student name", - "section")).'"'."\n"); + $r->print('"'.join('","',(&mt("username"),&mt("domain"),"ID", + &mt("student name"),&mt("section"))).'"'."\n"); } } elsif ($mode eq 'excel') { # Create the excel spreadsheet @@ -1188,7 +1225,7 @@ END } elsif ($mode eq 'excel') { $excel_workbook->close(); $r->print('

'. - 'Your Excel spreadsheet is ready for download.

'."\n"); + &mt('Your Excel spreadsheet').' '.&mt('is ready for download').'.

'."\n"); } } @@ -1210,18 +1247,17 @@ sub print_modify_student_form { $sdom, $sname); my ($tmp) = keys(%info); if ($tmp =~ /^(con_lost|error|no_such_host)/i) { - $r->print('Error'. + $r->print(''.&mt('Error').''. '

'. - 'Unable to retrieve environment data for '.$sname. - 'in domain '.$sdom.'

'. - 'Please contact your LON-CAPA administrator '. - 'regarding this situation.

'); + &mt('Unable to retrieve environment data for').' '.$sname. + &mt('in domain').' '.$sdom.'

'. + &mt('Please contact your LON-CAPA administrator regarding this situation.').'

'); return; } # determine the students starting and ending times and section my ($starttime,$endtime,$section) = &get_enrollment_data($sname,$sdom); if ($starttime =~ /^error/) { - $r->print('

Error

'); + $r->print('

'&mt('Error').'

'); $r->print('

'.$starttime.'

'); return; } @@ -1232,11 +1268,24 @@ sub print_modify_student_form { $ENV{'form.Status'} !~ /^(Any|Expired|Active)$/) { $ENV{'form.Status'} = 'crap'; } - # Make sure student is enrolled in course + # Make sure student is enrolled in course + my %lt=&Apache::lonlocal::texthash( + 'mef' => "Modify Enrollment for", + 'odcc' => "Only domain coordinators can change a users password.", + 'sn' => "Student Name", + 'fn' => "First", + 'mn' => "Middle", + 'ln' => "Last", + 'gen' => "Generation", + 'sid' => "Student ID", + 'disn' => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)", + 'sec' => "Section", + 'sm' => "Submit Modifications", + ); $r->print(< -Only domain coordinators can change a users password. +$lt{'odcc'}

@@ -1246,12 +1295,12 @@ Only domain coordinators can change a us -

Modify Enrollment for $info{'firstname'} $info{'middlename'} +

$lt{'mef'} $info{'firstname'} $info{'middlename'} $info{'lastname'} $info{'generation'}, $sname\@$sdom

-Student Name +$lt{'sn'}

- username + $lt{'usrn'} - domain + $lt{'dom'} ID - student name + $lt{'sn'} - section + $lt{'sec'}
- +
FirstMiddleLastGeneration
$lt{'fn'}$lt{'mn'}$lt{'ln'}$lt{'gen'}
@@ -1259,16 +1308,15 @@ $info{'lastname'} $info{'generation'}, $

-Student ID: +$lt{'sid'}:

-Disable ID/Student Number Safeguard and Force Change of Conflicting IDs -(only do if you know what you are doing) +$lt{'disn'}

-Section: +$lt{'sec'}:

$date_table

- + END return; @@ -1306,8 +1354,7 @@ sub modify_single_student { $ENV{'request.course.id'}); my ($tmp) = keys(%old); if ($tmp =~ /^(con_lost|error|no_such_host)/i) { - $r->print("There was an error determining the environment values ". - " for $slogin \@ $sdom."); + $r->print(&mt('There was an error determining the environment values for')." $slogin \@ $sdom."); return; } undef $tmp; @@ -1326,36 +1373,49 @@ sub modify_single_student { # check for forceid override if ((defined($old{'id'})) && ($old{'id'} ne '') && ($sid ne $old{'id'}) && (! exists($ENV{'form.forceid'}))) { - $r->print("You changed the students id ". - " but did not disable the ID change safeguard.". - " The students id will not be changed."); + $r->print("".&mt('You changed the students id but did not disable the ID change safeguard. The students id will not be changed.').""); $sid = $old{'id'}; } # # talk to the user about what we are going to do + my %lt=&Apache::lonlocal::texthash( + 'mdu' => "Modifying data for user", + 'si' => "Student Information", + 'fd' => "Field", + 'ov' => "Old Value", + 'nv' => "New Value", + 'fn' => "First name", + 'mn' => "Middle name", + 'ln' => "Last name", + 'gen' => "Generation", + 'sec' => "Section", + 'ri' => "Role Information", + 'st' => "Start Time", + 'et' => "End Time", + ); $r->print(<Modifying data for user $slogin \@ $sdom -

Student Information

+

$lt{'mdu'} $slogin \@ $sdom

+

$lt{'si'}

- - - + + + - + - + - + - + @@ -1363,15 +1423,15 @@ sub modify_single_student { - +
Field Old Value New Value $lt{'fd'} $lt{'ov'} $lt{'nv'}
First name $lt{'fn'} $old{'firstname'} $firstname
Middle name $lt{'mn'} $old{'middlename'} $middlename
Last name $lt{'ln'} $old{'lastname'} $lastname
Generation $lt{'gen'} $old{'generation'} $generation
$old{'id'} $sid
Section $lt{'sec'} $old{'section'} $section
-

Role Information

+

$lt{'ri'}

- - + +
Start Time: $displayable_starttime
End Time: $displayable_endtime
$lt{'st'}: $displayable_starttime
$lt{'et'}: $displayable_endtime

END @@ -1382,36 +1442,32 @@ END $ENV{'request.course.id'}, $section,undef); if ($modify_section_results !~ /^ok/) { - $r->print("An error occured during the attempt to change the ". - "section for this student.
"); + $r->print(&mt('An error occured during the attempt to change the section for this student.')."
"); } my $roleresults = &Apache::lonnet::modifystudent ($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname, $generation,$section,$endtime,$starttime,$ENV{'form.forceid'}); if ($roleresults eq 'refused' ) { - $r->print("Your request to change the role information for this ". - "student was refused. You do not appear to have ". - "sufficient authority to change student information."); + $r->print(&mt('Your request to change the role information for this student was refused. You do not appear to have sufficient authority to change student information.')); } elsif ($roleresults !~ /ok/) { - $r->print("An error occurred during the attempt to change the role". - " information for this student.
". - "The error reported was ". + $r->print(&mt('An error occurred during the attempt to change the role information for this student.')."
". + &mt('The error reported was')." ". $roleresults); &Apache::lonnet::logthis("londropadd:failed attempt to modify student". " data for ".$slogin." \@ ".$sdom." by ". $ENV{'user.name'}." \@ ".$ENV{'user.domain'}. ":".$roleresults); } else { # everything is okay! - $r->print("Student information updated successfully.
". - "The student must log out and log in again to see ". - "these changes."); + $r->print(&mt('Student information updated successfully.')."
". + &mt('The student must log out and log in again to see these changes.')); } + my $Masd=&mt('Modify another students data'); $r->print(<

-Modify another students data +$Masd END return; @@ -1509,36 +1565,44 @@ function uncheckAll(field) { END if ($nosort) { + my %lt=&Apache::lonlocal::texthash( + 'usrn' => "username", + 'dom' => "domain", + 'sn' => "student name", + 'sec' => "section", + ); $r->print(<   - username - domain + $lt{'usrn'} + $lt{'dom'} ID - student name - section + $lt{'sn'} + $lt{'sec'} END } else { - my $wordusername=&mt('username'); - my $worddomain=&mt('domain'); - my $wordstudentname=&mt('student name'); - my $wordsection=&mt('section'); + my %lt=&Apache::lonlocal::texthash( + 'usrn' => "username", + 'dom' => "domain", + 'sn' => "student name", + 'sec' => "section", + ); $r->print(<   - $wordusername + $lt{'usrn'} - $worddomain + $lt{'dom'} ID - $wordstudentname + $lt{'sn'} - $wordsection + $lt{'sec'} END @@ -1582,14 +1646,16 @@ END END } $r->print('
'); - my $DropStudents=&mt('Drop Students'); - my $CheckAll=&mt('check all'); - my $UncheckAll=&mt('uncheck all'); + my %lt=&Apache::lonlocal::texthash( + 'dp' => "Drop Students", + 'ca' => "check all", + 'ua' => "uncheck all", + ); $r->print(<<"END");

-   - -

+   + +

END return; }