--- loncom/interface/lonmenu.pm 2016/11/09 23:21:08 1.369.2.65 +++ loncom/interface/lonmenu.pm 2016/12/01 16:53:15 1.369.2.67 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.65 2016/11/09 23:21:08 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.67 2016/12/01 16:53:15 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -384,6 +384,7 @@ sub secondary_menu { ? "/$env{'request.course.sec'}" : ''); my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); + my $canvieweditor = &Apache::lonnet::allowed('cev', $env{'request.course.id'}); my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'}; if ($canviewroster eq 'disabled') { undef($canviewroster); @@ -402,7 +403,7 @@ sub secondary_menu { if ($env{'request.course.id'}) { $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - unless ($canedit) { + unless ($canedit || $canvieweditor) { unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) { if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) || ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) || @@ -415,7 +416,7 @@ sub secondary_menu { $showfeeds = 1; } } - unless (($canmgr) || ($canvgr)) { + unless ($canmgr || $canvgr) { my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom); if (keys(%slots) > 0) { $showresv = 1; @@ -445,11 +446,11 @@ sub secondary_menu { next if $$menuitem[4] ne 'always' && ($$menuitem[4] ne 'author' && $$menuitem[4] ne 'cca') && !$env{'request.course.id'}; - next if $$menuitem[4] =~ /^mdc/ - && !$canedit; - next if $$menuitem[4] eq 'mdcCourse' + next if $$menuitem[4] =~ /^crsedit/ + && (!$canedit && !$canvieweditor); + next if $$menuitem[4] eq 'crseditCourse' && ($crstype eq 'Community'); - next if $$menuitem[4] eq 'mdcCommunity' + next if $$menuitem[4] eq 'crseditCommunity' && ($crstype eq 'Course'); next if $$menuitem[4] eq 'nvgr' && $canvgr; @@ -497,7 +498,7 @@ sub secondary_menu { next if ($item->[2] eq 'viewusers' && !($canmodifyuser || $canviewusers)); next if ($item->[2] eq 'mgr' && !$canmgr); next if ($item->[2] eq 'vcg' && !$canviewgrps); - next if ($item->[2] eq 'mdc' && !$canedit); + next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor); push(@scndsub,$item); } } @@ -823,6 +824,7 @@ sub innerregister { $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'}); + $perms{'cev'} = &Apache::lonnet::allowed('cev',$env{'request.course.id'}); my @privs; if ($env{'request.symb'} ne '') { if ($env{'request.filename'}=~/$LONCAPA::assess_re/) { @@ -864,7 +866,7 @@ sub innerregister { # # This applies to items inside a folder/page modifiable in the course. # - if (($env{'request.symb'}=~/^uploaded/) && ($perms{'mdc'})) { + if (($env{'request.symb'}=~/^uploaded/) && (($perms{'mdc'}) || ($perms{'cev'}))) { my $text = 'Edit Folder'; if (($mapurl =~ /\.page$/) || ($env{'request.symb'}=~ @@ -1401,9 +1403,9 @@ sub get_editbutton { my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_; my $jscall; if (($forceview) && ($env{'form.todocs'})) { - my ($folderpath,$command); + my ($folderpath,$command,$navmap); if ($env{'request.symb'}) { - $folderpath = &Apache::loncommon::symb_to_docspath($env{'request.symb'}); + $folderpath = &Apache::loncommon::symb_to_docspath($env{'request.symb'},\$navmap); } elsif ($env{'form.folderpath'} =~ /^supplemental/) { $folderpath = $env{'form.folderpath'}; $command = '&forcesupplement=1';