version 1.216, 2004/04/23 17:52:55
|
version 1.217, 2004/04/27 15:24:09
|
Line 405 my $totalfound;
|
Line 405 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 504 sub search_html_header {
|
Line 503 sub search_html_header {
|
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
<script type="text/javascript"> |
|
function openhelp(val) { |
|
openhelpwin=open('/adm/help/searchcat.html','helpscreen', |
|
'scrollbars=1,width=600,height=300'); |
|
openhelpwin.focus(); |
|
} |
|
</script> |
|
</head> |
</head> |
ENDHEADER |
ENDHEADER |
return $Str; |
return $Str; |
Line 532 Prints the form for the basic search. S
|
Line 524 Prints the form for the basic search. S
|
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::lonhtmlcommon::breadcrumbs(undef,'Searching','Finding_Resources', |
&Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Searching', |
undef,undef,! $ENV{'form.launch'}); |
undef,undef,! $ENV{'form.launch'}); |
my $scrout = &search_html_header().$bodytag; |
my $scrout = &search_html_header().$bodytag; |
if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { |
Line 656 Prints the advanced search form.
|
Line 648 Prints the advanced search form.
|
###################################################################### |
###################################################################### |
sub print_advanced_search_form{ |
sub print_advanced_search_form{ |
my ($r,$closebutton,$hidden_fields) = @_; |
my ($r,$closebutton,$hidden_fields) = @_; |
|
my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search'). |
|
&Apache::lonhtmlcommon::breadcrumbs(undef,'Searching', |
|
'Searching', |
|
undef,undef, |
|
! $ENV{'form.launch'}); |
|
|
my %lt=&Apache::lonlocal::texthash('srch' => 'Search', |
my %lt=&Apache::lonlocal::texthash('srch' => 'Search', |
'reset' => 'Reset', |
'reset' => 'Reset', |
'help' => 'Help'); |
'help' => 'Help'); |
my $advanced_buttons = <<"END"; |
my $advanced_buttons=<<"END"; |
<p> |
|
<input type="submit" name="advancedsubmit" value='$lt{"srch"}' /> |
<input type="submit" name="advancedsubmit" value='$lt{"srch"}' /> |
<input type="reset" name="reset" value='$lt{"reset"}' /> |
<input type="reset" name="reset" value='$lt{"reset"}' /> |
$closebutton |
$closebutton |
<input type="button" value="$lt{'help'}" onClick="openhelp()" /> |
|
END |
END |
my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search'). |
|
&Apache::lonhtmlcommon::breadcrumbs(undef,'Searching', |
|
'Finding_Resources', |
|
undef,undef, |
|
! $ENV{'form.launch'}); |
|
my $searchhelp=&searchhelp(); |
|
my $scrout=&search_html_header(); |
my $scrout=&search_html_header(); |
$scrout .= <<"ENDHEADER"; |
$scrout .= <<"ENDHEADER"; |
$bodytag |
$bodytag |
<form method="post" action="/adm/searchcat" name="advsearch"> |
<form method="post" action="/adm/searchcat" name="advsearch"> |
|
<p> |
$advanced_buttons |
$advanced_buttons |
ENDHEADER |
ENDHEADER |
$scrout.=(' 'x2).&viewoptions().'</p>'.$hidden_fields. |
$scrout.=(' 'x2).&viewoptions().'</p>'.$hidden_fields. |
'<input type="hidden" name="phase" value="adv_search" />'; |
'<input type="hidden" name="phase" value="adv_search" />'; |
my %fields=&Apache::lonmeta::fieldnames(); |
my %fields=&Apache::lonmeta::fieldnames(); |
# |
# |
$scrout.= '<p>'.$searchhelp.'</p>'. |
$scrout .= '<h3>'.&mt('Standard Metadata').'</h3>'; |
"<table>\n"; |
$scrout .= "<table>\n"; |
|
$scrout .= '<tr><td> </td><td colspan="2"><font size="-1">'. |
|
(' 'x2).&searchhelp()."</font></td></tr>\n"; |
my %related_word_search = |
my %related_word_search = |
('title'=>1, |
('title' => 1, |
'author'=>0, |
'author' => 0, |
'owner'=>0, |
'owner' => 0, |
'authorspace'=>0, |
'authorspace' => 0, |
'modifyinguser'=>0, |
'modifyinguser'=> 0, |
'keywords'=>1, |
'keywords' => 1, |
'notes'=>1, |
'notes' => 1, |
'abstract'=>1, |
'abstract' => 1, |
'standards'=>1, |
'standards'=> 1, |
'mime'=>1, |
'mime' => 1, |
); |
); |
# |
# |
foreach my $field ('title','author','owner','authorspace','modifyinguser', |
foreach my $field ('title','author','owner','authorspace','modifyinguser', |
Line 736 ENDHEADER
|
Line 729 ENDHEADER
|
&Apache::loncommon::domain_select('domains', |
&Apache::loncommon::domain_select('domains', |
$ENV{'form.domains'},1). |
$ENV{'form.domains'},1). |
'</td></tr>'.$/; |
'</td></tr>'.$/; |
$scrout .= "</table>\n<br />"; |
# |
|
# Misc metadata |
|
$scrout.='<tr><td align="right" valign="top">'. |
|
&titlefield(&mt('Copyright/Distribution')).'</td><td colspan="2">'. |
|
&Apache::lonmeta::selectbox('copyright', |
|
'',, |
|
\&Apache::loncommon::copyrightdescription, |
|
( undef, |
|
&Apache::loncommon::copyrightids) |
|
).'</td></tr>'.$/; |
|
$scrout.='<tr><td align="right" valign="top">'. |
|
&titlefield(&mt('Language')).'</td><td colspan="2">'. |
|
&Apache::lonmeta::selectbox('language', |
|
'notset',, |
|
\&Apache::loncommon::languagedescription, |
|
('any',&Apache::loncommon::languageids) |
|
).'</td></tr>'; |
|
$scrout .= "</table>\n"; |
|
# |
|
# Dynamic metadata |
|
$scrout .= '<h3>'.&mt('Problem Statistics').'</h3>'; |
|
$scrout .= "<table>\n"; |
|
$scrout .= '<tr><td> </td><td align="center">'.&mt('Minimum').'</td>'. |
|
'<td align="center">'.&mt('Maximum').'</td></tr>'."\n"; |
|
foreach my $statistic |
|
({ name=>'stdno', |
|
description=>'Number of Students',}, |
|
{ name => 'avetries', |
|
description=>'Average tries to answer correctly',}, |
|
{ name => 'difficulty', |
|
description=>'Degree of difficulty',}, |
|
{ name => 'disc', |
|
description=>'Degree of discrimination'}) { |
|
$scrout .= '<tr><td align="right">'. |
|
&titlefield(&mt($statistic->{'description'})). |
|
'</td><td align="center">'. |
|
'<input type="text" name="'.$statistic->{'name'}.'_min" '. |
|
'value="" size="6" />'. |
|
'</td><td align="center">'. |
|
'<input type="text" name="'.$statistic->{'name'}.'_max" '. |
|
'value="" size="6" />'. |
|
'</td></tr>'.$/; |
|
} |
|
$scrout .= "</table>\n"; |
|
$scrout .= '<h3>'.&mt('Evaluation Data').'</h3>'; |
|
$scrout .= "<table>\n"; |
|
$scrout .= '<tr><td> </td><td align="center">'.&mt('Minimum').'</td>'. |
|
'<td align="center">'.&mt('Maximum').'</td></tr>'."\n"; |
|
foreach my $evaluation |
|
( { name => 'clear', |
|
description => 'Material presented in clear way'}, |
|
{ name =>'depth', |
|
description => 'Material covered with sufficient depth'}, |
|
{ name => 'helpful', |
|
description => 'Material is helpful'}, |
|
{ name => 'correct', |
|
description => 'Material appears to be correct'}, |
|
{ name => 'technical', |
|
description => 'Resource is technically correct'}){ |
|
$scrout .= '<tr><td align="right">'. |
|
&titlefield(&mt($evaluation->{'description'})). |
|
'</td><td align="center">'. |
|
'<input type="text" name="'.$evaluation->{'name'}.'_min" '. |
|
'value="" size="6" />'. |
|
'</td><td align="center">'. |
|
'<input type="text" name="'.$evaluation->{'name'}.'_max" '. |
|
'value="" size="6" />'. |
|
'</td></tr>'.$/; |
|
} |
|
$scrout .= "</table>\n"; |
# |
# |
# Creation/Modification date limits |
# Creation/Modification date limits |
|
$scrout .= '<h3>'.&mt('Creation and Modification dates').'</h3>'; |
$scrout .= "\n<table>\n"; |
$scrout .= "\n<table>\n"; |
my $cafter = |
my $cafter = |
&Apache::lonhtmlcommon::date_setter('advsearch', # formname |
&Apache::lonhtmlcommon::date_setter('advsearch', # formname |
Line 1082 Parse advanced search form and return th
|
Line 1145 Parse advanced search form and return th
|
sub parse_advanced_search { |
sub parse_advanced_search { |
my ($r,$closebutton,$hidden_fields)=@_; |
my ($r,$closebutton,$hidden_fields)=@_; |
my @BasicFields = ('title','author','subject','keywords','url','version', |
my @BasicFields = ('title','author','subject','keywords','url','version', |
'notes','abstract','extension','language','owner', |
'notes','abstract','extension','owner', |
# 'custommetadata','customshow', |
# 'custommetadata','customshow', |
'modifyinguser','standards','mime'); |
'modifyinguser','standards','mime'); |
|
my @StatsFields = ('stdno','avetries','difficulty','disc'); |
|
my @EvalFields = ('clear','depth','helpful','correct','technical'); |
|
my @ContextFields = ('courses','dependencies'); |
my $fillflag=0; |
my $fillflag=0; |
my $pretty_search_string = "<br />\n"; |
my $pretty_search_string = "<br />\n"; |
# Clean up fields for safety |
# Clean up fields for safety |
Line 1198 sub parse_advanced_search {
|
Line 1263 sub parse_advanced_search {
|
"<br \>\n"; |
"<br \>\n"; |
} |
} |
# |
# |
|
# Statistics |
|
foreach my $field (@StatsFields,@EvalFields) { |
|
my ($min,$max); |
|
if (exists($ENV{'form.'.$field.'_min'}) && |
|
$ENV{'form.'.$field.'_min'} ne '') { |
|
$min = $ENV{'form.'.$field.'_min'}; |
|
} |
|
if (exists($ENV{'form.'.$field.'_max'}) && |
|
$ENV{'form.'.$field.'_max'} ne '') { |
|
$max = $ENV{'form.'.$field.'_max'}; |
|
} |
|
next if (! defined($max) && ! defined($min)); |
|
if (defined($min) && defined($max)) { |
|
($min,$max) = sort {$a <=>$b} ($min,$max); |
|
} |
|
if (defined($min) && $min =~ /^(\d+\.\d+|\d+|\.\d+)$/) { |
|
push(@queries,'('.$field.'>'.$min.')'); |
|
$pretty_search_string.=$font.$field.'</font>>'.$min.'<br />'; |
|
} |
|
if (defined($max) && $max =~ /^(\d+\.\d+|\d+|\.\d+)$/) { |
|
push(@queries,'('.$field.'<'.$max.')'); |
|
$pretty_search_string.=$font.$field.'</font><'.$max.'<br />'; |
|
} |
|
} |
|
# |
# Evaluate date windows |
# Evaluate date windows |
my $cafter = |
my $cafter = |
&Apache::lonhtmlcommon::get_date_from_form('creationdate1'); |
&Apache::lonhtmlcommon::get_date_from_form('creationdate1'); |
Line 1262 sub parse_advanced_search {
|
Line 1352 sub parse_advanced_search {
|
} elsif ($customquery) { |
} elsif ($customquery) { |
$query = ''; |
$query = ''; |
} |
} |
|
# &Apache::lonnet::logthis('query = '.$/.$query); |
return ($query,$customquery,$customshow,$libraries_to_query, |
return ($query,$customquery,$customshow,$libraries_to_query, |
$pretty_search_string); |
$pretty_search_string); |
} |
} |