Diff for /loncom/interface/lonmenu.pm between versions 1.531 and 1.535

version 1.531, 2023/04/11 21:54:09 version 1.535, 2023/07/15 03:34:40
Line 210  use Apache::lonenc(); Line 210  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonmsg();  use Apache::lonmsg();
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use LONCAPA::ltiutils;  
 use HTML::Entities();  use HTML::Entities();
 use Apache::lonwishlist();  use Apache::lonwishlist();
   
Line 1131  END Line 1130  END
 # End course context  # End course context
   
 # Prepare the rest of the buttons  # Prepare the rest of the buttons
         my ($menuitems,$got_prt,$got_wishlist);          my ($menuitems,$got_prt,$got_wishlist,$crsauthor);
         if ($const_space) {          if ($const_space) {
 #  #
 # We are in construction space  # We are in construction space
Line 1140  END Line 1139  END
             my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};              my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
     my ($udom,$uname,$thisdisfn) =      my ($udom,$uname,$thisdisfn) =
  ($env{'request.filename'}=~m{^\Q$londocroot/priv/\E([^/]+)/([^/]+)/(.*)$});   ($env{'request.filename'}=~m{^\Q$londocroot/priv/\E([^/]+)/([^/]+)/(.*)$});
               my $crsauthor;
               if (($env{'request.course.id'}) &&
                   ($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&
                   ($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {
                   $crsauthor = 1;
               }
             my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;              my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;
             if ($currdir =~ m-/$-) {              if ($currdir =~ m-/$-) {
                 $is_const_dir = 1;                  $is_const_dir = 1;
                 if ($thisdisfn eq '') {                  if (($thisdisfn eq '') && ($crsauthor)) {
                     unless (($env{'request.course.id'}) &&                       $is_const_dir = 2;
                             ($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&  
                             ($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {   
                         $is_const_dir = 2;  
                     }  
                 }                  }
                   my $esc_currdir = &Apache::loncommon::escape_single($currdir);
                   $menuitems=(<<ENDMENUITEMS);
   s&6&3&pub.png&Publish&dir[_2]&gocstr('/adm/publish','$esc_currdir')&Publish this Directory
   s&7&4&docs-22x22.png&Edit Metadata&defaults[_1]&gopost('${esc_currdir}default.meta','')&Edit metadata for this Directory
   s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','$esc_currdir')&Print contents of directory
   s&7&1&del.png&Delete&dir[_3]&gocstr('/adm/cfile?action=delete','$esc_currdir')&Delete this Directory
   ENDMENUITEMS
             } else {              } else {
                 $currdir =~ s|[^/]+$||;                  $currdir =~ s|[^/]+$||;
  my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);   my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
Line 1164  END Line 1172  END
 #  #
 # Probably should be in mydesk.tab  # Probably should be in mydesk.tab
 #  #
                 $menuitems=(<<ENDMENUITEMS);                  if (($crsauthor) && ($pubfile eq "/res/$udom/$uname/default.rights")) {
                       $menuitems=(<<ENDMENUITEMS);
   s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory
   s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource
   ENDMENUITEMS
                   } else {
                       $menuitems=(<<ENDMENUITEMS);
 s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory  s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory
 s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version  s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version
 s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource  s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource
 s&7&3&copy.png&Copy&resource[_4]&gocstr('/adm/cfile?action=copy','/priv/$udom/$uname/$cleandisfn')&Copy this resource  s&7&3&copy.png&Copy&resource[_4]&gocstr('/adm/cfile?action=copy','/priv/$udom/$uname/$cleandisfn')&Copy this resource
 ENDMENUITEMS  ENDMENUITEMS
                   }
 #  #
 # Rename and Delete only available if obsolete or unpublished  # Rename and Delete only available if obsolete or unpublished
 #  #
Line 1255  ENDMENUITEMS Line 1270  ENDMENUITEMS
             $got_prt = 1;              $got_prt = 1;
             if (($env{'user.adv'}) && ($env{'request.uri'} =~ /^\/res/)              if (($env{'user.adv'}) && ($env{'request.uri'} =~ /^\/res/)
                 && (!$env{'request.enc'})) {                  && (!$env{'request.enc'})) {
                 my ($cnum,$cdom) = &Apache::loncommon::crsauthor_url($env{'request.uri'});                  my $privurl = $env{'request.uri'};
                 unless ($cnum) {                  $privurl =~ s{^/res/}{/priv/};
                   my ($cnum,$cdom) = &Apache::loncommon::crsauthor_url($privurl);
                   if ($cnum) {
                       $crsauthor = 1;
                   } else {
                     # wishlist is only available for users with access to resource-pool                      # wishlist is only available for users with access to resource-pool
                     # and links can only be set for resources within the resource-pool                      # and links can only be set for resources within the resource-pool
                     $menuitems .= (<<ENDMENUITEMS);                      $menuitems .= (<<ENDMENUITEMS);
Line 1311  s&8&3&prt.png&Print&printout[_1]&gopost( Line 1330  s&8&3&prt.png&Print&printout[_1]&gopost(
 ENDMENUITEMS  ENDMENUITEMS
                 $got_prt = 1;                  $got_prt = 1;
             }              }
             unless ($got_wishlist) {              unless (($got_wishlist) || ($crsauthor)) {
                 if (($env{'user.adv'}) && (!$env{'request.enc'})) {                  if (($env{'user.adv'}) && (!$env{'request.enc'})) {
                     # wishlist is only available for users with access to resource-pool                      # wishlist is only available for users with access to resource-pool
                     $menuitems .= (<<ENDMENUITEMS);                      $menuitems .= (<<ENDMENUITEMS);

Removed from v.1.531  
changed lines
  Added in v.1.535


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