[LON-CAPA-cvs] cvs: loncom /interface londropadd.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 26 Sep 2002 14:04:34 -0000


matthew		Thu Sep 26 10:04:34 2002 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Bug 674 - remind the course coordinator the role will not become active
  until the student next logs in to LON-CAPA.
  Fixed idiocy in &handler regarding subroutine to call in bad 'drop' state.
  It is always helpful to call subroutines that exist.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.54 loncom/interface/londropadd.pm:1.55
--- loncom/interface/londropadd.pm:1.54	Thu Sep 26 09:29:44 2002
+++ loncom/interface/londropadd.pm	Thu Sep 26 10:04:34 2002
@@ -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 @@
         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("<p> If active, the new role will be available ".
+                          "when the student next logs in to LON-CAPA.</p>");
+            } else {
+                $r->print("unable to enroll: ".$login_result);
+            }
 	} else {
             $r->print('<p><font color="#ff0000">ERROR</font>&nbsp;'.
                       'Invalid login mode or password.  '.
@@ -1391,7 +1399,9 @@
                 }
             }
         } # end of foreach (@studentdata)
-        $r->print('<p>Processed Students: '.$count);
+        $r->print('<p>Processed Students: '.$count.'</p>');
+        $r->print("<p>If active, the new role will be available when the ".
+                  "students next log in to LON-CAPA.</p>");
         #####################################
         #           Drop students           #
         #####################################
@@ -1568,7 +1578,7 @@
         } 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'})) {