--- loncom/interface/lonsearchcat.pm 2001/03/21 02:27:11 1.53 +++ loncom/interface/lonsearchcat.pm 2001/03/21 03:37:43 1.58 @@ -52,8 +52,16 @@ my %metadatafields; my %cprtag; my %mimetag; my $closebutton; -my $viewselect=< +my $basicviewselect=< + + + + + +END +my $advancedviewselect=< @@ -99,7 +107,7 @@ END { my $fh=Apache::File->new($r->dir_config('lonTabDir').'/language.tab'); map { - $_=~/(\w+)\s+([\w\s\-]+)/; + $_=~/(\w+)\s+([\w\s\-]+)/; chomp; $language{$1}=$2; } <$fh>; } @@ -109,7 +117,7 @@ END { my $fh=Apache::File->new($r->dir_config('lonIncludes').'/copyright.tab'); map { - $_=~/(\w+)\s+([\w\s\-]+)/; + $_=~/(\w+)\s+([\w\s\-]+)/; chomp; $cprtag{$1}=$2; } <$fh>; } @@ -119,7 +127,7 @@ END { my $fh=Apache::File->new($r->dir_config('lonTabDir').'/filetypes.tab'); map { - $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/; + $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/; chomp; $mimetag{$1}=".$1 $3"; } <$fh>; } @@ -262,7 +270,7 @@ ENDDOCUMENT $closebutton -$viewselect +$basicviewselect


Advanced Search

@@ -271,7 +279,7 @@ $scrout $closebutton -$viewselect +$advancedviewselect

@@ -486,13 +494,24 @@ sub advancedsearch { my @queries; # 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}) { 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) { - $query=join(" and ",@queries); + $query=join(" AND ",@queries); $query="select * from metadata where $query"; my $reply=&Apache::lonnet::metadata_query($query); &output_results('Advanced',$r,$envhash,$query,$reply); @@ -617,7 +636,7 @@ sub output_results { $shortabstract=substr($abstract,0,200) if length($abstract)>200; $fields[7]=$shortabstract; $compiledresult.=<($title) +

END $compiledresult.=<$url -
-Title: $title
-Author(s): $author
+$owner, last revised $lastrevisiondate +

$title

+

$author

+

+

Subject: $subject
Keyword(s): $keywords
Notes: $notes
-Abstract: $shortabstract
MIME Type: $mimetag{$mime}
Language: $language{$lang}
-Creation Date: $creationdate
-Last Revision Date: $lastrevisiondate
-Publisher/Owner: $owner
-Copyright/Distribution: $copyright
-Repository Location: $hostname +Copyright/Distribution: $cprtag{$copyright}
+$shortabstract

END return $result; @@ -797,22 +820,10 @@ sub summary_view { $creationdate,$lastrevisiondate,$owner,$copyright, $hostname,$httphost)=@_; my $result=<URL: $url -
-Title: $title
-Author(s): $author
-Subject: $subject
-Keyword(s): $keywords
-Notes: $notes
-Abstract: $shortabstract
-MIME Type: $mimetag{$mime}
-Language: $language{$lang}
-Creation Date: $creationdate
-Last Revision Date: $lastrevisiondate
-Publisher/Owner: $owner
-Copyright/Distribution: $copyright
-Repository Location: $hostname +$author
+$title
+$owner -- $lastrevisiondate
+$cprtag{$copyright}

END return $result; @@ -825,22 +836,21 @@ sub fielded_format_view { $creationdate,$lastrevisiondate,$owner,$copyright, $hostname,$httphost)=@_; my $result=<URL: $url -
-Title: $title
-Author(s): $author
-Subject: $subject
-Keyword(s): $keywords
-Notes: $notes
-Abstract: $shortabstract
-MIME Type: $mimetag{$mime}
-Language: $language{$lang}
-Creation Date: $creationdate
-Last Revision Date: $lastrevisiondate
-Publisher/Owner: $owner
-Copyright/Distribution: $copyright
-Repository Location: $hostname +
+Title: $title
+Author(s): $author
+Subject: $subject
+Keyword(s): $keywords
+Notes: $notes
+MIME Type: $mimetag{$mime}
+Language: $language{$lang}
+Creation Date: $creationdate
+Last Revision Date: $lastrevisiondate
+Publisher/Owner: $owner
+Copyright/Distribution: $cprtag{$copyright}
+Repository Location: $hostname
+Abstract: $shortabstract

END return $result; @@ -853,23 +863,33 @@ sub xml_sgml_view { $creationdate,$lastrevisiondate,$owner,$copyright, $hostname,$httphost)=@_; my $result=<URL: $url -
-Title: $title
-Author(s): $author
-Subject: $subject
-Keyword(s): $keywords
-Notes: $notes
-Abstract: $shortabstract
-MIME Type: $mimetag{$mime}
-Language: $language{$lang}
-Creation Date: $creationdate
-Last Revision Date: $lastrevisiondate
-Publisher/Owner: $owner
-Copyright/Distribution: $copyright
-Repository Location: $hostname -

+
+<LonCapaResource>
+<url>$url</url>
+<title>$title</title>
+<author>$author</author>
+<subject>$subject</subject>
+<keywords>$keywords</keywords>
+<notes>$notes</notes>
+<mimeInfo>
+<mime>$mime</mime>
+<mimetag>$mimetag{$mime}</mimetag>
+</mimeInfo>
+<languageInfo>
+<language>$lang</language>
+<languagetag>$language{$lang}</languagetag>
+</languageInfo>
+<creationdate>$creationdate</creationdate>
+<lastrevisiondate>$lastrevisiondate</lastrevisiondate>
+<owner>$owner</owner>
+<copyrightInfo>
+<copyright>$copyright</copyright>
+<copyrighttag>$cprtag{$copyright}</copyrighttag>
+</copyrightInfo>
+<repositoryLocation>$hostname</repositoryLocation>
+<shortabstract>$shortabstract</shortabstract>
+</LonCapaResource>
+
END return $result; }