Diff for /loncom/interface/lonsearchcat.pm between versions 1.23 and 1.35

version 1.23, 2001/03/15 19:18:20 version 1.35, 2001/03/15 20:47:04
Line 424  sub advancedsearch { Line 424  sub advancedsearch {
     my ($r,$envhash)=@_;      my ($r,$envhash)=@_;
     my %ENV=%{$envhash};      my %ENV=%{$envhash};
   
     return(<<END);      my $fillflag=0;
       for my $field ('title','author','subject','keywords','url','version',
      'notes','abstract','mime','language','owner',
      'custommetadata') {
    if (&filled($ENV{'form.basicexp'})) {
       $fillflag++;
    }
       }
   
       unless ($fillflag) {
    &output_blank_field_error($r);
    return OK;
       }
   
       $r->print(<<END);
 Advanced searching is not yet implemented.  Advanced searching is not yet implemented.
 END  END
       return OK;
   }
   
   # ---------------------------------------------------- see if a field is filled
   sub filled {
       my ($field)=@_;
       if ($field=~/\S/) {
    return 1;
       }
       else {
    return 0;
       }
 }  }
   
 # --------------------------------------------------- Performing a basic search  # --------------------------------------------------- Performing a basic search
Line 435  sub basicsearch { Line 460  sub basicsearch {
     my ($r,$envhash)=@_;      my ($r,$envhash)=@_;
     my %ENV=%{$envhash};      my %ENV=%{$envhash};
   
     &output_blank_field_error($r) unless length($ENV{'form.basicexp'});      unless (&filled($ENV{'form.basicexp'})) {
    &output_blank_field_error($r);
    return OK;
       }
   
     my $query=$ENV{'form.basicexp'};      my $query=$ENV{'form.basicexp'};
     $query="select * from metadata where concat(title,\"    \",author) like '\%$ENV{'form.basicexp'}\%'";      my $concatarg=join(',"    ",',
          ('title', 'author', 'subject', 'notes', 'abstract'));
   
       $query="select * from metadata where concat($concatarg) like '\%$ENV{'form.basicexp'}\%'";
     my $reply=&Apache::lonnet::metadata_query($query);      my $reply=&Apache::lonnet::metadata_query($query);
     &output_results($r,$envhash,$reply);      &output_results($r,$envhash,$query,$reply);
     return OK;      return OK;
 }  }
   
Line 490  RESULTS Line 521  RESULTS
   
 # ----------------------------- format and output results based on a reply list  # ----------------------------- format and output results based on a reply list
 sub output_results {  sub output_results {
     my ($r,$envhash,@replylist)=@_;      my ($r,$envhash,$testval,@replylist)=@_;
     my %ENV=%{$envhash};      my %ENV=%{$envhash};
     foreach my $reply (@replylist) {      foreach my $reply (@replylist) {
   
Line 597  SCRIPT Line 628  SCRIPT
 <body bgcolor="#ffffff">  <body bgcolor="#ffffff">
 <img align=right src=/adm/lonIcons/lonlogos.gif>  <img align=right src=/adm/lonIcons/lonlogos.gif>
 <h1>Search Catalog</h1>  <h1>Search Catalog</h1>
   $testval
 <form method="post" action="/adm/searchcat">  <form method="post" action="/adm/searchcat">
 <input type='button' value='Revise search request'  <input type='button' value='Revise search request'
 onClick='this.form.submit();'>  onClick='this.form.submit();'>

Removed from v.1.23  
changed lines
  Added in v.1.35


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