'.
- '';
+ my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt,
+ $CourseBreadcrumbs,$topic_help,$topic_help_text,$links_target) = @_;
#
+ $css_class ||= 'LC_breadcrumbs';
+
# Make the faq and bug data cascade
- my $faq = '';
- my $bug = '';
+ my $faq = '';
+ my $bug = '';
+ my $help = '';
+ # Crumb Symbol
+ my $crumbsymbol = '»';
# The last breadcrumb does not have a link, so handle it separately.
my $last = pop(@Crumbs);
#
# The first one should be the course or a menu link
- if (!defined($menulink)) { $menulink=1; }
+ if (!defined($menulink)) { $menulink=1; }
+ if ($menulink) {
+ if ($env{'request.course.id'}) {
+ my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect();
+ if (($menucoll) && (ref($menuref) eq 'HASH')) {
+ if ($menuref->{'main'} eq 'n') {
+ undef($menulink);
+ }
+ }
+ }
+ }
if ($menulink) {
my $description = 'Menu';
- if (exists($ENV{'request.course.id'}) &&
- $ENV{'request.course.id'} ne '') {
+ my $no_mt_descr = 0;
+ if ((exists($env{'request.course.id'})) &&
+ ($env{'request.course.id'} ne '') &&
+ ($env{'course.'.$env{'request.course.id'}.'.description'} ne '')) {
$description =
- $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
+ $env{'course.'.$env{'request.course.id'}.'.description'};
+ $no_mt_descr = 1;
+ if ($env{'request.noversionuri'} =~
+ m{^/?public/($match_domain)/($match_courseid)/syllabus$}) {
+ unless (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $1) &&
+ ($env{'course.'.$env{'request.course.id'}.'.num'} eq $2)) {
+ $description = 'Menu';
+ $no_mt_descr = 0;
+ }
+ }
+ }
+ my $target = '_top';
+ if ($links_target) {
+ $target = $links_target;
+ } elsif (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {
+ $target = '';
+ }
+ $menulink = { href =>'/adm/menu',
+ title =>'Go to main menu',
+ target =>$target,
+ text =>$description,
+ no_mt =>$no_mt_descr, };
+ if($last) {
+ #$last set, so we have some crumbs
+ unshift(@Crumbs,$menulink);
+ } else {
+ #only menulink crumb present
+ $last = $menulink;
}
- unshift(@Crumbs,{
- href =>'/adm/menu',
- title =>'Go to main menu',
- target =>'_top',
- text =>$description,
- });
- }
- my $links .=
- join('->',
- map {
- $faq = $_->{'faq'} if (exists($_->{'faq'}));
- $bug = $_->{'bug'} if (exists($_->{'bug'}));
- my $result = '{'target'}) && $_->{'target'} ne '') {
- $result .= 'target="'.$_->{'target'}.'" ';
- }
- $result .='title="'.&mt($_->{'title'}).'">'.
- &mt($_->{'text'}).'';
- $result;
- } @Crumbs
- );
- $links .= '->' if ($links ne '');
- $links .= ''.$last->{'text'}.'';
- #
- my $icons = '';
- $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 ($bug ne '') {
- $icons .= &Apache::loncommon::help_open_bug($bug);
+ my $links;
+ if ((&show_return_link) && (!$CourseBreadcrumbs) && (ref($last) eq 'HASH')) {
+ my $alttext = &mt('Go Back');
+ my $hashref = { href => '/adm/flip?postdata=return:',
+ title => &mt('Back to most recent content resource'),
+ class => 'LC_menubuttons_link',
+ };
+ if ($links_target) {
+ $hashref->{'target'} = $links_target;
+ }
+ $links=&htmltag( 'a','',
+ $hashref);
+ $links=&htmltag('li',$links);
}
- if ($icons ne '') {
- $Str .= $icons.' ';
+ $links.= join "",
+ map {
+ $faq = $_->{'faq'} if (exists($_->{'faq'}));
+ $bug = $_->{'bug'} if (exists($_->{'bug'}));
+ $help = $_->{'help'} if (exists($_->{'help'}));
+
+ my $result = $_->{no_mt} ? $_->{text} : &mt($_->{text});
+
+ if ($_->{href}){
+ $result = &htmltag( 'a', $result,
+ { href => $_->{href},
+ title => $_->{no_mt} ? $_->{title} : &mt($_->{title}),
+ target => $_->{target}, });
+ }
+
+ $result = &htmltag( 'li', "$result $crumbsymbol");
+ } @Crumbs;
+
+ #should the last Element be translated?
+
+ my $lasttext = $last->{'no_mt'} ? $last->{'text'}
+ : mt( $last->{'text'} );
+
+ # last breadcrumb is the first order heading of a page
+ # for course breadcrumbs it's just bold
+
+ if ($lasttext ne '') {
+ $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
+ $lasttext), {title => $lasttext});
+ }
+
+ my $icons = '';
+ $faq = $last->{'faq'} if (exists($last->{'faq'}));
+ $bug = $last->{'bug'} if (exists($last->{'bug'}));
+ $help = $last->{'help'} if (exists($last->{'help'}));
+ $component_help=($component_help?$component_help:$help);
+# if ($faq ne '') {
+# $icons .= &Apache::loncommon::help_open_faq($faq);
+# }
+# if ($bug ne '') {
+# $icons .= &Apache::loncommon::help_open_bug($bug);
+# }
+ if ($faq ne '' || $component_help ne '' || $bug ne '') {
+ $icons .= &Apache::loncommon::help_open_menu($component,
+ $component_help,
+ $faq,$bug,'','','','',
+ $links_target);
+ }
+ if ($topic_help && $topic_help_text) {
+ $icons .= ' '.&Apache::loncommon::help_open_topic($topic_help,&mt($topic_help_text),'',
+ undef,600,'',$links_target);
}
#
- $Str .= $links.' | ';
- #
- if (defined($component)) {
- $Str .= ''.
- ''.&mt($component).'';
- if (defined($component_help)) {
- $Str .=
- &Apache::loncommon::help_open_topic($component_help);
+
+
+ if ($links ne '') {
+ unless ($CourseBreadcrumbs) {
+ $links = &htmltag('ol', $links, { id => "LC_MenuBreadcrumbs" });
+ } else {
+ $links = &htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" });
}
- $Str.= ' | ';
}
- $Str .= '