Diff for /loncom/lonsql between versions 1.82 and 1.86

version 1.82, 2007/07/25 22:40:00 version 1.86, 2007/08/25 19:52:11
Line 372  sub make_new_child { Line 372  sub make_new_child {
     $run = $run+1;      $run = $run+1;
     my $userinput = <$client>;      my $userinput = <$client>;
     chomp($userinput);      chomp($userinput);
             $userinput=~s/\:(\w+)$//;              $userinput=~s/\:($LONCAPA::domain_re)$//;
             my $searchdomain=$1;              my $searchdomain=$1;
             #              #
     my ($conserver,$query,      my ($conserver,$query,
Line 387  sub make_new_child { Line 387  sub make_new_child {
     print $client "$queryid\n";      print $client "$queryid\n";
     #      #
     # &logthis("QUERY: $query - $arg1 - $arg2 - $arg3 - $queryid");      # &logthis("QUERY: $query - $arg1 - $arg2 - $arg3 - $queryid");
     sleep 1;      # sleep 1;
             #              #
             my $result='';              my $result='';
             #              #
Line 457  sub make_new_child { Line 457  sub make_new_child {
                 $query = "SELECT $fieldlist FROM allusers WHERE (domain = $quoted_dom AND ";                  $query = "SELECT $fieldlist FROM allusers WHERE (domain = $quoted_dom AND ";
                 if ($srchby eq 'lastfirst') {                  if ($srchby eq 'lastfirst') {
                     my ($fraglast,$fragfirst) = split(/,/,$srchterm);                      my ($fraglast,$fragfirst) = split(/,/,$srchterm);
                       $fragfirst =~ s/^\s+//;
                       $fraglast =~ s/\s+$//;
                     if ($srchtype eq 'exact') {                      if ($srchtype eq 'exact') {
                         $query .= 'lastname = '.$dbh->quote($fraglast).                          $query .= 'lastname = '.$dbh->quote($fraglast).
                                   ' AND firstname = '.$dbh->quote($fragfirst);                                    ' AND firstname = '.$dbh->quote($fragfirst);
                       } elsif ($srchtype eq 'begins') {
                           $query .= 'lastname LIKE '.$dbh->quote($fraglast.'%').' AND firstname LIKE '.$dbh->quote($fragfirst.'%');
                     } else {                      } else {
                         $query .= 'lastname LIKE '.$dbh->quote('%'.$fraglast.'%').' AND firstname LIKE '.$dbh->quote('%'.$fragfirst.'%');                          $query .= 'lastname LIKE '.$dbh->quote('%'.$fraglast.'%').' AND firstname LIKE '.$dbh->quote('%'.$fragfirst.'%');
                     }                      }
Line 470  sub make_new_child { Line 474  sub make_new_child {
                                     );                                      );
                     if ($srchtype eq 'exact') {                      if ($srchtype eq 'exact') {
                         $query .= $srchfield{$srchby}.' = '.$dbh->quote($srchterm);                          $query .= $srchfield{$srchby}.' = '.$dbh->quote($srchterm);
                       } elsif ($srchtype eq 'begins') {
                           $query .= $srchfield{$srchby}.' LIKE '.$dbh->quote($srchterm.'%');
                     } else {                      } else {
                         $query .= $srchfield{$srchby}.' LIKE '.$dbh->quote('%'.$srchterm.'%');                          $query .= $srchfield{$srchby}.' LIKE '.$dbh->quote('%'.$srchterm.'%');
                     }                      }
Line 492  sub make_new_child { Line 498  sub make_new_child {
                              'WARNING: Could not retrieve from database:'.                               'WARNING: Could not retrieve from database:'.
                              $sth->errstr().'</font>');                               $sth->errstr().'</font>');
                }                 }
       } elsif ($query eq 'instdirsearch') {
    $result = &do_inst_dir_search($searchdomain,$arg1,$arg2,$arg3);
             } elsif ($query eq 'prepare activity log') {              } elsif ($query eq 'prepare activity log') {
                 my ($cid,$domain) = map {&unescape($_);} ($arg1,$arg2);                  my ($cid,$domain) = map {&unescape($_);} ($arg1,$arg2);
                 &logthis('preparing activity log tables for '.$cid);                  &logthis('preparing activity log tables for '.$cid);
Line 543  sub make_new_child { Line 551  sub make_new_child {
     }      }
 }  }
   
   sub do_inst_dir_search {
       my ($domain,$srchby,$srchterm,$srchtype) = @_;
       $srchby   = &unescape($srchby);
       $srchterm = &unescape($srchterm);
       $srchtype = &unescape($srchtype);
       my (%instusers,%instids,$result,$response);
       eval {
           local($SIG{__DIE__})='DEFAULT';
           $result=&localenroll::get_userinfo($domain,undef,undef,\%instusers,
      \%instids,undef,$srchby,$srchterm,
      $srchtype);
       };
       if ($result eq 'ok') {
           if (%instusers) {
               foreach my $key (keys(%instusers)) {
                   my $usrstr = &Apache::lonnet::freeze_escape($instusers{$key});
                   $response .=&escape(&escape($key).'='.$usrstr).'&';
               }
           }
           $response=~s/\&$//;
       }
       return $response;
   }
   
 ########################################################  ########################################################
 ########################################################  ########################################################
   

Removed from v.1.82  
changed lines
  Added in v.1.86


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