--- rat/lonsequence.pm 2017/08/21 21:30:05 1.46 +++ rat/lonsequence.pm 2019/02/06 23:45:14 1.48.2.1 @@ -2,7 +2,7 @@ # # Sequence Handler # -# $Id: lonsequence.pm,v 1.46 2017/08/21 21:30:05 raeburn Exp $ +# $Id: lonsequence.pm,v 1.48.2.1 2019/02/06 23:45:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -245,35 +245,40 @@ sub handler { } } + &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(); if (ref($navmap)) { # renderer call if (&Apache::lonnet::is_on_map($requrl)) { - my $mapurl = &Apache::lonnet::declutter($requrl); - my @crumbs = ({text => $crstype.' Contents', - href => "javascript:gopost('/adm/navmaps','')"}); + @crumbs = ({text => $crstype.' Contents', + href => "javascript:gopost('/adm/navmaps','')"}); my $res = $navmap->getResourceByUrl($mapurl); if (ref($res)) { - my ($parent) = &Apache::lonnet::decode_symb($res->symb()); - if ($parent ne $env{'course.'.$env{'request.course.id'}.'.url'}) { - my @mapcrumbs = $navmap->recursed_crumbs($parent); - if (@mapcrumbs) { - push(@crumbs,@mapcrumbs); - } else { - push(@crumbs,{text => '...', - no_mt => 1}); + my $symb = $res->symb(); + if ($symb) { + my ($parent) = &Apache::lonnet::decode_symb($res->symb()); + if ($parent ne $env{'course.'.$env{'request.course.id'}.'.url'}) { + my @mapcrumbs = $navmap->recursed_crumbs($parent); + if (@mapcrumbs) { + push(@crumbs,@mapcrumbs); + } } + $env{'request.symb'} = $symb; } } - 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}; $r->print(&Apache::loncommon::start_page($maptitle,undef,$args)); my $renderArgs = { 'cols' => [0,1,2,3], @@ -293,14 +298,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; } }