version 1.130, 2002/06/26 16:04:13
|
version 1.136, 2002/07/05 18:56:52
|
Line 107 button that closes the search window
|
Line 107 button that closes the search window
|
|
|
=item $importbutton |
=item $importbutton |
|
|
button to take the selecte results and go to group sorting |
button to take the select results and go to group sorting |
|
|
=item %hash |
=item %hash |
|
|
Line 212 END
|
Line 212 END
|
onClick='javascript:select_group()'> |
onClick='javascript:select_group()'> |
END |
END |
} |
} |
$hidden .= <<END; |
$hidden .= &make_persistent({ "form.mode" => $ENV{'form.mode'}, |
<input type='hidden' name='mode' value='$ENV{'form.mode'}'> |
"form.form" => $ENV{'form.form'}, |
<input type='hidden' name='form' value='$ENV{'form.form'}'> |
"form.element" => $ENV{'form.element'}, |
<input type='hidden' name='element' value='$ENV{'form.element'}'> |
"form.date" => 2 }); |
<input type='hidden' name='date' value='2'> |
|
END |
|
## |
## |
## What are we doing? |
## What are we doing? |
## |
## |
if ($ENV{'form.basicsubmit'} eq 'SEARCH') { |
my $searchtype; |
# Perform basic search and give results |
$searchtype = 'Basic' if ($ENV{'form.basicsubmit'} eq 'SEARCH'); |
return &basicsearch($r,$hidden); |
$searchtype = 'Advanced' if ($ENV{'form.advancedsubmit'} eq 'SEARCH'); |
} elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') { |
if ($searchtype) { |
# Perform advanced search and give results |
my ($query,$customquery,$customshow,$libraries) = |
return &advancedsearch($r,$hidden); |
(undef,undef,undef,undef); |
|
if ($searchtype eq 'Basic') { |
|
$query = &parse_basic_search($r); |
|
} elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') { |
|
($query,$customquery,$customshow,$libraries) |
|
= &parse_advanced_search($r); |
|
return OK if (! defined($query)); |
|
} |
|
# Send query statements over the network to be processed by |
|
# either the SQL database or a recursive scheme of 'grep'-like |
|
# actions (for custom metadata). |
|
$r->rflush(); |
|
my $reply=&Apache::lonnet::metadata_query($query,$customquery, |
|
$customshow,$libraries); |
|
&output_results($searchtype,$r,$reply,$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)); |
return OK; |
|
} else { |
} else { |
# Output normal search interface |
# Output normal search interface |
$r->print(&basic_search_form($closebutton,$hidden)); |
$r->print(&basic_search_form($closebutton,$hidden)); |
Line 273 sub basic_search_form{
|
Line 284 sub basic_search_form{
|
$hidden |
$hidden |
<h3>Basic Search</h3> |
<h3>Basic Search</h3> |
<p> |
<p> |
Enter terms or quoted phrases separated by AND, OR, or NOT |
Enter terms or phrases separated by AND, OR, or NOT |
then press SEARCH below. |
then press SEARCH below. |
</p> |
</p> |
<p> |
<p> |
Line 346 END
|
Line 357 END
|
<img align='right' src='/adm/lonIcons/lonlogos.gif' /> |
<img align='right' src='/adm/lonIcons/lonlogos.gif' /> |
<h1>Advanced Catalog Search</h1> |
<h1>Advanced Catalog Search</h1> |
<hr /> |
<hr /> |
Enter terms or quoted phrases separated by search operators |
Enter terms or 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"> |
<form method="post" action="/adm/searchcat"> |
$advanced_buttons |
$advanced_buttons |
Line 364 $hidden
|
Line 375 $hidden
|
<!-- end of view selection --> |
<!-- end of view selection --> |
</td></tr> |
</td></tr> |
ENDHEADER |
ENDHEADER |
$scrout.=&searchphrasefield('title','title', |
$scrout.=&searchphrasefield('title', 'title' ,$ENV{'form.title'}); |
$ENV{'form.title'}); |
$scrout.=&searchphrasefield('author', 'author' ,$ENV{'form.author'}); |
$scrout.=&searchphrasefield('author','author', |
$scrout.=&searchphrasefield('subject', 'subject' ,$ENV{'form.subject'}); |
$ENV{'form.author'}); |
$scrout.=&searchphrasefield('keywords','keywords',$ENV{'form.keywords'}); |
$scrout.=&searchphrasefield('subject','subject', |
$scrout.=&searchphrasefield('URL', 'url' ,$ENV{'form.url'}); |
$ENV{'form.subject'}); |
$scrout.=&searchphrasefield('notes', 'notes' ,$ENV{'form.notes'}); |
$scrout.=&searchphrasefield('keywords','keywords', |
$scrout.=&searchphrasefield('abstract','abstract',$ENV{'form.abstract'}); |
$ENV{'form.keywords'}); |
|
$scrout.=&searchphrasefield('URL','url', |
|
$ENV{'form.url'}); |
|
# $scrout.=&searchphrasefield('Limit by version','version', |
|
# $ENV{'form.version'}); |
|
$scrout.=&searchphrasefield('notes','notes', |
|
$ENV{'form.notes'}); |
|
$scrout.=&searchphrasefield('abstract','abstract', |
|
$ENV{'form.abstract'}); |
|
# Hack - an empty table row. |
# Hack - an empty table row. |
$scrout.="<tr><td> </td><td> </td></tr>\n"; |
$scrout.="<tr><td> </td><td> </td></tr>\n"; |
$scrout.=&searchphrasefield('file<br />extension','mime', |
$scrout.=&searchphrasefield('file<br />extension','mime', |
Line 388 ENDHEADER
|
Line 390 ENDHEADER
|
$scrout.=&searchphrasefield('publisher<br />owner','owner', |
$scrout.=&searchphrasefield('publisher<br />owner','owner', |
$ENV{'form.owner'}); |
$ENV{'form.owner'}); |
$scrout.="</table>\n"; |
$scrout.="</table>\n"; |
# $ENV{'form.mime'}='any' unless length($ENV{'form.mime'}); |
$ENV{'form.category'}='any' unless length($ENV{'form.category'}); |
# $scrout.=&selectbox('Limit by MIME type','mime', |
$scrout.=&selectbox('File Category','category', |
# $ENV{'form.mime'}, |
$ENV{'form.category'}, |
# 'any','Any type', |
'any','Any category', |
# \&{Apache::loncommon::filedescriptionex}, |
undef, |
# (&Apache::loncommon::fileextensions)); |
(&Apache::loncommon::filecategories())); |
$ENV{'form.language'}='any' unless length($ENV{'form.language'}); |
$ENV{'form.language'}='any' unless length($ENV{'form.language'}); |
|
#---------------------------------------------------------------- |
|
# Allow restriction to multiple domains. |
|
# I make the crazy assumption that there will never be a domain 'any'. |
|
# |
|
$ENV{'form.domains'} = 'any' if (! exists($ENV{'form.domains'})); |
|
my @allowed_domains = (ref($ENV{'form.domains'}) ? @{$ENV{'form.domains'}} |
|
: ($ENV{'form.domains'}) ); |
|
my %domain_hash = (); |
|
foreach (@allowed_domains) { |
|
$domain_hash{$_}++; |
|
} |
|
my @domains =&Apache::loncommon::get_domains(); |
|
# adjust the size of the select box |
|
my $size = 4; |
|
my $size = (scalar @domains < ($size - 1) ? scalar @domains + 1 : $size); |
|
# standalone machines do not get to choose a domain to search. |
|
if ((scalar @domains) == 1) { |
|
$scrout .='<input type="hidden" name="domains" value="any" />'."\n"; |
|
} else { |
|
$scrout.="\n".'<font color="#800000" face="helvetica"><b>'. |
|
'DOMAINS</b></font><br />'. |
|
'<select name="domains" size="'.$size.'" multiple>'."\n". |
|
'<option name="any" value="any" '. |
|
($domain_hash{'any'}? 'selected ' :''). |
|
'>all domains</option>'."\n"; |
|
foreach my $dom (sort @domains) { |
|
$scrout.="<option name=\"$dom\" ". |
|
($domain_hash{$dom} ? 'selected ' :'').">$dom</option>\n"; |
|
} |
|
$scrout.="</select>\n"; |
|
} |
|
#---------------------------------------------------------------- |
$scrout.=&selectbox('Limit by language','language', |
$scrout.=&selectbox('Limit by language','language', |
$ENV{'form.language'},'any','Any Language', |
$ENV{'form.language'},'any','Any Language', |
\&{Apache::loncommon::languagedescription}, |
\&{Apache::loncommon::languagedescription}, |
Line 493 to be somewhat persistent.
|
Line 527 to be somewhat persistent.
|
###################################################################### |
###################################################################### |
|
|
sub make_persistent { |
sub make_persistent { |
|
my %save = %{shift()}; |
my $persistent=''; |
my $persistent=''; |
foreach (keys %ENV) { |
foreach (keys %save) { |
if (/^form\./ && !/submit/) { |
if (/^form\./ && !/submit/) { |
my $name=$_; |
my $name=$_; |
my $key=$name; |
my @values = (ref($save{$name}) ? @{$save{$name}} : ($save{$name})); |
$ENV{$key}=~s/\'//g; # do not mess with html field syntax |
|
$name=~s/^form\.//; |
$name=~s/^form\.//; |
$persistent.=<<END; |
foreach (@values) { |
<input type="hidden" name="$name" value="$ENV{$key}" /> |
s/\"/\'/g; # do not mess with html field syntax |
|
$persistent.=<<END; |
|
<input type="hidden" name="$name" value="$_" /> |
END |
END |
|
} |
} |
} |
} |
} |
return $persistent; |
return $persistent; |
Line 667 sub selectbox {
|
Line 704 sub selectbox {
|
if (! defined($functionref)) { $functionref = sub { $_[0]}; } |
if (! defined($functionref)) { $functionref = sub { $_[0]}; } |
my $uctitle=uc($title); |
my $uctitle=uc($title); |
my $selout="\n".'<p><font color="#800000" face="helvetica">'. |
my $selout="\n".'<p><font color="#800000" face="helvetica">'. |
'<b>'.$uctitle.':</b></font><br /><select name="'.$name.'">'; |
'<b>'.$uctitle.': </b></font><select name="'.$name.'">'; |
foreach ($anyvalue,@idlist) { |
foreach ($anyvalue,@idlist) { |
$selout.='<option value="'.$_.'"'; |
$selout.='<option value="'.$_.'"'; |
if ($_ eq $default and !/^any$/) { |
if ($_ eq $default and !/^any$/) { |
Line 686 sub selectbox {
|
Line 723 sub selectbox {
|
|
|
=pod |
=pod |
|
|
=item &advancedsearch() |
=item &parse_advanced_search() |
|
|
|
Parse advanced search form and return the following: |
|
|
|
=over 4 |
|
|
|
=item $query Scalar containing an SQL query. |
|
|
Parse advanced search results. |
=item $customquery Scalar containing a custom query. |
|
|
|
=item $customshow Scalar containing commands to show custom metadata. |
|
|
|
=item $libraries_to_query Reference to array of domains to search. |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub advancedsearch { |
sub parse_advanced_search { |
my ($r,$hidden)=@_; |
my ($r)=@_; |
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 706 sub advancedsearch {
|
Line 755 sub advancedsearch {
|
'lastrevisiondatestart_year','lastrevisiondateend_month', |
'lastrevisiondatestart_year','lastrevisiondateend_month', |
'lastrevisiondateend_day','lastrevisiondateend_year', |
'lastrevisiondateend_day','lastrevisiondateend_year', |
'notes','abstract','mime','language','owner', |
'notes','abstract','mime','language','owner', |
'custommetadata','customshow') { |
'custommetadata','customshow','category') { |
$ENV{"form.$field"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
$ENV{"form.$field"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
} |
} |
foreach ('mode','form','element') { |
foreach ('mode','form','element') { |
Line 715 sub advancedsearch {
|
Line 764 sub advancedsearch {
|
$ENV{"form.$_"}=&Apache::lonnet::unescape($ENV{"form.$_"}); |
$ENV{"form.$_"}=&Apache::lonnet::unescape($ENV{"form.$_"}); |
$ENV{"form.$_"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
$ENV{"form.$_"}=~s/[^\w\/\s\(\)\=\-\"\']//g; |
} |
} |
|
# Preprocess the category form element. |
|
if ($ENV{'form.category'} ne 'any') { |
|
my @extensions = &Apache::loncommon::filecategorytypes |
|
($ENV{'form.category'}); |
|
$ENV{'form.mime'} = join ' OR ',@extensions; |
|
} |
# Check to see if enough information was filled in |
# Check to see if enough information was filled in |
for my $field ('title','author','subject','keywords','url','version', |
for my $field ('title','author','subject','keywords','url','version', |
'notes','abstract','mime','language','owner', |
'notes','abstract','mime','language','owner', |
Line 725 sub advancedsearch {
|
Line 780 sub advancedsearch {
|
} |
} |
unless ($fillflag) { |
unless ($fillflag) { |
&output_blank_field_error($r); |
&output_blank_field_error($r); |
return OK; |
return ; |
} |
} |
# Turn the form input into a SQL-based query |
# Turn the form input into a SQL-based query |
my $query=''; |
my $query=''; |
Line 735 sub advancedsearch {
|
Line 790 sub advancedsearch {
|
'keywords','version','owner','mime') { |
'keywords','version','owner','mime') { |
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}); |
} |
} |
|
} |
|
# I dislike the hack below. |
|
if ($ENV{'form.category'}) { |
|
$ENV{'form.mime'}=''; |
} |
} |
# Evaluate option lists |
# Evaluate option lists |
if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') { |
if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') { |
push @queries,"(language like \"$ENV{'form.language'}\")"; |
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') { |
if ($ENV{'form.copyright'} and $ENV{'form.copyright'} ne 'any') { |
push @queries,"(copyright like \"$ENV{'form.copyright'}\")"; |
push @queries,"(copyright like \"$ENV{'form.copyright'}\")"; |
} |
} |
Line 765 sub advancedsearch {
|
Line 821 sub advancedsearch {
|
# Test to see if date windows are legitimate |
# Test to see if date windows are legitimate |
if ($datequery=~/^Incorrect/) { |
if ($datequery=~/^Incorrect/) { |
&output_date_error($r,$datequery); |
&output_date_error($r,$datequery); |
return OK; |
return ; |
} |
} |
elsif ($datequery) { |
elsif ($datequery) { |
push @queries,$datequery; |
push @queries,$datequery; |
} |
} |
# Process form information for custom metadata querying |
# Process form information for custom metadata querying |
my $customquery=''; |
my $customquery=undef; |
if ($ENV{'form.custommetadata'}) { |
if ($ENV{'form.custommetadata'}) { |
$customquery=&build_custommetadata_query('custommetadata', |
$customquery=&build_custommetadata_query('custommetadata', |
$ENV{'form.custommetadata'}); |
$ENV{'form.custommetadata'}); |
} |
} |
my $customshow=''; |
my $customshow=undef; |
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=split(/\s+/,$customshow); |
my @fields=split(/\s+/,$customshow); |
$customshow=join(" ",@fields); |
$customshow=join(" ",@fields); |
} |
} |
# Send query statements over the network to be processed by either the SQL |
## --------------------------------------------------------------- |
# database or a recursive scheme of 'grep'-like actions (for custom |
## Deal with restrictions to given domains |
# metadata). |
## |
|
my $libraries_to_query = undef; |
|
# $ENV{'form.domains'} can be either a scalar or an array reference. |
|
# We need an array. |
|
my @allowed_domains = (ref($ENV{'form.domains'}) ? @{$ENV{'form.domains'}} |
|
: ($ENV{'form.domains'}) ); |
|
my %domain_hash = (); |
|
foreach (@allowed_domains) { |
|
$domain_hash{$_}++; |
|
} |
|
foreach (keys(%Apache::lonnet::libserv)) { |
|
if ($_ eq 'any') { |
|
$libraries_to_query = undef; |
|
last; |
|
} |
|
if (exists($domain_hash{$Apache::lonnet::hostdom{$_}})) { |
|
push @$libraries_to_query,$_; |
|
} |
|
} |
|
# |
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; # reply hash reference |
|
unless ($customquery or $customshow) { |
|
$reply=&Apache::lonnet::metadata_query($query); |
|
} |
|
else { |
|
$reply=&Apache::lonnet::metadata_query($query, |
|
$customquery,$customshow); |
|
} |
|
&output_results('Advanced',$r,$customquery,$reply,$hidden); |
|
return OK; |
|
} elsif ($customquery) { |
} elsif ($customquery) { |
my $reply; # reply hash reference |
$query = ''; |
$reply=&Apache::lonnet::metadata_query('', |
|
$customquery,$customshow); |
|
&output_results('Advanced',$r,$customquery,$reply,$hidden); |
|
return OK; |
|
} |
} |
# should not get to this point |
return ($query,$customquery,$customshow,$libraries_to_query); |
return 'Error. Should not have gone to this point.'; |
|
} |
} |
|
|
###################################################################### |
###################################################################### |
Line 815 sub advancedsearch {
|
Line 875 sub advancedsearch {
|
|
|
=pod |
=pod |
|
|
=item &basicsearch() |
=item &parse_basic_search() |
|
|
Parse basic search form. |
Parse the basic search form and return a scalar containing an sql query. |
|
|
=cut |
=cut |
|
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub basicsearch { |
sub parse_basic_search { |
my ($r,$hidden)=@_; |
my ($r)=@_; |
# 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 850 sub basicsearch {
|
Line 910 sub basicsearch {
|
$concatarg='title' if $ENV{'form.titleonly'}; |
$concatarg='title' if $ENV{'form.titleonly'}; |
|
|
$query=&build_SQL_query('concat('.$concatarg.')',$ENV{'form.'.'basicexp'}); |
$query=&build_SQL_query('concat('.$concatarg.')',$ENV{'form.'.'basicexp'}); |
|
return 'select * from metadata where '.$query; |
# Get reply (either a hash reference to filehandles or bad connection) |
|
# &Apache::lonnet::logthis("metadata query started:".time); |
|
my $reply=&Apache::lonnet::metadata_query('select * from metadata where '.$query); |
|
# &Apache::lonnet::logthis("metadata query finished:".time); |
|
# Output search results |
|
|
|
&output_results('Basic',$r,$query,$reply,$hidden); |
|
|
|
return OK; |
|
} |
} |
|
|
|
|
Line 1049 contacted, etc.)
|
Line 1100 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,$query,$replyref,$hidden)=@_; |
my ($mode,$r,$replyref,$hidden)=@_; |
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'}; |
## |
|
## Set viewing function |
|
## |
|
my $viewfunction = undef; |
|
if ($ENV{'form.viewselect'} eq 'Detailed Citation View') { |
|
$viewfunction = \&detailed_citation_view; |
|
} elsif ($ENV{'form.viewselect'} eq 'Summary View') { |
|
$viewfunction = \&summary_view; |
|
} elsif ($ENV{'form.viewselect'} eq 'Fielded Format') { |
|
$viewfunction = \&fielded_format_view; |
|
} elsif ($ENV{'form.viewselect'} eq 'XML/SGML') { |
|
$viewfunction = \&xml_sgml_view; |
|
} |
|
if (!defined($viewfunction)) { |
|
$r->print("Internal Error - Bad view selected.\n"); |
|
$r->rflush(); |
|
return; |
|
} |
# |
# |
# 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(\%ENV); |
# spit out the results header |
# |
|
# Begin producing output |
$r->print(&search_results_header($mode)); |
$r->print(&search_results_header($mode)); |
$r->rflush(); |
$r->rflush(); |
|
# |
# begin showing the cataloged results |
# begin showing the cataloged results |
my $action = "/adm/searchcat"; |
my $action = "/adm/searchcat"; |
if ($mode eq 'Basic') { |
if ($mode eq 'Basic') { |
Line 1083 $persistent
|
Line 1153 $persistent
|
CATALOGCONTROLS |
CATALOGCONTROLS |
# |
# |
# make the pop-up window for status |
# make the pop-up window for status |
# |
|
$r->print(&make_popwin(%rhash)); |
$r->print(&make_popwin(%rhash)); |
$r->rflush(); |
$r->rflush(); |
## |
## |
Line 1160 CATALOGCONTROLS
|
Line 1229 CATALOGCONTROLS
|
} # end of if ($reply eq 'con_lost') else statement |
} # end of if ($reply eq 'con_lost') else statement |
my %Fields = undef; # Holds the data to be sent to the various |
my %Fields = undef; # Holds the data to be sent to the various |
# *_view routines. |
# *_view routines. |
my ($extrashow,$customfields,$customhash) = &handle_custom_fields(\@results); |
my ($extrashow,$customfields,$customhash) = |
|
&handle_custom_fields(\@results); |
my @customfields = @$customfields; |
my @customfields = @$customfields; |
my %customhash = %$customhash; |
my %customhash = %$customhash; |
untie %hash if (keys %hash); |
untie %hash if (keys %hash); |
Line 1211 END
|
Line 1281 END
|
# <input type="hidden" name="url$fnum" value="$url" /> |
# <input type="hidden" name="url$fnum" value="$url" /> |
$fnum++; |
$fnum++; |
} |
} |
if ($viewselect eq 'Detailed Citation View') { |
# Render the result into html |
$compiledresult.=&detailed_citation_view |
$compiledresult.= &$viewfunction(%Fields, hostname => $rkey ); |
(%Fields, hostname => $rkey ); |
|
} |
|
elsif ($viewselect eq 'Summary View') { |
|
$compiledresult.=&summary_view |
|
(%Fields, hostname => $rkey ); |
|
} |
|
elsif ($viewselect eq 'Fielded Format') { |
|
$compiledresult.=&fielded_format_view |
|
(%Fields, hostname => $rkey ); |
|
} |
|
elsif ($viewselect eq 'XML/SGML') { |
|
$compiledresult.=&xml_sgml_view |
|
(%Fields, hostname => $rkey ); |
|
} |
|
if ($compiledresult or $servercount!=$servernum) { |
if ($compiledresult or $servercount!=$servernum) { |
$compiledresult.="<hr align='left' width='200' noshade />"; |
$compiledresult.="<hr align='left' width='200' noshade />"; |
} |
} |
Line 1237 END
|
Line 1293 END
|
$resultflag=1; |
$resultflag=1; |
$r->print($compiledresult); |
$r->print($compiledresult); |
} |
} |
my $percent=sprintf('%3.0f',($servercount/$servernum*100)); |
|
} # End of foreach loop over servers remaining |
} # End of foreach loop over servers remaining |
} # End of big loop - while($serversleft && $timeremain) |
} # End of big loop - while($serversleft && $timeremain) |
unless ($resultflag) { |
unless ($resultflag) { |
$r->print("\nThere were no results that matched your query\n"); |
$r->print("\nThere were no results that matched your query\n"); |
} |
} |
# $r->print('<script type="text/javascript">'.'popwin.close()</script>'."\n"); $r->rflush(); |
$r->print('<script type="text/javascript">'.'popwin.close()</script>'. |
|
"\n"); |
$r->print("</body>\n</html>\n"); |
$r->print("</body>\n</html>\n"); |
|
$r->rflush(); |
return; |
return; |
} |
} |
|
|
Line 1308 sub parse_raw_result {
|
Line 1365 sub parse_raw_result {
|
&Apache::loncommon::copyrightdescription($Fields{'copyright'}); |
&Apache::loncommon::copyrightdescription($Fields{'copyright'}); |
$Fields{'mimetag'} = |
$Fields{'mimetag'} = |
&Apache::loncommon::filedescription($Fields{'mime'}); |
&Apache::loncommon::filedescription($Fields{'mime'}); |
|
if ($Fields{'author'}=~/^(\s*|error)$/) { |
|
$Fields{'author'}="Unknown Author"; |
|
} |
# Put spaces in the keyword list, if needed. |
# Put spaces in the keyword list, if needed. |
$Fields{'keywords'}=~ s/,([A-z])/, $1/g; |
$Fields{'keywords'}=~ s/,([A-z])/, $1/g; |
if ($Fields{'title'}=~ /^\s*$/ ) { |
if ($Fields{'title'}=~ /^\s*$/ ) { |
Line 1539 sub make_popwin {
|
Line 1599 sub make_popwin {
|
# rows of 10 each. No longer used to index images. |
# rows of 10 each. No longer used to index images. |
my $sn=1; |
my $sn=1; |
foreach my $sk (sort keys %rhash) { |
foreach my $sk (sort keys %rhash) { |
# '<a href=" |
|
$grid.="'<a href=\""; |
$grid.="'<a href=\""; |
# javascript:displayinfo('+ |
|
$grid.="javascript:opener.displayinfo('+"; |
$grid.="javascript:opener.displayinfo('+"; |
# "'"+'key |
|
$grid.="\"'\"+'"; |
$grid.="\"'\"+'"; |
$grid.=$sk; |
$grid.=$sk; |
my $hc; |
my $hc; |
if ($rhash{$sk} eq 'con_lost') { |
if ($rhash{$sk} eq 'con_lost') { |
$hc="BAD CONNECTION, CONTACT SYSTEM ADMINISTRATOR "; |
$hc="BAD CONNECTION "; |
} |
} |
else { |
else { |
$hc="'+\"'\"+\"+hc['$sk']+\"+\"'\"+'"; |
$hc="'+\"'\"+\"+hc['$sk']+\"+\"'\"+'"; |
Line 1801 sub filled {
|
Line 1858 sub filled {
|
sub output_blank_field_error { |
sub output_blank_field_error { |
my ($r)=@_; |
my ($r)=@_; |
# 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(\%ENV); |
|
|
$r->print(<<BEGINNING); |
$r->print(<<BEGINNING); |
<html> |
<html> |
Line 1847 Output a full html page with an error me
|
Line 1904 Output a full html page with an error me
|
sub output_date_error { |
sub output_date_error { |
my ($r,$message)=@_; |
my ($r,$message)=@_; |
# 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(\%ENV); |
|
|
$r->print(<<RESULTS); |
$r->print(<<RESULTS); |
<html> |
<html> |