--- loncom/interface/lonmenu.pm 2010/03/16 19:55:49 1.318
+++ loncom/interface/lonmenu.pm 2010/04/19 09:22:14 1.326
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.318 2010/03/16 19:55:49 droeschl Exp $
+# $Id: lonmenu.pm,v 1.326 2010/04/19 09:22:14 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -109,14 +109,9 @@ Same as primary_menu() but operates on @
=item show_return_link()
-=item registerurl()
-
-This gets called in the header section
-
=item innerregister()
-This gets called in order to register a URL, both with the Remote
-and in the body of the document
+This gets called in order to register a URL in the body of the document
=item clear()
@@ -182,7 +177,7 @@ sub prep_menuitem {
return '
$link|;
+ . qq| href="$$menuitem[0]" target="_top">$link|;
}
# primary_menu() evaluates @primary_menu and returns XHTML for the menu
@@ -194,6 +189,11 @@ sub primary_menu {
my $menu;
# each element of @primary contains following array:
# (link url, icon path, alt text, link text, condition)
+ my $public;
+ if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
+ || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
+ $public = 1;
+ }
foreach my $menuitem (@primary_menu) {
# evaluate conditions
next if ref($menuitem) ne 'ARRAY'; #
@@ -201,12 +201,12 @@ sub primary_menu {
&& &Apache::lonmsg::mynewmail(); # whether a new msg
next if $$menuitem[4] eq 'newmsg' # arrived or not
&& !&Apache::lonmsg::mynewmail(); #
- next if $$menuitem[4] !~ /public/ ##we've a public user,
- && $env{'user.name'} eq 'public' ##who should not see all
- && $env{'user.domain'} eq 'public'; ##links
+ next if $$menuitem[4] !~ /public/ ##we've a public user,
+ && $public; ##who should not see all
+ ##links
next if $$menuitem[4] eq 'onlypublic'# hide links which are
- && $env{'user.name'} ne 'public' # only visible to public
- && $env{'user.domain'} ne 'public'; # users
+ && !$public; # only visible to public
+ # users
next if $$menuitem[4] eq 'roles' ##show links depending on
&& &Apache::loncommon::show_course(); ##term 'Courses' or
next if $$menuitem[4] eq 'courses' ##'Roles' wanted
@@ -216,11 +216,11 @@ sub primary_menu {
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
$menu .= ''.&Apache::loncommon::top_nav_help('Help').'';
} else {
- my @items = @{$menuitem};
- $items[0] = 'javascript:'.$menuitem->[0].';';
- $menu .= &prep_menuitem(\@items);
+ $menu .= prep_menuitem($menuitem);
}
}
+ $menu =~ s/\[domain\]/$env{'user.domain'}/g;
+ $menu =~ s/\[user\]/$env{'user.name'}/g;
return "";
}
@@ -297,6 +297,11 @@ sub secondary_menu {
}
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 '')
||
@@ -305,19 +310,12 @@ sub show_return_link {
(($env{'request.noversionuri'}=~/^\/adm\//) &&
($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
($env{'request.noversionuri'}!~
- m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
- ));
-}
-
-
-sub registerurl {
- if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
- return Apache::lonxml::display_title();
+ m{^/adm/.*/(smppg|bulletinboard)($|\?)})
+ ));
}
sub innerregister {
- my ($forcereg,$titletable,$bread_crumbs) = @_;
- my ($uname,$thisdisfn);
+ my ($forcereg,$bread_crumbs) = @_;
my $const_space = ($env{'request.state'} eq 'construct');
my $is_const_dir = 0;
@@ -338,10 +336,13 @@ sub innerregister {
#SD
#course_type only Course and Community?
#
- my @crumbs = ({text => Apache::loncommon::course_type()
+ my @crumbs;
+ unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')
+ && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
+ @crumbs = ({text => Apache::loncommon::course_type()
. ' Contents',
- href => "Javascript:gonav('/adm/navmaps')"});
-
+ href => "Javascript:gopost('/adm/navmaps','')"});
+ }
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
push(@crumbs, {text => '...',
no_mt => 1});
@@ -565,7 +566,7 @@ if(length($annotation) > 0){
$menuitems.="&anno-[_1]&tations[_1]&annotate()&";
$menuitems.="Make notes and annotations about this resource&&1\n";
- unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
+ unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
$menuitems.=(<