Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.222 and 1.223

version 1.222, 2009/06/08 18:04:45 version 1.223, 2009/06/10 13:32:38
Line 1314  sub htmlareabrowser { Line 1314  sub htmlareabrowser {
 =item breadcrumbs  =item breadcrumbs
   
 Compiles the previously registered breadcrumbs into an series of links.  Compiles the previously registered breadcrumbs into an series of links.
 FAQ and BUG links will be placed on the left side of the table if they  
 are defined for the last registered breadcrumb.    
 Additionally supports a 'component', which will be displayed on the  Additionally supports a 'component', which will be displayed on the
 right side of the table (without a link).  right side of the breadcrumbs enclosing div (without a link).
 A link to help for the component will be included if one is specified.  A link to help for the component will be included if one is specified.
   
 All inputs can be undef without problems.  All inputs can be undef without problems.
   
 Inputs: $component (the large text on the right side of the table),  Inputs: $component (the text on the right side of the breadcrumbs trail),
         $component_help          $component_help
         $menulink (boolean, controls whether to include a link to /adm/menu)          $menulink (boolean, controls whether to include a link to /adm/menu)
         $helplink (if 'nohelp' don't include the orange help link)          $helplink (if 'nohelp' don't include the orange help link)
Line 1357  returns: nothing Line 1355  returns: nothing
         my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt, $CourseBreadcrumbs) = @_;          my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt, $CourseBreadcrumbs) = @_;
         #          #
         $css_class ||= 'LC_breadcrumbs';          $css_class ||= 'LC_breadcrumbs';
         my $Str1 = '<div id="LC_head_subbox"><ol id="LC_MenuBreadcrumbs">';  
   
  if($CourseBreadcrumbs){  
  $Str1 = '<ul id="LC_CourseBreadcrumbs">';  
  }  
   
         my $Str = '';  
         #  
         # Make the faq and bug data cascade          # Make the faq and bug data cascade
         my $faq = '';          my $faq  = '';
         my $bug = '';          my $bug  = '';
         my $help='';          my $help = '';
         # Crumb Symbol          # Crumb Symbol
         my $crumbsymbol = '&raquo;&nbsp;';          my $crumbsymbol = '&raquo;';
         # The last breadcrumb does not have a link, so handle it separately.          # The last breadcrumb does not have a link, so handle it separately.
         my $last = pop(@Crumbs);          my $last = pop(@Crumbs);
         #          #
Line 1405  returns: nothing Line 1396  returns: nothing
                      $help = $_->{'help'} if (exists($_->{'help'}));                       $help = $_->{'help'} if (exists($_->{'help'}));
   
                      my $result = htmltag( 'a',                        my $result = htmltag( 'a', 
                                            $_->{no_mt} ? $_->{text} : mt($_->{text}),                                              $_->{no_mt} ? 
                                               $_->{text} : mt($_->{text}), 
                                            {                                              { 
                                                href   => $_->{href},                                                 href   => $_->{href},
                                                title  => $_->{no_mt} ? $_->{title} : mt($_->{title}),                                                 title  => $_->{no_mt} ? 
                                                   $_->{title} : mt($_->{title}),
                                                target => $_->{target},                                                 target => $_->{target},
                                            });                                             });
                      $result = htmltag( 'li', $crumbsymbol.$result);                       $result = htmltag( 'li', "$result $crumbsymbol");
                      } @Crumbs;                       } @Crumbs;
 #Workaround for edit course.   
  if(@Crumbs == 0 ){          #should the last Element be translated?
  $links .= '<li>' if ($links ne '');          $links  .= htmltag( 'li', 
  } else {                          htmltag( 'b', 
  $links .= '<li>'.$crumbsymbol if ($links ne '');                                   $last->{'no_mt'} ? 
  }                                   $last->{'text'} : mt($last->{'text'}) ));
 #should the last Element be translated?  
  if ($last->{'no_mt'}) {  
     $links .= '<b>'.$last->{'text'}.'</b>';  
  } else {  
     $links .= '<b>'.&mt($last->{'text'}).'</b>';  
  }  
  $links .= '</li>';  
         my $icons = '';          my $icons = '';
         $faq = $last->{'faq'} if (exists($last->{'faq'}));          $faq  = $last->{'faq'}  if (exists($last->{'faq'}));
         $bug = $last->{'bug'} if (exists($last->{'bug'}));          $bug  = $last->{'bug'}  if (exists($last->{'bug'}));
         $help = $last->{'help'} if (exists($last->{'help'}));          $help = $last->{'help'} if (exists($last->{'help'}));
         $component_help=($component_help?$component_help:$help);          $component_help=($component_help?$component_help:$help);
 #        if ($faq ne '') {  #        if ($faq ne '') {
Line 1437  returns: nothing Line 1424  returns: nothing
 #        if ($bug ne '') {  #        if ($bug ne '') {
 #            $icons .= &Apache::loncommon::help_open_bug($bug);  #            $icons .= &Apache::loncommon::help_open_bug($bug);
 #        }  #        }
  if ($faq ne '' || $component_help ne '' || $bug ne '') {          if ($faq ne '' || $component_help ne '' || $bug ne '') {
     $icons .= &Apache::loncommon::help_open_menu($component,              $icons .= &Apache::loncommon::help_open_menu($component,
  $component_help,                                                           $component_help,
  $faq,$bug);                                                           $faq,$bug);
  }          }
         #          #
   
   
  if($CourseBreadcrumbs){          unless ($CourseBreadcrumbs) {
         $Str1 .= $links.'</ul>';              $links = htmltag('ol',  $links, { id => "LC_MenuBreadcrumbs"   });
  } else {          } else {
         $Str1 .= $links.'</ol></div>';              $links = htmltag('ul',  $links, { id => "LC_CourseBreadcrumbs" });
  }  
         #  
         if (defined($component)) {  
             $Str .= "\n".'<table class="'.$css_class.'">'  
                    .'<tr><td class="'.$css_class.'_component">';  
             if ($no_mt) {  
                 $Str .= $component;  
             } else {  
                 $Str .= &mt($component);  
             }  
     if ($icons ne '') {  
  $Str .= '&nbsp;'.$icons;  
     }  
     $Str .= '</td></tr></table>'."\n";  
         }          }
         #  
           if ($component) {
               $links = htmltag('span', 
                                ( $no_mt ? $component : mt($component) ).
                                ( $icons ? $icons : '' ),
                                { class => 'LC_breadcrumbs_component' } )
                                .$links;
           }
           
           $links = htmltag('div', $links, 
                           { id => "LC_head_subbox" }) unless ($CourseBreadcrumbs) ;
   
         # Return the @Crumbs stack to what we started with          # Return the @Crumbs stack to what we started with
         push(@Crumbs,$last);          push(@Crumbs,$last);
         shift(@Crumbs);          shift(@Crumbs);
         # Return a table and after that the breadcrumb's line          # Return the breadcrumb's line
         return "$Str\n$Str1";          return "$links";
     }      }
   
     sub clear_breadcrumbs {      sub clear_breadcrumbs {

Removed from v.1.222  
changed lines
  Added in v.1.223


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>