--- loncom/interface/lonhelpmenu.pm 2014/01/05 21:33:58 1.44
+++ loncom/interface/lonhelpmenu.pm 2025/02/20 03:05:34 1.50
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# generate frame-based help system
#
-# $Id: lonhelpmenu.pm,v 1.44 2014/01/05 21:33:58 raeburn Exp $
+# $Id: lonhelpmenu.pm,v 1.50 2025/02/20 03:05:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,6 +36,7 @@ use Apache::lonlocal;
use Apache::lonnet;
use lib '/home/httpd/lib/perl/';
use LONCAPA;
+use HTML::Entities();
sub handler {
my ($r) = @_;
@@ -63,6 +64,7 @@ sub handler {
}
my $faqbaseurl = $Apache::lonnet::perlvar{'FAQHost'};
my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
+ $origurl = &unescape($origurl);
my $defdom;
if ($env{'request.course.id'}) {
$defdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -83,7 +85,6 @@ sub handler {
sub display_help_banner {
my ($r,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage) = @_;
- my $location=&Apache::loncommon::lonhttpdurl("/adm");
my $dom = $env{'request.role.domain'};
my $scripttag = '';
if ($requestmail) {
@@ -154,13 +155,14 @@ SCRIPT_TWO
{'only_body' => 1,}));
}
my $menu = &helpmenu_items($dom,$faq,$bug,$topic,$component_url,$origurl,$bugurl,$faqbaseurl,$requestmail,$stayOnPage);
+ $r->print('
'."\n");
if ($menu) {
$r->print("");
}
if ($stayOnPage && $env{'user.adv'}) {
$r->print('
');
}
- $r->print(&Apache::loncommon::end_page());
+ $r->print('
'.&Apache::loncommon::end_page());
}
sub helpmenu_items {
@@ -179,63 +181,84 @@ sub helpmenu_items {
lastloc => 'Go back',
close => 'Close',
);
+ my %alt = &Apache::lonlocal::texthash(
+ general => 'Intro help icon',
+ component => 'Topic icon',
+ faq => 'FAQ icon',
+ helpdesk => 'Helpdesk form icon',
+ bugs => 'Bug reporting icon',
+ manuals_web => 'HTML manuals icon',
+ manuals_pdf => 'PDF manuals icon',
+ lastloc => 'Return icon',
+ close => 'Close help icon',
+ );
+ my ($target,$bugs_target);
+ if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+ (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
+ $target = '_parent';
+ $bugs_target = '_blank';
+ } else {
+ $target = '_top';
+ $bugs_target = '_top';
+ }
my %items = (
general => {
href => '/adm/help/'.$general_help.'.hlp',
img => $location.'/help/help.png',
- alt => $lt{'general'},
+ alt => $alt{'general'},
text => $lt{'general'},
},
component => {
href => $component_url,
img => $location.'/help/help.png',
- alt => $lt{'component'},
+ alt => $alt{'component'},
text => $topic,
},
faq => {
href => $faqbaseurl.'fom/cache/'.$faq.'.html',
img => $location.'/lonMisc/smallFAQ.gif',
- alt => $lt{'faq'},
+ alt => $alt{'faq'},
text => $lt{'faq'},
},
helpdesk => {
href => '#',
onclick => 'gohelpdesk()',
img => $location.'/lonIcons/helpdesk.gif',
- alt => $lt{'helpdesk'},
+ alt => $alt{'helpdesk'},
text => $lt{'helpdesk'},
},
bugs => {
href => $bugurl,
img => $location.'/lonMisc/smallBug.gif',
- alt => $lt{'bugs'},
+ alt => $alt{'bugs'},
text => $lt{'bugs'},
+ target => $bugs_target,
},
manuals_web => {
href => '',
img => $location.'/lonIcons/html.gif',
- alt => $lt{'manuals_web'},
+ alt => $alt{'manuals_web'},
text => $lt{'manuals_web'},
},
manuals_pdf => {
href => '',
img => $location.'/lonIcons/pdf.gif',
- alt => $lt{'manuals_pdf'},
+ alt => $alt{'manuals_pdf'},
text => $lt{'manuals_pdf'},
},
lastloc => {
- href => $origurl,
+ href => &HTML::Entities::encode($origurl,'"&<>'),
img => '/res/adm/pages/tolastloc.png',
- alt => $lt{'lastloc'},
+ alt => $alt{'lastloc'},
text => $lt{'lastloc'},
- target => '_top',
+ target => $target,
},
close => {
href => 'javascript:window.close()',
img => $location.'/lonIcons/close.gif',
- alt => $lt{'close'},
+ alt => $alt{'close'},
text => $lt{'close'},
- target => '_top',
+ target => $target,
},
);
my %help_submenu = (
@@ -338,7 +361,7 @@ sub create_submenu {
my $menu = ''.$img.
''.
''.$title.
- ''.
+ ''.
' ▼'.
'';
my $count = 0;
@@ -391,9 +414,14 @@ sub display_help_mainpage {
$r->print(&Apache::loncommon::start_page('Help Content',undef,
{'only_body' => 1,}));
}
+ my $target = '_top';
+ if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+ (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
+ $target = '_parent';
+ }
if ($stayOnPage) {
$r->print('');
- }
+ }
$r->print('
'.$lt{'chen'});
if ($requestmail) {
$r->print(', '.$lt{'orto'});
@@ -424,7 +452,7 @@ sub display_help_mainpage {
&mt('[_1]Note[_2]: questions about course content should not be directed to the support team, but instead should be sent to the course instructor.').
' '.
&mt('This can be done by clicking the [_1]Communicate[_2] link or the "Send Feedback" link when viewing a content page.',
- '',''));
+ '',''));
}
$r->print("");
}