--- rat/lonsequence.pm 2018/04/14 17:52:53 1.50 +++ rat/lonsequence.pm 2022/10/29 18:13:29 1.59 @@ -2,7 +2,7 @@ # # Sequence Handler # -# $Id: lonsequence.pm,v 1.50 2018/04/14 17:52:53 raeburn Exp $ +# $Id: lonsequence.pm,v 1.59 2022/10/29 18:13:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -234,9 +234,13 @@ sub handler { $r->send_http_header; $r->print(&Apache::loncommon::check_release_result(@reinit)); return OK; - } elsif ($result eq 'update') { - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + } + my ($cnum,$cdom); + if ($result) { + $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + } + if (($result eq 'main') || ($result eq 'both')) { my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum"); if ($ferr) { my $requrl = $r->uri; @@ -245,6 +249,24 @@ sub handler { return HTTP_NOT_ACCEPTABLE; } } + if (($result eq 'both') || ($result eq 'supp')) { + my $possdel; + if ($result eq 'supp') { + $possdel = 1; + } + my ($supplemental,$refs_updated) = &Apache::loncommon::get_supplemental($cnum,$cdom,'',$possdel); + unless ($refs_updated) { + &Apache::loncommon::set_supp_httprefs($cnum,$cdom,$supplemental,$possdel); + } + } + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + + my $mapurl = &Apache::lonnet::declutter($requrl); + my $maptitle = &Apache::lonnet::gettitle($mapurl); + my @crumbs = ({text => $maptitle, no_mt => 1}); + my $args = {'bread_crumbs' => \@crumbs, + 'bread_crumbs_nomenu' => 1}; # Create the nav map my $navmap = Apache::lonnavmaps::navmap->new(); @@ -258,8 +280,7 @@ sub handler { my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; ($ltiscope,$ltiuri) = &LONCAPA::ltiutils::lti_provider_scope($env{'request.lti.uri'},$cdom,$cnum); } - my $mapurl = &Apache::lonnet::declutter($requrl); - my @crumbs; + @crumbs = (); unless ($ltiscope eq 'resource') { unless ($ltiscope eq 'map') { @crumbs = ({text => $crstype.' Contents', @@ -281,13 +302,10 @@ sub handler { } } } - my $maptitle = &Apache::lonnet::gettitle($mapurl); push(@crumbs,{text => $maptitle, no_mt => 1}); - my $args = {'bread_crumbs' => \@crumbs, - 'bread_crumbs_nomenu' => 1}; - &Apache::loncommon::content_type($r,'text/html'); - $r->send_http_header; - + $args = {'bread_crumbs' => \@crumbs, + 'bread_crumbs_nomenu' => 1, + 'no_auto_mt_title' => 1}; $r->print(&Apache::loncommon::start_page($maptitle,undef,$args)); my $renderArgs = { 'cols' => [0,1,2,3], @@ -307,14 +325,27 @@ sub handler { # If no resources were found let the user know. if ($renderArgs->{'counter'} == 0) { - $r->print("
". - &mt("This folder is empty.")."
"); + $r->print(''. + &mt('No items found in folder'). + '
'); } $r->print(&Apache::loncommon::end_page()); - $r->rflush(); - return OK; + } else { + $r->print(&Apache::loncommon::start_page($maptitle,undef,$args). + ''. + &mt('Folder no longer appears to be a part of the course'). + '
'. + &Apache::loncommon::end_page()); } + } else { + $r->print(&Apache::loncommon::start_page($maptitle,undef,$args). + ''. + &mt('Error: could not determine contents of folder'). + '
'. + &Apache::loncommon::end_page()); } + $r->rflush(); + return OK; } } @@ -357,8 +388,6 @@ sub handler { $dismapid=(split(/\./,$disid))[1]; if (!$env{'request.role.adv'}) { $randomout = $bighash{'randomout_'.$disid}; - } - if (!$env{'request.role.adv'}) { $is_encrypted = $bighash{'encrypted_'.$disid}; } } elsif (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', @@ -379,8 +408,6 @@ sub handler { $dismapid=(split(/\./,$disid))[1]; if (!$env{'request.role.adv'}) { $randomout = $bighash{'randomout_'.$disid}; - } - if (!$env{'request.role.adv'}) { $is_encrypted = $bighash{'encrypted_'.$disid}; } } @@ -400,10 +427,14 @@ sub handler { if ($is_encrypted) { $showdisurl = &Apache::lonenc::encrypted($disurl); } - &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid], - 'last_known' => [$disurl,$dismapid]); + if ($disurl =~ m{^/adm/navmaps(\?|$)}) { + &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid]); + } else { + &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid], + 'last_known' => [$disurl,$dismapid]); + } &Apache::loncommon::content_type($r,'text/html'); - $r->header_out(Location => &Apache::lonnet::absolute_url($ENV{'SERVER_NAME'}). + $r->header_out(Location => &Apache::lonnet::absolute_url(). $showdisurl); return REDIRECT; } else {