--- loncom/interface/lonnavmaps.pm 2025/02/26 19:50:21 1.572
+++ loncom/interface/lonnavmaps.pm 2025/05/27 23:31:49 1.575
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.572 2025/02/26 19:50:21 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.575 2025/05/27 23:31:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1380,13 +1380,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'};
@@ -1604,15 +1608,15 @@ sub render {
# Print key?
if ($printKey) {
my $location = &Apache::loncommon::lonhttpdurl("/adm/lonMisc");
- $result .= '
'.
- ''."\n";
+ $legend = ''.
+ ''."\n";
}
if ($printCloseAll && !$args->{'resource_no_folder_link'}) {
@@ -1632,9 +1636,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.
@@ -1646,7 +1650,7 @@ sub render {
my $time=time;
my $submit = &mt($markread);
my $querystr = &HTML::Entities::encode($ENV{'QUERY_STRING'},'<>&"');
- $result .= (<
@@ -1663,12 +1667,12 @@ END
}
if ($totdisc > 0) {
$haveDisc =~ s/:$//;
- $result .= (<
END
}
}
- $result .= <
END
@@ -1693,31 +1697,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
- if ($counter) {
- $result.=&Apache::loncommon::start_data_table("LC_tableOfContent").
- &Apache::loncommon::start_data_table_header_row('LC_visually_hidden').
- ''.&mt('Resource or Folder').' | '.
- ''.&mt('Alerts').' | '.
- ''.&mt('Status Icon').' | '.
- ''.&mt('Date/Completion Status').' | '.
- &Apache::loncommon::end_data_table_row()."\n";
- }
my $res = "Apache::lonnavmaps::resource";
my %condenseStatuses =
@@ -1729,7 +1717,8 @@ END
$args->{'counter'} = 0; # counts the rows
$args->{'indentLevel'} = 0;
$args->{'isNewBranch'} = 0;
- $args->{'condensed'} = 0;
+ $args->{'condensed'} = 0;
+ $args->{'deeplinknolist'} = 0;
my $location = &Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif");
$args->{'indentString'} = setDefault($args->{'indentString'}, "
");
@@ -1904,6 +1893,9 @@ END
# If this has been filtered out, continue on
if (!(&$filterFunc($curRes))) {
+ if (!$userCanSeeHidden && !$curRes->randomout && $curRes->deeplinkout) {
+ $args->{'deeplinknolist'} ++;
+ }
$args->{'isNewBranch'} = 0; # Don't falsely remember this
next;
}
@@ -1928,6 +1920,7 @@ END
if ($userCanSeeHidden) {
$args->{'mapHiddenDeepLink'} = 1;
} else {
+ $args->{'deeplinknolist'} ++;
next;
}
} else {
@@ -1937,6 +1930,7 @@ END
if ($userCanSeeHidden) {
$args->{'mapUnlisted'} = 1;
} else {
+ $args->{'deeplinknolist'} ++;
next;
}
}
@@ -1950,6 +1944,16 @@ END
}
$args->{'counter'}++;
+ unless ($tablestarted) {
+ $result.=&Apache::loncommon::start_data_table("LC_tableOfContent").
+ &Apache::loncommon::start_data_table_header_row('LC_visually_hidden').
+ ''.&mt('Resource or Folder').' | '.
+ ''.&mt('Alerts').' | '.
+ ''.&mt('Status Icon').' | '.
+ ''.&mt('Date/Completion Status').' | '.
+ &Apache::loncommon::end_data_table_row()."\n";
+ $tablestarted = 1;
+ }
# Does it have multiple parts?
$args->{'multipart'} = 0;
@@ -2100,6 +2104,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();
@@ -2115,8 +2125,8 @@ END
}
}
- if ($counter) {
- $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
@@ -2135,12 +2145,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 {
@@ -3067,7 +3088,7 @@ sub parmval_real {
}
sub recurseup_maps {
- my ($self,$mapname,$getsymb) = @_;
+ my ($self,$mapname,$getsymb,$inclusive) = @_;
my @recurseup;
if ($mapname) {
my $res = $self->getResourceByUrl($mapname);
@@ -3081,6 +3102,13 @@ sub recurseup_maps {
@recurseup = map { &Apache::lonnet::declutter($self->getByMapPc($_)->src()); } reverse(@pcs);
}
}
+ if ($inclusive) {
+ if ($getsymb) {
+ unshift(@recurseup,$res->symb());
+ } else {
+ unshift(@recurseup,$mapname);
+ }
+ }
}
}
return @recurseup;