version 1.79, 2001/03/27 02:48:02
|
version 1.87, 2001/03/27 20:33:40
|
Line 560 sub advancedsearch {
|
Line 560 sub advancedsearch {
|
$customquery=&build_custommetadata_query('custommetadata', |
$customquery=&build_custommetadata_query('custommetadata', |
$ENV{'form.custommetadata'}); |
$ENV{'form.custommetadata'}); |
} |
} |
|
my $customshow=''; |
|
if ($ENV{'form.customshow'}) { |
|
$customshow=$ENV{'form.customshow'}; |
|
$customshow=~s/[^\w\s]//g; |
|
my @fields=split(/\s+/,$customshow); |
|
$customshow=join(" ",@fields); |
|
} |
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=''; |
my $reply=''; |
unless ($customquery) { |
unless ($customquery or $customshow) { |
$reply=&Apache::lonnet::metadata_query($query); |
$reply=&Apache::lonnet::metadata_query($query); |
} |
} |
else { |
else { |
$reply=&Apache::lonnet::metadata_query($query,$customquery); |
$reply=&Apache::lonnet::metadata_query($query, |
|
$customquery,$customshow); |
} |
} |
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
} |
} |
else { |
elsif ($customquery) { |
&output_results('Advanced',$r,$envhash,$query); |
my $reply=''; |
|
$reply=&Apache::lonnet::metadata_query('', |
|
$customquery,$customshow); |
|
&output_results('Advanced',$r,$envhash,$customquery,$reply); |
} |
} |
|
$r->print(' '); # just in case.. hrrmm.. |
return OK; |
return OK; |
} |
} |
|
|
Line 678 sub output_results {
|
Line 690 sub output_results {
|
|
|
my $customshow=''; |
my $customshow=''; |
my $extrashow=''; |
my $extrashow=''; |
|
my @customfields; |
if ($ENV{'form.customshow'}) { |
if ($ENV{'form.customshow'}) { |
$customshow=$ENV{'form.customshow'}; |
$customshow=$ENV{'form.customshow'}; |
$customshow=~s/[^\w\s]//g; |
$customshow=~s/[^\w\s]//g; |
my @fields=map {"<font color=\"#008000\">$_:</font>"} |
my @fields=map {"<font color=\"#008000\">$_:</font><!-- $_ -->"} |
split(/\s+/,$customshow); |
split(/\s+/,$customshow); |
$extrashow="<ul><li>".join("</li><li>",@fields)."</li></ul>\n"; |
my @customfields=split(/\s+/,$customshow); |
|
if ($customshow) { |
|
$extrashow="<ul><li>".join("</li><li>",@fields)."</li></ul>\n"; |
|
} |
} |
} |
my $customdata=''; |
my $customdata=''; |
|
my %customhash; |
foreach my $result (@results) { |
foreach my $result (@results) { |
$result=~/(\&custom.*)$/; # grab all custom metadata |
if ($result=~/^(custom\=.*)$/) { # grab all custom metadata |
$custom=$1; |
my $tmp=$result; |
$result=~s/\&custom.*$//; # remove custom metadata |
$tmp=~s/^custom\=//; |
|
my ($k,$v)=map {&Apache::lonnet::unescape($_); |
|
} split(/\,/,$tmp); |
|
$customhash{$k}=$v; |
|
} |
} |
} |
foreach my $result (@results) { |
foreach my $result (@results) { |
|
next if $result=~/^custom\=/; |
|
chomp $result; |
|
next unless $result; |
my @fields=map |
my @fields=map |
{&Apache::lonnet::unescape($_)} |
{&Apache::lonnet::unescape($_)} |
(split(/\,/,$result)); |
(split(/\,/,$result)); |
Line 701 sub output_results {
|
Line 725 sub output_results {
|
my $shortabstract=$abstract; |
my $shortabstract=$abstract; |
$shortabstract=substr($abstract,0,200) if length($abstract)>200; |
$shortabstract=substr($abstract,0,200) if length($abstract)>200; |
$fields[7]=$shortabstract; |
$fields[7]=$shortabstract; |
|
my $extrashow2=$extrashow; |
|
if ($extrashow) { |
|
foreach my $field (@customfields) { |
|
my $value=''; |
|
if ($customhash{$url}=~/\<${field}[^\>]*\>(.*?)\<\/${field}[^\>]*\>/s) { |
|
my $value=$1; |
|
} |
|
$extrashow2=~s/\<\!\-\- $field \-\-\>/$value/g; |
|
} |
|
} |
$compiledresult.=<<END; |
$compiledresult.=<<END; |
<p> |
<p> |
END |
END |
Line 723 END
|
Line 757 END
|
if ($viewselect eq 'Detailed Citation View') { |
if ($viewselect eq 'Detailed Citation View') { |
$compiledresult.=&detailed_citation_view(@fields, |
$compiledresult.=&detailed_citation_view(@fields, |
$hostname,$httphost, |
$hostname,$httphost, |
$extrashow); |
$extrashow2); |
} |
} |
elsif ($viewselect eq 'Summary View') { |
elsif ($viewselect eq 'Summary View') { |
$compiledresult.=&summary_view(@fields,$hostname,$httphost, |
$compiledresult.=&summary_view(@fields,$hostname,$httphost, |
$extrashow); |
$extrashow2); |
} |
} |
elsif ($viewselect eq 'Fielded Format') { |
elsif ($viewselect eq 'Fielded Format') { |
$compiledresult.=&fielded_format_view(@fields,$hostname, |
$compiledresult.=&fielded_format_view(@fields,$hostname, |
$httphost,$extrashow); |
$httphost,$extrashow2); |
} |
} |
elsif ($viewselect eq 'XML/SGML') { |
elsif ($viewselect eq 'XML/SGML') { |
$compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost, |
$compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost, |
$extrashow); |
$extrashow2); |
} |
} |
|
|
} |
} |
Line 776 SCRIPT
|
Line 810 SCRIPT
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<img align=right src=/adm/lonIcons/lonlogos.gif> |
<h1>Search Catalog</h1> |
<h1>Search Catalog</h1> |
<form method="post" action="/adm/searchcat"> |
<form method="post" action="/adm/searchcat"> |
$custom |
$customdata |
<input type='button' value='Revise search request' |
<input type='button' value='Revise search request' |
onClick='this.form.submit();'> |
onClick='this.form.submit();'> |
$closebutton |
$closebutton |