Diff for /loncom/interface/lonsearchcat.pm between versions 1.51 and 1.58

version 1.51, 2001/03/21 02:18:14 version 1.58, 2001/03/21 03:37:43
Line 52  my %metadatafields; Line 52  my %metadatafields;
 my %cprtag;  my %cprtag;
 my %mimetag;  my %mimetag;
 my $closebutton;  my $closebutton;
 my $viewselect=<<END;  my $basicviewselect=<<END;
 <select name='view'>  <select name='basicviewselect'>
   <option value='Detailed Citation View'>Detailed Citation View</option>
   <option value='Summary View'>Summary View</option>
   <option value='Fielded Format'>Fielded Format</option>
   <option value='XML/SGML'>XML/SGML</option>
   </select>
   END
   my $advancedviewselect=<<END;
   <select name='advancedviewselect'>
 <option value='Detailed Citation View'>Detailed Citation View</option>  <option value='Detailed Citation View'>Detailed Citation View</option>
 <option value='Summary View'>Summary View</option>  <option value='Summary View'>Summary View</option>
 <option value='Fielded Format'>Fielded Format</option>  <option value='Fielded Format'>Fielded Format</option>
Line 99  END Line 107  END
     {      {
  my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab');   my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab');
  map {   map {
     $_=~/(\w+)\s+([\w\s\-]+)/;      $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
     $language{$1}=$2;      $language{$1}=$2;
  } <$fh>;   } <$fh>;
     }      }
Line 109  END Line 117  END
     {      {
  my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab');   my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab');
  map {   map {
     $_=~/(\w+)\s+([\w\s\-]+)/;      $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
     $cprtag{$1}=$2;      $cprtag{$1}=$2;
  } <$fh>;   } <$fh>;
     }      }
Line 119  END Line 127  END
     {      {
  my $fh=Apache::File->new($r->dir_config('lonTabDir').'/filetypes.tab');   my $fh=Apache::File->new($r->dir_config('lonTabDir').'/filetypes.tab');
  map {   map {
     $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/;      $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/; chomp;
     $mimetag{$1}=".$1 $3";      $mimetag{$1}=".$1 $3";
  } <$fh>;   } <$fh>;
     }      }
Line 262  ENDDOCUMENT Line 270  ENDDOCUMENT
 <input type="submit" name="basicsubmit" value="SEARCH">  <input type="submit" name="basicsubmit" value="SEARCH">
 <input type="reset" name="reset" value="RESET">  <input type="reset" name="reset" value="RESET">
 $closebutton  $closebutton
 $viewselect  $basicviewselect
 </p>  </p>
 <hr>  <hr>
 <h3>Advanced Search</h3>  <h3>Advanced Search</h3>
Line 271  $scrout Line 279  $scrout
 <input type="submit" name="advancedsubmit" value="SEARCH">  <input type="submit" name="advancedsubmit" value="SEARCH">
 <input type="reset" name="reset" value="RESET">  <input type="reset" name="reset" value="RESET">
 $closebutton  $closebutton
 $viewselect  $advancedviewselect
 </p>  </p>
 </form>  </form>
 </body>  </body>
