Diff for /loncom/interface/lonmenu.pm between versions 1.543 and 1.551

version 1.543, 2023/12/13 22:12:16 version 1.551, 2024/05/01 22:08:11
Line 378  sub primary_menu { Line 378  sub primary_menu {
                         } else {                          } else {
                             next;                              next;
                         }                          }
                       }
                     if ($env{'request.course.id'} && $menucoll) {                      if ($env{'request.course.id'} && $menucoll) {
                         next if ($item->[3]) && (!$menuopts{$item->[3]});                          next if ($item->[3]) && (!$menuopts{$item->[3]});
                     }                      }
Line 909  sub innerregister { Line 910  sub innerregister {
     my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname,      my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname,
         $ltiscope,$ltiuri,$showncrumbsref) = @_;          $ltiscope,$ltiuri,$showncrumbsref) = @_;
     my $const_space = ($env{'request.state'} eq 'construct');      my $const_space = ($env{'request.state'} eq 'construct');
     my $is_const_dir = 0;      my $in_daxe = 0;
   
     if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }      if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
   
Line 1234  END Line 1235  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,$crsauthor);      my ($menuitems,$got_prt,$got_wishlist,$crsauthor,$toplevel_cstr,$crsauthor_cstr);
         if ($const_space) {      if ($const_space) {
 #  #
 # We are in construction space  # We are in construction space
 #  #
Line 1243  END Line 1244  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'}) &&              if (($env{'request.course.id'}) &&
                 ($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&                  ($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&
                 ($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {                  ($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {
                 $crsauthor = 1;                  $crsauthor_cstr = 1;
             }              }
             my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;              my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;
             if ($currdir =~ m-/$-) {              if ($currdir =~ m-/$-) {
                 $is_const_dir = 1;                  if ($thisdisfn eq '') {
                 if (($thisdisfn eq '') && ($crsauthor)) {                      $toplevel_cstr = 1;
                     $is_const_dir = 2;  
                 }                  }
                 my $esc_currdir = &Apache::loncommon::escape_single($currdir);                  my $esc_currdir = &Apache::loncommon::escape_single($currdir);
                 $menuitems=(<<ENDMENUITEMS);                  $menuitems=(<<ENDMENUITEMS);
Line 1276  ENDMENUITEMS Line 1275  ENDMENUITEMS
 #  #
 # Probably should be in mydesk.tab  # Probably should be in mydesk.tab
 #  #
                 if (($crsauthor) && ($pubfile eq "/res/$udom/$uname/default.rights")) {                  if (($crsauthor_cstr) && ($pubfile eq "/res/$udom/$uname/default.rights")) {
                     $menuitems=(<<ENDMENUITEMS);                      $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&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
Line 1298  s&7&4&rename.png&Rename&resource[_5]&goc Line 1297  s&7&4&rename.png&Rename&resource[_5]&goc
 s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource  s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource
 ENDMENUITEMS  ENDMENUITEMS
                 }                  }
                 $menuitems .= (<<ENDMENUITEMS);  #
   # Print only makes sense for certain mime types
   #
                   if ($thisdisfn=~/\.(xml|html|htm|xhtml|xhtm|tex)$/ || $thisdisfn=~/$LONCAPA::assess_re/) {
                       $menuitems .= (<<ENDMENUITEMS);
 s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','/priv/$udom/$uname/$cleandisfn')&Prepare a printable document  s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','/priv/$udom/$uname/$cleandisfn')&Prepare a printable document
 ENDMENUITEMS  ENDMENUITEMS
                   }
   #
   # "Exit Daxe" in Functions menu when using Daxe
   #
                   if ((($env{'form.editmode'} eq 'daxe') &&
                        ($thisdisfn=~/\.(xml|html|htm|xhtml|xhtm)$/)) ||
                       (($env{'form.problemmode'} eq 'daxe') &&
                        ($thisdisfn=~/$LONCAPA::assess_re/))) {
                       my %editors = &Apache::loncommon::permitted_editors();
                       if ($editors{'daxe'}) {
                           my $privfile = &Apache::loncommon::escape_single("/priv/$udom/$uname/$thisdisfn");
                           $in_daxe = 1;
                           $menuitems .= (<<ENDMENUITEMS);
   my $privfile = &Apache::loncommon::escape_single("/priv/$udom/$uname/$thisdisfn");
   s&7&6&tolastloc.png&Exit Daxe&resource[_1]&go('$privfile')&Exit editing this resource
   ENDMENUITEMS
                       }
                   }
               }
   #
   # Editing options usually accessed via "Settings" in inline menu need to be
   # accessed in a different way, when Authoring Space is accessed in course
   # context
   #
               if ($env{'request.role'} !~/^(aa|ca|au)/) {
                   my $privfile = &Apache::loncommon::escape_single("/priv/$udom/$uname/$thisdisfn");
                   $menuitems .= (<<ENDMENUITEMS);
   s&7&5&editops.png&Options&edit[_1]&gocstr('/adm/preferences?action=authorsettings','$privfile')&Authoring Space Options
   ENDMENUITEMS
             }              }
                 if (ref($bread_crumbs) eq 'ARRAY') {                  if (ref($bread_crumbs) eq 'ARRAY') {
                     &Apache::lonhtmlcommon::clear_breadcrumbs();                      &Apache::lonhtmlcommon::clear_breadcrumbs();
Line 1511  ENDMENUITEMS Line 1543  ENDMENUITEMS
             &Apache::lonhtmlcommon::add_breadcrumb_tool(              &Apache::lonhtmlcommon::add_breadcrumb_tool(
                 'tools',@tools);                  'tools',@tools);
   
               #exit editing link/icon when using daxe in construction space 
             #publish button in construction space              #publish button in construction space
             if ($env{'request.state'} eq 'construct'){              if ($env{'request.state'} eq 'construct'){
                   if ($in_daxe) {
                       &Apache::lonhtmlcommon::add_breadcrumb_tool(
                            'advtools', $inlineremote[76]);
                   }
                 &Apache::lonhtmlcommon::add_breadcrumb_tool(                  &Apache::lonhtmlcommon::add_breadcrumb_tool(
                      'advtools', $inlineremote[63]);                       'advtools', $inlineremote[63]);
             } else {              } else {
Line 1520  ENDMENUITEMS Line 1557  ENDMENUITEMS
                      'tools', $inlineremote[63]);                       'tools', $inlineremote[63]);
             }              }
             &advtools_crumbs(@inlineremote);              &advtools_crumbs(@inlineremote);
               #options link/icon in constructions space viewed with course role
               if (($env{'request.state'} eq 'construct') &&
                   ($env{'request.role'} !~/^(aa|ca|au)/)) {
                   &Apache::lonhtmlcommon::add_breadcrumb_tool(
                            'advtools', $inlineremote[75]);
               }
         }          }
     } else {      } else {
         if ($showprogress) {          if ($showprogress) {
Line 1530  ENDMENUITEMS Line 1573  ENDMENUITEMS
         }          }
     }      }
     my ($topic_help,$topic_help_text);      my ($topic_help,$topic_help_text);
     if ($is_const_dir == 2) {      if ($toplevel_cstr && !$crsauthor_cstr) {
         if ((($ENV{'SERVER_PORT'} == 443) ||           if ((($ENV{'SERVER_PORT'} == 443) || 
              ($Apache::lonnet::protocol{$Apache::lonnet::perlvar{'lonHostID'}} eq 'https')) &&                ($Apache::lonnet::protocol{$Apache::lonnet::perlvar{'lonHostID'}} eq 'https')) && 
             (&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},'webdav'))) {              (&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},'webdav'))) {
Line 1704  sub prepare_functions { Line 1747  sub prepare_functions {
         } elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) &&          } elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) &&
                  ($resurl ne '/cgi-bin/printout.pl')) {                   ($resurl ne '/cgi-bin/printout.pl')) {
             if ($env{'request.filename'}) {              if ($env{'request.filename'}) {
                 my $file=&Apache::lonnet::declutter($env{'request.filename'});                  my $file;
                   my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
                   if ($env{'request.filename'} =~ m{^\Q$londocroot\E/priv/}) {
                       $file = $env{'request.filename'};
                       $file =~ s{^\Q$londocroot\E/}{};
                   } else {
                       $file=&Apache::lonnet::declutter($env{'request.filename'});
                   }
                 ($cfile,$home,$switchserver,$forceedit,$forceview) =                  ($cfile,$home,$switchserver,$forceedit,$forceview) =
                     &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,                      &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
                         &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);                          &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
Line 2762  function gocstr(url,filename) { Line 2812  function gocstr(url,filename) {
         this.document.cstrprint.submit();          this.document.cstrprint.submit();
         return;          return;
     }      }
       if (url == '/adm/preferences?action=authorsettings') {
           document.location.href=url+'&returnurl='+filename;
           return;
       }
     if (url !='') {      if (url !='') {
         this.document.constspace.filename.value = filename;          this.document.constspace.filename.value = filename;
         this.document.constspace.action = url;          this.document.constspace.action = url;

Removed from v.1.543  
changed lines
  Added in v.1.551


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