[LON-CAPA-cvs] cvs: rat / lonpageflip.pm lonsequence.pm loncom/auth lonroles.pm loncom/interface courseprefs.pm loncommon.pm londocs.pm lonnavdisplay.pm lonquickgrades.pm lonrelrequtils.pm loncom/lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Tue Oct 18 20:03:12 EDT 2022


raeburn		Wed Oct 19 00:03:12 2022 EDT

  Modified files:              
    /loncom/interface	courseprefs.pm loncommon.pm londocs.pm 
                     	lonquickgrades.pm lonrelrequtils.pm 
                     	lonnavdisplay.pm 
    /loncom/auth	lonroles.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /rat	lonsequence.pm lonpageflip.pm 
  Log:
  - Bug 6975
    Folders and Resources in Supplemental Content area can be hidden using
    Course Editor.
  
  
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.116 loncom/interface/courseprefs.pm:1.117
--- loncom/interface/courseprefs.pm:1.116	Tue Oct 18 23:28:00 2022
+++ loncom/interface/courseprefs.pm	Wed Oct 19 00:03:10 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.116 2022/10/18 23:28:00 raeburn Exp $
+# $Id: courseprefs.pm,v 1.117 2022/10/19 00:03:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4006,10 +4006,7 @@
             }
         }
     }
-    my $suppmap = 'supplemental.sequence';
-    my ($suppcount,$supptools,$errors) = (0,0,0);
-    ($suppcount,$supptools,$errors) = &Apache::loncommon::recurse_supplemental($cnum,$cdom,
-                                                      $suppmap,$suppcount,$supptools,$errors);
+    my $supptools = &Apache::lonnet::count_supptools($cnum,$cdom,1,1);
     my $mapres_header = '<h4>'.
                         &mt('Requirements for specific folders or resources').
                         '</h4>';
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1390 loncom/interface/loncommon.pm:1.1391
--- loncom/interface/loncommon.pm:1.1390	Tue Oct 18 23:28:00 2022
+++ loncom/interface/loncommon.pm	Wed Oct 19 00:03:10 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1390 2022/10/18 23:28:00 raeburn Exp $
+# $Id: loncommon.pm,v 1.1391 2022/10/19 00:03:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -18320,23 +18320,47 @@
         if ($blocked) {
             return ();
         }
