--- loncom/interface/lonsearchcat.pm 2002/06/26 16:04:13 1.130 +++ loncom/interface/lonsearchcat.pm 2002/07/12 21:02:27 1.142 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.130 2002/06/26 16:04:13 matthew Exp $ +# $Id: lonsearchcat.pm,v 1.142 2002/07/12 21:02:27 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,7 +40,7 @@ =head1 NAME -lonsearchcat +lonsearchcat - LONCAPA Search Interface =head1 SYNOPSIS @@ -107,17 +107,24 @@ button that closes the search window =item $importbutton -button to take the selecte results and go to group sorting +button to take the select results and go to group sorting -=item %hash +=item %groupsearch_db -The ubiquitous database hash +Database hash used to save values for the groupsearch RAT interface. =item $diropendb The full path to the (temporary) search database file. This is set and used in &handler() and is also used in &output_results(). +=item %Views + +Hash which associates an output view description with the function +that produces it. Adding a new view type should be as easy as +adding a line to the definition of this hash and making sure the function +takes the proper parameters. + =back =cut @@ -130,9 +137,15 @@ my $closebutton; # button that closes t my $importbutton; # button to take the selected results and go to group sorting # -- miscellaneous variables -my %hash; # database hash +my %groupsearch_db; # database hash my $diropendb = ""; # db file +# View Description Function Pointer +my %Views = ("Detailed Citation View" => \&detailed_citation_view, + "Summary View" => \&summary_view, + "Fielded Format" => \&fielded_format_view, + "XML/SGML" => \&xml_sgml_view ); + ###################################################################### ###################################################################### @@ -160,7 +173,7 @@ string that holds portions of the screen ###################################################################### sub handler { my $r = shift; - untie %hash; + untie %groupsearch_db; $r->content_type('text/html'); $r->send_http_header; @@ -177,9 +190,9 @@ sub handler { ## Clear out old values from database ## if ($ENV{'form.launch'} eq '1') { - if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) { + if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) { &start_fresh_session(); - untie %hash; + untie %groupsearch_db; } else { $r->print('
Unable to tie hash to db '. 'file'); @@ -212,28 +225,53 @@ END onClick='javascript:select_group()'> END } - $hidden .= <-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.
@@ -284,20 +322,21 @@ ENDDOCUMENT
' ';
# $scrout.=&simplecheckbox('allversions',$ENV{'form.allversions'});
# $scrout.='Search historic archives';
- $scrout.=<Advanced Search
+ my $checkbox = &simplecheckbox('related',$ENV{'form.related'});
+ $scrout.=<Advanced Search
+
+
$checkbox use related words
$closebutton
-
-
-
+END
+ $scrout.=&selectbox(undef,'viewselect',
+ $ENV{'form.viewselect'},
+ undef,undef,undef,
+ sort(keys(%Views)));
+ $scrout.=<