--- loncom/interface/lonhtmlcommon.pm 2011/01/13 17:44:30 1.286
+++ loncom/interface/lonhtmlcommon.pm 2011/01/18 19:52:46 1.288
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.286 2011/01/13 17:44:30 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.288 2011/01/18 19:52:46 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1424,6 +1424,29 @@ sub htmlareabrowser {
return 1;
}
+#
+# Should the "return to content" link be shown?
+#
+
+sub show_return_link {
+ if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
+ || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
+
+ return if ($env{'form.register'});
+ }
+ return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
+ $env{'request.symb'} eq '')
+ ||
+ ($env{'request.noversionuri'}=~ m{^/cgi-bin/printout.pl})
+ ||
+ (($env{'request.noversionuri'}=~/^\/adm\//) &&
+ ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
+ ($env{'request.noversionuri'}!~
+ m{^/adm/.*/(smppg|bulletinboard)($|\?)})
+ ));
+}
+
+
############################################################
############################################################
@@ -1509,22 +1532,28 @@ returns: nothing
$last = $menulink;
}
}
- my $links = join "",
+ my $links;
+ if ((&show_return_link) && (!$CourseBreadcrumbs)) {
+ $links=&htmltag( 'a',"
",
+ { href => '/adm/flip?postdata=return:',
+ title => &mt("Back to most recent content resource") });
+ }
+ $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});
+ my $result = $_->{no_mt} ? $_->{text} : &mt($_->{text});
if ($_->{href}){
- $result = htmltag( 'a', $result,
+ $result = &htmltag( 'a', $result,
{ href => $_->{href},
- title => $_->{no_mt} ? $_->{title} : mt($_->{title}),
+ title => $_->{no_mt} ? $_->{title} : &mt($_->{title}),
target => $_->{target}, });
}
- $result = htmltag( 'li', "$result $crumbsymbol");
+ $result = &htmltag( 'li', "$result $crumbsymbol");
} @Crumbs;
#should the last Element be translated?
@@ -1534,7 +1563,7 @@ returns: nothing
# last breadcrumb is the first order heading of a page
# for course breadcrumbs it's just bold
- $links .= htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
+ $links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
$lasttext), {title => $lasttext});
my $icons = '';
@@ -1557,23 +1586,23 @@ returns: nothing
unless ($CourseBreadcrumbs) {
- $links = htmltag('ol', $links, { id => "LC_MenuBreadcrumbs" });
+ $links = &htmltag('ol', $links, { id => "LC_MenuBreadcrumbs" });
} else {
- $links = htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" });
+ $links = &htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" });
}
if ($component) {
- $links = htmltag('span',
+ $links = &htmltag('span',
( $no_mt ? $component : mt($component) ).
( $icons ? $icons : '' ),
{ class => 'LC_breadcrumbs_component' } )
.$links;
}
- render_tools(\$links);
- $links = htmltag('div', $links,
+ &render_tools(\$links);
+ $links = &htmltag('div', $links,
{ id => "LC_breadcrumbs" }) unless ($CourseBreadcrumbs) ;
- render_advtools(\$links);
+ &render_advtools(\$links);
# Return the @Crumbs stack to what we started with
push(@Crumbs,$last);
@@ -1628,7 +1657,7 @@ returns: nothing
@html = grep {defined $_ && $_ ne ''} @html;
for (@html) {
s/align="(right|left)"//;
- s/// if $category ne 'advtools';
+# s/// if $category ne 'advtools';
}
push @{$tools{$category}}, @html;