--- loncom/interface/Attic/londropadd.pm 2003/11/06 22:49:59 1.89 +++ loncom/interface/Attic/londropadd.pm 2003/12/08 21:01:03 1.92 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.89 2003/11/06 22:49:59 matthew Exp $ +# $Id: londropadd.pm,v 1.92 2003/12/08 21:01:03 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -146,7 +146,8 @@ 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'); $r->print(< @@ -169,7 +170,10 @@ sub print_main_menu { $Text{'drop'} -

+

+ + $Text{'populate'} + END } @@ -237,7 +241,12 @@ sub javascript_validations { my %param = ( formname => 'studentform', kerb_def_dom => $krbdefdom ); $authheader = &Apache::loncommon::authform_header(%param); + } elsif ($mode eq 'createcourse') { + my %param = ( formname => 'ccrs', + kerb_def_dom => $krbdefdom ); + $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.', @@ -256,10 +265,16 @@ function verify_message (vf,founduname,f END my $auth_checks = (<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; @@ -557,24 +580,28 @@ sub print_upload_manager_form { 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')], + ['names',&mt('Last Name, First Names')], + ['fname',&mt('First Name')], + ['mname',&mt('Middle Names/Initials')], + ['lname',&mt('Last Name')], + ['gen',&mt('Generation')], + ['id',&mt('ID/Student Number')], + ['sec',&mt('Group/Section')], + ['ipwd',&mt('Initial Password')], + ['email',&mt('EMail Address')]); 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))); } @@ -582,7 +609,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 @@ -668,21 +696,25 @@ sub enroll_single_student { } 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', @@ -691,6 +723,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); } @@ -704,11 +744,14 @@ 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'; + if ($mode eq 'createcourse') { + $dateDefault = ' '; + } my $perpetual = 'print("

Drop Students

"); + $r->print("

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

"); my $cid=$ENV{'request.course.id'}; my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist(); if (! defined($classlist)) { @@ -1052,7 +1095,7 @@ END $r->print('"'.join('","',("username","domain","ID","student name", "section","status")).'"'."\n"); } else { - $r->print('"'.join('","',("username","domain","ID","student name", + $r->print('"'.join('","',(&mt("username"),"domain","ID","student name", "section")).'"'."\n"); } } elsif ($mode eq 'excel') { @@ -1471,7 +1514,7 @@ END   username - domain + domaind ID student name section @@ -1479,19 +1522,23 @@ END END } else { + my $wordusername=&mt('username'); + my $worddomain=&mt('domain'); + my $wordstudentname=&mt('student name'); + my $wordsection=&mt('section'); $r->print(<   - username + $wordusername - domain + $worddomain ID - student name + $wordstudentname - section + $wordsection END @@ -1535,11 +1582,14 @@ END END } $r->print('
'); + my $DropStudents=&mt('Drop Students'); + my $CheckAll=&mt('check all'); + my $UncheckAll=&mt('uncheck all'); $r->print(<<"END");

-   - -

+   + +

END return; } @@ -1561,10 +1611,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);