Diff for /loncom/interface/lonmenu.pm between versions 1.491 and 1.503

version 1.491, 2018/05/08 20:30:12 version 1.503, 2020/10/06 21:28:33
Line 448  sub secondary_menu { Line 448  sub secondary_menu {
                 $showresv = 1;                  $showresv = 1;
             }              }
         }          }
         my %groups = &Apache::lonnet::get_active_groups(          if ($env{'request.course.groups'} ne '') {
                      $env{'user.domain'}, $env{'user.name'},$cdom,$cnum);              foreach my $group (split(/:/,$env{'request.course.groups'})) {
         if (%groups) {                  next unless ($group =~ /^\w+$/);
             foreach my $group (keys(%groups)) {  
                 my @privs = split(/:/,$env{"user.priv.$env{'request.role'}./$cdom/$cnum/$group"});                  my @privs = split(/:/,$env{"user.priv.$env{'request.role'}./$cdom/$cnum/$group"});
                 shift(@privs);                  shift(@privs);
                 if (@privs) {                  if (@privs) {
Line 605  sub secondary_menu { Line 604  sub secondary_menu {
                 }                  }
                 if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://}) {                  if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://}) {
                     if (($ENV{'SERVER_PORT'} == 443) || ($env{'request.use_absolute'} =~ m{^https://})) {                      if (($ENV{'SERVER_PORT'} == 443) || ($env{'request.use_absolute'} =~ m{^https://})) {
                         unless ($$menuitem[0] =~ m{^https?://}) {                          unless (&Apache::lonnet::uses_sts()) {
                             $$menuitem[0] = 'http://'.$ENV{'SERVER_NAME'}.$$menuitem[0];                              unless ($$menuitem[0] =~ m{^https?://}) {
                         }                                  $$menuitem[0] = 'http://'.$ENV{'SERVER_NAME'}.$$menuitem[0];
                         unless ($$menuitem[0] =~ /(\&|\?)usehttp=1/) {                              }
                             $$menuitem[0] .= (($$menuitem[0]=~/\?/) ? '&' : '?').'usehttp=1';                              unless ($$menuitem[0] =~ /(\&|\?)usehttp=1/) {
                                   $$menuitem[0] .= (($$menuitem[0]=~/\?/) ? '&' : '?').'usehttp=1';
                               }
                         }                          }
                     }                      }
                 }                  }
Line 1097  if ($env{'browser.mobile'}) { Line 1098  if ($env{'browser.mobile'}) {
 }  }
   
             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {              unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
  if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/}) && ($env{'request.noversionuri'} !~ m{^/adm/.+/ext\.tool$})) {   if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) &&
                       ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/(docs/|default_\d+\.page$)}) &&
                       ($env{'request.noversionuri'} !~ m{^/adm/.+/ext\.tool$})) {
     $menuitems.=(<<ENDREALRES);      $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.png&Info&info[_1]&catalog_info('$is_mobile')&Show Metadata  s&6&3&catalog.png&Info&info[_1]&catalog_info(currentURL,'$is_mobile')&Show Metadata
 ENDREALRES  ENDREALRES
                 }                  }
                 unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/docs/}) ||                  unless (($env{'request.noversionuri'} =~ m{^/uploaded/$match_domain/$match_courseid/(docs/|default_\d+\.page$)}) ||
                         ($env{'request.noversionuri'} =~ m{^\Q/adm/wrapper/\E(ext|uploaded)/}) ||                          ($env{'request.noversionuri'} =~ m{^\Q/adm/wrapper/\E(ext|uploaded)/}) ||
                         ($env{'request.noversionuri'} =~ m{^/adm/.+/ext\.tool$})) {                          ($env{'request.noversionuri'} =~ m{^/adm/.+/ext\.tool$})) {
                     $menuitems.=(<<ENDREALRES);                      $menuitems.=(<<ENDREALRES);
Line 1364  sub prepare_functions { Line 1367  sub prepare_functions {
                 if ((($cfile eq '') || (!$editbutton)) &&                  if ((($cfile eq '') || (!$editbutton)) &&
                     ($resurl =~ /$LONCAPA::assess_re/)) {                      ($resurl =~ /$LONCAPA::assess_re/)) {
                     my $showurl = &Apache::lonnet::clutter($resurl);                      my $showurl = &Apache::lonnet::clutter($resurl);
                       my $crs_sec = $env{'request.course.id'} . (($env{'request.course.sec'} ne '')
                                                                 ? "/$env{'request.course.sec'}"
                                                                 : '');
                     if ((&Apache::lonnet::allowed('cre','/')) &&                      if ((&Apache::lonnet::allowed('cre','/')) &&
                         (&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open')) {                          (&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open')) {
                         $viewsrcbutton = 1;                          $viewsrcbutton = 1;
                     } elsif (&Apache::lonnet::allowed('vxc',$env{'request.course.id'})) {                      } elsif (&Apache::lonnet::allowed('vxc',$crs_sec)) {
                         if ($showurl =~ m{^\Q/res/$cdom/\E($match_username)/}) {                          if ($showurl =~ m{^\Q/res/$cdom/\E($match_username)/}) {
                             my $auname = $1;                              my $auname = $1;
                             if (($env{'request.course.adhocsrcaccess'} ne '') &&                              if (($env{'request.course.adhocsrcaccess'} ne '') &&
                                 (grep(/^\Q$auname\E$/,split(/,/,$env{'request.course.adhocsrcaccess'})))) {                                  (grep(/^\Q$auname\E$/,split(/,/,$env{'request.course.adhocsrcaccess'})))) {
                                 $viewsrcbutton = 1;                                  $viewsrcbutton = 1;
                             } elsif ((&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open') &&                              } elsif ((&Apache::lonnet::metadata($resurl,'sourceavail') eq 'open') &&
                                      (&Apache::lonnet::allowed('bre','/'))) {                                       (&Apache::lonnet::allowed('bre',$crs_sec))) {
                                 $viewsrcbutton = 1;                                  $viewsrcbutton = 1;
                             }                              }
                         }                          }
Line 1551  sub switch { Line 1557  sub switch {
         unless ($env{'request.state'} eq 'construct') {          unless ($env{'request.state'} eq 'construct') {
             push(@tools,63);              push(@tools,63);
         }          }
         if (($env{'environment.icons'} eq 'iconsonly') &&           if ((($env{'environment.icons'} eq 'iconsonly') ||
                ($env{'environment.icons'} eq '') && ($env{'request.lti.login'})) &&
             (grep(/^$idx$/,@tools))) {              (grep(/^$idx$/,@tools))) {
             $inlineremote[$idx] =              $inlineremote[$idx] =
         '<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.'</a>';          '<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.'</a>';
Line 1902  sub done_button_js { Line 1909  sub done_button_js {
                  key      => 'Key:',                   key      => 'Key:',
                  nokey    => 'A proctor key is required',                    nokey    => 'A proctor key is required', 
     );      );
       my $shownsymb = &HTML::Entities::encode(&Apache::lonenc::check_encrypt($env{'request.symb'}));
     my $navmap = Apache::lonnavmaps::navmap->new();       my $navmap = Apache::lonnavmaps::navmap->new(); 
     my ($missing,$tried) = (0,0);      my ($missing,$tried) = (0,0);
     if (ref($navmap)) {      if (ref($navmap)) {
         my @resources=();          my @resources=();
         if ($type eq 'map') {          if ($type eq 'map') {
             my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});              my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($env{'request.symb'});
             @resources=$navmap->retrieveResources($mapurl,sub { $_[0]->is_problem() });              if ($env{'request.symb'} =~ /\.page$/) {
                   @resources=$navmap->retrieveResources($resurl,sub { $_[0]->is_problem() });
               } else {
                   @resources=$navmap->retrieveResources($mapurl,sub { $_[0]->is_problem() });
               }
         } else {          } else {
             my $res = $navmap->getBySymb($env{'request.symb'});              my $res = $navmap->getBySymb($env{'request.symb'});
             if (ref($res)) {              if (ref($res)) {
Line 1960  sub done_button_js { Line 1972  sub done_button_js {
 <form method="post" name="LCdoneButton" action="">  <form method="post" name="LCdoneButton" action="">
     <input type="hidden" name="LC_interval_done" value="" />      <input type="hidden" name="LC_interval_done" value="" />
     <input type="hidden" name="LC_interval_done_proctorpass" value="" />      <input type="hidden" name="LC_interval_done_proctorpass" value="" />
       <input type="hidden" name="symb" value="$shownsymb" />
     <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>      <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>
 </form>  </form>
   
Line 2041  END Line 2054  END
   
 <form method="post" name="LCdoneButton" action="">  <form method="post" name="LCdoneButton" action="">
     <input type="hidden" name="LC_interval_done" value="" />      <input type="hidden" name="LC_interval_done" value="" />
       <input type="hidden" name="symb" value="$shownsymb" />
     <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>      <button id="LC_done-confirm-opener" type="button">$donebuttontext</button>
 </form>  </form>
   
Line 2086  END Line 2100  END
 sub utilityfunctions {  sub utilityfunctions {
     my ($httphost) = @_;      my ($httphost) = @_;
     my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));      my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
     if ($currenturl =~ m{^/adm/wrapper/ext/}      my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
         && $env{'request.external.querystring'} ) {      if ($currenturl =~ m{^/adm/wrapper/ext/}) {
           if ($env{'request.external.querystring'}) {
             $currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};              $currenturl .= ($currenturl=~/\?/)?'&':'?'.$env{'request.external.querystring'};
           }
           my ($anchor) = ($env{'request.symb'} =~ /(\#[^\#]+)$/);
           if (($anchor) && ($currenturl !~ /\Q$anchor\E$/)) {
               $currenturl .= $1;
           }
     }      }
     $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));      $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl));
       
     my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});  
   
     my $dc_popup_cid;      my $dc_popup_cid;
     if ($env{'user.adv'} && exists($env{'user.role.dc./'.      if ($env{'user.adv'} && exists($env{'user.role.dc./'.
Line 2124  sub utilityfunctions { Line 2142  sub utilityfunctions {
         $ltitarget = $env{'request.lti.target'};          $ltitarget = $env{'request.lti.target'};
     }      }
   
       my $annotateurl = '/adm/annotation';
       if ($httphost) {
           $annotateurl = '/adm/annotations';
       }
     my $hostvar = '      my $hostvar = '
 function setLCHost() {  function setLCHost() {
     var lcHostname="";      var lcHostname="";
Line 2231  function golist(url) { Line 2253  function golist(url) {
   
   
   
 function catalog_info(isMobile) {  function catalog_info(url,isMobile) {
     if (isMobile == 1) {      if (isMobile == 1) {
         openMyModal(window.location.pathname+'.meta?modal=1',500,400,'yes');          openMyModal(url+'.meta?modal=1',500,400,'yes');
     } else {      } else {
         loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');          loncatinfo=window.open(url+'.meta',"LONcatInfo",'height=500,width=400,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
     }      }
 }  }
   
Line 2257  function annotate() { Line 2279  function annotate() {
    annotator.document.write(     annotator.document.write(
    '$start_page_annotate'     '$start_page_annotate'
   +"<form name='goannotate' target='Annotator' method='post' "    +"<form name='goannotate' target='Annotator' method='post' "
   +"action='/adm/annotations'>"    +"action='$annotateurl'>"
   +"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"    +"<input type='hidden' name='symbnew' value='"+currentSymb+"' />"
   +"<\\/form>"    +"<\\/form>"
   +'$end_page_annotate');    +'$end_page_annotate');
Line 2279  function open_StoredLinks_Import(rat) { Line 2301  function open_StoredLinks_Import(rat) {
 }  }
   
 function open_source() {  function open_source() {
    var url = escape(window.location.pathname);     sourcewin=window.open('/adm/source?inhibitmenu=yes&viewonly=1&filename='+currentURL,'LONsource',
    sourcewin=window.open('/adm/source?inhibitmenu=yes&viewonly=1&filename='+url,'LONsource',  
                          'height=500,width=600,resizable=yes,location=no,menubar=no,toolbar=no,scrollbars=yes');                           'height=500,width=600,resizable=yes,location=no,menubar=no,toolbar=no,scrollbars=yes');
 }  }
   

Removed from v.1.491  
changed lines
  Added in v.1.503


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