--- loncom/interface/Attic/londropadd.pm 2003/11/06 20:04:06 1.88 +++ loncom/interface/Attic/londropadd.pm 2004/02/20 19:44:59 1.102 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.88 2003/11/06 20:04:06 matthew Exp $ +# $Id: londropadd.pm,v 1.102 2004/02/20 19:44:59 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,11 +25,6 @@ # # http://www.lon-capa.org/ # -# (Handler to set parameters for assessments -# -# (Handler to resolve ambiguous file locations -# -# (TeX Content Handler # ############################################################### ############################################################## @@ -146,38 +141,54 @@ sub print_main_menu { 'enrollone' => 'Enroll a single student', 'modify' => 'Modify student data', 'view' => 'View Class List', - 'drop' => 'Drop Students'); + 'drop' => 'Drop Students', + 'populate' => 'Automated Enrollment Manager'); + my %help=(); + foreach ('Course_Drop_Student','Course_Add_Student', + 'Course_Modify_Student_Data','Course_View_Class_List', + 'Course_Create_Class_List') { + $help{$_}=&Apache::loncommon::help_open_topic($_); + } $r->print(< - $Text{'upload'} - +$Text{'upload'} +$help{'Course_Create_Class_List'}

$Text{'enrollone'} - + $help{'Course_Add_Student'}

$Text{'modify'} - + $help{'Course_Modify_Student_Data'}

$Text{'view'} - + $help{'Course_View_Class_List'}

$Text{'drop'} + $help{'Course_Drop_Student'} +

+ + $Text{'populate'} -

END } ############################################################### ############################################################### +sub hidden_input { + my ($name,$value) = @_; + return ''."\n"; +} + sub print_upload_manager_header { my ($r,$datatoken,$distotal,$krbdefdom)=@_; my $javascript; + # if (! exists($ENV{'form.upfile_associate'})) { $ENV{'form.upfile_associate'} = 'forward'; } @@ -193,7 +204,20 @@ sub print_upload_manager_header { } else { $javascript=&upload_manager_javascript_forward_associate(); } - my $javascript_validations=&javascript_validations($krbdefdom); + # + # Deal with restored settings + my $password_choice = ''; + if (exists($ENV{'form.ipwd_choice'}) && + $ENV{'form.ipwd_choice'} ne '') { + # If a column was specified for password, assume it is for an + # internal password. This is a bug waiting to be filed (could be + # local or krb auth instead of internal) but I do not have the + # time to mess around with this now. + $password_choice = 'int'; + } + # + my $javascript_validations=&javascript_validations('auth',$krbdefdom, + $password_choice); my $checked=(($ENV{'form.noFirstLine'})?' checked="1"':''); $r->print('

'.&mt('Uploading Class List')."

\n". "
\n". @@ -202,59 +226,128 @@ sub print_upload_manager_header { &mt('Total number of records found in file: [_1].',$distotal). "\n". "


\n"); - $r->print(< - - - - - - -Ignore First Line - - -
- -ENDPICK + $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',''). + &hidden_input('datatoken',$datatoken). + &hidden_input('fileupload',$ENV{'form.fileupload'}). + &hidden_input('upfiletype',$ENV{'form.upfiletype'}). + &hidden_input('upfile_associate',$ENV{'form.upfile_associate'})); + $r->print(''); + $r->print(''. + &mt('Ignore First Line')); + $r->print("
\n". + ''); } ############################################################### ############################################################### sub javascript_validations { - my ($krbdefdom)=@_; - my %param = ( formname => 'studentform', - kerb_def_dom => $krbdefdom ); - my $authheader = &Apache::loncommon::authform_header(%param); - my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); - return (< 'studentform', + kerb_def_dom => $krbdefdom, + curr_authtype => $curr_authtype); + $authheader = &Apache::loncommon::authform_header(%param); + } elsif ($mode eq 'createcourse') { + my %param = ( formname => 'ccrs', + kerb_def_dom => $krbdefdom, + curr_authtype => $curr_authtype ); + $authheader = &Apache::loncommon::authform_header(%param); + } elsif ($mode eq 'modifycourse') { + my %param = ( formname => 'cmod', + kerb_def_dom => $krbdefdom, + mode => 'modifycourse', + curr_authtype => $curr_authtype, + curr_autharg => $curr_authfield ); + $authheader = &Apache::loncommon::authform_header(%param); + } + + + my %alert = &Apache::lonlocal::texthash + (username => 'You need to specify the username field.', + authen => 'You must choose an authentication type.', + krb => 'You need to specify the Kerberos domain.', + ipass => 'You need to specify the initial password.', + name => 'The optional name field was not specified.', + snum => 'The optional student number field was not specified.', + section => 'The optional section or group field was not specified.', + email => 'The optional email address field was not specified.', + continue => 'Continue enrollment?', + ); + +# my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); + my $function_name =(< $krbdefdom, kerb_def_auth => $krbdef ); + if (exists($ENV{'form.ipwd_choice'}) && + defined($ENV{'form.ipwd_choice'}) && + $ENV{'form.ipwd_choice'} ne '') { + $param{'curr_authtype'} = 'int'; + } my $krbform = &Apache::loncommon::authform_kerberos(%param); my $intform = &Apache::loncommon::authform_internal(%param); my $locform = &Apache::loncommon::authform_local(%param); my $domform = &domain_form($defdom); my $date_table = &date_setting_table(); - $r->print(< - - -

