--- rat/lonsequence.pm 2023/01/20 23:49:50 1.48.2.4.2.1 +++ rat/lonsequence.pm 2020/09/03 12:44:56 1.53 @@ -2,7 +2,7 @@ # # Sequence Handler # -# $Id: lonsequence.pm,v 1.48.2.4.2.1 2023/01/20 23:49:50 raeburn Exp $ +# $Id: lonsequence.pm,v 1.53 2020/09/03 12:44:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use Apache::lonnet; use Apache::Constants qw(:common :http REDIRECT); use GDBM_File; use LONCAPA::map(); +use LONCAPA::ltiutils; use LONCAPA; use Apache::lonpageflip(); use Apache::loncommon(); @@ -233,13 +234,9 @@ sub handler { $r->send_http_header; $r->print(&Apache::loncommon::check_release_result(@reinit)); return OK; - } - 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')) { + } elsif ($result eq 'update') { + 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"); if ($ferr) { my $requrl = $r->uri; @@ -248,16 +245,7 @@ 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; @@ -273,26 +261,37 @@ sub handler { if (ref($navmap)) { # renderer call if (&Apache::lonnet::is_on_map($requrl)) { - @crumbs = ({text => $crstype.' Contents', - href => "javascript:gopost('/adm/navmaps','')"}); - my $res = $navmap->getResourceByUrl($mapurl); - if (ref($res)) { - 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); + my ($ltiscope,$ltiuri); + if (($env{'request.lti.login'}) && ($env{'request.lti.uri'})) { + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + ($ltiscope,$ltiuri) = &LONCAPA::ltiutils::lti_provider_scope($env{'request.lti.uri'},$cdom,$cnum); + } + @crumbs = (); + unless ($ltiscope eq 'resource') { + unless ($ltiscope eq 'map') { + @crumbs = ({text => $crstype.' Contents', + href => "javascript:gopost('/adm/navmaps','')"}); + } + my $res = $navmap->getResourceByUrl($mapurl); + if (ref($res)) { + my $symb = $res->symb(); + if ($symb) { + my ($parent) = &Apache::lonnet::decode_symb($res->symb()); + if (($parent ne $env{'course.'.$env{'request.course.id'}.'.url'}) && + !(($ltiscope eq 'map') && ($requrl eq $ltiuri))) { + my @mapcrumbs = $navmap->recursed_crumbs($parent); + if (@mapcrumbs) { + push(@crumbs,@mapcrumbs); + } } + $env{'request.symb'} = $symb; } - $env{'request.symb'} = $symb; } } push(@crumbs,{text => $maptitle, no_mt => 1}); $args = {'bread_crumbs' => \@crumbs, - 'bread_crumbs_nomenu' => 1, - 'no_auto_mt_title' => 1}; + 'bread_crumbs_nomenu' => 1}; $r->print(&Apache::loncommon::start_page($maptitle,undef,$args)); my $renderArgs = { 'cols' => [0,1,2,3], @@ -375,6 +374,8 @@ 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', @@ -395,6 +396,8 @@ 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}; } } @@ -421,7 +424,7 @@ sub handler { 'last_known' => [$disurl,$dismapid]); } &Apache::loncommon::content_type($r,'text/html'); - $r->header_out(Location => &Apache::lonnet::absolute_url(). + $r->header_out(Location => &Apache::lonnet::absolute_url($ENV{'SERVER_NAME'}). $showdisurl); return REDIRECT; } else {