--- loncom/interface/lonnavmaps.pm 2025/01/16 21:26:55 1.509.2.14.2.10
+++ loncom/interface/lonnavmaps.pm 2025/05/28 04:25:24 1.509.2.14.2.11
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.509.2.14.2.10 2025/01/16 21:26:55 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.509.2.14.2.11 2025/05/28 04:25:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
@@ -1366,13 +1366,17 @@ sub cmp_title {
sub render {
my $args = shift;
&Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
- my $result = '';
# Configure the renderer.
my $cols = $args->{'cols'};
if (!defined($cols)) {
# no columns, no nav maps.
return '';
}
+ my $legend = '';
+ my $tools = '';
+ my $result = '';
+ my $tools_printed = 0;
+ my $tablestarted = 0;
my $navmap;
if (defined($args->{'navmap'})) {
$navmap = $args->{'navmap'};
@@ -1584,24 +1588,24 @@ sub render {
# Print key?
if ($printKey) {
- $result .= '
';
- $result.='Key: | ';
+ $legend = '';
+ $legend .= '
';
}
if ($printCloseAll && !$args->{'resource_no_folder_link'}) {
@@ -1621,9 +1625,9 @@ sub render {
"location.href='$link'",$text);
}
} else {
- $result.= ''.&mt($text).'';
+ $tools = ''.&mt($text).'';
}
- $result .= "\n";
+ $tools .= "\n";
}
# Check for any unread discussions in all resources.
@@ -1633,7 +1637,7 @@ sub render {
'Mark all posts read');
my $time=time;
my $querystr = &HTML::Entities::encode($ENV{'QUERY_STRING'},'<>&"');
- $result .= (<
@@ -1650,13 +1654,13 @@ END
}
if ($totdisc > 0) {
$haveDisc =~ s/:$//;
- $result .= (<
END
}
}
- $result.='';
+ $tools .= '';
}
if (($args->{'caller'} eq 'navmapsdisplay') && ($env{'request.course.id'})) {
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -1678,23 +1682,15 @@ END
}
if ($args->{'caller'} eq 'navmapsdisplay') {
- $result .= &show_linkitems_toolbar($args,$condition);
+ $tools .= &show_linkitems_toolbar($args,$condition);
} elsif ($args->{'sort_html'}) {
- $result.=$args->{'sort_html'};
+ $tools .= $args->{'sort_html'};
}
- #$result .= "
\n";
- if ($r) {
- $r->print($result);
- $r->rflush();
- $result = "";
- }
+ #$tools .= "
\n";
# End parameter setting
-
- $result .= "
\n";
# Data
- $result.=&Apache::loncommon::start_data_table("LC_tableOfContent");
my $res = "Apache::lonnavmaps::resource";
my %condenseStatuses =
@@ -1928,6 +1924,10 @@ END
}
$args->{'counter'}++;
+ unless ($tablestarted) {
+ $result .= "
\n".&Apache::loncommon::start_data_table("LC_tableOfContent");
+ $tablestarted = 1;
+ }
# Does it have multiple parts?
$args->{'multipart'} = 0;
@@ -2078,6 +2078,12 @@ END
}
if ($r && $rownum % 20 == 0) {
+ unless ($tools_printed) {
+ $r->print($legend.$tools);
+ $legend = "";
+ $tools = "";
+ $tools_printed = 1;
+ }
$r->print($result);
$result = "";
$r->rflush();
@@ -2093,8 +2099,10 @@ END
}
}
- $result.=&Apache::loncommon::end_data_table();
-
+ if ($tablestarted) {
+ $result.=&Apache::loncommon::end_data_table();
+ }
+
# Print out the part that jumps to #curloc if it exists
# delay needed because the browser is processing the jump before
# it finishes rendering, so it goes to the wrong place!
@@ -2111,12 +2119,23 @@ if (location.href.indexOf('#curloc')==-1
}
if ($r) {
+ unless ($tools_printed) {
+ if (($args->{'counter'}) || ($userCanSeeHidden) ||
+ (($args->{'caller'} eq 'navmapsdisplay') &&
+ ($env{'form.showOnlyHomework'} ||
+ $ENV{QUERY_STRING} =~ /^jumpToFirstHomework/))) {
+ $r->print($legend.$tools);
+ }
+ $legend = "";
+ $tools = "";
+ $tools_printed = 1;
+ }
$r->print($result);
$result = "";
$r->rflush();
}
- return $result;
+ return $legend.$tools.$result;
}
sub add_linkitem {