--- loncom/interface/lonsearchcat.pm 2002/06/25 15:08:59 1.129 +++ loncom/interface/lonsearchcat.pm 2002/06/27 14:46:00 1.132 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.129 2002/06/25 15:08:59 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.132 2002/06/27 14:46:00 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -223,10 +223,10 @@ END ## if ($ENV{'form.basicsubmit'} eq 'SEARCH') { # Perform basic search and give results - return &basicsearch($r,\%ENV,$hidden); + return &basicsearch($r,$hidden); } elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') { # Perform advanced search and give results - return &advancedsearch($r,\%ENV,$hidden); + return &advancedsearch($r,$hidden); } elsif ($ENV{'form.reqinterface'} eq 'advanced') { # Output the advanced interface $r->print(&advanced_search_form($closebutton,$hidden)); @@ -273,7 +273,7 @@ sub basic_search_form{ $hidden

Basic Search

-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.

@@ -290,15 +290,14 @@ ENDDOCUMENT

   $closebutton - - + + + + - +

@@ -328,15 +327,6 @@ sub advanced_search_form{ $closebutton - - -

END @@ -356,11 +346,23 @@ END

Advanced Catalog Search


-Enter terms or quoted phrases separated by search operators +Enter terms or phrases separated by search operators such as AND, OR, or NOT.
+
$advanced_buttons $hidden + + ENDHEADER $scrout.=&searchphrasefield('title','title', $ENV{'form.title'}); @@ -386,13 +388,37 @@ ENDHEADER $scrout.=&searchphrasefield('publisher
owner','owner', $ENV{'form.owner'}); $scrout.="
VIEW: + + + +
\n"; -# $ENV{'form.mime'}='any' unless length($ENV{'form.mime'}); -# $scrout.=&selectbox('Limit by MIME type','mime', -# $ENV{'form.mime'}, -# 'any','Any type', -# \&{Apache::loncommon::filedescriptionex}, -# (&Apache::loncommon::fileextensions)); + $ENV{'form.category'}='any' unless length($ENV{'form.category'}); + $scrout.=&selectbox('File Category','category', + $ENV{'form.category'}, + 'any','Any category', + undef, + (&Apache::loncommon::filecategories())); $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'. + # + 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 .=''."\n"; + } else { + $scrout.=''. + 'DOMAINS
'. + '\n"; + } + # + # + # $scrout.=&selectbox('Limit by language','language', $ENV{'form.language'},'any','Any Language', \&{Apache::loncommon::languagedescription}, @@ -665,7 +691,7 @@ sub selectbox { if (! defined($functionref)) { $functionref = sub { $_[0]}; } my $uctitle=uc($title); my $selout="\n".'

'. - ''.$uctitle.':
'; foreach ($anyvalue,@idlist) { $selout.='

Search Catalog

-CATALOGBEGIN my $action = "/adm/searchcat"; if ($mode eq 'Basic') { $action .= "?reqinterface=basic"; @@ -1086,19 +1137,8 @@ $importbutton $closebutton $persistent
-

Search Query

CATALOGCONTROLS # - # Remind them what they searched for - # - if ($mode eq 'Basic') { - $r->print('

Basic search: '.$ENV{'form.basicexp'}.'

'); - } elsif ($mode eq 'Advanced') { - $r->print('

Advanced search '.$query.'

'); - } - $r->print('

Search Results

'); - $r->rflush(); - # # make the pop-up window for status # $r->print(&make_popwin(%rhash)); @@ -1202,9 +1242,6 @@ CATALOGCONTROLS $Fields{'extrashow'}=~s/\<\!\-\- $field \-\-\>/ $value/g; } } - if ($compiledresult or $servercount!=$servernum) { - $compiledresult.="
"; - } $compiledresult.="\n

\n"; if ($ENV{'form.catalogmode'} eq 'interactive') { my $titleesc=$Fields{'title'}; @@ -1231,13 +1268,6 @@ END # $fnum++; } - my $viewselect; - if ($mode eq 'Basic') { - $viewselect=$ENV{'form.basicviewselect'}; - } - elsif ($mode eq 'Advanced') { - $viewselect=$ENV{'form.advancedviewselect'}; - } if ($viewselect eq 'Detailed Citation View') { $compiledresult.=&detailed_citation_view (%Fields, hostname => $rkey ); @@ -1254,6 +1284,9 @@ END $compiledresult.=&xml_sgml_view (%Fields, hostname => $rkey ); } + if ($compiledresult or $servercount!=$servernum) { + $compiledresult.="


"; + } } untie %hash; } @@ -1402,10 +1435,18 @@ sub handle_custom_fields { =item &search_results_header -Output the proper javascript code to deal with different calling modes. +Output the proper html headers and javascript code to deal with different +calling modes. -Takes inputs directly from from %ENV. The following environment variables -are checked: +Takes most inputs directly from %ENV, except $mode. + +=over 4 + +=item $mode is either (at this writing) 'Basic' or 'Advanced' + +=back + +The following environment variables are checked: =over 4 @@ -1428,12 +1469,20 @@ Checked for existance & 'edit' mode. ###################################################################### ###################################################################### sub search_results_header { + my ($mode) = @_; + $mode = lc($mode); + my $title; + if ($mode eq 'advanced') { + $title = "Advanced Search Results"; + } elsif ($mode eq 'basic') { + $title = "Basic Search Results"; + } my $result = ''; # output beginning of search page $result.=< -The LearningOnline Network with CAPA +$title BEGINNING # conditional output of script functions dependent on the mode in # which the search was invoked @@ -1516,6 +1565,12 @@ SCRIPT } SCRIPT + $result.=< + + +

$title

+END return $result; } @@ -1639,30 +1694,17 @@ extra custom metadata to show. sub detailed_citation_view { my %values = @_; my $result=<$values{'owner'}, last revised $values{'lastrevisiondate'}

$values{'title'}

-

$values{'author'}

-

-Subject: $values{'subject'}
-Keyword(s): $values{'keywords'}
-Notes: $values{'notes'}
-MIME Type: -END - $result.=&Apache::loncommon::filedescription($values{'mime'}); - $result.=< -Language: -END - $result.=&Apache::loncommon::languagedescription($values{'lang'}); - $result.=< -Copyright/Distribution: -END - $result.=&Apache::loncommon::copyrightdescription($values{'copyright'}); - $result.=< +$values{'author'}, $values{'owner'}
+ +Subject: $values{'subject'}
+Keyword(s): $values{'keywords'}
+Notes: $values{'notes'}
+MIME Type: $values{'mimetag'}
+Language: $values{'language'}
+Copyright/Distribution: $values{'cprtag'}

$values{'extrashow'}