--- loncom/interface/lonmenu.pm 2010/03/10 21:25:50 1.316
+++ 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.316 2010/03/10 21:25:50 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'}) {
@@ -388,12 +360,12 @@ sub innerregister {
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
- #$breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
}
# =============================================================================
# ============================ This is for URLs that actually can be registered
return '' unless ( ($env{'request.noversionuri'}!~m{^/(res/)*adm/})
|| $forcereg );
+
# -- This applies to homework problems for users with grading privileges
my $crs='/'.$env{'request.course.id'};
if ($env{'request.course.sec'}) {
@@ -405,18 +377,18 @@ sub innerregister {
if ($env{'request.symb'} ne '' &&
$env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
if (&Apache::lonnet::allowed('mgr',$crs)) {
- $hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_4]',
+ $hwkadd.=&switch('','',7,2,'pgrd.png','problem[_1]','grades[_4]',
"gocmd('/adm/grades','gradingmenu')",
'Modify user grades for this assessment resource');
} elsif (&Apache::lonnet::allowed('vgr',$crs)) {
- $hwkadd.=&switch('','',7,2,'subm.gif','view sub-[_1]','missions[_1]',
+ $hwkadd.=&switch('','',7,2,'subm.png','view sub-[_1]','missions[_1]',
"gocmd('/adm/grades','submission')",
'View user submissions for this assessment resource');
}
}
if ($env{'request.symb'} ne '' &&
&Apache::lonnet::allowed('opa',$crs)) {
- $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
+ $hwkadd.=&switch('','',7,3,'pparm.png','problem[_2]','parms[_2]',
"gocmd('/adm/parmset','set')",
'Modify parameter settings for this resource');
}
@@ -511,7 +483,7 @@ sub innerregister {
$editbutton=&clear(6,1);
} else {
$editbutton=&switch
- ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
+ ('','',6,1,'pcstr.png','edit[_1]','resource[_2]',
"go('".$cfile."');","Edit this resource");
$noeditbutton = 0;
}
@@ -527,7 +499,7 @@ sub innerregister {
my $cfile = &edit_course_upload($file,$cnum,$cdom);
if ($cfile) {
$editbutton=&switch
- ('','',6,1,'pcstr.gif','edit[_1]',
+ ('','',6,1,'pcstr.png','edit[_1]',
'resource[_2]',"go('".$cfile."');",
'Edit this resource');
}
@@ -556,11 +528,11 @@ sub innerregister {
# Probably should be in mydesk.tab
#
$menuitems=(< 0){
- $menuitems.="anot2.gif";
+ $menuitems.="anot2.png";
}else{
- $menuitems.="anot.gif";
+ $menuitems.="anot.png";
}
$menuitems.="&anno-[_1]&tations[_1]&annotate()&";
$menuitems.="Make notes and annotations about this resource&&1\n";
@@ -601,18 +573,18 @@ $menuitems.="Make notes and annotations
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
$menuitems.=(<';
- if ($env{'browser.interface'} eq 'faketextual') {
+ if ($env{'browser.interface'} eq 'faketextual') {
# Main Menu
if ($nobreak==3) {
$inlineremote[$idx]="\n".
@@ -776,17 +729,12 @@ sub switch {
'';
}
- } else {
+ } else {
# Inline Menu
-#SD look here
- if ($env{'environment.icons'} eq 'iconsonly') {
- $inlineremote[$idx]=''.$pic.'';
- } else {
- $inlineremote[$idx]=
- '';
- }
- }
+ $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 (<