--- loncom/interface/lonsearchcat.pm 2001/03/27 19:57:53 1.86 +++ loncom/interface/lonsearchcat.pm 2001/03/27 20:33:40 1.87 @@ -586,7 +586,7 @@ sub advancedsearch { $customquery,$customshow); &output_results('Advanced',$r,$envhash,$customquery,$reply); } - $r->print('system error'); # just in case.. hrrmm.. + $r->print(' '); # just in case.. hrrmm.. return OK; } @@ -690,19 +690,26 @@ sub output_results { my $customshow=''; my $extrashow=''; + my @customfields; if ($ENV{'form.customshow'}) { $customshow=$ENV{'form.customshow'}; $customshow=~s/[^\w\s]//g; - my @fields=map {"$_:"} + my @fields=map {"$_:"} split(/\s+/,$customshow); + my @customfields=split(/\s+/,$customshow); if ($customshow) { $extrashow="\n"; } } my $customdata=''; + my %customhash; foreach my $result (@results) { if ($result=~/^(custom\=.*)$/) { # grab all custom metadata - $customdata.=$result; + my $tmp=$result; + $tmp=~s/^custom\=//; + my ($k,$v)=map {&Apache::lonnet::unescape($_); + } split(/\,/,$tmp); + $customhash{$k}=$v; } } foreach my $result (@results) { @@ -718,6 +725,16 @@ sub output_results { my $shortabstract=$abstract; $shortabstract=substr($abstract,0,200) if length($abstract)>200; $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 @@ -740,19 +757,19 @@ END if ($viewselect eq 'Detailed Citation View') { $compiledresult.=&detailed_citation_view(@fields, $hostname,$httphost, - $extrashow); + $extrashow2); } elsif ($viewselect eq 'Summary View') { $compiledresult.=&summary_view(@fields,$hostname,$httphost, - $extrashow); + $extrashow2); } elsif ($viewselect eq 'Fielded Format') { $compiledresult.=&fielded_format_view(@fields,$hostname, - $httphost,$extrashow); + $httphost,$extrashow2); } elsif ($viewselect eq 'XML/SGML') { $compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost, - $extrashow); + $extrashow2); } }