Diff for /loncom/interface/lonmenu.pm between versions 1.369.2.72 and 1.369.2.74

version 1.369.2.72, 2018/09/03 14:30:16 version 1.369.2.74, 2019/02/22 01:57:36
Line 499  sub secondary_menu { Line 499  sub secondary_menu {
                         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 'crsedit' && !$canedit && !$canvieweditor);                          next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor);
                           next if ($item->[2] eq 'params' && !$canmodpara && !$canviewpara);
                         next if ($item->[2] eq 'author' && !$author);                          next if ($item->[2] eq 'author' && !$author);
                         next if ($item->[2] eq 'cca' && !$canmodifycoauthor);                          next if ($item->[2] eq 'cca' && !$canmodifycoauthor);
                         push(@scndsub,$item);                           push(@scndsub,$item); 
Line 1486  sub prepare_functions { Line 1487  sub prepare_functions {
     }      }
   
     my $editbutton = '';      my $editbutton = '';
       my $viewsrcbutton = '';
 #  #
 # Determine whether or not to display 'Edit' icon/button  # Determine whether or not to display 'Edit' or 'View Source' icon/button
 #  #
     if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {      if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {
         my $file=&Apache::lonnet::declutter($env{'request.filename'});          my $file=&Apache::lonnet::declutter($env{'request.filename'});
Line 1561  sub prepare_functions { Line 1563  sub prepare_functions {
                     $editbutton = &get_editbutton($cfile,$home,$switchserver,                      $editbutton = &get_editbutton($cfile,$home,$switchserver,
                                                   $forceedit,$forceview,$forcereg);                                                    $forceedit,$forceview,$forcereg);
                 }                  }
                   if ((($cfile eq '') || (!$editbutton)) &&
                       ($resurl =~ /$LONCAPA::assess_re/)) {
                       my $showurl = &Apache::lonnet::clutter($resurl);
                       if ((&Apache::lonnet::allowed('cre','/')) &&
                           (&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open')) {
                           $viewsrcbutton = 1;
                       } elsif (&Apache::lonnet::allowed('vxc',$env{'request.course.id'})) {
                           if ($showurl =~ m{^\Q/res/$cdom/\E($match_username)/}) {
                               my $auname = $1;
                               if (($env{'request.course.adhocsrcaccess'} ne '') &&
                                   (grep(/^\Q$auname\E$/,split(/,/,$env{'request.course.adhocsrcaccess'})))) {
                                   $viewsrcbutton = 1;
                               } elsif ((&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open') &&
                                        (&Apache::lonnet::allowed('bre','/'))) {
                                   $viewsrcbutton = 1;
                               }
                           }
                       }
                       if ($viewsrcbutton) {
                           &switch('','',6,1,'pcstr.png','View Source','resource[_2]','open_source()',
                                   'View source code');
                       }
                   }
             }              }
         }          }
     }      }

Removed from v.1.369.2.72  
changed lines
  Added in v.1.369.2.74


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