--- loncom/interface/Attic/londropadd.pm 2002/09/26 13:29:44 1.54 +++ loncom/interface/Attic/londropadd.pm 2002/09/26 14:04:34 1.55 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.54 2002/09/26 13:29:44 matthew Exp $ +# $Id: londropadd.pm,v 1.55 2002/09/26 14:04:34 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -594,17 +594,25 @@ sub enroll_single_student { my $home = &Apache::lonnet::homeserver($ENV{'form.cuname'}, $ENV{'form.lcdomain'}); if ((($amode) && ($genpwd)) || ($home ne 'no_host')) { + # Clean out any old roles the student has in this class. &modifystudent($ENV{'form.lcdomain'},$ENV{'form.cuname'}, $ENV{'request.course.id'},$ENV{'form.csec'}, $desiredhost); - $r->print(&Apache::lonnet::modifystudent( - $ENV{'form.lcdomain'},$ENV{'form.cuname'}, - $ENV{'form.cstid'},$amode,$genpwd, - $ENV{'form.cfirst'},$ENV{'form.cmiddle'}, - $ENV{'form.clast'},$ENV{'form.cgen'}, - $ENV{'form.csec'},$ENV{'form.enddate'}, - $ENV{'form.startdate'},$ENV{'form.forceid'}, - $desiredhost)); + my $login_result = &Apache::lonnet::modifystudent + ($ENV{'form.lcdomain'},$ENV{'form.cuname'}, + $ENV{'form.cstid'},$amode,$genpwd, + $ENV{'form.cfirst'},$ENV{'form.cmiddle'}, + $ENV{'form.clast'},$ENV{'form.cgen'}, + $ENV{'form.csec'},$ENV{'form.enddate'}, + $ENV{'form.startdate'},$ENV{'form.forceid'}, + $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.

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

ERROR '. 'Invalid login mode or password. '. @@ -1391,7 +1399,9 @@ sub upfile_drop_add { } } } # end of foreach (@studentdata) - $r->print('

Processed Students: '.$count); + $r->print('

Processed Students: '.$count.'

'); + $r->print("

If active, the new role will be available when the ". + "students next log in to LON-CAPA.

"); ##################################### # Drop students # ##################################### @@ -1568,7 +1578,7 @@ sub handler { } elsif ($ENV{'form.state'} eq 'done') { &drop_student_list($r); } else { - &menu_phase_two_drop($r); + &print_drop_menu($r); } } elsif ($ENV{'form.action'} eq 'enrollstudent') { if (! exists($ENV{'form.state'})) {