--- loncom/interface/Attic/londropadd.pm	2002/04/26 18:59:00	1.31
+++ loncom/interface/Attic/londropadd.pm	2002/04/29 14:36:23	1.33
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.31 2002/04/26 18:59:00 matthew Exp $
+# $Id: londropadd.pm,v 1.33 2002/04/29 14:36:23 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -75,7 +75,7 @@ ENDHEAD
 
 # =========== Drop student from all sections of a course, except optional $csec
 sub modifystudent {
-    my ($udom,$unam,$courseid,$csec)=@_;
+    my ($udom,$unam,$courseid,$csec,$desiredhost)=@_;
     # if $csec is undefined, drop the student from all the courses matching
     # this one.  If $csec is defined, drop them from all other sections of 
     # this course and add them to section $csec
@@ -97,7 +97,8 @@ sub modifystudent {
                 my $now=time;
                 if (!($start && ($now<$start)) || !($end && ($now>$end))) {
                     my $reply=&Apache::lonnet::modifystudent
-                        ($udom,$unam,'','','','','','','',$section,time);
+                        ($udom,$unam,'','','','','','','',
+                         $section,time,undef,undef,$desiredhost);
                 }
             }
         }
@@ -534,6 +535,9 @@ sub enroll_single_student {
 	    if (!$genpwd) { $genpwd=" "; }
 	}
         if (($amode) && ($genpwd)) {
+            &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,
@@ -542,8 +546,6 @@ sub enroll_single_student {
                       $ENV{'form.csec'},$ENV{'form.enddate'},
                       $ENV{'form.startdate'},$ENV{'form.forceid'},
                     $desiredhost));
-            &modifystudent($ENV{'form.lcdomain'},$ENV{'form.cuname'},
-                           $ENV{'request.course.id'},$ENV{'form.csec'});
 	} else {
            $r->print('Invalid login mode or password');    
         }          
@@ -698,6 +700,20 @@ sub show_drop_list {
     my ($r,%currentlist)=@_;
     my $cid=$ENV{'request.course.id'};
     $r->print(<<'END');
+<script>
+function checkAll(field)
+{
+    for (i = 0; i < field.length; i++)
+        field[i].checked = true ;
+}
+
+function uncheckAll(field)
+{
+    for (i = 0; i < field.length; i++)
+        field[i].checked = false ;
+}
+</script>
+<p>
 <input type="hidden" name="phase" value="four">
 <table border=2>
 <tr><th>&nbsp;</th><th>username</th><th>domain</th>
@@ -732,7 +748,12 @@ END
         }
     }
     $r->print('</table><br>');
-    $r->print('<input type=submit value="Drop Students">');
+    $r->print(<<"END");
+</p><p>
+<input type="button" value="check all" onclick="javascript:checkAll(document.studentform.droplist)"> &nbsp;
+<input type="button" value="uncheck all" onclick="javascript:uncheckAll(document.studentform.droplist)"> 
+<p><input type=submit value="Drop Students"></p>
+END
 }
 
 # ================================================= Drop/Add from uploaded file
@@ -852,11 +873,12 @@ sub upfile_drop_add {
                         }
                     }
                     if ($password) {
+                        &modifystudent($domain,$username,$cid,$sec,
+                                       $desiredhost);
                         my $reply=&Apache::lonnet::modifystudent
                             ($domain,$username,$id,$amode,$password,
                              $fname,$mname,$lname,$gen,$sec,$enddate,
                              $startdate,$ENV{'form.forceid'},$desiredhost);
-                        &modifystudent($domain,$username,$cid,$sec);
                         if ($reply ne 'ok') {
                             $r->print('<p><b>'.
                                       'Error enrolling '.$username.': '.