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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 03 Jul 2003 19:26:21 -0000


matthew		Thu Jul  3 15:26:21 2003 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Cleanup of error reporting in bulk enrollment.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.71 loncom/interface/londropadd.pm:1.72
--- loncom/interface/londropadd.pm:1.71	Wed Jul  2 15:52:56 2003
+++ loncom/interface/londropadd.pm	Thu Jul  3 15:26:20 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.71 2003/07/02 19:52:56 matthew Exp $
+# $Id: londropadd.pm,v 1.72 2003/07/03 19:26:20 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1466,7 +1466,7 @@
         #######################################
         ##         Enroll Students           ##
         #######################################
-        $r->print('<h3>Enrolling Students</h3>');
+        $r->print('<h3>Enrolling Students</h3>'."\n".'<p>');
         my $count=0;
         my $flushc=0;
         my %student=();
@@ -1495,9 +1495,9 @@
                     }
                 }
                 if ($entries{$fields{'username'}}=~/\W/) {
-                    $r->print('<p><b>Unacceptable username: '.
+                    $r->print('<br /><b>Unacceptable username: '.
                               $entries{$fields{'username'}}.' for user '.
-                              $fname.' '.$mname.' '.$lname.' '.$gen.'</b><p>');
+                              $fname.' '.$mname.' '.$lname.' '.$gen.'</b>');
                 } else {
                     # determine section number
                     my $sec='';
@@ -1539,9 +1539,9 @@
                              $fname,$mname,$lname,$gen,$sec,$enddate,
                              $startdate,$ENV{'form.forceid'},$desiredhost);
                         if ($reply ne 'ok') {
-                            $r->print('<p><b>'.
-                                      'Error enrolling '.$username.': '.
-                                      $reply.'</b></p>');
+                            $reply =~ s/^error://;
+                            $r->print('<br /><b>'.$username.'</b>:'.
+                                      '  Unable to enroll: '.$reply);
          		} else {
                             $count++; $flushc++;
                             $student{$username}=1;
@@ -1552,12 +1552,13 @@
                             }
                         }
                     } else {
-                        $r->print("<p><b>No password for $username</b><p>");
+                        $r->print('<br /><b>'.$username.'</b>:'.
+                           '  Unable to enroll: No password specified.');
                     }
                 }
             }
         } # end of foreach (@studentdata)
-        $r->print('<p>Processed Students: '.$count.'</p>');
+        $r->print('</p><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>");
         #####################################
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.385 loncom/lonnet/perl/lonnet.pm:1.386
--- loncom/lonnet/perl/lonnet.pm:1.385	Wed Jul  2 11:25:46 2003
+++ loncom/lonnet/perl/lonnet.pm	Thu Jul  3 15:26:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.385 2003/07/02 15:25:46 matthew Exp $
+# $Id: lonnet.pm,v 1.386 2003/07/03 19:26:21 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2774,7 +2774,7 @@
         }   
         $uhome=&homeserver($uname,$udom,'true');
         if (($uhome eq '') || ($uhome eq 'no_host') || ($uhome ne $unhome)) {
-	    return 'error: verify home';
+	    return 'error: unable verify users home machine.';
         }
     }   # End of creation of new user
 # ---------------------------------------------------------------------- Add ID
@@ -2784,7 +2784,8 @@
        if (($uidhash{$uname}) && ($uidhash{$uname}!~/error\:/) 
          && (!$forceid)) {
 	  unless ($uid eq $uidhash{$uname}) {
-	      return 'error: mismatch '.$uidhash{$uname}.' versus '.$uid;
+	      return 'error: user id "'.$uid.'" does not match '.
+                  'current user id "'.$uidhash{$uname}.'".';
           }
        } else {
 	  &idput($udom,($uname => $uid));