Line 486  sub advancedsearch { Line 494  sub advancedsearch {
   
     my @queries;      my @queries;
     # Go through logical expression AND/OR/NOT phrase fields.      # Go through logical expression AND/OR/NOT phrase fields.
     foreach my $field ('title','author','subject','notes','abstract') {  
       foreach my $field ('title','author','subject','notes','abstract','url',
          'keywords','version','owner') {
  if ($ENV{'form.'.$field}) {   if ($ENV{'form.'.$field}) {
     push @queries,&build_SQL_query($field,$ENV{'form.'.$field});      push @queries,&build_SQL_query($field,$ENV{'form.'.$field});
  }   }
     }      }
       if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') {
    push @queries,"language like $ENV{'form.language'}";
       }
       if ($ENV{'form.mime'} and $ENV{'form.mime'} ne 'any') {
    push @queries,"mime like $ENV{'form.mime'}";
       }
       if ($ENV{'form.copyright'} and $ENV{'form.copyright'} ne 'any') {
    push @queries,"copyright like $ENV{'form.copyright'}";
       }
     if (@queries) {      if (@queries) {
  $query=join(" and ",@queries);   $query=join(" AND ",@queries);
  $query="select * from metadata where $query";   $query="select * from metadata where $query";
  my $reply=&Apache::lonnet::metadata_query($query);   my $reply=&Apache::lonnet::metadata_query($query);
  &output_results('Advanced',$r,$envhash,$query,$reply);   &output_results('Advanced',$r,$envhash,$query,$reply);
Line 593  sub output_results { Line 612  sub output_results {
  $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1;   $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1;
  $reply=~/(.*?)\_/;   $reply=~/(.*?)\_/;
  my $hostname=$1;   my $hostname=$1;
    sleep 3; # temporary fix, need to check for completion and status
  {   {
     while (1) {      while (1) {
  last if -e $replyfile;   last if -e $replyfile;
Line 626  onClick="javascript:select_data('$title' Line 645  onClick="javascript:select_data('$title'
 <br>  <br>
 END  END
             my $httphost=$ENV{'HTTP_HOST'};              my $httphost=$ENV{'HTTP_HOST'};
             if ($ENV{'form.viewselect'} eq 'Detailed Citation View') {  
       my $viewselect;
       if ($mode eq 'Basic') {
    $viewselect=$ENV{'form.basicviewselect'};
       }
       elsif ($mode eq 'Advanced') {
    $viewselect=$ENV{'form.advancedviewselect'};
       }
   
               if ($viewselect eq 'Detailed Citation View') {
  $compiledresult.=&detailed_citation_view(@fields,   $compiledresult.=&detailed_citation_view(@fields,
  $hostname,$httphost);   $hostname,$httphost);
     }      }
             elsif ($ENV{'form.viewselect'} eq 'Summary View') {              elsif ($viewselect eq 'Summary View') {
  $compiledresult.=&summary_view(@fields,$hostname,$httphost);   $compiledresult.=&summary_view(@fields,$hostname,$httphost);
     }      }
             elsif ($ENV{'form.viewselect'} eq 'Fielded Format') {              elsif ($viewselect eq 'Fielded Format') {
  $compiledresult.=&fielded_format_view(@fields,$hostname,   $compiledresult.=&fielded_format_view(@fields,$hostname,
       $httphost);        $httphost);
     }      }
             elsif ($ENV{'form.viewselect'} eq 'XML/SGML') {              elsif ($viewselect eq 'XML/SGML') {
  $compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost);   $compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost);
     }      }
   
Line 768  sub detailed_citation_view { Line 796  sub detailed_citation_view {
  $creationdate,$lastrevisiondate,$owner,$copyright,   $creationdate,$lastrevisiondate,$owner,$copyright,
  $hostname,$httphost)=@_;   $hostname,$httphost)=@_;
     my $result=<<END;      my $result=<<END;
 DETAILED  <i>$owner</i>, last revised $lastrevisiondate
 <b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A>  <h3><A HREF="http://$httphost$url" TARGET='search_preview'>$title</A></h3>
 <br>  <h3>$author</h3>
 <b>Title:</b> $title<br>  </p>
 <b>Author(s):</b> $author<br>  <p>
 <b>Subject:</b> $subject<br>  <b>Subject:</b> $subject<br>
 <b>Keyword(s):</b> $keywords<br>  <b>Keyword(s):</b> $keywords<br>
 <b>Notes:</b> $notes<br>  <b>Notes:</b> $notes<br>
 <b>Abstract:</b> $shortabstract<br>  
 <b>MIME Type:</b> $mimetag{$mime}<br>  <b>MIME Type:</b> $mimetag{$mime}<br>
 <b>Language:</b> $language{$lang}<br>  <b>Language:</b> $language{$lang}<br>
 <b>Creation Date:</b> $creationdate<br>  <b>Copyright/Distribution:</b> $cprtag{$copyright}<br>
 <b>Last Revision Date:</b> $lastrevisiondate<br>  $shortabstract
 <b>Publisher/Owner:</b> $owner<br>  
 <b>Copyright/Distribution:</b> $copyright<br>  
 <b>Repository Location:</b> $hostname  
 </p>  </p>
 END  END
     return $result;      return $result;
Line 796  sub summary_view { Line 820  sub summary_view {
  $creationdate,$lastrevisiondate,$owner,$copyright,   $creationdate,$lastrevisiondate,$owner,$copyright,
  $hostname,$httphost)=@_;   $hostname,$httphost)=@_;
     my $result=<<END;      my $result=<<END;
 SUMMARY  <a href="http://$httphost$url" TARGET='search_preview'>$author</a><br />
 <b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A>  $title<br />
 <br>  $owner -- $lastrevisiondate<br />
 <b>Title:</b> $title<br>  $cprtag{$copyright}<br />
 <b>Author(s):</b> $author<br>  
 <b>Subject:</b> $subject<br>  
 <b>Keyword(s):</b> $keywords<br>  
 <b>Notes:</b> $notes<br>  
 <b>Abstract:</b> $shortabstract<br>  
 <b>MIME Type:</b> $mimetag{$mime}<br>  
 <b>Language:</b> $language{$lang}<br>  
 <b>Creation Date:</b> $creationdate<br>  
 <b>Last Revision Date:</b> $lastrevisiondate<br>  
 <b>Publisher/Owner:</b> $owner<br>  
 <b>Copyright/Distribution:</b> $copyright<br>  
 <b>Repository Location:</b> $hostname  
 </p>  </p>
 END  END
     return $result;      return $result;
Line 824  sub fielded_format_view { Line 836  sub fielded_format_view {
  $creationdate,$lastrevisiondate,$owner,$copyright,   $creationdate,$lastrevisiondate,$owner,$copyright,
  $hostname,$httphost)=@_;   $hostname,$httphost)=@_;
     my $result=<<END;      my $result=<<END;
 FIELDED  
 <b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A>  <b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A>
 <br>  <br />
 <b>Title:</b> $title<br>  <b>Title:</b> $title<br />
 <b>Author(s):</b> $author<br>  <b>Author(s):</b> $author<br />
 <b>Subject:</b> $subject<br>  <b>Subject:</b> $subject<br />
 <b>Keyword(s):</b> $keywords<br>  <b>Keyword(s):</b> $keywords<br />
 <b>Notes:</b> $notes<br>  <b>Notes:</b> $notes<br />
 <b>Abstract:</b> $shortabstract<br>  <b>MIME Type:</b> $mimetag{$mime}<br />
 <b>MIME Type:</b> $mimetag{$mime}<br>  <b>Language:</b> $language{$lang}<br />
 <b>Language:</b> $language{$lang}<br>  <b>Creation Date:</b> $creationdate<br />
 <b>Creation Date:</b> $creationdate<br>  <b>Last Revision Date:</b> $lastrevisiondate<br />
 <b>Last Revision Date:</b> $lastrevisiondate<br>  <b>Publisher/Owner:</b> $owner<br />
 <b>Publisher/Owner:</b> $owner<br>  <b>Copyright/Distribution:</b> $cprtag{$copyright}<br />
 <b>Copyright/Distribution:</b> $copyright<br>  <b>Repository Location:</b> $hostname<br />
 <b>Repository Location:</b> $hostname  <b>Abstract:</b> $shortabstract<br />
 </p>  </p>
 END  END
     return $result;      return $result;
Line 852  sub xml_sgml_view { Line 863  sub xml_sgml_view {
  $creationdate,$lastrevisiondate,$owner,$copyright,   $creationdate,$lastrevisiondate,$owner,$copyright,
  $hostname,$httphost)=@_;   $hostname,$httphost)=@_;
     my $result=<<END;      my $result=<<END;
 XML/SGML  <pre>
 <b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A>  &lt;LonCapaResource&gt;
 <br>  &lt;url&gt;$url&lt;/url&gt;
 <b>Title:</b> $title<br>  &lt;title&gt;$title&lt;/title&gt;
 <b>Author(s):</b> $author<br>  &lt;author&gt;$author&lt;/author&gt;
 <b>Subject:</b> $subject<br>  &lt;subject&gt;$subject&lt;/subject&gt;
 <b>Keyword(s):</b> $keywords<br>  &lt;keywords&gt;$keywords&lt;/keywords&gt;
 <b>Notes:</b> $notes<br>  &lt;notes&gt;$notes&lt;/notes&gt;
 <b>Abstract:</b> $shortabstract<br>  &lt;mimeInfo&gt;
 <b>MIME Type:</b> $mimetag{$mime}<br>  &lt;mime&gt;$mime&lt;/mime&gt;
 <b>Language:</b> $language{$lang}<br>  &lt;mimetag&gt;$mimetag{$mime}&lt;/mimetag&gt;
 <b>Creation Date:</b> $creationdate<br>  &lt;/mimeInfo&gt;
 <b>Last Revision Date:</b> $lastrevisiondate<br>  &lt;languageInfo&gt;
 <b>Publisher/Owner:</b> $owner<br>  &lt;language&gt;$lang&lt;/language&gt;
 <b>Copyright/Distribution:</b> $copyright<br>  &lt;languagetag&gt;$language{$lang}&lt;/languagetag&gt;
 <b>Repository Location:</b> $hostname  &lt;/languageInfo&gt;
 </p>  &lt;creationdate&gt;$creationdate&lt;/creationdate&gt;
   &lt;lastrevisiondate&gt;$lastrevisiondate&lt;/lastrevisiondate&gt;
   &lt;owner&gt;$owner&lt;/owner&gt;
   &lt;copyrightInfo&gt;
   &lt;copyright&gt;$copyright&lt;/copyright&gt;
   &lt;copyrighttag&gt;$cprtag{$copyright}&lt;/copyrighttag&gt;
   &lt;/copyrightInfo&gt;
   &lt;repositoryLocation&gt;$hostname&lt;/repositoryLocation&gt;
   &lt;shortabstract&gt;$shortabstract&lt;/shortabstract&gt;
   &lt;/LonCapaResource&gt;
   </pre>
 END  END
     return $result;      return $result;
 }  }

Removed from v.1.51  
changed lines
  Added in v.1.58


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