Diff for /loncom/interface/lonmenu.pm between versions 1.457 and 1.464

version 1.457, 2016/10/27 21:06:13 version 1.464, 2016/12/01 16:37:53
Line 381  sub secondary_menu { Line 381  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 400  sub secondary_menu { Line 401  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'};
         if ($canedit) {          if ($canedit || $canvieweditor)  {
             $showsyllabus = 1;              $showsyllabus = 1;
             $showfeeds = 1;              $showfeeds = 1;
         } else {          } else {
Line 416  sub secondary_menu { Line 417  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 452  sub secondary_menu { Line 453  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 'nvgr'          next if    $$menuitem[4]  eq 'nvgr'
                 && $canvgr;                  && $canvgr;
         next if    $$menuitem[4]  eq 'vgr'          next if    $$menuitem[4]  eq 'vgr'
Line 624  sub build_submenu { Line 625  sub build_submenu {
 }  }
   
 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 746  sub innerregister { Line 747  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 785  sub innerregister { Line 787  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 969  ENDMENUITEMS Line 971  ENDMENUITEMS
  foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }   foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
   
     if ($addremote) {      if ($addremote) {
         my $countdown;          my ($countdown,$buttonshide);
         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();
         }          }
         &Apache::lonhtmlcommon::clear_breadcrumb_tools();          &Apache::lonhtmlcommon::clear_breadcrumb_tools();
   
             &Apache::lonhtmlcommon::add_breadcrumb_tool(              &Apache::lonhtmlcommon::add_breadcrumb_tool(
                 'navigation', @inlineremote[21,23]);                  'navigation', @inlineremote[21,23]);
   
         if (&hidden_button_check() eq 'yes') {          if ($buttonshide eq 'yes') {
             if ($countdown) {              if ($countdown) {
                 &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);                  &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown);
             }              }
Line 1032  sub get_editbutton { Line 1036  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 1042  sub get_editbutton { Line 1046  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 1203  sub prepare_functions { Line 1212  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');                          'Folder/Page Content');
             }              }
         }          }
Line 2230  sub roles_selector { Line 2243  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 2540  sub required_privs { Line 2559  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.457  
changed lines
  Added in v.1.464


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