-        my $lastchange = &Apache::lonnet::get_coursechange($cdom,$cnum);
-        if ($lastchange > $env{'request.course.tied'}) {
-            my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired');
-            if ($curr_reqd_hash{'internal.releaserequired'} ne '') {
-                my $required = $env{'course.'.$cdom.'_'.$cnum.'.internal.releaserequired'};
-                if ($curr_reqd_hash{'internal.releaserequired'} ne $required) {
-                    &Apache::lonnet::appenv({'course.'.$cdom.'_'.$cnum.'.internal.releaserequired' =>
-                                             $curr_reqd_hash{'internal.releaserequired'}});
-                    my ($switchserver,$switchwarning) =
-                        &check_release_required($loncaparev,$cdom.'_'.$cnum,$env{'request.role'},
-                                                $curr_reqd_hash{'internal.releaserequired'});
-                    if ($switchwarning ne '' || $switchserver ne '') {
-                        return ('switch',$switchwarning,$switchserver);
-                    }
+        my $update;
+        my $lastmainchange = &Apache::lonnet::get_coursechange($cdom,$cnum);
+        my $lastsuppchange = &Apache::lonnet::get_suppchange($cdom,$cnum);
+        if ($lastmainchange > $env{'request.course.tied'}) {
+            my ($needswitch,$switchwarning,$switchserver) = &switch_for_update($loncaparev,$cdom,$cnum);
+            if ($needswitch) {
+                return ('switch',$switchwarning,$switchserver);
+            }
+            $update = 'main';
+        }
+        if ($lastsuppchange > $env{'request.course.suppupdated'}) {
+            if ($update) {
+                $update = 'both';
+            } else {
+                my ($needswitch,$switchwarning,$switchserver) = &switch_for_update($loncaparev,$cdom,$cnum);
+                if ($needswitch) {
+                    return ('switch',$switchwarning,$switchserver);
+                } else {
+                    $update = 'supp';
                 }
             }
-            return ('update');
+            return ($update);
+        }
+    }
+    return ();
+}
+
+sub switch_for_update {
+    my ($loncaparev,$cdom,$cnum) = @_;
+    my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired');
+    if ($curr_reqd_hash{'internal.releaserequired'} ne '') {
+        my $required = $env{'course.'.$cdom.'_'.$cnum.'.internal.releaserequired'};
+        if ($curr_reqd_hash{'internal.releaserequired'} ne $required) {
+            &Apache::lonnet::appenv({'course.'.$cdom.'_'.$cnum.'.internal.releaserequired' =>
+                                    $curr_reqd_hash{'internal.releaserequired'}});
+            my ($switchserver,$switchwarning) =
+                &check_release_required($loncaparev,$cdom.'_'.$cnum,$env{'request.role'},
+                                        $curr_reqd_hash{'internal.releaserequired'});
+            if ($switchwarning ne '' || $switchserver ne '') {
+                return ('switch',$switchwarning,$switchserver);
+            }
         }
     }
     return ();
@@ -18399,17 +18423,13 @@
         @resparms = @LONCAPA::map::resparms;
         @zombies = @LONCAPA::map::zombies;
     }
-    my $suppmap = 'supplemental.sequence';
-    my ($suppcount,$supptools,$errors) = (0,0,0);
-    ($suppcount,$supptools,$errors) = &recurse_supplemental($cnum,$cdom,$suppmap,
-                                                            $suppcount,$supptools,$errors);
     if ($keeporder) {
         @LONCAPA::map::resources = @resources;
         @LONCAPA::map::order = @order;
         @LONCAPA::map::resparms = @resparms;
         @LONCAPA::map::zombies = @zombies;
     }
-    if ($supptools) {
+    if (&Apache::lonnet::count_supptools($cnum,$cdom,1)) {
         my ($major,$minor) = split(/\./,$checkcrsrestypes{'exttool'});
         if (($major > $reqdmajor) || ($major == $reqdmajor && $minor > $reqdminor)) {
             ($reqdmajor,$reqdminor) = ($major,$minor);
@@ -18471,8 +18491,14 @@
 }
 
 sub recurse_supplemental {
-    my ($cnum,$cdom,$suppmap,$numfiles,$numexttools,$errors) = @_;
-    if ($suppmap) {
+    my ($cnum,$cdom,$suppmap,$errors,$possdel,$suppids,$hiddensupp,$hidden) = @_;
+    if (($suppmap) && (ref($suppids) eq 'HASH') && (ref($hiddensupp) eq 'HASH')) {
+        my $mapnum;
+        if ($suppmap eq 'supplemental.sequence') {
+            $mapnum = 0;
+        } else {
+            ($mapnum) = ($suppmap =~ /^supplemental_(\d+)\.sequence$/);
+        }
         my ($errtext,$fatal) = &LONCAPA::map::mapread('/uploaded/'.$cdom.'/'.$cnum.'/'.$suppmap);
         if ($fatal) {
             $errors ++;
@@ -18480,24 +18506,95 @@
             my @order = @LONCAPA::map::order;
             if (@order > 0) {
                 my @resources = @LONCAPA::map::resources;
+                my @resparms = @LONCAPA::map::resparms;
                 foreach my $idx (@order) {
                     my ($title,$src,$ext,$type,$status)=split(/\:/,$resources[$idx]);
                     if (($src ne '') && ($status eq 'res')) {
+                        my $id = $mapnum.':'.$idx;
+                        push(@{$suppids->{$src}},$id);
+                        if (($hidden) || (&get_supp_parameter($resparms[$idx],'parameter_hiddenresource') =~ /^yes/i)) {
+                            $hiddensupp->{$id} = 1;
+                        }
                         if ($src =~ m{^\Q/uploaded/$cdom/$cnum/\E(supplemental_\d+\.sequence)$}) {
-                            ($numfiles,$numexttools,$errors) = &recurse_supplemental($cnum,$cdom,$1,
-                                                                   $numfiles,$numexttools,$errors);
+                            $errors = &recurse_supplemental($cnum,$cdom,$1,$errors,$possdel,$suppids,
+                                                            $hiddensupp,$hiddensupp->{$id});
                         } else {
-                            if ($src =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) {
-                                $numexttools ++;
+                            my $allowed;
+                            if (($env{'request.role.adv'}) || (!$hiddensupp->{$id})) {
+                                $allowed = 1;
+                            } elsif ($possdel) {
+                                foreach my $item (@{$suppids->{$src}}) {
+                                    next if ($item eq $id);
+                                    unless ($hiddensupp->{$item}) {
+                                       $allowed = 1;
+                                       last;
+                                    }
+                                }
+                                if ((!$allowed) && (exists($env{'httpref.'.$src}))) {
+                                    &Apache::lonnet::delenv('httpref.'.$src);
+                                }
+                            }
+                            if ($allowed && (!exists($env{'httpref.'.$src}))) {
+                                &Apache::lonnet::allowuploaded('/adm/coursedoc',$src);
                             }
-                            $numfiles ++;
                         }
                     }
                 }
             }
         }
     }
-    return ($numfiles,$numexttools,$errors);
+    return $errors;
+}
+
+sub set_supp_httprefs {
+    my ($cnum,$cdom,$supplemental,$possdel) = @_;
+    if (ref($supplemental) eq 'HASH') {
+        if ((ref($supplemental->{'ids'}) eq 'HASH') && (ref($supplemental->{'hidden'}) eq 'HASH')) {
+            foreach my $src (keys(%{$supplemental->{'ids'}})) {
+                next if ($src =~ /\.sequence$/);
+                if (ref($supplemental->{'ids'}->{$src}) eq 'ARRAY') {
+                    my $allowed;
+                    if ($env{'request.role.adv'}) {
+                        $allowed = 1;
+                    } else {
+                        foreach my $id (@{$supplemental->{'ids'}->{$src}}) {
+                            unless ($supplemental->{'hidden'}->{$id}) {
+                                $allowed = 1;
+                                last;
+                            }
+                        }
+                    }
+                    if (exists($env{'httpref.'.$src})) {
+                        if ($possdel) {
+                            unless ($allowed) {
+                                &Apache::lonnet::delenv('httpref.'.$src);
+                            }
+                        }
+                    } elsif ($allowed) {
+                        &Apache::lonnet::allowuploaded('/adm/coursedoc',$src);
+                    }
+                }
+            }
+            if ($env{'request.course.id'} eq $cdom.'_'.$cnum) {
+                &Apache::lonnet::appenv({'request.course.suppupdated' => time});
+            }
+        }
+    }
+}
+
+sub get_supp_parameter {
+    my ($resparm,$name)=@_;
+    return if ($resparm eq '');
+    my $value=undef;
+    my $ptype=undef;
+    foreach (split('&&&',$resparm)) {
+        my ($thistype,$thisname,$thisvalue)=split('___',$_);
+        if ($thisname eq $name) {
+            $value=$thisvalue;
+            $ptype=$thistype;
+        }
+    }
+    return $value;
 }
 
 sub symb_to_docspath {
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.681 loncom/interface/londocs.pm:1.682
--- loncom/interface/londocs.pm:1.681	Thu Sep 29 03:59:29 2022
+++ loncom/interface/londocs.pm	Wed Oct 19 00:03:10 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.681 2022/09/29 03:59:29 raeburn Exp $
+# $Id: londocs.pm,v 1.682 2022/10/19 00:03:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -91,7 +91,7 @@
 
     if ($map =~ /^default/) {
         $hadchanges=1;
-    } else {
+    } elsif ($contentchg) {
         $suppchanges=1;
     }
     return ($errtext,0);
@@ -955,7 +955,6 @@
         &storemap($coursenum, $coursedom, $folder.'.'.$container,1);
     unless ($fatal) {
         if ($folder =~ /^supplemental/) {
-            &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
             my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
                                             $folder.'.'.$container);
         }
@@ -3278,11 +3277,28 @@
         return $errtext if ($fatal);
     }
 
+    my (%supphidden,%suppids,$suppmapid);
+
     if ($#LONCAPA::map::order<1) {
 	my $idx=&LONCAPA::map::getresidx();
 	if ($idx<=0) { $idx=1; }
        	$LONCAPA::map::order[0]=$idx;
         $LONCAPA::map::resources[$idx]='';
+    } elsif ($supplementalflag && !$allowed) {
+        my ($supplemental) = &Apache::lonnet::get_supplemental($coursenum,$coursedom);
+        if (ref($supplemental) eq 'HASH') {
+            if (ref($supplemental->{'hidden'}) eq 'HASH') {
+                %supphidden = %{$supplemental->{'hidden'}};
+            }
+            if (ref($supplemental->{'ids'}) eq 'HASH') {
+                %suppids = %{$supplemental->{'ids'}};
+            }
+        }
+        if ($folder eq 'supplemental') {
+            $suppmapid = 0;
+        } elsif ($folder =~ /^supplemental_(\d+)$/) {
+            $suppmapid = $1;
+        }
     }
 
 # ------------------------------------------------------------ Process commands
@@ -3566,11 +3582,15 @@
             push(@allmapidx,$res);
         }
 
+        if (($supplementalflag) && (!$allowed) && (!$env{'request.role.adv'})) {
+            next if ($supphidden{$suppmapid.':'.$res});
+        }
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum,$coursedom,$crstype,
                               $pathitem,$supplementalflag,$container,
                               \%filters,\%curr_groups,$ltitoolsref,$canedit,
-                              $isencrypted,$navmapref,$hostname);
+                              $isencrypted,$navmapref,$hostname,
+                              \%supphidden,\%suppids,$suppmapid);
         $idx++;
         $shown++;
     }
@@ -3579,10 +3599,14 @@
     my $need_save;
     if ($allowed || ($supplementalflag && $folder eq 'supplemental')) {
         my $toolslink;
-        if ($allowed) {
+        if ($allowed || $canedit) {
+            my $helpitem = 'Navigation_Screen';
+            if (!$allowed) {
+                $helpitem = 'Supplemental_Navigation';
+            }
             $toolslink = '<table><tr><td>'
                        .&Apache::loncommon::help_open_menu('Navigation Screen',
-                                                           'Navigation_Screen',undef,'RAT')
+                                                           $helpitem,undef,'RAT')
                        .'</td><td class="LC_middle">'.&mt('Tools:').'</td>'
                        .'<td align="left"><ul id="LC_toolbar">'
                        .'<li><a href="/adm/coursedocs?forcesupplement=1&command=editsupp" '
@@ -3598,11 +3622,9 @@
                           .&Apache::loncommon::start_data_table_header_row()
                           .'<th colspan="2">'.&mt('Move').'</th>'
                           .'<th colspan="3">'.&mt('Actions').'</th>'
-                          .'<th>'.&mt('Document').'</th>';
-                if ($folder !~ /^supplemental/) {
-                    $to_show .= '<th colspan="2">'.&mt('Settings').'</th>';
-                }
-                $to_show .= &Apache::loncommon::end_data_table_header_row();
+                          .'<th>'.&mt('Document').'</th>'
+                          .'<th colspan="2">'.&mt('Settings').'</th>'
+                          .&Apache::loncommon::end_data_table_header_row();
                 if ($folder !~ /^supplemental/) {
                     $lists{'canhide'} = join(',', at allidx);
                     $lists{'canrandomlyorder'} = join(',', at allmapidx);
@@ -3950,7 +3972,8 @@
 sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
         $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
-        $ltitoolsref,$canedit,$isencrypted,$navmapref,$hostname)=@_;
+        $ltitoolsref,$canedit,$isencrypted,$navmapref,$hostname,
+        $supphidden,$suppids,$suppmapid)=@_;
     my ($foldertitle,$renametitle,$oldtitle);
     if (&is_supplemental_title($title)) {
 	($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
@@ -4337,6 +4360,11 @@
         if (!$allowed && $supplementalflag) {
             $folderpath.=$containerarg.'&'.$foldername;
             $url.='folderpath='.&escape($folderpath);
+            if (ref($supphidden) eq 'HASH') {
+                if ($supphidden->{$suppmapid.':'.$residx}) {
+                    $hiddenfolder = 1;
+                }
+            }
         } else {
             my $rpicknum = (&LONCAPA::map::getparameter($orderidx,
                                                         'parameter_randompick'))[0];
@@ -4430,6 +4458,11 @@
         if ($anchor ne '') {
             $url .= '&anchor='.&HTML::Entities::encode($anchor,'"<>&');
         }
+        if (ref($supphidden) eq 'HASH') {
+            if ($supphidden->{$suppmapid.':'.$residx}) {
+                $hiddenres = 1;
+            }
+        }
     }
     my ($tdalign,$tdwidth);
     if ($allowed) {
@@ -4518,6 +4551,17 @@
     $line.='</span></td><td'.$tdwidth.'>';
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'">'.$title.'</a>';
+       if (!$allowed && $supplementalflag && $canedit && $isfolder) {
+           my $editicon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png';
+           my $editurl = $url;
+           $editurl =~ s{^\Q/adm/supplemental?\E}{/adm/coursedocs?command=direct&forcesupplement=1&};
+           $line .= ' '.'<a href="'.$editurl.'">'.
+                    '<img src="'.$editicon.'" alt="'.&mt('Edit Content').'" title="'.&mt('Edit Content').'" />'.
+                    '</a>';
+       }
+       if ((($hiddenfolder) || ($hiddenres)) && (!$allowed) && ($supplementalflag))  {
+           $line.= ' <span class="LC_warning">('.&mt('hidden').')</span> ';
+       }
     } elsif ($url) {
        if ($nomodal) {
            $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
@@ -4538,32 +4582,37 @@
     $line .= '</td>';
     $rand_pick_text = ' ' if ($rand_pick_text eq '');
     $rand_order_text = ' ' if ($rand_order_text eq '');
-    if (($allowed) && ($folder!~/^supplemental/)) {
- 	my %lt=&Apache::lonlocal::texthash(
- 			      'hd' => 'Hidden',
- 			      'ec' => 'URL hidden');
-        my ($enctext,$hidtext);
-        if ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) {
-            $enctext = ' checked="checked"';
-            if (($ishash) && (ref($filtersref->{'encrypturl'}) eq 'ARRAY')) {
-                push(@{$filtersref->{'encrypturl'}},$orderidx);
-            }
-        }
+    if ($allowed) {
+        my %lt=&Apache::lonlocal::texthash(
+                              'hd' => 'Hidden',
+                              'ec' => 'URL hidden');
+        my ($enctext,$hidtext,$formhidden,$formurlhidden);
         if ((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i) {
             $hidtext = ' checked="checked"';
             if (($ishash) && (ref($filtersref->{'randomorder'}) eq 'ARRAY')) {
                 push(@{$filtersref->{'hiddenresource'}},$orderidx);
             }
         }
-        my $formhidden = 'edit_hiddenresource_'.$orderidx;
-        my $formurlhidden = 'edit_encrypturl_'.$orderidx;
-	$line.=(<<ENDPARMS);
+        $formhidden = 'edit_hiddenresource_'.$orderidx;
+        $line.=(<<ENDPARMS);
   <td class="LC_docs_entry_parameter">
     <form action="/adm/coursedocs" method="post" name="$formhidden">
     $form_param
     $form_common
     <label><input type="checkbox" name="hiddenresource_$orderidx" id="hiddenresource_$orderidx" onclick="checkForSubmit(this.form,'hiddenresource','settings');" $hidtext $disabled /> $lt{'hd'}</label>
     $form_end
+ENDPARMS
+        if ($folder =~/^supplemental/) {
+            $line.= "\n    <td>";
+        } else {
+            if ((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) {
+                $enctext = ' checked="checked"';
+                if (($ishash) && (ref($filtersref->{'encrypturl'}) eq 'ARRAY')) {
+                    push(@{$filtersref->{'encrypturl'}},$orderidx);
+                }
+            }
+            $formurlhidden = 'edit_encrypturl_'.$orderidx;
+	    $line.=(<<ENDPARMS);
     <br />
     <form action="/adm/coursedocs" method="post" name="$formurlhidden">
     $form_param
@@ -4574,6 +4623,7 @@
   <td class="LC_docs_entry_parameter">$rand_pick_text<br />
                                       $rand_order_text</td>
 ENDPARMS
+        }
     }
     $line.=&Apache::loncommon::end_data_table_row();
     return $line;
@@ -5429,17 +5479,20 @@
     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
  
     my ($allowed,$canedit,$canview,$noendpage,$disabled);
+# does this user have privileges to modify content.
+    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
 # URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
-    unless ($r->uri eq '/adm/supplemental') {
-        # does this user have privileges to modify content.  
-        if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+        unless ($r->uri eq '/adm/supplemental') {
             $allowed = 1;
-            $canedit = 1;
-            $canview = 1;
-        } elsif (&Apache::lonnet::allowed('cev',$env{'request.course.id'})) {
+        }
+        $canedit = 1;
+        $canview = 1;
+    } elsif (&Apache::lonnet::allowed('cev',$env{'request.course.id'})) {
+# URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
+        unless ($r->uri eq '/adm/supplemental') {
             $allowed = 1;
-            $canview = 1;
         }
+        $canview = 1;
     }
     unless ($canedit) {
         $disabled = ' disabled="disabled"';
@@ -5544,7 +5597,7 @@
 # Get the parameters that may be needed
 #
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                            ['folderpath',
+                                            ['folderpath','title',
                                              'forcesupplement','forcestandard',
                                              'tools','symb','command','supppath']);
 
@@ -5817,8 +5870,14 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
 
     if ($showdoc) {
-        $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
-                                                {'force_register' => $showdoc,}));
+        my $args;
+        if ($supplementalflag) {
+            my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$env{'form.title'},1);
+            $args = {'bread_crumbs' => $brcrum};
+        } else {
+            $args = {'force_register' => $showdoc};
+        }
+        $r->print(&Apache::loncommon::start_page("$crstype documents",undef,$args));
     } elsif ($toolsflag) {
         my ($breadtext,$breadtitle);
         $breadtext = "$crstype Editor";
@@ -5836,6 +5895,12 @@
                      $breadtitle)
                  );
     } elsif ($r->uri eq '/adm/supplemental') {
+        unless ($env{'request.role.adv'}) {
+            unless (&Apache::lonnet::has_unhidden_suppfiles($coursenum,$coursedom)) {
+                $r->internal_redirect('/adm/navmaps');
+                return OK;
+            }
+        }
         my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
         $r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef,
                                                 {'bread_crumbs' => $brcrum,}));
@@ -6830,29 +6895,41 @@
                 'ff' => ['Other',&create_form_ul(&create_list_elements(@specialdocs))]
                 );
         if ($supplementalflag) {
-           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
-                               $supplementalflag,\%suporderhash,$iconpath,$pathitem,
-                               \%ltitools,$canedit,$hostname);
-           if ($error) {
-              $r->print('<p><span class="LC_error">'.$error.'</span></p>');
-           } else {
-               if ($suppchanges) {
-                   my %servers = &Apache::lonnet::internet_dom_servers($coursedom);
-                   my @ids=&Apache::lonnet::current_machine_ids();
-                   foreach my $server (keys(%servers)) {
-                       next if (grep(/^\Q$server\E$/, at ids));
-                       my $hashid=$coursenum.':'.$coursedom;
-                       my $cachekey = &escape('suppcount').':'.&escape($hashid);
-                       &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]);
-                   }
-                   &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
-                   undef($suppchanges);
-               }
-           }
+            $suppchanges = 0;
+            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
+                                $supplementalflag,\%suporderhash,$iconpath,$pathitem,
+                                \%ltitools,$canedit,$hostname);
+            if ($error) {
+                $r->print('<p><span class="LC_error">'.$error.'</span></p>');
+            }
+            if ($suppchanges) {
+                my %servers = &Apache::lonnet::internet_dom_servers($coursedom);
+                my @ids=&Apache::lonnet::current_machine_ids();
+                foreach my $server (keys(%servers)) {
+                    next if (grep(/^\Q$server\E$/, at ids));
+                    my $hashid=$coursenum.':'.$coursedom;
+                    my $cachekey = &escape('showsupp').':'.&escape($hashid);
+                    &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]);
+                }
+                &Apache::lonnet::has_unhidden_suppfiles($coursenum,$coursedom,1);
+                &Apache::lonnet::count_supptools($coursenum,$coursedom,1);
+                my $now = time;
+                if ($env{'request.course.id'} eq $coursedom.'_'.$coursenum) {
+                    &Apache::lonnet::appenv({'request.course.suppupdated' => $now});
+                }
+                &Apache::lonnet::put('environment',{'internal.supplementalchange' => $now},
+                                     $coursedom,$coursenum);
+                &Apache::lonnet::appenv(
+                    {'course.'.$coursedom.'_'.$coursenum.'.internal.supplementalchange' => $now});
+                &Apache::lonnet::do_cache_new('suppchange',$coursedom.'_'.$coursenum,$now,600);
+                &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
+                undef($suppchanges);
+            }
         }
     } elsif ($supplementalflag) {
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
-                            $supplementalflag,'',$iconpath,$pathitem,'','',$hostname);
+                            $supplementalflag,'',$iconpath,$pathitem,'',$canedit,
+                            $hostname);
         if ($error) {
             $r->print('<p><span class="LC_error">'.$error.'</span></p>');
         }
@@ -7358,7 +7435,12 @@
     } elsif ($env{'docs.exit.'.$env{'request.course.id'}} eq '/adm/menu') {
         $backtourl = '/adm/menu';
     } elsif ($supplementalflag) {
-        $backtourl = '/adm/supplemental';
+        if (($env{'request.role.adv'}) ||
+            (&Apache::lonnet::has_unhidden_suppfiles($coursenum,$coursedom))) {
+            $backtourl = '/adm/supplemental';
+        } else {
+            $backtourl = '/adm/navmaps';
+        }
     } else {
         $backtourl = '/adm/navmaps';
     }
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.122 loncom/interface/lonquickgrades.pm:1.123
--- loncom/interface/lonquickgrades.pm:1.122	Tue Nov 30 15:55:37 2021
+++ loncom/interface/lonquickgrades.pm	Wed Oct 19 00:03:10 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.122 2021/11/30 15:55:37 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.123 2022/10/19 00:03:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -120,10 +120,14 @@
             $r->send_http_header;
             $r->print(&Apache::loncommon::check_release_result(@reinit));
             return OK;
-        } elsif ($reinitresult eq 'update') {
-            my $cid = $env{'request.course.id'};
-            my $cnum = $env{'course.'.$cid.'.num'};
-            my $cdom = $env{'course.'.$cid.'.domain'};
+        }
+        my ($cid,$cnum,$cdom);
+        if ($reinitresult) {
+            $cid = $env{'request.course.id'};
+            $cnum = $env{'course.'.$cid.'.num'};
+            $cdom = $env{'course.'.$cid.'.domain'};
+        }
+        if (($reinitresult eq 'main') || ($reinitresult eq 'both')) {
             &Apache::loncommon::content_type($r,'text/html');
             $r->send_http_header;
             &startpage($r,$showPoints);
@@ -161,9 +165,15 @@
             $r->header_out(Location => $furl);
             return REDIRECT;
         }
