version 1.116, 2003/07/15 20:59:53
|
version 1.117, 2003/07/16 19:28:08
|
Line 2669 LISTJAVASCRIPT
|
Line 2669 LISTJAVASCRIPT
|
sub getSymbMap { |
sub getSymbMap { |
my ($request) = @_; |
my ($request) = @_; |
my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db', |
my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db', |
$ENV{'request.course.fn'}.'_parms.db',1, 1); |
$ENV{'request.course.fn'}.'_parms.db'); |
$navmap->init(); |
$navmap->init(); |
|
|
# End navmap using boilerplate |
|
|
|
my $iterator = Apache::lonnavmaps::iterator->new($navmap, undef, undef, undef, undef, 1, undef, 1); |
|
my $depth = 1; |
|
my $curRes = $iterator->next(); |
|
|
|
my %symbx = (); |
my %symbx = (); |
my @titles = (); |
my @titles = (); |
my $minder=0; |
my $minder = 0; |
my $seenBeginMap = 0; |
|
while ($depth > 0 || !$seenBeginMap) { |
|
if ($curRes == $iterator->BEGIN_MAP()) {$depth++; $seenBeginMap = 1; } |
|
if ($curRes == $iterator->END_MAP()) { $depth--; } |
|
|
|
if (ref($curRes) && $curRes->is_map()) { |
|
my ($mapUrl, $id, $resUrl) = split(/___/, $curRes->symb()); # check map contains at least one problem |
|
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps |
|
|
|
my $mapiterator = $navmap->getIterator($map->map_start(), |
|
$map->map_finish()); |
|
|
|
my $mapdepth = 1; |
|
my $countProblems = 0; |
|
$mapiterator->next(); # skip the first BEGIN_MAP |
|
my $mapcurRes = $mapiterator->next(); # for "current resource" |
|
while ($mapdepth > 0) { |
|
if($mapcurRes == $mapiterator->BEGIN_MAP) { $mapdepth++; } |
|
if($mapcurRes == $mapiterator->END_MAP) { $mapdepth--; } |
|
|
|
if (ref($mapcurRes) && $mapcurRes->is_problem() && !$mapcurRes->randomout) { |
# Gather every sequence that has problems. |
$countProblems++; |
my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); }, 1); |
} |
for my $sequence ($navmap->getById('0.0'), @sequences) { |
$mapcurRes = $mapiterator->next(); |
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) { |
} |
my $title = $minder.'.'.$sequence->compTitle(); |
if ($countProblems > 0) { |
push @titles, $title; # minder in case two titles are identical |
my $title = $curRes->compTitle(); |
$symbx{$title} = $sequence->symb(); |
push @titles,$minder.'.'.$title; # minder, just in case two titles are identical |
$minder++; |
$symbx{$minder.'.'.$title} = $curRes->symb(); |
} |
$minder++; |
|
} |
|
} |
|
$curRes = $iterator->next(); |
|
} |
} |
|
|
$navmap->untieHashes(); |
$navmap->untieHashes(); |