Diff for /loncom/interface/lonmenu.pm between versions 1.541 and 1.549

version 1.541, 2023/11/03 01:12:15 version 1.549, 2024/04/19 03:48:22
Line 245  sub prep_menuitem { Line 245  sub prep_menuitem {
 # @primary_menu is filled within the BEGIN block of this module with   # @primary_menu is filled within the BEGIN block of this module with 
 # entries from mydesk.tab  # entries from mydesk.tab
 sub primary_menu {  sub primary_menu {
     my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target) = @_;      my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target,$collapsible) = @_;
     my (%menu,%ltiexc,%menuopts);      my (%menu,%ltiexc,%menuopts);
     # each element of @primary contains following array:      # each element of @primary contains following array:
     # (link url, icon path, alt text, link text, condition, position)      # (link url, icon path, alt text, link text, condition, position)
Line 366  sub primary_menu { Line 366  sub primary_menu {
                              ($item->[2] eq 'blog')) &&                               ($item->[2] eq 'blog')) &&
                              (!&Apache::lonnet::usertools_access('','',$item->[2],                               (!&Apache::lonnet::usertools_access('','',$item->[2],
                                                            undef,'tools')));                                                             undef,'tools')));
                       if (($item->[2] eq 'browsepub') && ($item->[0] eq '/res/')) {
                           if ($env{'request.role'} =~ /^au\./) {
                               $item->[0] .= $env{'request.role.domain'}.'/?launch=1';
                           } elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) {
                               $item->[0] .= $1.'/'.$2.'/?launch=1';
                           } elsif (&Apache::lonnet::allowed('bre',$env{'user.domain'})) {
                               $item->[0] .= $env{'user.domain'}.'/?launch=1';
                           } elsif (&Apache::lonnet::allowed('bro','/res/')) {
                               $item->[0] .= '?launch=1';
                           } else {
                               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 421  sub primary_menu { Line 434  sub primary_menu {
     }      }
     my @output = ('','');      my @output = ('','');
     if ($menu{'left'} ne '') {      if ($menu{'left'} ne '') {
           if ($collapsible) {
               $menu{'left'} = ($listclass?'<li class="'.$listclass.'">':'<li>').
                               '&nbsp;</li>'.$menu{'left'};
           }
         $output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>";          $output[0] = "<ol class=\"LC_primary_menu LC_floatleft\">$menu{'left'}</ol>";
     }      }
     if ($menu{'right'} ne '') {      if ($menu{'right'} ne '') {
Line 894  sub innerregister { Line 911  sub innerregister {
         $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 $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 1282  s&7&4&rename.png&Rename&resource[_5]&goc Line 1300  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 1495  ENDMENUITEMS Line 1546  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 1504  ENDMENUITEMS Line 1560  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 1688  sub prepare_functions { Line 1750  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 2746  function gocstr(url,filename) { Line 2815  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.541  
changed lines
  Added in v.1.549


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