--- loncom/interface/loncommon.pm 2022/05/29 03:19:00 1.1380 +++ loncom/interface/loncommon.pm 2022/05/29 20:37:21 1.1381 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1380 2022/05/29 03:19:00 raeburn Exp $ +# $Id: loncommon.pm,v 1.1381 2022/05/29 20:37:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1257,7 +1257,7 @@ END =pod -=item * &help_open_topic($topic,$text,$stayOnPage,$width,$height,$imgid) +=item * &help_open_topic($topic,$text,$stayOnPage,$width,$height,$imgid,$links_target) Returns a string corresponding to an HTML link to the given help $topic, where $topic corresponds to the name of a .tex file in @@ -1281,10 +1281,12 @@ $imgid is the id of the img tag used for used in a javascript call to switch the image src. See lonhtmlcommon::htmlareaselectactive() for an example. +$links_target will optionally be set to a target (_top, _parent or _self). + =cut sub help_open_topic { - my ($topic, $text, $stayOnPage, $width, $height, $imgid) = @_; + my ($topic, $text, $stayOnPage, $width, $height, $imgid, $links_target) = @_; $text = "" if (not defined $text); $stayOnPage = 0 if (not defined $stayOnPage); $width = 500 if (not defined $width); @@ -1307,14 +1309,11 @@ sub help_open_topic { # Add the text my $target = ' target="_top"'; - if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || - (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { - if (($env{'request.noversionuri'} eq '/adm/searchcat') && - ($env{'form.phase'} =~ /^(sort|run_search)$/)) { - $target = ' target="_parent"'; - } else { - $target = ''; - } + if ($links_target) { + $target = ' target="'.$links_target.'"'; + } elsif ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || + (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { + $target = ''; } if ($text ne "") { $template.='' @@ -1401,20 +1400,20 @@ ENDOUTPUT # now just updates the help link and generates a blue icon sub help_open_menu { - my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) + my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text,$links_target) = @_; $stayOnPage = 1; my $output; if ($component_help) { if (!$text) { $output=&help_open_topic($component_help,undef,$stayOnPage, - $width,$height); + $width,$height,'',$links_target); } else { my $help_text; $help_text=&unescape($topic); $output='
'. &help_open_topic($component_help,$help_text,$stayOnPage, - $width,$height).'
'; + $width,$height,'',$links_target).''; } } my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage);