--- loncom/interface/lonsearchcourse.pm 2024/02/11 21:41:48 1.10 +++ loncom/interface/lonsearchcourse.pm 2024/02/11 22:20:06 1.11 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Course # -# $Id: lonsearchcourse.pm,v 1.10 2024/02/11 21:41:48 raeburn Exp $ +# $Id: lonsearchcourse.pm,v 1.11 2024/02/11 22:20:06 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -123,6 +123,11 @@ sub course_search { my $discuss=$env{'form.crsdiscuss'}; my @allwords=($search_string,@New_Words); $totalfound=0; + my $target = 'cat'; + if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || + (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { + $target = '_self'; + } $r->print( '
'. @@ -148,7 +153,7 @@ sub course_search { } my $symb=&make_symb($1); &checkonthis($r,$1,$hash{$_},0,&Apache::lonnet::gettitle($symb), - $fulltext,$symb,@allwords); + $fulltext,$symb,$target,@allwords); } } untie(%hash); @@ -220,7 +225,7 @@ sub course_search { } $url .= &escape($resource->symb()); my $title = $resource->compTitle(); - $r->print('
'. + $r->print('
'. ($title?$title:$url).'  - '. $disctype.'
'); $totaldiscussions++; @@ -240,7 +245,7 @@ sub course_search { # =============================== This pulls up a resource and its dependencies sub checkonthis { - my ($r,$id,$url,$level,$title,$fulltext,$symb,@allwords)=@_; + my ($r,$id,$url,$level,$title,$fulltext,$symb,$target,@allwords)=@_; $alreadyseen{$id}=1; if (&Apache::loncommon::connection_aborted($r)) { return; } $r->rflush(); @@ -281,7 +286,7 @@ sub checkonthis { $href .= '?symb='.&escape($symb); } } - $r->print(''.($title?$title:$url). + $r->print(''.($title?$title:$url). '
'); $totalfound++; } elsif ($fulltext) { @@ -293,7 +298,7 @@ sub checkonthis { &Apache::lonnet::metadata($url,'dependencies'); foreach (split(/\,/,$dependencies)) { if (($_=~/^\/res\//) && (!$alreadyseen{$id})) { - &checkonthis($r,$id,$_,$level+1,'',$fulltext,undef,@allwords); + &checkonthis($r,$id,$_,$level+1,'',$fulltext,undef,$target,@allwords); } } }