+        if (($reinitresult eq 'supp') || ($reinitresult eq 'both')) {
+            my ($supplemental,$refs_updated) = &Apache::lonnet::get_supplemental($cnum,$cdom);
+            unless ($refs_updated) {
+                &Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental);
+            }
+        }
     }
 
-    unless ($reinitresult eq 'update') {
+    unless (($reinitresult eq 'main') || ($reinitresult eq 'both')) {
         # Send header, don't cache this page
         &Apache::loncommon::no_cache($r);
         $r->send_http_header;
Index: loncom/interface/lonrelrequtils.pm
diff -u loncom/interface/lonrelrequtils.pm:1.7 loncom/interface/lonrelrequtils.pm:1.8
--- loncom/interface/lonrelrequtils.pm:1.7	Wed Jan  3 04:20:54 2018
+++ loncom/interface/lonrelrequtils.pm	Wed Oct 19 00:03:10 2022
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # The LearningOnline Network
 #
-# $Id: lonrelrequtils.pm,v 1.7 2018/01/03 04:20:54 raeburn Exp $
+# $Id: lonrelrequtils.pm,v 1.8 2022/10/19 00:03:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -520,11 +520,7 @@
                                           $Apache::lonrelrequtils::randomizetry{minor},$reqdmajor,$reqdminor);
         }
     }
