--- loncom/interface/loncommon.pm 2022/05/29 20:37:21 1.1381
+++ loncom/interface/loncommon.pm 2022/08/24 20:58:50 1.1386
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1381 2022/05/29 20:37:21 raeburn Exp $
+# $Id: loncommon.pm,v 1.1386 2022/08/24 20:58:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,7 +61,7 @@ use POSIX qw(strftime mktime);
use Apache::lonmenu();
use Apache::lonenc();
use Apache::lonlocal;
-use Apache::lonnet();
+use Apache::lonnavmaps();
use HTML::Entities;
use Apache::lonhtmlcommon();
use Apache::loncoursedata();
@@ -1521,26 +1521,25 @@ sub help_open_bug {
$link = $url;
}
- my $target = ' target="_top"';
- if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) {
- $target = '';
- }
- if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) {
- $target = ' target="'.$env{'request.deeplink.target'}.'"';
+ 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 = '_blank';
}
+
# Add the text
if ($text ne "")
{
$template .=
"
".
- "$text";
+ " | $text";
}
# Add the graphic
my $title = &mt('Report a Bug');
my $bugicon=&lonhttpdurl("/adm/lonMisc/smallBug.gif");
$template .= <<"ENDTEMPLATE";
-
+
ENDTEMPLATE
if ($text ne '') { $template.=' |
' };
return $template;
@@ -5999,7 +5998,7 @@ sub get_domainconf {
foreach my $host (keys(%{$domconfig{'login'}{$key}})) {
if (ref($domconfig{'login'}{$key}{$host}) eq 'HASH') {
$designhash{$udom.'.login.'.$key.'_'.$host} = 1;
- foreach my $item ('text','img','alt','url','title','notsso') {
+ foreach my $item ('text','img','alt','url','title','window','notsso') {
$designhash{$udom.'.login.'.$key.'_'.$item.'_'.$host} = $domconfig{'login'}{$key}{$host}{$item};
}
}
@@ -6378,6 +6377,21 @@ Inputs:
context, this will contain a reference to hash of items
to be included in the page header and/or inline menu.
+=item * $menucoll, optional argument, if specific menu collection is in
+ effect, either set as the default for the course, or set for
+ the deeplink paramater for $env{'request.deeplink.login'}
+ then $menucoll will be the number of that collection.
+
+=item * $menuref, optional argument, reference to a hash, containing the
+ menu options included for the menu in effect, based on the
+ configuration for the numbered menu collection in use.
+
+=item * $showncrumbsref, reference to a scalar. Calls to lonmenu::innerregister
+ within &bodytag() can result in calls to lonhtmlcommon::breadcrumbs(),
+ if so, $showncrumbsref is set there to 1, and will propagate back
+ via &bodytag() to &start_page(), to prevent lonhtmlcommon::breadcrumbs()
+ being called a second time.
+
=back
Returns: A uniform header for LON-CAPA web pages.
@@ -6390,7 +6404,7 @@ other decorations will be returned.
sub bodytag {
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,
$no_nav_bar,$bgcolor,$args,$advtoolsref,$ltiscope,$ltiuri,
- $ltimenu,$menucoll,$menuref)=@_;
+ $ltimenu,$menucoll,$menuref,$showncrumbsref)=@_;
my $public;
if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
@@ -6571,12 +6585,12 @@ sub bodytag {
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end');
if ($env{'request.state'} eq 'construct') {
$bodytag .= &Apache::lonmenu::innerregister($forcereg,
- $args->{'bread_crumbs'},'','',$hostname,$ltiscope,$ltiuri);
+ $args->{'bread_crumbs'},'','',$hostname,
+ $ltiscope,$ltiuri,$showncrumbsref);
} elsif ($forcereg) {
$bodytag .= &Apache::lonmenu::innerregister($forcereg,undef,
- $args->{'group'},
- $args->{'hide_buttons'},
- $hostname,$ltiscope,$ltiuri);
+ $args->{'group'},$args->{'hide_buttons'},
+ $hostname,$ltiscope,$ltiuri,$showncrumbsref);
} else {
$bodytag .=
&Apache::lonmenu::prepare_functions($env{'request.noversionuri'},
@@ -6660,8 +6674,38 @@ sub endbodytag {
}
if ( exists( $env{'internal.head.redirect'} ) ) {
if (!(ref($args) eq 'HASH' && $args->{'noredirectlink'})) {
+ my ($endbodyjs,$idattr);
+ if ($env{'internal.head.to_opener'}) {
+ my $linkid = 'LC_continue_link';
+ $idattr = ' id="'.$linkid.'"';
+ my $redirect_for_js = &js_escape($env{'internal.head.redirect'});
+ $endbodyjs=<
+//
+
+ENDJS
+ }
$endbodytag=
- "
".
+ "$endbodyjs
".
&mt('Continue').''.
$endbodytag;
}
@@ -8525,6 +8569,10 @@ a#LC_content_toolbar_edittoplevel {
background-image:url(/res/adm/pages/edittoplevel.gif);
}
+a#LC_content_toolbar_printout {
+ background-image:url(/res/adm/pages/printout.gif);
+}
+
ul#LC_toolbar li a:hover {
background-position: bottom center;
}
@@ -8827,7 +8875,12 @@ Inputs: $title - optional title for the
3- whether the side effect should occur
(side effect of setting
$env{'internal.head.redirect'} to the url
- redirected too)
+ redirected to)
+ 4- whether the redirect target should be
+ the opener of the current (pop-up)
+ window (side effect of setting
+ $env{'internal.head.to_opener'} to
+ 1, if true.
domain -> force to color decorate a page for a specific
domain
function -> force usage of a specific rolish color scheme
@@ -8890,15 +8943,43 @@ sub headtag {
}
}
if (ref($args->{'redirect'})) {
- my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
+ my ($time,$url,$inhibit_continue,$to_opener) = @{$args->{'redirect'}};
$url = &Apache::lonenc::check_encrypt($url);
if (!$inhibit_continue) {
$env{'internal.head.redirect'} = $url;
}
- $result.=<
+ADDMETA
+ if ($to_opener) {
+ $env{'internal.head.to_opener'} = 1;
+ my $dest = &js_escape($url);
+ my $timeout = int($time * 1000);
+ $result .=<<"ENDJS";
+
+ENDJS
+ } else {
+ $result.=<<"ADDMETA";
ADDMETA
+ }
} else {
unless (($args->{'frameset'}) || ($args->{'js_ready'}) || ($args->{'only_body'}) || ($args->{'no_nav_bar'})) {
my $requrl = $env{'request.uri'};
@@ -9335,6 +9416,7 @@ sub start_page {
}
}
+ my $showncrumbs;
if (! exists($args->{'skip_phases'}{'body'}) ) {
if ($args->{'frameset'}) {
my $attr_string = &make_attr_string($args->{'force_register'},
@@ -9347,7 +9429,8 @@ sub start_page {
$args->{'only_body'}, $args->{'domain'},
$args->{'force_register'}, $args->{'no_nav_bar'},
$args->{'bgcolor'}, $args,
- \@advtools,$ltiscope,$ltiuri,\%ltimenu,$menucoll,\%menu);
+ \@advtools,$ltiscope,$ltiuri,\%ltimenu,$menucoll,
+ \%menu,\$showncrumbs);
}
}
@@ -9369,6 +9452,7 @@ sub start_page {
#Breadcrumbs
if (exists($args->{'bread_crumbs'}) or exists($args->{'bread_crumbs_component'})) {
+ unless ($showncrumbs) {
&Apache::lonhtmlcommon::clear_breadcrumbs();
#if any br links exists, add them to the breadcrumbs
if (exists($args->{'bread_crumbs'}) and ref($args->{'bread_crumbs'}) eq 'ARRAY') {
@@ -9391,12 +9475,20 @@ sub start_page {
} else {
undef($menulink);
}
+ my $linkprotout;
+ if ($env{'request.deeplink.login'}) {
+ my $linkprotout = &Apache::lonmenu::linkprot_exit();
+ if ($linkprotout) {
+ &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout);
+ }
+ }
#if bread_crumbs_component exists show it as headline else show only the breadcrumbs
if(exists($args->{'bread_crumbs_component'})){
$result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'},'',$menulink);
} else {
$result .= &Apache::lonhtmlcommon::breadcrumbs('','',$menulink);
}
+ }
}
return $result;
}