Login Type

-

Note: this will not take effect if the user already exists

-

-$krbform -

-

-$intform -

-

-$locform -

-

LON-CAPA Domain for Students

-LON-CAPA domain: $domform

-

Starting and Ending Dates

-

-$date_table -

-

Full Update

- Full update -(also print list of users not enrolled anymore)

-

ID/Student Number

- -Disable ID/Student Number Safeguard and Force Change of Conflicting IDs -(only do if you know what you are doing)

-
-Note: for large courses, this operation may be time consuming. -ENDPICK + my $Str = "\n"; + $Str .= &hidden_input('nfields',$i); + $Str .= &hidden_input('keyfields',$keyfields); + $Str .= '

'.&mt('Login Type')."

\n"; + $Str .= "

\n". + &mt('Note: this will not take effect if the user already exists'). + "

\n"; + $Str .= $krbform."\n

\n". + $intform."\n

\n". + $locform."\n

\n"; + $Str .= '

'.&mt('LON-CAPA Domain for Students')."

\n"; + $Str .= "

\n".&mt('LON-CAPA domain: [_1]',$domform)."\n

\n"; + $Str .= "

".&mt('Starting and Ending Dates')."

\n"; + $Str .= "

\n".$date_table."

\n"; + $Str .= "

".&mt('Full Update')."

\n"; + $Str .= ''. + ' '.&mt('Full update (also print list of users not enrolled anymore)'). + "

\n"; + $Str .= "

".&mt('Student Number')."

\n"; + $Str .= "

\n".''; + $Str .= &mt('Disable ID/Student Number Safeguard and Force Change '. + 'of Conflicting IDs (only do if you know what you are doing)'). + "\n