-    my $suppmap = 'supplemental.sequence';
-    my ($suppcount,$suppexttools,$errors) = (0,0,0);
-    ($suppcount,$suppexttools,$errors) =
-       &Apache::loncommon::recurse_supplemental($cnum,$cdom,$suppmap,$suppcount,$suppexttools,$errors);
-    if ($suppexttools) {
+    if (&Apache::lonnet::count_supptools($cnum,$cdom,1,1)) {
         ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($Apache::lonrelrequtils::exttool{major},
                                                           $Apache::lonrelrequtils::exttool{minor});
     }
Index: loncom/interface/lonnavdisplay.pm
diff -u loncom/interface/lonnavdisplay.pm:1.39 loncom/interface/lonnavdisplay.pm:1.40
--- loncom/interface/lonnavdisplay.pm:1.39	Sat Jun 11 04:32:23 2022
+++ loncom/interface/lonnavdisplay.pm	Wed Oct 19 00:03:10 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Display Handler
 #
-# $Id: lonnavdisplay.pm,v 1.39 2022/06/11 04:32:23 raeburn Exp $
+# $Id: lonnavdisplay.pm,v 1.40 2022/10/19 00:03:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -78,10 +78,14 @@
         $r->send_http_header;
         $r->print(&Apache::loncommon::check_release_result(@reinit));
         return OK;
-    } elsif ($result eq 'update') {
-        my $cid = $env{'request.course.id'};
-        my $cnum = $env{'course.'.$cid.'.num'};
-        my $cdom = $env{'course.'.$cid.'.domain'};
+    }
+    my ($cid,$cnum,$cdom);
+    if ($result) {
+        $cid = $env{'request.course.id'};
+        $cnum = $env{'course.'.$cid.'.num'};
+        $cdom = $env{'course.'.$cid.'.domain'};
+    }
+    if (($result eq 'main') || ($result eq 'both')) {
         &Apache::loncommon::content_type($r,'text/html');
         $r->send_http_header;
         &startpage($r);
@@ -111,6 +115,16 @@
             return HTTP_NOT_ACCEPTABLE;
         }
     }
