--- loncom/interface/lonsearchcat.pm 2002/08/01 14:11:57 1.150
+++ loncom/interface/lonsearchcat.pm 2002/08/26 14:34:19 1.155
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.150 2002/08/01 14:11:57 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.155 2002/08/26 14:34:19 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -115,6 +115,11 @@ that produces it. Adding a new view typ
adding a line to the definition of this hash and making sure the function
takes the proper parameters.
+=item $bodytag
+
+LON-CAPA standard body tag, gotten from &Apache::lonnet::bodytag.
+No title, no table, just a
tag.
+
=back
=cut
@@ -136,6 +141,8 @@ my %Views = ("Detailed Citation View" =>
"Compact View" => \&compact_view);
my %persistent_db;
my $hidden_fields;
+my $bodytag;
+
######################################################################
######################################################################
@@ -201,19 +208,20 @@ sub handler {
($ENV{'form.launch'} eq '1')) {
$ENV{'form.persistent_db_id'} = time;
}
+ $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1);
my $persistent_db_file = "/home/httpd/perl/tmp/".
&Apache::lonnet::escape($domain).
'_'.&Apache::lonnet::escape($ENV{'user.name'}).
'_'.$ENV{'form.persistent_db_id'}.'_persistent_search.db';
##
- if (! &get_persistent_form_data($r,$persistent_db_file)) {
+ if (! &get_persistent_form_data($persistent_db_file)) {
if ($ENV{'form.phase'} =~ /(run_search|results)/) {
&Apache::lonnet::logthis("lonsearchcat:Unable to recover data ".
"from $persistent_db_file");
$r->print(<
LON-CAPA Search Error
-
+$bodytag
We were unable to retrieve data describing your search. This is a serious
error and has been logged. Please alert your LON-CAPA administrator.
@@ -233,8 +241,10 @@ END
&start_fresh_session();
untie %groupsearch_db;
} else {
- $r->print('Unable to tie hash to db '.
- 'file');
+ # This is a stupid error to give to the user.
+ # It really tells them nothing.
+ $r->print(''.$bodytag.
+ 'Unable to tie hash to db file');
return OK;
}
}
@@ -298,6 +308,7 @@ END
}
}
$ENV{'form.phase'} = 'disp_basic' if (! exists($ENV{'form.phase'}));
+ $ENV{'form.show'} = 20 if (! exists($ENV{'form.show'}));
##
## Switch on the phase
##
@@ -307,20 +318,28 @@ END
&print_advanced_search_form($r,$closebutton);
} elsif ($ENV{'form.phase'} eq 'results') {
&display_results($r,$importbutton,$closebutton);
- } elsif($ENV{'form.phase'} eq 'run_search') {
+ } elsif ($ENV{'form.phase'} =~ /^(sort|run_search)$/) {
my ($query,$customquery,$customshow,$libraries,$pretty_string) =
&get_persistent_data($persistent_db_file,
['query','customquery','customshow',
'libraries','pretty_string']);
- &run_search($r,$query,$customquery,$customshow,
- $libraries,$pretty_string);
+ if ($ENV{'form.phase'} eq 'sort') {
+ &print_sort_form($r,$pretty_string);
+ } elsif ($ENV{'form.phase'} eq 'run_search') {
+ &run_search($r,$query,$customquery,$customshow,
+ $libraries,$pretty_string);
+ }
} elsif(($ENV{'form.phase'} eq 'basic_search') ||
($ENV{'form.phase'} eq 'adv_search')) {
+ $ENV{'form.searchmode'} = 'basic';
+ if ($ENV{'form.phase'} eq 'adv_search') {
+ $ENV{'form.searchmode'} = 'advanced';
+ }
# Set up table
if (! defined(&create_results_table())) {
$r->print(<Search Error
-
+$bodytag
Unable to create table in which to store search results.
The search has been aborted.
@@ -332,7 +351,7 @@ END
if (! &make_form_data_persistent($r,$persistent_db_file)) {
$r->print(<Search Error
-
+$bodytag
Unable to properly store search information. The search has been aborted.