\n"; + $Str .= ''."
\n"; + $Str .= &mt('Note: for large courses, this operation may be time '. + 'consuming'); + $r->print($Str); + return; } -# ======================================================= Menu Phase Two Upload +############################################################### +############################################################### sub print_upload_manager_form { my $r=shift; + my $firstLine; my $datatoken; if (!$ENV{'form.datatoken'}) { - $datatoken=&Apache::loncommon::upfile_store($r); + $datatoken=&Apache::loncommon::upfile_store($r); } else { - $datatoken=$ENV{'form.datatoken'}; - &Apache::loncommon::load_tmp_file($r); + $datatoken=$ENV{'form.datatoken'}; + &Apache::loncommon::load_tmp_file($r); } my @records=&Apache::loncommon::upfile_record_sep(); - if($ENV{'form.noFirstLine'}){$firstLine=shift(@records);} + if($ENV{'form.noFirstLine'}){ + $firstLine=shift(@records); + } my $total=$#records; my $distotal=$total+1; my $today=time; my $halfyear=$today+15552000; + # + # Restore memorized settings + &Apache::loncommon::restore_course_settings + ('enrollment_upload',{ 'username_choice' => 'scalar', # column settings + 'names_choice' => 'scalar', + 'fname_choice' => 'scalar', + 'mname_choice' => 'scalar', + 'lname_choice' => 'scalar', + 'gen_choice' => 'scalar', + 'id_choice' => 'scalar', + 'sec_choice' => 'scalar', + 'ipwd_choice' => 'scalar', + 'email_choice' => 'scalar', + }); + # + # Determine kerberos parameters as appropriate my $defdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; my ($krbdef,$krbdefdom) = &Apache::loncommon::get_kerberos_defaults($defdom); + # &print_upload_manager_header($r,$datatoken,$distotal,$krbdefdom); my $i; my $keyfields; if ($total>=0) { - my @d=(['username','Username'], - ['names','Last Name, First Names'], - ['fname','First Name'], - ['mname','Middle Names/Initials'], - ['lname','Last Name'], - ['gen','Generation'], - ['id','ID/Student Number'], - ['sec','Group/Section'], - ['ipwd','Initial Password'], - ['email','EMail Address']); + my @field= + (['username',&mt('Username'), $ENV{'form.username_choice'}], + ['names',&mt('Last Name, First Names'),$ENV{'form.names_choice'}], + ['fname',&mt('First Name'), $ENV{'form.fname_choice'}], + ['mname',&mt('Middle Names/Initials'),$ENV{'form.mname_choice'}], + ['lname',&mt('Last Name'), $ENV{'form.lname_choice'}], + ['gen', &mt('Generation'), $ENV{'form.gen_choice'}], + ['id', &mt('ID/Student Number'),$ENV{'form.id_choice'}], + ['sec', &mt('Group/Section'), $ENV{'form.sec_choice'}], + ['ipwd', &mt('Initial Password'),$ENV{'form.ipwd_choice'}], + ['email',&mt('EMail Address'), $ENV{'form.email_choice'}]); if ($ENV{'form.upfile_associate'} eq 'reverse') { &Apache::loncommon::csv_print_samples($r,\@records); - $i=&Apache::loncommon::csv_print_select_table($r,\@records,\@d); - foreach (@d) { $keyfields.=$_->[0].','; } + $i=&Apache::loncommon::csv_print_select_table($r,\@records, + \@field); + foreach (@field) { + $keyfields.=$_->[0].','; + } chop($keyfields); } else { - unshift(@d,['none','']); - $i=&Apache::loncommon::csv_samples_select_table($r,\@records,\@d); + unshift(@field,['none','']); + $i=&Apache::loncommon::csv_samples_select_table($r,\@records, + \@field); my %sone=&Apache::loncommon::record_sep($records[0]); $keyfields=join(',',sort(keys(%sone))); } @@ -565,7 +691,8 @@ sub print_upload_manager_form { &print_upload_manager_footer($r,$i,$keyfields,$defdom,$today,$halfyear); } -# ======================================================= Enroll single student +############################################################### +############################################################### sub enroll_single_student { my $r=shift; # Remove non alphanumeric values from section @@ -580,8 +707,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/)) { @@ -593,12 +720,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=''; @@ -631,41 +758,44 @@ 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')); } } sub setup_date_selectors { - my ($starttime,$endtime) = @_; + my ($starttime,$endtime,$mode) = @_; if (! defined($starttime)) { $starttime = time; - if (exists($ENV{'course.'.$ENV{'request.course.id'}. + unless ($mode eq 'createcourse') { + if (exists($ENV{'course.'.$ENV{'request.course.id'}. '.default_enrollment_start_date'})) { - $starttime = $ENV{'course.'.$ENV{'request.course.id'}. + $starttime = $ENV{'course.'.$ENV{'request.course.id'}. '.default_enrollment_start_date'}; + } } } if (! defined($endtime)) { $endtime = time+(6*30*24*60*60); # 6 months from now, approx - if (exists($ENV{'course.'.$ENV{'request.course.id'}. + unless ($mode eq 'createcourse') { + if (exists($ENV{'course.'.$ENV{'request.course.id'}. '.default_enrollment_end_date'})) { - $endtime = $ENV{'course.'.$ENV{'request.course.id'}. + $endtime = $ENV{'course.'.$ENV{'request.course.id'}. '.default_enrollment_end_date'}; + } } } my $startdateform = &Apache::lonhtmlcommon::date_setter('studentform', @@ -674,6 +804,14 @@ sub setup_date_selectors { my $enddateform = &Apache::lonhtmlcommon::date_setter('studentform', 'enddate', $endtime); + if ($mode eq 'createcourse') { + $startdateform = &Apache::lonhtmlcommon::date_setter('ccrs', + 'startdate', + $starttime); + $enddateform = &Apache::lonhtmlcommon::date_setter('ccrs', + 'enddate', + $endtime); + } return ($startdateform,$enddateform); } @@ -687,22 +825,25 @@ sub get_dates_from_form { } sub date_setting_table { - my ($starttime,$endtime) = @_; - my ($startform,$endform)=&setup_date_selectors($starttime,$endtime); + 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 = ' '; + } my $perpetual = ''; + $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"; @@ -723,7 +864,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; @@ -736,18 +877,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 @@ -756,7 +903,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'}; @@ -774,7 +921,7 @@ sub print_enroll_single_student_form { # Set up authentication forms my ($krbdef,$krbdefdom) = &Apache::loncommon::get_kerberos_defaults($domain); - $javascript_validations=&javascript_validations($krbdefdom); + $javascript_validations=&javascript_validations('auth',$krbdefdom); my %param = ( formname => 'document.studentform', kerb_def_dom => $krbdefdom, kerb_def_auth => $krbdef @@ -795,22 +942,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 @@ -823,24 +980,31 @@ END } else { # User already exists. Do not worry about authentication my %uenv = &Apache::lonnet::dump('environment',$domain,$username); - $javascript_validations = &javascript_validations_without_auth(); + $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