+    if (($result eq 'both') || ($result eq 'supp')) {
+        my $possdel;
+        if ($result eq 'supp') {
+            $possdel = 1;
+        }
+        my ($supplemental,$refs_updated) = &Apache::lonnet::get_supplemental($cnum,$cdom,'',$possdel);
+        unless ($refs_updated) {
+            &Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental,$possdel);
+        }
+    }
 
     my $course_type = &Apache::loncommon::course_type();
     if (($course_type eq 'Placement') && (!$env{'request.role.adv'})) { 
@@ -370,14 +384,15 @@
 
     $r->print("\n".'<ul class="LC_TabContentBigger" id="mainnav">'."\n");
     $r->print('<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>       '.&mt('Main Content').'       </b></a></li>'."\n");
-    my $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
-    my ($suppcount,$errors);
-    unless ($allowed) {
+    my $supptab;
+    if ($env{'request.role.adv'}) {
+        $supptab = 1;
+    } else {
         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-        ($suppcount,$errors) = &Apache::lonnet::get_numsuppfiles($cnum,$cdom);
+        $supptab = &Apache::lonnet::has_unhidden_suppfiles($cnum,$cdom);
     }
-    if ($allowed || $suppcount) {
+    if ($supptab) {
         $r->print('<li '.(($mode eq 'supplemental')?' class="active"':'').'><a href="/adm/supplemental"><b>'.&mt('Supplemental Content').'</b></a></li>');
     }
     $r->print('<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>     '.&mt('Content Search').'     </b></a></li>'."\n");
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.367 loncom/auth/lonroles.pm:1.368
--- loncom/auth/lonroles.pm:1.367	Wed Oct  5 16:11:26 2022
+++ loncom/auth/lonroles.pm	Wed Oct 19 00:03:11 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.367 2022/10/05 16:11:26 raeburn Exp $
+# $Id: lonroles.pm,v 1.368 2022/10/19 00:03:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -499,6 +499,7 @@
 				 "request.course.sec"          => '',
                                  "request.course.tied"         => '',
                                  "request.course.timechecked"  => '',
+                                 "request.course.suppupdated"  => '',
 				 "request.role"                => 'cm',
                                  "request.role.adv"            => $env{'user.adv'},
 				 "request.role.domain"         => $env{'user.domain'}});
@@ -853,7 +854,6 @@
                             my ($feeds,$syllabus_time);
                             &Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds);
                             &Apache::lonnet::appenv({'request.course.feeds' => $feeds});
