[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm lonnavmaps.pm
raeburn
raeburn at source.lon-capa.org
Mon Jun 27 16:35:51 EDT 2022
raeburn Mon Jun 27 20:35:51 2022 EDT
Modified files:
/loncom/interface lonnavmaps.pm lonhelper.pm
Log:
- Bug 6907
- Support printout option: "Selected Resources from selected folder in course"
in sessions launched via deep-link.
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.559 loncom/interface/lonnavmaps.pm:1.560
--- loncom/interface/lonnavmaps.pm:1.559 Thu Jun 23 19:31:39 2022
+++ loncom/interface/lonnavmaps.pm Mon Jun 27 20:35:51 2022
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.559 2022/06/23 19:31:39 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.560 2022/06/27 20:35:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1724,11 +1724,31 @@
# mark as hidden for users who have $userCanSeeHidden.
# Use DFS for speed, since structure actually doesn't matter,
# except what map has what resources.
+ #
+ # To ensure the "Selected Resources from selected folder in course"
+ # printout generation option will work in sessions launched via a
+ # deep link, the value of $args->{'filterFunc'} included in the
+ # call to lonnavmaps::render() is omitted from the filter function
+ # used with the DFS Iterator when $args->{'caller'} is 'printout'.
+ #
+ # As a result $sequence->{DATA}->{HAS_VISIBLE_CHILDREN} can be
+ # set to 1 for folder(s) which include resources only accessible
+ # for sessions launched via a deep link, when the current session
+ # is of that type.
my $dfsit = Apache::lonnavmaps::DFSiterator->new($navmap,
$it->{FIRST_RESOURCE},
$it->{FINISH_RESOURCE},
{}, undef, 1);
+ my $dfsFilterFunc;
+ if ($args->{'caller'} eq 'printout') {
+ $dfsFilterFunc = sub { my $res = shift; return !$res->randomout() &&
+ ($res->deeplink($args->{'caller'}) ne 'absent') &&
+ ($res->deeplink($args->{'caller'}) ne 'grades') &&
+ !$res->deeplinkout();};
+ } else {
+ $dfsFilterFunc = $filterFunc;
+ }
my $depth = 0;
$dfsit->next();
my $curRes = $dfsit->next();
@@ -1747,8 +1767,9 @@
} elsif ($curRes->src()) {
# Not a sequence: if it's filtered, ignore it, otherwise
# rise up the stack and mark the sequences as having children
- if (&$filterFunc($curRes)) {
+ if (&$dfsFilterFunc($curRes)) {
for my $sequence (@{$dfsit->getStack()}) {
+ next unless ($sequence->is_map());
$sequence->{DATA}->{HAS_VISIBLE_CHILDREN} = 1;
}
}
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.203 loncom/interface/lonhelper.pm:1.204
--- loncom/interface/lonhelper.pm:1.203 Sat Jun 11 14:51:49 2022
+++ loncom/interface/lonhelper.pm Mon Jun 27 20:35:51 2022
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.203 2022/06/11 14:51:49 raeburn Exp $
+# $Id: lonhelper.pm,v 1.204 2022/06/27 20:35:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2546,6 +2546,10 @@
push @$cols, (Apache::lonnavmaps::part_status_summary());
}
+ my $caller;
+ if ($helper->{TITLE} eq 'Printing Helper') {
+ $caller = 'printout';
+ }
$result .=
&Apache::lonnavmaps::render( { 'cols' => $cols,
'showParts' => 0,
@@ -2558,7 +2562,8 @@
'map_no_edit_link' => 1,
'modalLink' => $modalLink,
'nocurrloc' => $self->{'nocurrloc'},
- 'suppressNavmap' => $self->{'suppressNavmap'}, }
+ 'suppressNavmap' => $self->{'suppressNavmap'},
+ 'caller' => $caller, }
);
$result .= $buttons;
More information about the LON-CAPA-cvs
mailing list