- + - + - + - + @@ -849,6 +1013,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(< @@ -893,21 +1064,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; @@ -916,11 +1086,11 @@ END # ========================================================= Menu Phase Two Drop sub print_drop_menu { my $r=shift; - $r->print("

Drop Students

"); + $r->print("

".&mt('Drop Students')."

"); 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 @@ -939,29 +1109,51 @@ sub print_html_classlist { } my $status_select = &Apache::lonhtmlcommon::StatusOptions ($ENV{'form.Status'},'studentform'); + my $cid=$ENV{'request.course.id'}; + my $cdom=$ENV{'course.'.$cid.'.domain'}; + my $cnum=$ENV{'course.'.$cid.'.num'}; +# -------------------------------------------------------- Get course personnel + my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum); + $r->print('
First Name:
$lt{'fn'}:
Middle Name:
$lt{'mn'}:
Last Name:
$lt{'ln'}:
Generation:
$lt{'gen'}:
'); + foreach (sort keys %coursepersonnel) { + $r->print(''); + } + $r->print('
'.$_.''); + foreach (split(/\,/,$coursepersonnel{$_})) { + my ($puname,$pudom)=split(/\:/,$_); + $r->print(' '.&Apache::loncommon::aboutmewrapper( + &Apache::loncommon::plainname($puname, + $pudom),$puname,$pudom)); + } + $r->print('
'); +# --------------------------------------------------------------- Student roles + 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') { @@ -981,7 +1173,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); @@ -1003,10 +1195,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(< @@ -1015,28 +1213,29 @@ sub show_class_list {

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('","',("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 @@ -1128,7 +1327,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"); } } @@ -1150,33 +1349,66 @@ 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; } + # # Deal with date forms + my $current_date_description = ''; + my $textdate = ''; + + if (! defined($starttime) || $starttime == 0) { + $current_date_description = &mt('Current Starting Date: not set'). + '
'; + } else { + $current_date_description = + &mt('Current Starting Date: [_1]', + &Apache::lonlocal::locallocaltime($starttime)).'
'; + } + if (! defined($endtime) || $endtime == 0) { + $current_date_description.= &mt('Current Ending Date: not set'). + '
'; + } else { + $current_date_description.= + &mt('Current Ending Date: [_1]', + &Apache::lonlocal::locallocaltime($endtime)).'
'; + + } my $date_table = &date_setting_table($starttime,$endtime); # if (! exists($ENV{'form.Status'}) || $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'}

@@ -1185,13 +1417,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'}
@@ -1199,16 +1430,16 @@ $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'}:

+

$current_date_description

$date_table

- + END return; @@ -1246,8 +1477,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; @@ -1266,36 +1496,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'}