-                            &Apache::lonnet::get_numsuppfiles($cnum,$cdom,1);
                             unless ($env{'course.'.$cdom.'_'.$cnum.'.updatedsyllabus'}) {
                                 unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) ||
                                         ($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) {
@@ -886,6 +886,8 @@
                                 if ($env{'form.symb'}) {
                                     $furl .= '&symb='.&HTML::Entities::encode($env{'form.symb'},'<>&"');
                                 }
+                            } else {
+                                &set_supplemental_access($cnum,$cdom);
                             }
                             if (($ferr) && ($tadv)) {
 				&error_page($r,$ferr,$furl);
@@ -951,6 +953,7 @@
                                               &Apache::loncommon::end_page());
                                 }
 			    } else {
+                                &set_supplemental_access($cnum,$cdom);
                                 if (($env{'request.lti.login'}) &&
                                     ($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) {
                                     &process_lti($r,$cdom,$cnum);
@@ -3610,6 +3613,14 @@
     return;
 }
 
+sub set_supplemental_access {
+    my ($cnum,$cdom) = @_;
+    my ($supplemental,$refs_updated) = &Apache::lonnet::get_supplemental($cnum,$cdom);
+    unless ($refs_updated) {
+        &Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental);
+    }
+}
+
 1;
 __END__
 
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1495 loncom/lonnet/perl/lonnet.pm:1.1496
--- loncom/lonnet/perl/lonnet.pm:1.1495	Tue Oct 18 19:07:04 2022
+++ loncom/lonnet/perl/lonnet.pm	Wed Oct 19 00:03:11 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1495 2022/10/18 19:07:04 raeburn Exp $
+# $Id: lonnet.pm,v 1.1496 2022/10/19 00:03:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -12457,25 +12457,93 @@
     return $itemid;
 }
 
-sub get_numsuppfiles {
+sub count_supptools {
+    my ($cnum,$cdom,$ignorecache,$reload)=@_;
+    my $hashid=$cnum.':'.$cdom;
+    my ($numexttools,$cached);
+    unless ($ignorecache) {
+        ($numexttools,$cached) = &is_cached_new('supptools',$hashid);
+    }
+    unless (defined($cached)) {
+        my $chome=&homeserver($cnum,$cdom);
+        $numexttools = 0;
+        unless ($chome eq 'no_host') {
+            my ($supplemental) = &get_supplemental($cnum,$cdom,$reload);
+            if (ref($supplemental) eq 'HASH') {
+                if ((ref($supplemental->{'ids'}) eq 'HASH') && (ref($supplemental->{'hidden'}) eq 'HASH')) {
+                    foreach my $key (keys(%{$supplemental->{'ids'}})) {
+                        if ($key =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) {
+                            $numexttools ++;
+                        }
+                    }
+                }
+            }
+        }
+        &do_cache_new('supptools',$hashid,$numexttools,600);
+    }
+    return $numexttools;
+}
+
+sub has_unhidden_suppfiles {
     my ($cnum,$cdom,$ignorecache)=@_;
     my $hashid=$cnum.':'.$cdom;
-    my ($suppcount,$cached);
+    my ($showsupp,$cached);
     unless ($ignorecache) {
-        ($suppcount,$cached) = &is_cached_new('suppcount',$hashid);
+        ($showsupp,$cached) = &is_cached_new('showsupp',$hashid);
     }
     unless (defined($cached)) {
         my $chome=&homeserver($cnum,$cdom);
         unless ($chome eq 'no_host') {
-            ($suppcount,my $supptools,my $errors) = (0,0,0);
-            my $suppmap = 'supplemental.sequence';
-            ($suppcount,$supptools,$errors) =
-                &Apache::loncommon::recurse_supplemental($cnum,$cdom,$suppmap,$suppcount,
-                                                         $supptools,$errors);
+            my ($supplemental) = &get_supplemental($cnum,$cdom,$ignorecache);
+            if (ref($supplemental) eq 'HASH') {
+                if ((ref($supplemental->{'ids'}) eq 'HASH') && (ref($supplemental->{'hidden'}) eq 'HASH')) {
+                    foreach my $key (keys(%{$supplemental->{'ids'}})) {
+                        next if ($key =~ /\.sequence$/);
+                        if (ref($supplemental->{'ids'}->{$key}) eq 'ARRAY') {
+                            foreach my $id (@{$supplemental->{'ids'}->{$key}}) {
+                                unless ($supplemental->{'hidden'}->{$id}) {
+                                    $showsupp = 1;
+                                    last;
+                                }
+                            }
+                        }
+                        last if ($showsupp);
+                    }
+                }
+            }
         }
-        &do_cache_new('suppcount',$hashid,$suppcount,600);
+        &do_cache_new('showsupp',$hashid,$showsupp,600);
     }
-    return $suppcount;
+    return $showsupp;
+}
+
+sub get_supplemental {
+    my ($cnum,$cdom,$ignorecache,$possdel)=@_;
+    my $hashid=$cnum.':'.$cdom;
+    my ($supplemental,$cached,$set_httprefs);
+    unless ($ignorecache) {
+        ($supplemental,$cached) = &is_cached_new('supplemental',$hashid);
+    }
+    unless (defined($cached)) {
+        my $chome=&homeserver($cnum,$cdom);
+        unless ($chome eq 'no_host') {
+            my ($errors,%ids,%hidden);
+            $errors =
+                &Apache::loncommon::recurse_supplemental($cnum,$cdom,
+                                                         'supplemental.sequence',
+                                                         $errors,$possdel,\%ids,\%hidden);
+            $set_httprefs = 1;
+            if ($env{'request.course.id'} eq $cdom.'_'.$cnum) {
+                &Apache::lonnet::appenv({'request.course.suppupdated' => time});
+            }
+            $supplemental = {
+                               ids => \%ids,
+                               hidden => \%hidden,
+                            };
+            &do_cache_new('supplemental',$hashid,$supplemental,600);
+        }
+    }
+    return ($supplemental,$set_httprefs);
 }
 
 #
@@ -13603,11 +13671,45 @@
 }
 
 sub devalidate_coursechange_cache {
-    my ($cnum,$cdom)=@_;
-    my $hashid=$cnum.':'.$cdom;
+    my ($cdom,$cnum)=@_;
+    my $hashid=$cdom.'_'.$cnum;
     &devalidate_cache_new('crschange',$hashid);
 }
 
