--- loncom/interface/lonsearchcat.pm 2004/03/08 17:31:37 1.205 +++ loncom/interface/lonsearchcat.pm 2004/04/19 14:42:24 1.208 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.205 2004/03/08 17:31:37 www Exp $ +# $Id: lonsearchcat.pm,v 1.208 2004/04/19 14:42:24 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -454,6 +454,23 @@ sub untiehash { } # End of course search scoping +sub search_html_header { + my $Str = < + +The LearningOnline Network with CAPA + + +ENDHEADER + return $Str; +} + ###################################################################### ###################################################################### @@ -472,24 +489,11 @@ sub print_basic_search_form { my $bodytag=&Apache::loncommon::bodytag('Search'). &Apache::loncommon::help_open_topic('Finding_Resources'). &Apache::loncommon::help_open_bug('Searching'); - my $scrout=<<"ENDDOCUMENT"; - - -The LearningOnline Network with CAPA - - -$bodytag -ENDDOCUMENT -if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { - my $CatalogSearch=&mt('Catalog Search'); - my $Statement=&searchhelp(); - $scrout.=(<$CatalogSearch
@@ -501,20 +505,23 @@ $Statement. @@ -602,66 +609,85 @@ sub print_advanced_search_form{ $closebutton -

END my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search'); my $searchhelp=&searchhelp(); - my $scrout=<<"ENDHEADER"; - - -The LearningOnline Network with CAPA - - + my $scrout=&search_html_header(); + $scrout .= <<"ENDHEADER"; $bodytag -$searchhelp $advanced_buttons -$hidden_fields - ENDHEADER - $scrout.=&viewoptions(); + $scrout.=(' 'x2).&viewoptions().'

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

'.$searchhelp.'

'. + "
ENDDOCUMENT - $scrout.=' '.&Apache::lonhtmlcommon::textbox('basicexp', - $ENV{'form.basicexp'},40). - ' '; - my $relatedcheckbox = &Apache::lonhtmlcommon::checkbox('related', - $ENV{'form.related'}); - my $domain = $r->dir_config('lonDefDomain'); - my $domaincheckbox = &Apache::lonhtmlcommon::checkbox('domains', - $ENV{'form.domains'}); - my $srch=&mt('Search'); - my $header=&mt('Advanced Search'); - my $userelatedwords=&mt('use related words'); - my $onlysearchdomain=&mt('only search domain'); - my $view=&viewoptions(); - $scrout.=<dir_config('lonDefDomain'); + my $domaincheckbox = + &Apache::lonhtmlcommon::checkbox('domains', + $ENV{'form.domains'}); + my $srch=&mt('Search'); + my $header=&mt('Advanced Search'); + my $userelatedwords=&mt('use related words'); + my $onlysearchdomain=&mt('only search domain'); + my $view=&viewoptions(); + $scrout.=<$header
\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, + ); - $scrout.='
'; - $scrout.="\n"; - foreach ('title','author','owner','authorspace','modifyinguser', - 'keywords','notes','abstract','standards', - 'lowestgradelevel','highestgradelevel','mime') { - $scrout.=''; + foreach my $field ('title','author','owner','authorspace','modifyinguser', + 'keywords','notes','abstract','standards','mime') { + $scrout.=''.$/; + } + foreach my $field ('lowestgradelevel','highestgradelevel') { + $scrout.=''. + ''. + ''.$/; } - $scrout.=''; - $scrout.=''.$/; + $scrout.=''; + ''.$/; + $scrout .= "
".&mt('Field').''.&mt('Value').'' - .&mt('Related').'
'.&mt('Words')."
'.&titlefield($fields{$_}).''. - &Apache::lonmeta::prettyinput($_,$ENV{'form.'.$_},$_,'advsearch', - 1,'',$ENV{'form.'.$_.'_related'}). - '
'.&titlefield($fields{$field}).''. + &Apache::lonmeta::prettyinput($field, + $ENV{'form.'.$field}, + $field, + 'advsearch', + $related_word_search{$field}, + '', + $ENV{'form.'.$field.'_related'}, + 50); + if ($related_word_search{$field}) { + $scrout .= 'related words'; + } else { + $scrout .= ' '; + } + $scrout .= '
'.&titlefield($fields{$field}).''. + &Apache::lonmeta::prettyinput($field, + $ENV{'form.'.$field}, + $field, + 'advsearch', + 0). + '
'. - &titlefield(&mt('MIME Type Category')).''. + $scrout.='
'. + &titlefield(&mt('MIME Type Category')).''. &Apache::loncommon::filecategoryselect('category', $ENV{'form.category'}). - ' 
'. - &titlefield(&mt('Limit Search to Domains')).''. + '
'. + &titlefield(&mt('Domains')).''. &Apache::loncommon::domain_select('domains', $ENV{'form.domains'},1). - ' 
\n
\n\n"; 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.=''. - ''. - ''; + foreach my $field (sort keys %dates) { + $scrout.=''. + ''.$/; } - $scrout.="
'.&titlefield($dates{$_}).''. - &Apache::lonhtmlcommon::date_setter('advsearch',$_,0,'',1). - ' 
'.&titlefield($dates{$field}).''. + &Apache::lonhtmlcommon::date_setter('advsearch',$field,0,'',1). + '
\n"; $scrout.=<'.$title.''; + return $title; } ###################################################################### @@ -735,20 +761,20 @@ Outputs: text for box with view options ###################################################################### ###################################################################### sub viewoptions { - my $scrout="\n\n".''. - '
'.&mt('View Options').''. - &mt('Records per Page').'
'; - unless ($ENV{'form.viewselect'}) { $ENV{'form.viewselect'}='detailed'; } + my $scrout="\n".''; + if (! defined($ENV{'form.viewselect'})) { + $ENV{'form.viewselect'}='detailed'; + } $scrout.=&Apache::lonmeta::selectbox('viewselect', $ENV{'form.viewselect'}, \&viewoptiontext, sort(keys(%Views))); - $scrout.=''; + $scrout.= '  '; $scrout.=&Apache::lonmeta::selectbox('show', $ENV{'form.show'}, undef, (10,20,50,100,1000,10000)); - $scrout.="
\n\n"; + $scrout .= (' 'x2).&mt('Records per Page').''.$/; return $scrout; } @@ -2236,11 +2262,10 @@ The 'title' field is set to "Untitled" i sub parse_raw_result { my ($result,$hostname) = @_; # conclude from self to others regarding fields - my %Fields=&Apache::lonmeta::metadata_col_to_hash( - map { - &Apache::lonnet::unescape($_); - } (split(/\,/,$result)) - ); + my %Fields=&LONCAPA::lonmetadata::metadata_col_to_hash + (map { + &Apache::lonnet::unescape($_); + } (split(/\,/,$result)) ); return %Fields; }