--- loncom/interface/lonmenu.pm 2010/03/11 16:35:12 1.317
+++ loncom/interface/lonmenu.pm 2010/03/17 19:35:56 1.319
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.317 2010/03/11 16:35:12 droeschl Exp $
+# $Id: lonmenu.pm,v 1.319 2010/03/17 19:35:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -118,12 +118,6 @@ This gets called in the header section
This gets called in order to register a URL, both with the Remote
and in the body of the document
-=item loadevents()
-
-=item unloadevents()
-
-=item get_menu_name()
-
=item clear()
=item switch()
@@ -200,6 +194,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'; #
@@ -207,12 +206,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
@@ -259,13 +258,9 @@ sub secondary_menu {
&& $crstype eq 'Community';
next if $$menuitem[4] eq 'mdcCommunity'
&& $crstype ne 'Community';
- next if $$menuitem[4] =~ /^remotenav/
- && $env{'environment.remotenavmap'} ne 'on';
- next if $$menuitem[4] =~ /noremotenav/
- && $env{'environment.remotenavmap'} eq 'on';
- next if $$menuitem[4] =~ /^(no|)remotenav$/
+ next if $$menuitem[4] =~ /^Course$/
&& $crstype eq 'Community';
- next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/
+ next if $$menuitem[4] =~ /^Community$/
&& $crstype ne 'Community';
next if $$menuitem[4] =~ /showgroups$/
&& !$canviewgrps
@@ -279,15 +274,6 @@ sub secondary_menu {
$menu .= $roles_selector ? "
$roles_selector"
: '';
- } elsif ($env{'environment.remotenavmap'} eq 'on') {
- # open link using javascript when remote navmap is activated
- my @items = @{$menuitem};
- if ($menuitem->[4] eq 'remotenav') {
- $items[0] = "javascript:gonav('$menuitem->[0]');";
- } else {
- $items[0] = "javascript:go('$menuitem->[0]');";
- }
- $menu .= &prep_menuitem(\@items);
} else {
$menu .= &prep_menuitem(\@$menuitem);
}
@@ -330,21 +316,8 @@ sub show_return_link {
sub registerurl {
- my ($forcereg) = @_;
- my $result = '';
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
- my $force_title='';
- if ($env{'request.state'} eq 'construct') {
- $force_title=&Apache::lonxml::display_title();
- }
- return
- $result
- .''
- .$force_title;
+ return Apache::lonxml::display_title();
}
sub innerregister {
@@ -366,13 +339,12 @@ sub innerregister {
my $maptitle = &Apache::lonnet::gettitle($mapurl);
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
- my $contentstext;
- if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') {
- $contentstext = &mt('Community Contents');
- } else {
- $contentstext = &mt('Course Contents');
- }
- my @crumbs = ({text => $contentstext,
+
+#SD
+#course_type only Course and Community?
+#
+ my @crumbs = ({text => Apache::loncommon::course_type()
+ . ' Contents',
href => "Javascript:gonav('/adm/navmaps')"});
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
@@ -703,24 +675,6 @@ sub edit_course_upload {
return $cfile;
}
-sub loadevents() {
- if ($env{'request.state'} eq 'construct' ||
- $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
- return 'LONCAPAreg();';
-}
-
-sub unloadevents() {
- if ($env{'request.state'} eq 'construct' ||
- $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
- return 'LONCAPAstale();';
-}
-
-sub get_menu_name {
- my $hostid = $Apache::lonnet::perlvar{'lonHostID'};
- $hostid =~ s/\W//g;
- return 'LCmenu'.$hostid;
-}
-
# ================================================================== Raw Config
#SD
@@ -748,7 +702,6 @@ sub switch {
$category_members{$cat}.=':'.$idx;
# Inline Remote
-#RC $img=~s/\.gif$/\.png/;
if ($nobreak==2) { return ''; }
my $text=$top.' '.$bot;
$text=~s/\s*\-\s*//gs;
@@ -778,14 +731,9 @@ sub switch {
}
} else {
# Inline Menu
-#SD look here
- if ($env{'environment.icons'} eq 'iconsonly') {
- $inlineremote[$idx]=''.$pic.'';
- } else {
$inlineremote[$idx]=
'';
- }
}
return '';
}
@@ -1045,25 +993,6 @@ sub check_for_rcrs {
return $showreqcrs;
}
-# ====================================================================== Footer
-
-sub nav_control_js {
- my $nav=($env{'environment.remotenavmap'} eq 'on');
- return (< '(More ...)',
@@ -1098,7 +1027,6 @@ sub utilityfunctions {
$currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
- my $nav_control=&nav_control_js();
my $dc_popup_cid;
if ($env{'user.adv'} && exists($env{'user.role.dc./'.
@@ -1133,7 +1061,6 @@ return (<