- - - + + + - + - + - + - + @@ -1303,15 +1546,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 @@ -1322,36 +1565,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; @@ -1449,32 +1688,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 %lt=&Apache::lonlocal::texthash( + 'usrn' => "username", + 'dom' => "domain", + 'sn' => "student name", + 'sec' => "section", + ); $r->print(<   - username + $lt{'usrn'} - domain + $lt{'dom'} ID - student name + $lt{'sn'} - section + $lt{'sec'} END @@ -1518,11 +1769,16 @@ END END } $r->print('
'); + my %lt=&Apache::lonlocal::texthash( + 'dp' => "Drop Students", + 'ca' => "check all", + 'ua' => "uncheck all", + ); $r->print(<<"END");

-   - -

+   + +

END return; } @@ -1544,10 +1800,10 @@ sub print_first_courselist_upload_form { $str .= ' '. &mt('Ignore First Line')."

\n"; $str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List", - "How do I create a class list from a spreadsheet"). + &mt("How do I create a class list from a spreadsheet")). "
\n"; $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV", - "How do I create a CSV file from a spreadsheet"). + &mt("How do I create a CSV file from a spreadsheet")). "
\n"; $str .= "\n\n"; $r->print($str); @@ -1573,6 +1829,24 @@ sub upfile_drop_add { } } # + # Store the field choices away + foreach my $field (qw/username names + fname mname lname gen id sec ipwd email/) { + $ENV{'form.'.$field.'_choice'}=$fields{$field}; + } + &Apache::loncommon::store_course_settings('enrollment_upload', + { 'username_choice' => 'scalar', + 'names_choice' => 'scalar', + 'fname_choice' => 'scalar', + 'mname_choice' => 'scalar', + 'lname_choice' => 'scalar', + 'gen_choice' => 'scalar', + 'id_choice' => 'scalar', + 'sec_choice' => 'scalar', + 'ipwd_choice' => 'scalar', + 'email_choice' => 'scalar' }); + + # my ($startdate,$enddate) = &get_dates_from_form(); if ($ENV{'form.makedatesdefault'}) { $r->print(&make_dates_default($startdate,$enddate)); @@ -1828,6 +2102,12 @@ sub handler { } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['action','state']); + + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"/adm/dropadd", + text=>"Enrollment Manager", + faq=>9,bug=>'Instructor Interface',}); # Needs to be in a course if (! (($ENV{'request.course.fn'}) && (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'})))) { @@ -1839,6 +2119,8 @@ sub handler { # # Only output the header information if they did not request csv format # + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['state','action']); if (exists($ENV{'form.state'}) && ($ENV{'form.state'} eq 'csv')) { $r->content_type('text/csv'); } else { @@ -1850,8 +2132,16 @@ sub handler { # # Main switch on form.action and form.state, as appropriate if (! exists($ENV{'form.action'})) { + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Enrollment Manager')); &print_main_menu($r); } elsif ($ENV{'form.action'} eq 'upload') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/dropadd?action=upload&state=', + text=>"Upload Classlist", + faq=>9,bug=>'Instructor Interface',}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Upload Classlist')); if (! exists($ENV{'form.state'})) { &print_first_courselist_upload_form($r); } elsif ($ENV{'form.state'} eq 'got_file') { @@ -1866,6 +2156,12 @@ sub handler { &print_first_courselist_upload_form($r); } } elsif ($ENV{'form.action'} eq 'drop') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/dropadd?action=drop', + text=>"Drop Students", + faq=>9,bug=>'Instructor Interface',}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Drop Students')); if (! exists($ENV{'form.state'})) { &print_drop_menu($r); } elsif ($ENV{'form.state'} eq 'done') { @@ -1874,6 +2170,12 @@ sub handler { &print_drop_menu($r); } } elsif ($ENV{'form.action'} eq 'enrollstudent') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/dropadd?action=enrollstudent', + text=>"Enroll Student", + faq=>9,bug=>'Instructor Interface',}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Enroll Student')); if (! exists($ENV{'form.state'})) { &get_student_username_domain_form($r); } elsif ($ENV{'form.state'} eq 'gotusername') { @@ -1884,6 +2186,12 @@ sub handler { &get_student_username_domain_form($r); } } elsif ($ENV{'form.action'} eq 'classlist') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/dropadd?action=classlist', + text=>"View Classlist", + faq=>9,bug=>'Instructor Interface',}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'View Classlist')); if (! exists($ENV{'form.state'})) { &print_html_classlist($r); } elsif ($ENV{'form.state'} eq 'csv') { @@ -1894,6 +2202,12 @@ sub handler { &print_html_classlist($r); } } elsif ($ENV{'form.action'} eq 'modifystudent') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/dropadd?action=modifystudent', + text=>"Modify Student Data", + faq=>9,bug=>'Instructor Interface',}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Modify Student Data')); if (! exists($ENV{'form.state'})) { &print_html_classlist($r); } elsif ($ENV{'form.state'} eq 'selected') { @@ -1908,6 +2222,8 @@ sub handler { &Apache::lonnet::logthis("Undetermined state in londropadd.pm. ". "form.action = ".$ENV{'form.action'}. "Someone should fix this."); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Enrollment Manager')); &print_main_menu($r); } #