[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 19 Apr 2004 16:53:27 -0000


matthew		Mon Apr 19 12:53:27 2004 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Added calls to breadcrumbs in &print_(basic|advanced)_search_form 
  subroutines.
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.208 loncom/interface/lonsearchcat.pm:1.209
--- loncom/interface/lonsearchcat.pm:1.208	Mon Apr 19 10:42:24 2004
+++ loncom/interface/lonsearchcat.pm	Mon Apr 19 12:53:27 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.208 2004/04/19 14:42:24 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.209 2004/04/19 16:53:27 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -164,6 +164,25 @@
             '_'.&Apache::lonnet::escape($ENV{'user.name'}).
                 '_'.$ENV{'form.persistent_db_id'}.'_persistent_search.db';
     ##
+    &Apache::lonhtmlcommon::clear_breadcrumbs();
+    if (exists($ENV{'request.course.id'}) && $ENV{'request.course.id'} ne '') {
+        &Apache::lonhtmlcommon::add_breadcrumb
+             ({href=>'/adm/searchcat?'.
+                   'catalogmode='.$ENV{'form.catalogmode'}.
+                   '&launch='.$ENV{'form.launch'}.
+                   '&mode='.$ENV{'form.mode'},
+              text=>"Course and Catalog Search",
+              bug=>'Searching',});
+    } else {
+        &Apache::lonhtmlcommon::add_breadcrumb
+             ({href=>'/adm/searchcat?'.
+                   'catalogmode='.$ENV{'form.catalogmode'}.
+                   '&launch='.$ENV{'form.launch'}.
+                   '&mode='.$ENV{'form.mode'},
+              text=>"Catalog Search",
+              bug=>'Searching',});
+    }
+    #
     if (! &get_persistent_form_data($persistent_db_file)) {
         if ($ENV{'form.phase'} =~ /(run_search|results)/) {
             &Apache::lonnet::logthis("lonsearchcat:Unable to recover data ".
@@ -264,6 +283,32 @@
     }
     $ENV{'form.phase'} = 'disp_basic' if (! exists($ENV{'form.phase'}));
     $ENV{'form.show'} = 20 if (! exists($ENV{'form.show'}));
+    #
+    $ENV{'form.searchmode'} = 'basic';
+    if ($ENV{'form.phase'} eq 'adv_search' ||
+        $ENV{'form.phase'} eq 'disp_adv') {
+        $ENV{'form.searchmode'} = 'advanced';
+    } elsif ($ENV{'form.phase'} eq 'course_search') {
+        $ENV{'form.searchmode'} = 'course_search';
+    }
+    #
+    if ($ENV{'form.searchmode'} eq 'advanced') {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>'/adm/searchcat?phase=disp_adv&'.
+                  'catalogmode='.$ENV{'form.catalogmode'}.
+                  '&launch='.$ENV{'form.launch'}.
+                  '&mode='.$ENV{'form.mode'},
+                  text=>"Advanced Search",
+                  bug=>'Searching',});
+    } elsif ($ENV{'form.searchmode'} eq 'course search') {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>'/adm/searchcat?phase=disp_adv&'.
+                  'catalogmode='.$ENV{'form.catalogmode'}.
+                  '&launch='.$ENV{'form.launch'}.
+                  '&mode='.$ENV{'form.mode'},
+                  text=>"Course Search",
+                  bug=>'Searching',});
+    }
     ##
     ## Switch on the phase
     ##
@@ -288,10 +333,6 @@
         &course_search($r);
     } 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())) {
 	    my $errorstring=&Apache::lonmysql::get_error();
@@ -487,14 +528,12 @@
 sub print_basic_search_form {
     my ($r,$closebutton,$hidden_fields) = @_;
     my $bodytag=&Apache::loncommon::bodytag('Search').
-	&Apache::loncommon::help_open_topic('Finding_Resources').
-	&Apache::loncommon::help_open_bug('Searching');
+        &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Finding_Resources',
+                                            undef,undef,! $ENV{'form.launch'});
     my $scrout = &search_html_header().$bodytag;
     if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
-        my $CatalogSearch=&mt('Catalog Search');
         my $Statement=&searchhelp();
         $scrout.=(<<ENDDOCUMENT);
-<h1>$CatalogSearch</h1>
 <form name="loncapa_search" method="post" action="/adm/searchcat">
 <input type="hidden" name="phase" value="basic_search" />
 $hidden_fields
@@ -610,7 +649,11 @@
 $closebutton
 <input type="button" value="$lt{'help'}" onClick="openhelp()" />
 END
-    my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search');
+    my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search').
+        &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching',
+                                            'Finding_Resources',
+                                            undef,undef,
+                                            ! $ENV{'form.launch'});
     my $searchhelp=&searchhelp();
     my $scrout=&search_html_header();
     $scrout .= <<"ENDHEADER";
@@ -636,7 +679,7 @@
          'standards'=>1,
          'mime'=>1,
          );
-
+    #
     foreach my $field ('title','author','owner','authorspace','modifyinguser',
 	     'keywords','notes','abstract','standards','mime') {
 	$scrout.='<tr><td align="right">'.&titlefield($fields{$field}).'</td><td>'.