--- loncom/interface/lonsearchcat.pm 2004/04/23 17:52:55 1.216 +++ loncom/interface/lonsearchcat.pm 2004/04/27 15:24:09 1.217 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.216 2004/04/23 17:52:55 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.217 2004/04/27 15:24:09 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -405,8 +405,7 @@ my $totalfound; sub course_search { my $r=shift; - my $bodytag=&Apache::loncommon::bodytag('Course Search'). - &Apache::loncommon::help_open_bug('Searching'); + my $bodytag=&Apache::loncommon::bodytag('Course Search'); my $pretty_search_string = ''.$ENV{'form.courseexp'}.''; my $search_string = $ENV{'form.courseexp'}; my @New_Words; @@ -504,13 +503,6 @@ sub search_html_header { The LearningOnline Network with CAPA - ENDHEADER return $Str; @@ -532,7 +524,7 @@ Prints the form for the basic search. S sub print_basic_search_form { my ($r,$closebutton,$hidden_fields) = @_; my $bodytag=&Apache::loncommon::bodytag('Search'). - &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Finding_Resources', + &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Searching', undef,undef,! $ENV{'form.launch'}); my $scrout = &search_html_header().$bodytag; if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { @@ -656,45 +648,46 @@ Prints the advanced search form. ###################################################################### sub print_advanced_search_form{ 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', 'reset' => 'Reset', 'help' => 'Help'); - my $advanced_buttons = <<"END"; -

+ my $advanced_buttons=<<"END"; $closebutton - 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(); $scrout .= <<"ENDHEADER"; $bodytag

+

$advanced_buttons ENDHEADER $scrout.=(' 'x2).&viewoptions().'

'.$hidden_fields. ''; my %fields=&Apache::lonmeta::fieldnames(); # - $scrout.= '

'.$searchhelp.'

'. - "\n"; + $scrout .= '

'.&mt('Standard Metadata').'

'; + $scrout .= "
\n"; + $scrout .= '\n"; my %related_word_search = - ('title'=>1, - 'author'=>0, - 'owner'=>0, - 'authorspace'=>0, - 'modifyinguser'=>0, - 'keywords'=>1, - 'notes'=>1, - 'abstract'=>1, - 'standards'=>1, - 'mime'=>1, + ('title' => 1, + 'author' => 0, + 'owner' => 0, + 'authorspace' => 0, + 'modifyinguser'=> 0, + 'keywords' => 1, + 'notes' => 1, + 'abstract' => 1, + 'standards'=> 1, + 'mime' => 1, ); # foreach my $field ('title','author','owner','authorspace','modifyinguser', @@ -736,9 +729,79 @@ ENDHEADER &Apache::loncommon::domain_select('domains', $ENV{'form.domains'},1). ''.$/; - $scrout .= "
 '. + (' 'x2).&searchhelp()."
\n
"; + # + # Misc metadata + $scrout.=''. + &titlefield(&mt('Copyright/Distribution')).''. + &Apache::lonmeta::selectbox('copyright', + '',, + \&Apache::loncommon::copyrightdescription, + ( undef, + &Apache::loncommon::copyrightids) + ).''.$/; + $scrout.=''. + &titlefield(&mt('Language')).''. + &Apache::lonmeta::selectbox('language', + 'notset',, + \&Apache::loncommon::languagedescription, + ('any',&Apache::loncommon::languageids) + ).''; + $scrout .= "\n"; + # + # Dynamic metadata + $scrout .= '

'.&mt('Problem Statistics').'

'; + $scrout .= "\n"; + $scrout .= ''. + ''."\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 .= ''.$/; + } + $scrout .= "
 '.&mt('Minimum').''.&mt('Maximum').'
'. + &titlefield(&mt($statistic->{'description'})). + ''. + ''. + ''. + ''. + '
\n"; + $scrout .= '

'.&mt('Evaluation Data').'

'; + $scrout .= "\n"; + $scrout .= ''. + ''."\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 .= ''.$/; + } + $scrout .= "
 '.&mt('Minimum').''.&mt('Maximum').'
'. + &titlefield(&mt($evaluation->{'description'})). + ''. + ''. + ''. + ''. + '
\n"; # # Creation/Modification date limits + $scrout .= '

'.&mt('Creation and Modification dates').'

'; $scrout .= "\n\n"; my $cafter = &Apache::lonhtmlcommon::date_setter('advsearch', # formname @@ -1082,10 +1145,12 @@ Parse advanced search form and return th sub parse_advanced_search { my ($r,$closebutton,$hidden_fields)=@_; my @BasicFields = ('title','author','subject','keywords','url','version', - 'notes','abstract','extension','language','owner', + 'notes','abstract','extension','owner', # 'custommetadata','customshow', 'modifyinguser','standards','mime'); - + my @StatsFields = ('stdno','avetries','difficulty','disc'); + my @EvalFields = ('clear','depth','helpful','correct','technical'); + my @ContextFields = ('courses','dependencies'); my $fillflag=0; my $pretty_search_string = "
\n"; # Clean up fields for safety @@ -1198,6 +1263,31 @@ sub parse_advanced_search { "
\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.'>'.$min.'
'; + } + if (defined($max) && $max =~ /^(\d+\.\d+|\d+|\.\d+)$/) { + push(@queries,'('.$field.'<'.$max.')'); + $pretty_search_string.=$font.$field.'<'.$max.'
'; + } + } + # # Evaluate date windows my $cafter = &Apache::lonhtmlcommon::get_date_from_form('creationdate1'); @@ -1262,6 +1352,7 @@ sub parse_advanced_search { } elsif ($customquery) { $query = ''; } +# &Apache::lonnet::logthis('query = '.$/.$query); return ($query,$customquery,$customshow,$libraries_to_query, $pretty_search_string); }