--- loncom/interface/Attic/londropadd.pm 2002/04/16 21:02:17 1.26 +++ loncom/interface/Attic/londropadd.pm 2002/04/17 13:55:35 1.27 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.26 2002/04/16 21:02:17 matthew Exp $ +# $Id: londropadd.pm,v 1.27 2002/04/17 13:55:35 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -59,8 +59,7 @@ use Apache::Constants qw(:common :http R # ================================================================ Print header sub header { - my $r=shift; - $r->print(< LON-CAPA Student Drop/Add @@ -94,9 +93,9 @@ sub modifystudent { my $section=$1; $section='' if ($course eq $courseid.'_st'); if (((!$section) && (!$csec)) || ($section ne $csec)) { - my (undef,$end,$start)=split(/\_/,$course); + my (undef,$end,$start)=split(/\_/,$roles{$course}); my $now=time; - if (($start) && ($end) && ($now>$start) && ($now<$end)) { + if (!($start && ($now<$start)) || !($end && ($now>$end))) { my $reply=&Apache::lonnet::modifystudent ($udom,$unam,'','','','','','','',$section,time); } @@ -654,9 +653,9 @@ sub get_current_classlist { $currentlist{$student}=1; } } - return %currentlist; + return (undef,%currentlist); } else { - return undef; + return ($tmp,undef); } } @@ -664,11 +663,13 @@ sub get_current_classlist { sub menu_phase_two_drop { my $r=shift; my $cid=$ENV{'request.course.id'}; - my %currentlist=&get_current_classlist($ENV{'course.'.$cid.'.domain'}, + my ($error,%currentlist)=&get_current_classlist($ENV{'course.'.$cid.'.domain'}, $ENV{'course.'.$cid.'.num'}); + if (defined($error)) { + $r->print('
ERROR:$error
'); + } if (!defined(%currentlist)) { - $r->print(''. - '

Could not access classlist.

'); + $r->print("There are no students currently enrolled.\n"); } else { # Print out the available choices &show_drop_list($r,%currentlist); @@ -854,9 +855,12 @@ sub upfile_drop_add { if ($ENV{'form.fullup'} eq 'yes') { $r->print('

Dropping Students

'); # Get current classlist - my %currentlist=&get_current_classlist + my ($error,%currentlist)=&get_current_classlist ($ENV{'course.'.$cid.'.domain'}, $ENV{'course.'.$cid.'.num'}); + if (defined($error)) { + $r->print('
ERROR:$error
'); + } if (defined(%currentlist)) { # Drop the students foreach (@studentdata) { @@ -870,8 +874,7 @@ sub upfile_drop_add { # Print out list of dropped students &show_drop_list($r,%currentlist); } else { - $r->print(''. - '

Could not access classlist

'); + $r->print("There are no students currently enrolled.\n"); } } } # end of unless @@ -906,7 +909,7 @@ sub handler { # Start page $r->content_type('text/html'); $r->send_http_header; - &header($r); + $r->print(&header()); # Phase one, initial screen unless ($ENV{'form.phase'}) { &menu_phase_one($r);