version 1.188, 2003/05/14 18:33:28
|
version 1.190, 2003/05/14 20:16:56
|
Line 737 returns a true or false value. If true,
|
Line 737 returns a true or false value. If true,
|
false, it is simply skipped in the display. By default, all resources |
false, it is simply skipped in the display. By default, all resources |
are shown. |
are shown. |
|
|
|
=item * B<suppressEmptySequences>: |
|
|
|
If you're using a filter function, and displaying sequences to orient |
|
the user, then frequently some sequences will be empty. Setting this to |
|
true will cause those sequences not to display, so as not to confuse the |
|
user into thinking that if the sequence is there there should be things |
|
under it. |
|
|
=item * B<suppressNavmaps>: |
=item * B<suppressNavmaps>: |
|
|
If true, will not display Navigate Content resources. Default to |
If true, will not display Navigate Content resources. Default to |
Line 1223 sub render {
|
Line 1231 sub render {
|
$args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='/adm/lonIcons/whitespace1.gif' width='25' height='1' alt='' border='0' />"); |
$args->{'indentString'} = setDefault($args->{'indentString'}, "<img src='/adm/lonIcons/whitespace1.gif' width='25' height='1' alt='' border='0' />"); |
$args->{'displayedHereMarker'} = 0; |
$args->{'displayedHereMarker'} = 0; |
|
|
|
# If we're suppressing empty sequences, look for them here. Use DFS for speed, |
|
# since structure actually doesn't matter, except what map has what resources. |
|
if ($args->{'suppressEmptySequences'}) { |
|
my $dfsit = Apache::lonnavmaps::DFSiterator->new($navmap, |
|
$it->{FIRST_RESOURCE}, |
|
$it->{FINISH_RESOURCE}, |
|
{}, undef, 1); |
|
$depth = 0; |
|
$dfsit->next(); |
|
my $curRes = $dfsit->next(); |
|
while ($depth > -1) { |
|
if ($curRes == $dfsit->BEGIN_MAP()) { $depth++; } |
|
if ($curRes == $dfsit->END_MAP()) { $depth--; } |
|
|
|
if (ref($curRes)) { |
|
# Parallel pre-processing: Do sequences have non-filtered-out children? |
|
if ($curRes->is_sequence()) { |
|
$curRes->{DATA}->{HAS_VISIBLE_CHILDREN} = 0; |
|
# Sequences themselves do not count as visible children, |
|
# unless those sequences also have visible children. |
|
# This means if a sequence appears, there's a "promise" |
|
# that there's something under it if you open it, somewhere. |
|
} else { |
|
# Not a sequence: if it's filtered, ignore it, otherwise |
|
# rise up the stack and mark the sequences as having children |
|
if (&$filterFunc($curRes)) { |
|
for my $sequence (@{$dfsit->getStack()}) { |
|
$sequence->{DATA}->{HAS_VISIBLE_CHILDREN} = 1; |
|
} |
|
} |
|
} |
|
} |
|
} continue { |
|
$curRes = $dfsit->next(); |
|
} |
|
} |
|
|
my $displayedJumpMarker = 0; |
my $displayedJumpMarker = 0; |
# Set up iteration. |
# Set up iteration. |
$depth = 1; |
$depth = 1; |
Line 1266 sub render {
|
Line 1311 sub render {
|
next; |
next; |
} |
} |
|
|
|
# If this is an empty sequence and we're filtering them, continue on |
|
if ($curRes->is_sequence() && $args->{'suppressEmptySequences'} && |
|
!$curRes->{DATA}->{HAS_VISIBLE_CHILDREN}) { |
|
next; |
|
} |
|
|
# If we're suppressing navmaps and this is a navmap, continue on |
# If we're suppressing navmaps and this is a navmap, continue on |
if ($suppressNavmap && $curRes->src() =~ /^\/adm\/navmaps/) { |
if ($suppressNavmap && $curRes->src() =~ /^\/adm\/navmaps/) { |
next; |
next; |
Line 2194 sub new {
|
Line 2245 sub new {
|
|
|
$curRes->{DATA}->{DISPLAY_DEPTH} = $finalDepth; |
$curRes->{DATA}->{DISPLAY_DEPTH} = $finalDepth; |
if ($finalDepth > $maxDepth) {$maxDepth = $finalDepth;} |
if ($finalDepth > $maxDepth) {$maxDepth = $finalDepth;} |
} |
} |
|
} continue { |
$curRes = $iterator->next(); |
$curRes = $iterator->next(); |
} |
} |
} |
} |
Line 2571 sub next {
|
Line 2623 sub next {
|
return $self->{HERE}; |
return $self->{HERE}; |
} |
} |
|
|
|
# Identical to the full iterator methods of the same name. Hate to copy/paste |
|
# but I also hate to "inherit" either iterator from the other. |
|
|
|
sub getStack { |
|
my $self=shift; |
|
|
|
my @stack; |
|
|
|
$self->populateStack(\@stack); |
|
|
|
return \@stack; |
|
} |
|
|
|
# Private method: Calls the iterators recursively to populate the stack. |
|
sub populateStack { |
|
my $self=shift; |
|
my $stack = shift; |
|
|
|
push @$stack, $self->{HERE} if ($self->{HERE}); |
|
|
|
if ($self->{RECURSIVE_ITERATOR_FLAG}) { |
|
$self->{RECURSIVE_ITERATOR}->populateStack($stack); |
|
} |
|
} |
|
|
1; |
1; |
|
|
package Apache::lonnavmaps::resource; |
package Apache::lonnavmaps::resource; |
Line 3201 sub extractParts {
|
Line 3278 sub extractParts {
|
my %responseIdHash; |
my %responseIdHash; |
my %responseTypeHash; |
my %responseTypeHash; |
|
|
|
|
|
# Init the responseIdHash |
|
foreach (@{$self->{PARTS}}) { |
|
$responseIdHash{$_} = []; |
|
} |
|
|
# Now, the unfortunate thing about this is that parts, part name, and |
# Now, the unfortunate thing about this is that parts, part name, and |
# response if are delimited by underscores, but both the part |
# response if are delimited by underscores, but both the part |
# name and response id can themselves have underscores in them. |
# name and response id can themselves have underscores in them. |
Line 3221 sub extractParts {
|
Line 3304 sub extractParts {
|
if ($parts{$partIdSoFar}) { |
if ($parts{$partIdSoFar}) { |
my @otherChunks = @partChunks[$i+1..$#partChunks]; |
my @otherChunks = @partChunks[$i+1..$#partChunks]; |
my $responseId = join('_', @otherChunks); |
my $responseId = join('_', @otherChunks); |
if (!defined($responseIdHash{$partIdSoFar})) { |
|
$responseIdHash{$partIdSoFar} = []; |
|
} |
|
push @{$responseIdHash{$partIdSoFar}}, $responseId; |
push @{$responseIdHash{$partIdSoFar}}, $responseId; |
$responseTypeHash{$partIdSoFar} = $responseType; |
$responseTypeHash{$partIdSoFar} = $responseType; |
last; |
last; |