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

raeburn raeburn@source.lon-capa.org
Mon, 01 Nov 2010 18:19:01 -0000


raeburn		Mon Nov  1 18:19:01 2010 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - Trim leading and trailing spaces from entries for email, domain and institutional status fields
    in uploaded file of users.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.128 loncom/interface/lonuserutils.pm:1.129
--- loncom/interface/lonuserutils.pm:1.128	Mon Nov  1 18:01:26 2010
+++ loncom/interface/lonuserutils.pm	Mon Nov  1 18:19:01 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.128 2010/11/01 18:01:26 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.129 2010/11/01 18:19:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4006,6 +4006,7 @@
                               $nowhitespace);
                     next;
                 } else {
+                    $entries{$fields{'domain'}} =~ s/^\s+|\s+$//g;
                     if ($entries{$fields{'domain'}} 
                         ne &LONCAPA::clean_domain($entries{$fields{'domain'}})) {
                         $r->print('<br />'. '<b>'.$entries{$fields{'domain'}}.
@@ -4064,6 +4065,7 @@
                     # determine email address
                     my $email='';
                     if (defined($fields{'email'})) {
+                        $entries{$fields{'email'}} =~ s/^\s+|\s+$//g;
                         if (defined($entries{$fields{'email'}})) {
                             $email=$entries{$fields{'email'}};
                             unless ($email=~/^[^\@]+\@[^\@]+$/) { $email=''; }
@@ -4110,7 +4112,7 @@
                         $role = $defaultrole;
                     }
                     # Clean up whitespace
-                    foreach (\$id,\$fname,\$mname,\$lname,\$gen) {
+                    foreach (\$id,\$fname,\$mname,\$lname,\$gen,\$inststatus) {
                         $$_ =~ s/(\s+$|^\s+)//g;
                     }
                     # check against rules