--- loncom/interface/Attic/londropadd.pm 2002/05/03 17:45:07 1.39 +++ loncom/interface/Attic/londropadd.pm 2002/05/03 20:38:13 1.40 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.39 2002/05/03 17:45:07 matthew Exp $ +# $Id: londropadd.pm,v 1.40 2002/05/03 20:38:13 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,14 +62,14 @@ sub header { return(< -LON-CAPA Student Drop/Add +LON-CAPA Enrollment Manager -

Drop/Add Students

-
-

Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}

+

$ENV{'course.'.$ENV{'request.course.id'}.'.description'}

+

Enrollment Manager

+ ENDHEAD } @@ -150,13 +150,16 @@ sub menu_phase_one {

Upload a courselist

$upfile_select -

-


+

+


Enroll a single student

-

-


+

+
+

Classlist

+

+

Drop students

-

+

ENDUPFORM } @@ -170,6 +173,7 @@ sub phase_two_header { } my $javascript_validations=&javascript_validations($krbdefdom); $r->print(<Uploading Class List

Identify fields

Total number of records found in file: $distotal
@@ -570,6 +574,7 @@ sub enroll_single_student { # ======================================================= Menu Phase Two Enroll sub menu_phase_two_enroll { my $r=shift; + $r->print("

Enroll One Student

"); my ($krbdefdom) = $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; $krbdefdom=~tr/a-z/A-Z/; my $today = time; @@ -695,6 +700,7 @@ sub get_current_classlist { # ========================================================= Menu Phase Two Drop sub menu_phase_two_drop { my $r=shift; + $r->print("

Drop Students

"); my $cid=$ENV{'request.course.id'}; my ($error,%currentlist)=&get_current_classlist ($ENV{'course.'.$cid.'.domain'},$ENV{'course.'.$cid.'.num'}); @@ -712,6 +718,66 @@ sub menu_phase_two_drop { } } +# ============================================== view classlist +sub menu_phase_two_view { + my $r=shift; + $r->print("

Current Classlist

"); + my $cid=$ENV{'request.course.id'}; + my ($error,%currentlist)=&get_current_classlist + ($ENV{'course.'.$cid.'.domain'},$ENV{'course.'.$cid.'.num'}); + if (defined($error)) { + if ($error =~ /^No such file or directory/) { + $r->print("There are no students currently enrolled.\n"); + } else { + $r->print("
ERROR:$error
"); + } + } elsif (!defined(%currentlist)) { + $r->print("There are no students currently enrolled.\n"); + } else { + # Print out the available choices + &show_class_list($r,%currentlist); + } +} + +# =================================================== Show student list to drop +sub show_class_list { + my ($r,%currentlist)=@_; + my $cid=$ENV{'request.course.id'}; + $r->print(< + + + +END + foreach (sort keys %currentlist) { + my ($sname,$sdom)=split(/\:/,$_); + my %reply=&Apache::lonnet::idrget($sdom,$sname); + my $ssec=&Apache::lonnet::usection($sdom,$sname,$cid); + my %info=&Apache::lonnet::get('environment', + ['firstname','middlename', + 'lastname','generation'], + $sdom, $sname); + my ($tmp) = keys(%info); + if ($tmp =~ /^(con_lost|error|no_such_host)/i) { + $r->print(''); + } else { + $r->print(<<"END"); + + + + + + + + +END + } + } + $r->print('
usernamedomainIDstudent namegenerationsection
'. + 'Internal error: unable to get environment '. + 'for '.$sname.' in domain '.$sdom.'
$sname$sdom$reply{$sname}$info{'lastname'}, $info{'firstname'} $info{'middlename'}$info{'generation'}$ssec

'); +} + # =================================================== Show student list to drop sub show_drop_list { my ($r,%currentlist)=@_; @@ -1007,6 +1073,8 @@ sub handler { &menu_phase_two_enroll($r); } elsif ($ENV{'form.drop'}) { &menu_phase_two_drop($r); + } elsif ($ENV{'form.view'}) { + &menu_phase_two_view($r); } } # Phase three