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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 30 Apr 2002 13:51:00 -0000


matthew		Tue Apr 30 09:51:00 2002 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Better reports to user if things go wrong.  No longer need to enter password
  for a user who already exists.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.33 loncom/interface/londropadd.pm:1.34
--- loncom/interface/londropadd.pm:1.33	Mon Apr 29 10:36:23 2002
+++ loncom/interface/londropadd.pm	Tue Apr 30 09:51:00 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.33 2002/04/29 14:36:23 matthew Exp $
+# $Id: londropadd.pm,v 1.34 2002/04/30 13:51:00 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -503,7 +503,8 @@
 sub enroll_single_student {
     my $r=shift;
     $r->print('<h3>Enrolling Student</h3>');
-    $r->print($ENV{'form.cuname'}." in domain ".$ENV{'form.lcdomain'});
+    $r->print('<p>Enrolling '.$ENV{'form.cuname'}." in domain ".
+              $ENV{'form.lcdomain'}.'</p>');
     if (($ENV{'form.cuname'})&&($ENV{'form.cuname'}!~/\W/)&&
         ($ENV{'form.lcdomain'})&&($ENV{'form.lcdomain'}!~/\W/)) {
         # Deal with home server selection
@@ -519,7 +520,7 @@
                 return;
             }
         }
-        $r->print(" with server $desiredhost :");
+        $r->print(" with server $desiredhost :") if (defined($desiredhost));
         # End of home server selection logic
 	my $amode='';
         my $genpwd='';
@@ -534,7 +535,9 @@
 	    $genpwd=$ENV{'form.locarg'};
 	    if (!$genpwd) { $genpwd=" "; }
 	}
-        if (($amode) && ($genpwd)) {
+        my $home = &Apache::lonnet::homeserver($ENV{'form.cuname'},
+                                                   $ENV{'form.lcdomain'});
+        if ((($amode) && ($genpwd)) || ($home ne 'no_host')) {
             &modifystudent($ENV{'form.lcdomain'},$ENV{'form.cuname'},
                            $ENV{'request.course.id'},$ENV{'form.csec'},
                             $desiredhost);
@@ -547,7 +550,9 @@
                       $ENV{'form.startdate'},$ENV{'form.forceid'},
                     $desiredhost));
 	} else {
-           $r->print('Invalid login mode or password');    
+            $r->print('<p><font color="#ff0000">ERROR</font>&nbsp;'.
+                      'Invalid login mode or password.  '.
+                      'Unable to enroll '.$ENV{'form.cuname'}.'.</p>');
         }          
     } else {
         $r->print('Invalid username or domain');