Diff for /loncom/interface/lonmenu.pm between versions 1.369.2.61 and 1.369.2.67

version 1.369.2.61, 2016/10/27 21:46:38 version 1.369.2.67, 2016/12/01 16:53:15
Line 384  sub secondary_menu { Line 384  sub secondary_menu {
                                                ? "/$env{'request.course.sec'}"                                                 ? "/$env{'request.course.sec'}"
                                                : '');                                                 : '');
     my $canedit       = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});      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'};      my $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'};
     if ($canviewroster eq 'disabled') {      if ($canviewroster eq 'disabled') {
         undef($canviewroster);          undef($canviewroster);
Line 402  sub secondary_menu { Line 403  sub secondary_menu {
     if ($env{'request.course.id'}) {      if ($env{'request.course.id'}) {
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};          $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};          $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
         unless ($canedit) {          unless ($canedit || $canvieweditor) {
             unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) {              unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) {
                 if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) ||                  if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) ||
                     ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) ||                      ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) ||
Line 415  sub secondary_menu { Line 416  sub secondary_menu {
                 $showfeeds = 1;                  $showfeeds = 1;
             }              }
         }          }
         unless (($canmgr) || ($canvgr)) {          unless ($canmgr || $canvgr) {
             my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom);              my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom);
             if (keys(%slots) > 0) {              if (keys(%slots) > 0) {
                 $showresv = 1;                  $showresv = 1;
Line 445  sub secondary_menu { Line 446  sub secondary_menu {
         next if    $$menuitem[4]   ne 'always'          next if    $$menuitem[4]   ne 'always'
                 && ($$menuitem[4]  ne 'author' && $$menuitem[4] ne 'cca')                  && ($$menuitem[4]  ne 'author' && $$menuitem[4] ne 'cca')
                 && !$env{'request.course.id'};                  && !$env{'request.course.id'};
         next if    $$menuitem[4]   =~ /^mdc/          next if    $$menuitem[4]   =~ /^crsedit/
                 && !$canedit;                  && (!$canedit && !$canvieweditor);
         next if    $$menuitem[4]  eq 'mdcCourse'          next if    $$menuitem[4]  eq 'crseditCourse'
                 && ($crstype eq 'Community');                  && ($crstype eq 'Community');
         next if    $$menuitem[4]  eq 'mdcCommunity'          next if    $$menuitem[4]  eq 'crseditCommunity'
                 && ($crstype eq 'Course');                  && ($crstype eq 'Course');
         next if    $$menuitem[4]  eq 'nvgr'          next if    $$menuitem[4]  eq 'nvgr'
                 && $canvgr;                  && $canvgr;
Line 497  sub secondary_menu { Line 498  sub secondary_menu {
                         next if ($item->[2] eq 'viewusers' && !($canmodifyuser || $canviewusers));                          next if ($item->[2] eq 'viewusers' && !($canmodifyuser || $canviewusers));
                         next if ($item->[2] eq 'mgr' && !$canmgr);                          next if ($item->[2] eq 'mgr' && !$canmgr);
                         next if ($item->[2] eq 'vcg' && !$canviewgrps);                          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);                           push(@scndsub,$item); 
                     }                      }
                 }                  }
Line 677  sub registerurl { Line 678  sub registerurl {
 }  }
   
 sub innerregister {  sub innerregister {
     my ($forcereg,$bread_crumbs,$group) = @_;      my ($forcereg,$bread_crumbs,$group,$pagebuttonshide) = @_;
     my $const_space = ($env{'request.state'} eq 'construct');      my $const_space = ($env{'request.state'} eq 'construct');
     my $is_const_dir = 0;      my $is_const_dir = 0;
   
Line 823  sub innerregister { Line 824  sub innerregister {
             $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};              $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
             $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};              $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
             $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});              $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
               $perms{'cev'} = &Apache::lonnet::allowed('cev',$env{'request.course.id'});
             my @privs;              my @privs;
             if ($env{'request.symb'} ne '') {              if ($env{'request.symb'} ne '') {
                 if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {                  if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {
Line 864  sub innerregister { Line 866  sub innerregister {
 #  #
 # This applies to items inside a folder/page modifiable in the course.  # 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';                  my $text = 'Edit Folder';
                 if (($mapurl =~ /\.page$/) ||                  if (($mapurl =~ /\.page$/) ||
                     ($env{'request.symb'}=~                      ($env{'request.symb'}=~
Line 1031  ENDMENUITEMS Line 1033  ENDMENUITEMS
     my $addremote=0;      my $addremote=0;
     foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }      foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
             if ($addremote) {              if ($addremote) {
                   my ($countdown,$buttonshide);
                 &Apache::lonhtmlcommon::clear_breadcrumb_tools();  
   
                 &Apache::lonhtmlcommon::add_breadcrumb_tool(  
                     'navigation', @inlineremote[21,23]);  
   
                 my $countdown;  
                 if ($env{'request.filename'} =~ /\.page$/) {                  if ($env{'request.filename'} =~ /\.page$/) {
                     my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();                      my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
                     if (ref($breadcrumb_tools{'tools'}) eq 'ARRAY') {                      if (ref($breadcrumb_tools{'tools'}) eq 'ARRAY') {
                         $countdown = $breadcrumb_tools{'tools'}[0];                          $countdown = $breadcrumb_tools{'tools'}->[0];
                     }                      }
                       $buttonshide = $pagebuttonshide;
                 } else {                  } else {
                     $countdown = &countdown_timer();                      $countdown = &countdown_timer();
                       $buttonshide = &hidden_button_check();
                 }                  }
                 if (&hidden_button_check() eq 'yes') {  
                   &Apache::lonhtmlcommon::clear_breadcrumb_tools();
   
                   &Apache::lonhtmlcommon::add_breadcrumb_tool(
                       'navigation', @inlineremote[21,23]);
   
                   if ($buttonshide eq 'yes') {
                     if ($countdown) {                      if ($countdown) {
                         &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);                          &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
                     }                      }
Line 1399  sub get_editbutton { Line 1403  sub get_editbutton {
     my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_;      my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_;
     my $jscall;      my $jscall;
     if (($forceview) && ($env{'form.todocs'})) {      if (($forceview) && ($env{'form.todocs'})) {
         my ($folderpath,$command);          my ($folderpath,$command,$navmap);
         if ($env{'request.symb'}) {          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/) {          } elsif ($env{'form.folderpath'} =~ /^supplemental/) {
             $folderpath = $env{'form.folderpath'};              $folderpath = $env{'form.folderpath'};
             $command = '&forcesupplement=1';              $command = '&forcesupplement=1';
Line 1409  sub get_editbutton { Line 1413  sub get_editbutton {
         $folderpath = &escape(&HTML::Entities::encode(&escape($folderpath),'<>&"'));          $folderpath = &escape(&HTML::Entities::encode(&escape($folderpath),'<>&"'));
         $jscall = "go('/adm/coursedocs?folderpath=$folderpath$command')";          $jscall = "go('/adm/coursedocs?folderpath=$folderpath$command')";
     } else {      } else {
           my $suppanchor;
           if ($env{'form.folderpath'}) {
               $suppanchor = $env{'form.anchor'};
           }
         $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,          $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
                                                 $forceedit,$forcereg,$env{'request.symb'},                                                  $forceedit,$forcereg,$env{'request.symb'},
                                                 &escape($env{'form.folderpath'}),                                                  &escape($env{'form.folderpath'}),
                                                 &escape($env{'form.title'}),$env{'form.idx'},                                                  &escape($env{'form.title'}),$env{'form.idx'},
                                                 &escape($env{'form.suppurl'},$env{'form.todocs'}));                                                  &escape($env{'form.suppurl'}),$env{'form.todocs'},
                                                   $suppanchor);
     }      }
     if ($jscall) {      if ($jscall) {
         my $icon = 'pcstr.png';          my $icon = 'pcstr.png';
Line 1585  sub prepare_functions { Line 1594  sub prepare_functions {
              ($resurl =~ m{^/adm/$match_domain/$match_username/aboutme$}))) {               ($resurl =~ m{^/adm/$match_domain/$match_username/aboutme$}))) {
             my @folders=split('&',$env{'form.folderpath'});              my @folders=split('&',$env{'form.folderpath'});
             if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {              if ((@folders > 2) || ($resurl ne '/adm/supplemental')) {
                   my $suppanchor;
                   if ($resurl =~ m{^/adm/wrapper/ext/}) {
                       $suppanchor = $env{'form.anchor'};
                   }
                 my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));                  my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));
                 &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',                  &switch('','',7,4,'docs-22x22.png','Edit Folder','parms[_2]',
                         "location.href='/adm/coursedocs?command=direct&amp;forcesupplement=1&amp;supppath=$esc_path'",                          "location.href='/adm/coursedocs?command=direct&amp;forcesupplement=1&amp;supppath=$esc_path&amp;anchor=$suppanchor'",
                         'Folder/Page Content','','',1);                          'Folder/Page Content','','',1);
             }              }
         }          }
Line 2491  sub roles_selector { Line 2504  sub roles_selector {
                     $include = 1;                      $include = 1;
                 }                  }
                 if ($include) {                  if ($include) {
                       my $rolename;
                       if ($role =~ m{^cr/$cdom/$cdom\-domainconfig/(\w+)(?:/\w+|$)}) {
                           $rolename = &mt('Helpdesk [_1]',$1);
                       } else {
                           $rolename = &Apache::lonnet::plaintext($role);
                       }
                     push(@submenu,['javascript:adhocRole('."'$role'".')',                      push(@submenu,['javascript:adhocRole('."'$role'".')',
                                    &Apache::lonnet::plaintext($role)]);                                     $rolename]);
                 }                  }
             }              }
         }          }
Line 2802  sub required_privs { Line 2821  sub required_privs {
              '/adm/parmset'      => 'opa,vpa',               '/adm/parmset'      => 'opa,vpa',
              '/adm/courseprefs'  => 'opa,vpa',               '/adm/courseprefs'  => 'opa,vpa',
              '/adm/whatsnew'     => 'whn',               '/adm/whatsnew'     => 'whn',
              '/adm/populate'     => 'cst',               '/adm/populate'     => 'cst,vpa,vcl',
              '/adm/trackstudent' => 'vsa',               '/adm/trackstudent' => 'vsa',
              '/adm/statistics'   => 'mgr,vgr',               '/adm/statistics'   => 'mgr,vgr',
              '/adm/setblock'     => 'dcm,vcb',               '/adm/setblock'     => 'dcm,vcb',

Removed from v.1.369.2.61  
changed lines
  Added in v.1.369.2.67


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>