Diff for /loncom/interface/loncreateuser.pm between versions 1.174 and 1.177

version 1.174, 2007/08/16 21:36:13 version 1.177, 2007/08/25 19:52:29
Line 1472  sub update_user_data { Line 1472  sub update_user_data {
     <th>$lt{'lst'}</th>      <th>$lt{'lst'}</th>
     <th>$lt{'gen'}</th>      <th>$lt{'gen'}</th>
     <th>$lt{'mail'}</th>      <th>$lt{'mail'}</th>
     <th>$lt{'disk'}<th></tr>      <th>$lt{'disk'}</th></tr>
 <tr><td>$lt{'prvs'}</td>  <tr><td>$lt{'prvs'}</td>
     <td>$userenv{'firstname'}  </td>      <td>$userenv{'firstname'}  </td>
     <td>$userenv{'middlename'} </td>      <td>$userenv{'middlename'} </td>
Line 2194  sub user_search_result { Line 2194  sub user_search_result {
     my %inst_matches;      my %inst_matches;
     my %srch_results;      my %srch_results;
     my ($response,$state,$forcenewuser);      my ($response,$state,$forcenewuser);
       $srch->{'srchterm'} =~ s/^\s+//;
       $srch->{'srchterm'} =~ s/\s+$//;
   
     if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) {       if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) {
         $response = &mt('Invalid search.');          $response = &mt('Invalid search.');
     }      }
     if ($srch->{'srchin'} !~ /^(crs|dom|alc|instd)$/) {      if ($srch->{'srchin'} !~ /^(crs|dom|alc|instd)$/) {
         $response = &mt('Invalid search.');          $response = &mt('Invalid search.');
     }      }
     if ($srch->{'srchtype'} !~ /^(exact|contains)$/) {      if ($srch->{'srchtype'} !~ /^(exact|contains|begins)$/) {
         $response = &mt('Invalid search.');          $response = &mt('Invalid search.');
     }      }
     if ($srch->{'srchterm'} eq '') {      if ($srch->{'srchterm'} eq '') {
Line 2215  sub user_search_result { Line 2217  sub user_search_result {
     }      }
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||
         ($srch->{'srchin'} eq 'alc')) {          ($srch->{'srchin'} eq 'alc')) {
         if ($srch->{'srchterm'} !~ /^$match_username$/) {          if ($srch->{'srchby'} eq 'uname') {
             $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');              if ($srch->{'srchterm'} !~ /^$match_username$/) {
                   $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
               }
         }          }
     }      }
     if ($srch->{'srchin'} eq 'instd') {      if ($srch->{'srchin'} eq 'instd') {
Line 2270  sub user_search_result { Line 2274  sub user_search_result {
                         foreach my $user (keys(%$courseusers)) {                          foreach my $user (keys(%$courseusers)) {
                             my ($cuname,$cudomain) = split(/:/,$user);                              my ($cuname,$cudomain) = split(/:/,$user);
                             if ($cudomain eq $srch->{'srchdomain'}) {                              if ($cudomain eq $srch->{'srchdomain'}) {
                                 if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) {                                  my $matched = 0;
                                   if ($srch->{'srchtype'} eq 'begins') {
                                       if ($cuname =~ /^\Q$srch->{'srchterm'}\E/i) {
                                           $matched = 1;
                                       }
                                   } else {
                                       if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) {
                                           $matched = 1;
                                       }
                                   }
                                   if ($matched) {
                                     $srch_results{$user} =                                       $srch_results{$user} = 
  {&Apache::lonnet::get('environment',   {&Apache::lonnet::get('environment',
      ['firstname',       ['firstname',
Line 2305  sub user_search_result { Line 2319  sub user_search_result {
                 if ($srch->{'srchby'} eq 'lastname') {                  if ($srch->{'srchby'} eq 'lastname') {
                     if ((($srch->{'srchtype'} eq 'exact') &&                       if ((($srch->{'srchtype'} eq 'exact') && 
                          ($names{'lastname'} eq $srch->{'srchterm'})) ||                            ($names{'lastname'} eq $srch->{'srchterm'})) || 
                           (($srch->{'srchtype'} eq 'begins') &&
                            ($names{'lastname'} =~ /^\Q$srch->{'srchterm'}\E/i)) ||
                         (($srch->{'srchtype'} eq 'contains') &&                          (($srch->{'srchtype'} eq 'contains') &&
                          ($names{'lastname'} =~ /\Q$srch->{'srchterm'}\E/i))) {                           ($names{'lastname'} =~ /\Q$srch->{'srchterm'}\E/i))) {
                         $srch_results{$user} = {firstname => $names{'firstname'},                          $srch_results{$user} = {firstname => $names{'firstname'},
Line 2314  sub user_search_result { Line 2330  sub user_search_result {
                     }                      }
                 } elsif ($srch->{'srchby'} eq 'lastfirst') {                  } elsif ($srch->{'srchby'} eq 'lastfirst') {
                     my ($srchlast,$srchfirst) = split(/,/,$srch->{'srchterm'});                      my ($srchlast,$srchfirst) = split(/,/,$srch->{'srchterm'});
                       $srchlast =~ s/\s+$//;
                       $srchfirst =~ s/^\s+//;
                     if ($srch->{'srchtype'} eq 'exact') {                      if ($srch->{'srchtype'} eq 'exact') {
                         if (($names{'lastname'} eq $srchlast) &&                          if (($names{'lastname'} eq $srchlast) &&
                             ($names{'firstname'} eq $srchfirst)) {                              ($names{'firstname'} eq $srchfirst)) {
Line 2323  sub user_search_result { Line 2341  sub user_search_result {
   
                                            };                                             };
                         }                          }
                     } elsif ($srch->{'srchtype'} eq 'contains') {                      } elsif ($srch->{'srchtype'} eq 'begins') {
                           if (($names{'lastname'} =~ /^\Q$srchlast\E/i) &&
                               ($names{'firstname'} =~ /^\Q$srchfirst\E/i)) {
                               $srch_results{$user} = {firstname => $names{'firstname'},
                                                   lastname => $names{'lastname'},
                                                   permanentemail => $emails{'permanentemail'},
                                                  };
                           }
                       } else {
                         if (($names{'lastname'} =~ /\Q$srchlast\E/i) &&                           if (($names{'lastname'} =~ /\Q$srchlast\E/i) && 
                             ($names{'firstname'} =~ /\Q$srchfirst\E/i)) {                              ($names{'firstname'} =~ /\Q$srchfirst\E/i)) {
                             $srch_results{$user} = {firstname => $names{'firstname'},                              $srch_results{$user} = {firstname => $names{'firstname'},

Removed from v.1.174  
changed lines
  Added in v.1.177


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>