version 1.200, 2004/01/01 20:13:17
|
version 1.203, 2004/01/15 03:18:19
|
Line 359 my $totalfound;
|
Line 359 my $totalfound;
|
|
|
sub course_search { |
sub course_search { |
my $r=shift; |
my $r=shift; |
my $bodytag=&Apache::loncommon::bodytag('Course Search'); |
my $bodytag=&Apache::loncommon::bodytag('Course Search'). |
|
&Apache::loncommon::help_open_bug('Searching'); |
my $pretty_search_string = '<b>'.$ENV{'form.courseexp'}.'</b>'; |
my $pretty_search_string = '<b>'.$ENV{'form.courseexp'}.'</b>'; |
my $search_string = $ENV{'form.courseexp'}; |
my $search_string = $ENV{'form.courseexp'}; |
my @New_Words; |
my @New_Words; |
Line 375 sub course_search {
|
Line 376 sub course_search {
|
my @allwords=($search_string,@New_Words); |
my @allwords=($search_string,@New_Words); |
$totalfound=0; |
$totalfound=0; |
$r->print('<html><head><title>LON-CAPA Course Search</title></head>'. |
$r->print('<html><head><title>LON-CAPA Course Search</title></head>'. |
$bodytag.$pretty_search_string); |
$bodytag.'<hr /><center><font size="+2" face="arial">'.$pretty_search_string.'</font></center><hr />'); |
$r->rflush(); |
$r->rflush(); |
# ======================================================= Go through the course |
# ======================================================= Go through the course |
undef %alreadyseen; |
undef %alreadyseen; |
Line 468 Returns a scalar which holds html for th
|
Line 469 Returns a scalar which holds html for th
|
|
|
sub print_basic_search_form{ |
sub print_basic_search_form{ |
my ($r,$closebutton,$hidden_fields) = @_; |
my ($r,$closebutton,$hidden_fields) = @_; |
my $bodytag=&Apache::loncommon::bodytag('Search'); |
my $bodytag=&Apache::loncommon::bodytag('Search'). |
|
&Apache::loncommon::help_open_topic('Finding_Resources'). |
|
&Apache::loncommon::help_open_bug('Searching'); |
my $scrout=<<"ENDDOCUMENT"; |
my $scrout=<<"ENDDOCUMENT"; |
<html> |
<html> |
<head> |
<head> |
Line 485 $bodytag
|
Line 488 $bodytag
|
ENDDOCUMENT |
ENDDOCUMENT |
if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { |
my $CatalogSearch=&mt('Catalog Search'); |
my $CatalogSearch=&mt('Catalog Search'); |
my $Statement=&mt('Enter terms or phrases separated by AND, OR, or NOT then press SEARCH below'); |
my $Statement=&searchhelp(); |
$scrout.=(<<ENDDOCUMENT); |
$scrout.=(<<ENDDOCUMENT); |
<h1>$CatalogSearch</h1> |
<h1>$CatalogSearch</h1> |
<form name="loncapa_search" method="post" action="/adm/searchcat"> |
<form name="loncapa_search" method="post" action="/adm/searchcat"> |
Line 602 $closebutton
|
Line 605 $closebutton
|
<input type="button" value="$lt{'help'}" onClick="openhelp()" /> |
<input type="button" value="$lt{'help'}" onClick="openhelp()" /> |
</p> |
</p> |
END |
END |
if (!defined($ENV{'form.viewselect'})) { |
|
$ENV{'form.viewselect'} ="Detailed Citation View"; |
|
} |
|
my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search'); |
my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search'); |
|
my $searchhelp=&searchhelp(); |
my $scrout=<<"ENDHEADER"; |
my $scrout=<<"ENDHEADER"; |
<html> |
<html> |
<head> |
<head> |
Line 619 END
|
Line 620 END
|
</script> |
</script> |
</head> |
</head> |
$bodytag |
$bodytag |
Enter terms or phrases separated by search operators |
$searchhelp |
such as AND, OR, or NOT.<br /> |
|
<form method="post" action="/adm/searchcat" name="advsearch"> |
<form method="post" action="/adm/searchcat" name="advsearch"> |
$advanced_buttons |
$advanced_buttons |
$hidden_fields |
$hidden_fields |
Line 628 $hidden_fields
|
Line 628 $hidden_fields
|
ENDHEADER |
ENDHEADER |
$scrout.=&viewoptions(); |
$scrout.=&viewoptions(); |
my %fields=&Apache::lonmeta::fieldnames(); |
my %fields=&Apache::lonmeta::fieldnames(); |
# set undefined to "any" |
|
$ENV{'form.language'}='any' unless length($ENV{'form.language'}); |
|
$ENV{'form.domains'} = 'any' if (! exists($ENV{'form.domains'})); |
|
$ENV{'form.category'}='any' if (! defined($ENV{'form.category'})); |
|
|
|
|
|
$scrout.='<table>'; |
$scrout.='<table>'; |
$scrout.="<tr><th>".&mt('Field').'</th><th>'.&mt('Value').'</th><th>' |
$scrout.="<tr><th>".&mt('Field').'</th><th>'.&mt('Value').'</th><th>' |
.&mt('Related').'<br />'.&mt('Words')."</td></tr>\n"; |
.&mt('Related').'<br />'.&mt('Words')."</td></tr>\n"; |
foreach ('title','author','keywords','notes','abstract','standards', |
foreach ('title','author','owner','authorspace','modifyinguser', |
|
'keywords','notes','abstract','standards', |
'lowestgradelevel','highestgradelevel','mime') { |
'lowestgradelevel','highestgradelevel','mime') { |
$scrout.='<tr><td>'.&titlefield($fields{$_}).'</td><td>'. |
$scrout.='<tr bgcolor="#FFFFBB"><td>'.&titlefield($fields{$_}).'</td><td>'. |
&Apache::lonmeta::prettyinput($_,$ENV{'form.'.$_},$_,'advsearch', |
&Apache::lonmeta::prettyinput($_,$ENV{'form.'.$_},$_,'advsearch', |
1,'</td><td>',$ENV{'form.'.$_.'_related'}). |
1,'</td><td>',$ENV{'form.'.$_.'_related'}). |
'</td></tr>'; |
'</td></tr>'; |
} |
} |
# Hack - an empty table row. |
$scrout.='<tr bgcolor="#FFFFBB"><td>'. |
$scrout.="<tr><td> </td><td> </td><td> </td></tr>\n"; |
&titlefield(&mt('MIME Type Category')).'</td><td>'. |
# $scrout.=&searchphrasefield('file<br />extension','extension', |
&Apache::loncommon::filecategoryselect('category', |
# $ENV{'form.extension'}); |
$ENV{'form.category'}). |
# $scrout.="<tr><td> </td><td> </td><td> </td></tr>\n"; |
'</td><td> </td></td></tr>'; |
# $scrout.=&searchphrasefield('publisher<br />owner','owner', |
$scrout.='<tr bgcolor="#FFFFBB"><td>'. |
# $ENV{'form.owner'}); |
&titlefield(&mt('Limit Search to Domains')).'</td><td>'. |
|
&Apache::loncommon::domain_select('domains', |
|
$ENV{'form.domains'},1). |
|
'</td><td> </td></td></tr>'; |
|
my %dates=&Apache::lonlocal::texthash('creationdatestart' => 'Creation Date After', |
|
'creationdateend' => 'Creation Date Before', |
|
'lastrevisiondatestart' => 'Last Revision Date After', |
|
'lastrevisiondateend' => 'Last Revision Date Before'); |
|
foreach (sort keys %dates) { |
|
$scrout.='<tr bgcolor="#FFFFBB"><td>'.&titlefield($dates{$_}).'</td><td>'. |
|
&Apache::lonhtmlcommon::date_setter('advsearch',$_,0,'',1). |
|
'</td><td> </td></td></tr>'; |
|
} |
|
|
$scrout.="</table>\n"; |
$scrout.="</table>\n"; |
# $scrout.=&Apache::lonmeta::selectbox('File Category','category', |
|
# $ENV{'form.category'}, |
|
# 'any','Any category', |
|
# undef, |
|
# (&Apache::loncommon::filecategories())); |
|
#---------------------------------------------------------------- |
|
# Allow restriction to multiple domains. |
|
# I make the crazy assumption that there will never be a domain 'any'. |
|
# |
|
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; |
|
$size = (scalar @domains < ($size - 1) ? scalar @domains + 1 : $size); |
|
$scrout.="\n".&titlefield(&mt('Domain to be searched')). |
|
'<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"; |
|
|
|
# ------------------------------------------- Compute customized metadata field |
|
# $scrout.=<<CUSTOMMETADATA; |
|
#<p> |
|
#<font color="#800000" face="helvetica"><b>LIMIT BY SPECIAL METADATA FIELDS:</b> |
|
#</font> |
|
#For resource-specific metadata, enter in an expression in the form of |
|
#<i>key</i>=<i>value</i> separated by operators such as AND, OR or NOT.<br /> |
|
#<b>Example:</b> grandmother=75 OR grandfather=85 |
|
#<br /> |
|
#CUSTOMMETADATA |
|
# $scrout.=&simpletextfield('custommetadata',$ENV{'form.custommetadata'}); |
|
# $scrout.=<<CUSTOMSHOW; |
|
#<p> |
|
#<font color="#800000" face="helvetica"><b>SHOW SPECIAL METADATA FIELDS:</b> |
|
#</font> |
|
#Enter in a space-separated list of special metadata fields to show |
|
#in a fielded listing for each record result. |
|
#<br /> |
|
#CUSTOMSHOW |
|
# $scrout.=&simpletextfield('customshow',$ENV{'form.customshow'}); |
|
$scrout.=<<ENDDOCUMENT; |
$scrout.=<<ENDDOCUMENT; |
$advanced_buttons |
$advanced_buttons |
</form> |
</form> |
Line 789 sub viewoptions {
|
Line 749 sub viewoptions {
|
} |
} |
|
|
###################################################################### |
###################################################################### |
|
|
|
=pod |
|
|
|
=item searchhelp |
|
|
|
Inputs: none |
|
|
|
Outputs: return little blurb on how to enter searches |
|
|
|
=cut |
|
|
|
###################################################################### |
|
###################################################################### |
|
|
|
sub searchhelp { |
|
return &mt('Enter terms or phrases separated by AND, OR, or NOT'); |
|
} |
|
|
|
###################################################################### |
###################################################################### |
###################################################################### |
|
|
=pod |
=pod |