Diff for /loncom/interface/lonmenu.pm between versions 1.546 and 1.553

version 1.546, 2024/01/01 01:22:24 version 1.553, 2024/05/14 15:53:17
Line 910  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 1235  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 1244  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 1263  s&7&4&docs-22x22.png&Edit Metadata&defau Line 1261  s&7&4&docs-22x22.png&Edit Metadata&defau
 s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','$esc_currdir')&Print contents of 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  s&7&1&del.png&Delete&dir[_3]&gocstr('/adm/cfile?action=delete','$esc_currdir')&Delete this Directory
 ENDMENUITEMS  ENDMENUITEMS
                   unless ($crsauthor_cstr) {
                       if ($env{'environment.authorarchive'}) {
                           $menuitems .= (<<ENDMENUITEMS);
   s&7&7&archive.png&Export&dir[_1]&gocstr('/adm/cfile?action=archive','$esc_currdir')&Export Authoring Space Archive
   ENDMENUITEMS
                       }
                   }
             } else {              } else {
                 $currdir =~ s|[^/]+$||;                  $currdir =~ s|[^/]+$||;
  my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);   my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
Line 1277  ENDMENUITEMS Line 1282  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 1307  ENDMENUITEMS Line 1312  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 1517  ENDMENUITEMS Line 1550  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 1526  ENDMENUITEMS Line 1564  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 1536  ENDMENUITEMS Line 1580  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 1710  sub prepare_functions { Line 1754  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 1852  sub advtools_crumbs { Line 1903  sub advtools_crumbs {
     } elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {      } elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
         if ($env{'request.state'} eq 'construct') {          if ($env{'request.state'} eq 'construct') {
             &Apache::lonhtmlcommon::add_breadcrumb_tool(              &Apache::lonhtmlcommon::add_breadcrumb_tool(
                 'advtools', @funcs[61,73,74,71,72]);                  'advtools', @funcs[61,73,74,71,72,77]);
         } else {          } else {
             &Apache::lonhtmlcommon::add_breadcrumb_tool(              &Apache::lonhtmlcommon::add_breadcrumb_tool(
                 'advtools', @funcs[61,71,72,73,74,75,92]);                  'advtools', @funcs[61,71,72,73,74,75,92]);
Line 2768  function gocstr(url,filename) { Line 2819  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.546  
changed lines
  Added in v.1.553


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