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

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 01 Mar 2004 16:04:43 -0000


matthew		Mon Mar  1 11:04:43 2004 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  breadcrumbs: 'bug' and 'faq' entries now cascade down if values are not 
  specified in later crumbs.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.56 loncom/interface/lonhtmlcommon.pm:1.57
--- loncom/interface/lonhtmlcommon.pm:1.56	Tue Feb 24 18:19:15 2004
+++ loncom/interface/lonhtmlcommon.pm	Mon Mar  1 11:04:43 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.56 2004/02/24 23:19:15 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.57 2004/03/01 16:04:43 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -876,7 +876,7 @@
 ############################################################
 {
     my @Crumbs;
-
+    
     sub breadcrumbs {
         my ($color,$component,$component_help,$function,$domain) = @_;
         if (! defined($color)) {
@@ -891,19 +891,27 @@
             '<table width="100%" border="0" cellpadding="0" cellspacing="0">'.
             '<tr><td bgcolor="'.$color.'">'.
             '<font size="-1">';
+        #
+        # Make the faq and bug data cascade
+        my $faq = '';
+        my $bug = '';
         # The last breadcrumb does not have a link, so handle it seperately.
         my $last = pop(@Crumbs);
+        #
         # The first one should be the course, I guess.
         if (exists($ENV{'request.course.id'})) {
             my $cid = $ENV{'request.course.id'};
-            unshift(@Crumbs,{href=>'/adm/menu',
+            unshift(@Crumbs,{
+                             href=>'/adm/menu',
                              title=>'Go to main menu',
                              text=>$ENV{'course.'.$cid.'.description'},
-                         });
+                            });
         }
         my $links .= 
             join('-&gt;',
                  map {
+                     $faq = $_->{'faq'} if (exists($_->{'faq'}));
+                     $bug = $_->{'bug'} if (exists($_->{'bug'}));
                      '<a href="'.$_->{'href'}.'" title="'.$_->{'title'}.'">'.
                          $_->{'text'}.'</a>' 
                      } @Crumbs
@@ -912,11 +920,13 @@
         $links .= '<b>'.$last->{'text'}.'</b>';
         #
         my $icons = '';
-        if (exists($last->{'faq'})) {
-            $icons .= &Apache::loncommon::help_open_faq($last->{'faq'});
+        $faq = $last->{'faq'} if (exists($last->{'faq'}));
+        $bug = $last->{'bug'} if (exists($last->{'bug'}));
+        if ($faq ne '') {
+            $icons .= &Apache::loncommon::help_open_faq($faq);
         }
-        if (exists($last->{'bug'})) {
-            $icons .= &Apache::loncommon::help_open_bug($last->{'bug'});
+        if ($bug ne '') {
+            $icons .= &Apache::loncommon::help_open_bug($bug);
         }
         if ($icons ne '') {
             $Str .= $icons.'&nbsp;';
@@ -950,7 +960,7 @@
         push (@Crumbs,@_);
     }
 
-}
+} # End of scope for @Crumbs
 
 ############################################################
 ############################################################