version 1.129, 2002/06/25 15:08:59
|
version 1.130, 2002/06/26 16:04:13
|
Line 223 END
|
Line 223 END
|
## |
## |
if ($ENV{'form.basicsubmit'} eq 'SEARCH') { |
if ($ENV{'form.basicsubmit'} eq 'SEARCH') { |
# Perform basic search and give results |
# Perform basic search and give results |
return &basicsearch($r,\%ENV,$hidden); |
return &basicsearch($r,$hidden); |
} elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') { |
} elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') { |
# Perform advanced search and give results |
# Perform advanced search and give results |
return &advancedsearch($r,\%ENV,$hidden); |
return &advancedsearch($r,$hidden); |
} elsif ($ENV{'form.reqinterface'} eq 'advanced') { |
} elsif ($ENV{'form.reqinterface'} eq 'advanced') { |
# Output the advanced interface |
# Output the advanced interface |
$r->print(&advanced_search_form($closebutton,$hidden)); |
$r->print(&advanced_search_form($closebutton,$hidden)); |
Line 290 ENDDOCUMENT
|
Line 290 ENDDOCUMENT
|
<p> |
<p> |
<input type="submit" name="basicsubmit" value='SEARCH' /> |
<input type="submit" name="basicsubmit" value='SEARCH' /> |
$closebutton |
$closebutton |
<!-- basic view selection --> |
<!-- view selection --> |
<select name='basicviewselect'> |
<select name="viewselect"> |
<option value='Detailed Citation View' selected="true"> |
<option value="Detailed Citation View" selected="true" >Detailed Citation View</option> |
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> |
<option value="XML/SGML" >XML/SGML</option> |
<option value='XML/SGML'>XML/SGML</option> |
|
</select> |
</select> |
<!-- end of basic view selection --> |
<!-- end of view selection --> |
<input type="button" value="HELP" onClick="openhelp()" /> |
<input type="button" value="HELP" onClick="openhelp()" /> |
</p> |
</p> |
</form> |
</form> |
Line 328 sub advanced_search_form{
|
Line 327 sub advanced_search_form{
|
<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 |
<!-- advance view select --> |
|
<select name='advancedviewselect'> |
|
<option value='Detailed Citation View' selected="true"> |
|
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 of advanced view select --> |
|
<input type="button" value="HELP" onClick="openhelp()" /> |
<input type="button" value="HELP" onClick="openhelp()" /> |
</p> |
</p> |
END |
END |
Line 358 END
|
Line 348 END
|
<hr /> |
<hr /> |
Enter terms or quoted phrases separated by search operators |
Enter terms or quoted phrases separated by search operators |
such as AND, OR, or NOT.<br /> |
such as AND, OR, or NOT.<br /> |
|
<form method="post" action="/adm/searchcat"> |
$advanced_buttons |
$advanced_buttons |
$hidden |
$hidden |
<table> |
<table> |
|
<tr><td><font color="#800000" face="helvetica"><b>VIEW:</b></font></td> |
|
<td> |
|
<!-- view selection --> |
|
<select name="viewselect" size ="1"> |
|
<option value="Detailed Citation View" selected="true">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 of view selection --> |
|
</td></tr> |
ENDHEADER |
ENDHEADER |
$scrout.=&searchphrasefield('title','title', |
$scrout.=&searchphrasefield('title','title', |
$ENV{'form.title'}); |
$ENV{'form.title'}); |
Line 693 Parse advanced search results.
|
Line 695 Parse advanced search results.
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub advancedsearch { |
sub advancedsearch { |
my ($r,$envhash,$hidden)=@_; |
my ($r,$hidden)=@_; |
my %ENV=%{$envhash}; |
|
my $fillflag=0; |
my $fillflag=0; |
# Clean up fields for safety |
# Clean up fields for safety |
for my $field ('title','author','subject','keywords','url','version', |
for my $field ('title','author','subject','keywords','url','version', |
Line 796 sub advancedsearch {
|
Line 797 sub advancedsearch {
|
$reply=&Apache::lonnet::metadata_query($query, |
$reply=&Apache::lonnet::metadata_query($query, |
$customquery,$customshow); |
$customquery,$customshow); |
} |
} |
&output_results('Advanced',$r,$envhash,$customquery,$reply,$hidden); |
&output_results('Advanced',$r,$customquery,$reply,$hidden); |
return OK; |
return OK; |
} elsif ($customquery) { |
} elsif ($customquery) { |
my $reply; # reply hash reference |
my $reply; # reply hash reference |
$reply=&Apache::lonnet::metadata_query('', |
$reply=&Apache::lonnet::metadata_query('', |
$customquery,$customshow); |
$customquery,$customshow); |
&output_results('Advanced',$r,$envhash,$customquery,$reply,$hidden); |
&output_results('Advanced',$r,$customquery,$reply,$hidden); |
return OK; |
return OK; |
} |
} |
# should not get to this point |
# should not get to this point |
Line 823 Parse basic search form.
|
Line 824 Parse basic search form.
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub basicsearch { |
sub basicsearch { |
my ($r,$envhash,$hidden)=@_; |
my ($r,$hidden)=@_; |
my %ENV=%{$envhash}; |
|
# Clean up fields for safety |
# Clean up fields for safety |
for my $field ('basicexp') { |
for my $field ('basicexp') { |
$ENV{"form.$field"}=~s/[^\w\s\(\)\-]//g; |
$ENV{"form.$field"}=~s/[^\w\s\(\)\-]//g; |
Line 857 sub basicsearch {
|
Line 857 sub basicsearch {
|
# &Apache::lonnet::logthis("metadata query finished:".time); |
# &Apache::lonnet::logthis("metadata query finished:".time); |
# Output search results |
# Output search results |
|
|
&output_results('Basic',$r,$envhash,$query,$reply,$hidden); |
&output_results('Basic',$r,$query,$reply,$hidden); |
|
|
return OK; |
return OK; |
} |
} |
Line 1049 contacted, etc.)
|
Line 1049 contacted, etc.)
|
sub output_results { |
sub output_results { |
# &Apache::lonnet::logthis("output_results:".time); |
# &Apache::lonnet::logthis("output_results:".time); |
my $fnum; # search result counter |
my $fnum; # search result counter |
my ($mode,$r,$envhash,$query,$replyref,$hidden)=@_; |
my ($mode,$r,$query,$replyref,$hidden)=@_; |
my %ENV=%{$envhash}; |
|
my %rhash=%{$replyref}; |
my %rhash=%{$replyref}; |
my $compiledresult=''; |
my $compiledresult=''; |
my $timeremain=300; # (seconds) |
my $timeremain=300; # (seconds) |
my $elapsetime=0; |
my $elapsetime=0; |
my $resultflag=0; |
my $resultflag=0; |
my $tflag=1; |
my $tflag=1; |
|
my $viewselect=$ENV{'form.viewselect'}; |
# |
# |
# make query information persistent to allow for subsequent revision |
# make query information persistent to allow for subsequent revision |
my $persistent=&make_persistent(); |
my $persistent=&make_persistent(); |
# spit out the generic header |
# spit out the results header |
$r->print(&search_results_header()); |
$r->print(&search_results_header($mode)); |
$r->rflush(); |
$r->rflush(); |
# begin showing the cataloged results |
# begin showing the cataloged results |
$r->print(<<CATALOGBEGIN); |
|
</head> |
|
<body bgcolor="#ffffff"> |
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>Search Catalog</h1> |
|
CATALOGBEGIN |
|
my $action = "/adm/searchcat"; |
my $action = "/adm/searchcat"; |
if ($mode eq 'Basic') { |
if ($mode eq 'Basic') { |
$action .= "?reqinterface=basic"; |
$action .= "?reqinterface=basic"; |
Line 1086 $importbutton
|
Line 1080 $importbutton
|
$closebutton |
$closebutton |
$persistent |
$persistent |
<hr /> |
<hr /> |
<h3>Search Query</h3> |
|
CATALOGCONTROLS |
CATALOGCONTROLS |
# |
# |
# Remind them what they searched for |
|
# |
|
if ($mode eq 'Basic') { |
|
$r->print('<p><b>Basic search:</b> '.$ENV{'form.basicexp'}.'</p>'); |
|
} elsif ($mode eq 'Advanced') { |
|
$r->print('<p><b>Advanced search</b> '.$query.'</p>'); |
|
} |
|
$r->print('<h3>Search Results</h3>'); |
|
$r->rflush(); |
|
# |
|
# make the pop-up window for status |
# make the pop-up window for status |
# |
# |
$r->print(&make_popwin(%rhash)); |
$r->print(&make_popwin(%rhash)); |
Line 1202 CATALOGCONTROLS
|
Line 1185 CATALOGCONTROLS
|
$Fields{'extrashow'}=~s/\<\!\-\- $field \-\-\>/ $value/g; |
$Fields{'extrashow'}=~s/\<\!\-\- $field \-\-\>/ $value/g; |
} |
} |
} |
} |
if ($compiledresult or $servercount!=$servernum) { |
|
$compiledresult.="<hr align='left' width='200' noshade />"; |
|
} |
|
$compiledresult.="\n<p>\n"; |
$compiledresult.="\n<p>\n"; |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
my $titleesc=$Fields{'title'}; |
my $titleesc=$Fields{'title'}; |
Line 1231 END
|
Line 1211 END
|
# <input type="hidden" name="url$fnum" value="$url" /> |
# <input type="hidden" name="url$fnum" value="$url" /> |
$fnum++; |
$fnum++; |
} |
} |
my $viewselect; |
|
if ($mode eq 'Basic') { |
|
$viewselect=$ENV{'form.basicviewselect'}; |
|
} |
|
elsif ($mode eq 'Advanced') { |
|
$viewselect=$ENV{'form.advancedviewselect'}; |
|
} |
|
if ($viewselect eq 'Detailed Citation View') { |
if ($viewselect eq 'Detailed Citation View') { |
$compiledresult.=&detailed_citation_view |
$compiledresult.=&detailed_citation_view |
(%Fields, hostname => $rkey ); |
(%Fields, hostname => $rkey ); |
Line 1254 END
|
Line 1227 END
|
$compiledresult.=&xml_sgml_view |
$compiledresult.=&xml_sgml_view |
(%Fields, hostname => $rkey ); |
(%Fields, hostname => $rkey ); |
} |
} |
|
if ($compiledresult or $servercount!=$servernum) { |
|
$compiledresult.="<hr align='left' width='200' noshade />"; |
|
} |
} |
} |
untie %hash; |
untie %hash; |
} |
} |
Line 1402 sub handle_custom_fields {
|
Line 1378 sub handle_custom_fields {
|
|
|
=item &search_results_header |
=item &search_results_header |
|
|
Output the proper javascript code to deal with different calling modes. |
Output the proper html headers and javascript code to deal with different |
|
calling modes. |
|
|
|
Takes most inputs directly from %ENV, except $mode. |
|
|
|
=over 4 |
|
|
|
=item $mode is either (at this writing) 'Basic' or 'Advanced' |
|
|
|
=back |
|
|
Takes inputs directly from from %ENV. The following environment variables |
The following environment variables are checked: |
are checked: |
|
|
|
=over 4 |
=over 4 |
|
|
Line 1428 Checked for existance & 'edit' mode.
|
Line 1412 Checked for existance & 'edit' mode.
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub search_results_header { |
sub search_results_header { |
|
my ($mode) = @_; |
|
$mode = lc($mode); |
|
my $title; |
|
if ($mode eq 'advanced') { |
|
$title = "Advanced Search Results"; |
|
} elsif ($mode eq 'basic') { |
|
$title = "Basic Search Results"; |
|
} |
my $result = ''; |
my $result = ''; |
# output beginning of search page |
# output beginning of search page |
$result.=<<BEGINNING; |
$result.=<<BEGINNING; |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>$title</title> |
BEGINNING |
BEGINNING |
# conditional output of script functions dependent on the mode in |
# conditional output of script functions dependent on the mode in |
# which the search was invoked |
# which the search was invoked |
Line 1516 SCRIPT
|
Line 1508 SCRIPT
|
} |
} |
</script> |
</script> |
SCRIPT |
SCRIPT |
|
$result.=<<END; |
|
</head> |
|
<body bgcolor="#ffffff"> |
|
<img align=right src=/adm/lonIcons/lonlogos.gif> |
|
<h1>$title</h1> |
|
END |
return $result; |
return $result; |
} |
} |
|
|
Line 1639 extra custom metadata to show.
|
Line 1637 extra custom metadata to show.
|
sub detailed_citation_view { |
sub detailed_citation_view { |
my %values = @_; |
my %values = @_; |
my $result=<<END; |
my $result=<<END; |
<i>$values{'owner'}</i>, last revised $values{'lastrevisiondate'} |
|
<h3><a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
<h3><a href="http://$ENV{'HTTP_HOST'}$values{'url'}" |
target='search_preview'>$values{'title'}</a></h3> |
target='search_preview'>$values{'title'}</a></h3> |
<h3>$values{'author'}</h3> |
|
</p> |
|
<p> |
<p> |
<b>Subject:</b> $values{'subject'}<br /> |
<b>$values{'author'}</b>, <i>$values{'owner'}</i><br /> |
<b>Keyword(s):</b> $values{'keywords'}<br /> |
|
<b>Notes:</b> $values{'notes'}<br /> |
<b>Subject: </b> $values{'subject'}<br /> |
<b>MIME Type:</b> |
<b>Keyword(s): </b> $values{'keywords'}<br /> |
END |
<b>Notes: </b> $values{'notes'}<br /> |
$result.=&Apache::loncommon::filedescription($values{'mime'}); |
<b>MIME Type: </b> $values{'mimetag'}<br /> |
$result.=<<END; |
<b>Language: </b> $values{'language'}<br /> |
<br /> |
<b>Copyright/Distribution:</b> $values{'cprtag'}<br /> |
<b>Language:</b> |
|
END |
|
$result.=&Apache::loncommon::languagedescription($values{'lang'}); |
|
$result.=<<END; |
|
<br /> |
|
<b>Copyright/Distribution:</b> |
|
END |
|
$result.=&Apache::loncommon::copyrightdescription($values{'copyright'}); |
|
$result.=<<END; |
|
<br /> |
|
</p> |
</p> |
$values{'extrashow'} |
$values{'extrashow'} |
<p> |
<p> |