--- loncom/interface/lonsearchcat.pm 2002/06/24 15:09:52 1.126 +++ loncom/interface/lonsearchcat.pm 2002/06/26 16:04:13 1.130 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.126 2002/06/24 15:09:52 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.130 2002/06/26 16:04:13 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,14 +67,14 @@ search (on a server basis) is displayed ############################################################################### ############################################################################### +############################################################################### ## ## ## ORGANIZATION OF THIS PERL MODULE ## ## ## ## 1. Modules used by this module ## -## 2. Choices for different output views (detailed, summary, xml, etc) ## -## 3. BEGIN block (to be run once after compilation) ## -## 4. Handling routine called via Apache and mod_perl ## -## 5. Other subroutines ## +## 2. Variables used throughout the module ## +## 3. handler subroutine called via Apache and mod_perl ## +## 4. Other subroutines ## ## ## ############################################################################### @@ -101,18 +101,6 @@ use Apache::loncommon(); =over 4 -=item %hostdomains - -matches host name to host domain - -=item %hostips - -matches host name to host ip - -=item %hitcount - -stores number of hits per host - =item $closebutton button that closes the search window @@ -137,46 +125,13 @@ used in &handler() and is also used in & ###################################################################### ###################################################################### -# -- information holders -my %hostdomains; # matches host name to host domain -my %hostips; # matches host name to host ip -my %hitcount; # stores number of hits per host - # -- dynamically rendered interface components my $closebutton; # button that closes the search window my $importbutton; # button to take the selected results and go to group sorting # -- miscellaneous variables -my $yourself; # allows for quickly limiting to oneself my %hash; # database hash - -# ------------------------------------------ choices for different output views -# Detailed Citation View ---> sub detailed_citation_view -# Summary View ---> sub summary_view -# Fielded Format ---> sub fielded_format_view -# XML/SGML ---> sub xml_sgml_view - -#------------------------------------------------------------- global variables -my $diropendb = ""; -my $domain = ""; - -# ----------------------------------------------------------------------- BEGIN - -=pod - -=item BEGIN block - -Load %hostdomains and %hostips with data from lonnet.pm. Only library -servers are considered. - -=cut - -BEGIN { - foreach (keys (%Apache::lonnet::libserv)) { - $hostdomains{$_}=$Apache::lonnet::hostdom{$_}; - $hostips{$_}=$Apache::lonnet::hostip{$_}; - } -} +my $diropendb = ""; # db file ###################################################################### ###################################################################### @@ -268,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)); @@ -318,7 +273,8 @@ sub basic_search_form{ $hidden

Basic Search

-Enter terms or phrases separated by AND, OR, or NOT then press SEARCH below. +Enter terms or quoted phrases separated by AND, OR, or NOT +then press SEARCH below.

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

   $closebutton - - + + + + - +

@@ -367,6 +322,14 @@ Returns a scalar which holds html for th sub advanced_search_form{ my ($closebutton,$hidden) = @_; + my $advanced_buttons = <<"END"; +

+ + +$closebutton + +

+END my $scrout=<<"ENDHEADER"; @@ -381,34 +344,56 @@ sub advanced_search_form{ -

Search Catalog

+

Advanced Catalog Search

+
+Enter terms or quoted phrases separated by search operators +such as AND, OR, or NOT.
+$advanced_buttons $hidden -
-

Advanced Search

+
+ + ENDHEADER - $scrout.=&searchphrasefield('Limit by title','title', + $scrout.=&searchphrasefield('title','title', $ENV{'form.title'}); - $scrout.=&searchphrasefield('Limit by author','author', + $scrout.=&searchphrasefield('author','author', $ENV{'form.author'}); - $scrout.=&searchphrasefield('Limit by subject','subject', + $scrout.=&searchphrasefield('subject','subject', $ENV{'form.subject'}); - $scrout.=&searchphrasefield('Limit by keywords','keywords', + $scrout.=&searchphrasefield('keywords','keywords', $ENV{'form.keywords'}); - $scrout.=&searchphrasefield('Limit by URL','url', + $scrout.=&searchphrasefield('URL','url', $ENV{'form.url'}); # $scrout.=&searchphrasefield('Limit by version','version', # $ENV{'form.version'}); - $scrout.=&searchphrasefield('Limit by notes','notes', + $scrout.=&searchphrasefield('notes','notes', $ENV{'form.notes'}); - $scrout.=&searchphrasefield('Limit by abstract','abstract', + $scrout.=&searchphrasefield('abstract','abstract', $ENV{'form.abstract'}); - $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)); + # Hack - an empty table row. + $scrout.="\n"; + $scrout.=&searchphrasefield('file
extension','mime', + $ENV{'form.mime'}); + $scrout.="\n"; + $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.language'}='any' unless length($ENV{'form.language'}); $scrout.=&selectbox('Limit by language','language', $ENV{'form.language'},'any','Any Language', @@ -455,8 +440,6 @@ LASTREVISIONDATEEND $ENV{'form.lastrevisiondateend_year'}, ); $scrout.='

'; - $scrout.=&searchphrasefield('Limit by publisher/owner','owner', - $ENV{'form.owner'}); $ENV{'form.copyright'}='any' unless length($ENV{'form.copyright'}); $scrout.=&selectbox('Limit by copyright/distribution','copyright', $ENV{'form.copyright'}, @@ -485,21 +468,7 @@ in a fielded listing for each record res CUSTOMSHOW $scrout.=&simpletextfield('customshow',$ENV{'form.customshow'}); $scrout.=< - - -$closebutton - - - - -

+$advanced_buttons @@ -579,7 +548,46 @@ the day, month, and year. =item &selectbox() -Returns html selection form. +Returns a scalar containing an html tag. + +=item $default + +The default value of the form. Can be $anyvalue or in @idlist. + +=item $anyvalue + +The