+sub get_suppchange {
+    my ($cdom,$cnum) = @_;
+    if ($cdom eq '' || $cnum eq '') {
+        return unless ($env{'request.course.id'});
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+    }
+    my $hashid=$cdom.'_'.$cnum;
+    my ($change,$cached)=&is_cached_new('suppchange',$hashid);
+    if ((defined($cached)) && ($change ne '')) {
+        return $change;
+    } else {
+        my %crshash = &get('environment',['internal.supplementalchange'],$cdom,$cnum);
+        if ($crshash{'internal.supplementalchange'} eq '') {
+            $change = $env{'course.'.$cdom.'_'.$cnum.'.internal.created'};
+            if ($change eq '') {
+                %crshash = &get('environment',['internal.created'],$cdom,$cnum);
+                $change = $crshash{'internal.created'};
+            }
+        } else {
+            $change = $crshash{'internal.supplementalchange'};
+        }
+        my $cachetime = 600;
+        &do_cache_new('suppchange',$hashid,$change,$cachetime);
+    }
+    return $change;
+}
+
+sub devalidate_suppchange_cache {
+    my ($cdom,$cnum)=@_;
+    my $hashid=$cdom.'_'.$cnum;
+    &devalidate_cache_new('suppchange',$hashid);
+}
+
 # ------------------------------------------------- Update symbolic store links
 
 sub symblist {
@@ -16464,10 +16566,6 @@
 values that are the resource value.  I believe that the timestamps and
 versions are also returned.
 
-get_numsuppfiles($cnum,$cdom) : retrieve number of files in a course's
-supplemental content area. This routine caches the number of files for 
-10 minutes.
-
 =back
 
 =head2 Course Modification
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.56 rat/lonsequence.pm:1.57
--- rat/lonsequence.pm:1.56	Mon Jul 19 15:48:25 2021
+++ rat/lonsequence.pm	Wed Oct 19 00:03:12 2022
@@ -2,7 +2,7 @@
 #
 # Sequence Handler
 #
-# $Id: lonsequence.pm,v 1.56 2021/07/19 15:48:25 raeburn Exp $
+# $Id: lonsequence.pm,v 1.57 2022/10/19 00:03:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -234,7 +234,7 @@
                $r->send_http_header;
                $r->print(&Apache::loncommon::check_release_result(@reinit));
                return OK;
-           } elsif ($result eq 'update') {
+           } elsif (($result eq 'main') || ($result eq 'both')) {
                my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
                my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.111 rat/lonpageflip.pm:1.112
--- rat/lonpageflip.pm:1.111	Fri Dec 31 19:51:04 2021
+++ rat/lonpageflip.pm	Wed Oct 19 00:03:12 2022
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.111 2021/12/31 19:51:04 raeburn Exp $
+# $Id: lonpageflip.pm,v 1.112 2022/10/19 00:03:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -502,9 +502,13 @@
               $r->send_http_header;
               $r->print(&Apache::loncommon::check_release_result(@reinit));
               return OK;
-          } elsif ($reinitcheck eq 'update') {
-              my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
-              my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+          }
+          my ($cnum,$cdom);
+          if ($reinitcheck) {
+              $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+              $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+          }
+          if (($reinitcheck eq 'main') || ($reinitcheck eq 'both')) {
               $preupdatepos = &Apache::lonnet::symbread($currenturl);
               unless ($direction eq 'return') {
                   if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
@@ -540,6 +544,12 @@
                   }
               }
           }
+          if (($reinitcheck eq 'both') || ($reinitcheck eq 'supp')) {
+              my ($supplemental,$refs_updated) = &Apache::lonnet::get_supplemental($cnum,$cdom);
+              unless ($refs_updated) {
+                  &Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental);
+              }
+          }
       }
       if ($direction eq 'firstres') {
 	  my $furl=&first_accessible_resource();


More information about the LON-CAPA-cvs mailing list