version 1.99, 2002/11/08 18:44:02
|
version 1.106, 2002/11/14 21:36:23
|
Line 37
|
Line 37
|
# 3/1/1,6/1,17/1,29/1,30/1,2/8,9/21,9/24,9/25 Gerd Kortemeyer |
# 3/1/1,6/1,17/1,29/1,30/1,2/8,9/21,9/24,9/25 Gerd Kortemeyer |
# YEAR=2002 |
# YEAR=2002 |
# 1/1 Gerd Kortemeyer |
# 1/1 Gerd Kortemeyer |
# |
# Oct-Nov Jeremy Bowers |
|
|
package Apache::lonnavmaps; |
package Apache::lonnavmaps; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::lonnet(); |
|
use Apache::loncommon(); |
use Apache::loncommon(); |
use GDBM_File; |
|
use POSIX qw (floor strftime); |
use POSIX qw (floor strftime); |
|
|
sub handler { |
sub handler { |
Line 73 sub handler {
|
Line 71 sub handler {
|
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
|
|
# Create the nav map the nav map |
# Create the nav map |
my $navmap = Apache::lonnavmaps::navmap->new( |
my $navmap = Apache::lonnavmaps::navmap->new( |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}."_parms.db", 1, 1); |
$ENV{"request.course.fn"}."_parms.db", 1, 1); |
Line 89 sub handler {
|
Line 87 sub handler {
|
$r->print(&Apache::loncommon::bodytag('Navigate Course Map','', |
$r->print(&Apache::loncommon::bodytag('Navigate Course Map','', |
'')); |
'')); |
$r->print('<script>window.focus();</script>'); |
$r->print('<script>window.focus();</script>'); |
my $desc=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
|
$r->print('<table border="0" cellpadding="2" cellspacing="0">'); |
$r->print('<table border="0" cellpadding="2" cellspacing="0">'); |
my $date=localtime; |
my $date=localtime; |
$r->print('<tr><td align="right" valign="bottom">Key: </td>'); |
$r->print('<tr><td align="right" valign="bottom">Key: </td>'); |
|
|
|
# Print discussions and feedback header |
if ($navmap->{LAST_CHECK}) { |
if ($navmap->{LAST_CHECK}) { |
$r->print('<td align="center" valign="bottom"> '. |
$r->print('<td align="center" valign="bottom"> '. |
'<img src="/adm/lonMisc/chat.gif"> New discussion since '. |
'<img src="/adm/lonMisc/chat.gif"> New discussion since '. |
Line 107 sub handler {
|
Line 107 sub handler {
|
'</td>'); |
'</td>'); |
} |
} |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
|
|
my $condition = 0; |
my $condition = 0; |
if ($ENV{'form.condition'}) { |
if ($ENV{'form.condition'}) { |
$condition = 1; |
$condition = 1; |
Line 135 sub handler {
|
Line 136 sub handler {
|
# is technically not proper, but should be harmless |
# is technically not proper, but should be harmless |
my $res = $navmap->firstResource(); |
my $res = $navmap->firstResource(); |
|
|
|
# These are some data tables, which make it easy to change some of |
|
# of the specific visualization parameters if desired. |
|
|
# Defines a status->color mapping, null string means don't color |
# Defines a status->color mapping, null string means don't color |
my %colormap = |
my %colormap = |
( $res->NETWORK_FAILURE => '', |
( $res->NETWORK_FAILURE => '', |
Line 192 sub handler {
|
Line 196 sub handler {
|
my $currenturl = $ENV{'form.postdata'}; |
my $currenturl = $ENV{'form.postdata'}; |
$currenturl=~s/^http\:\/\///; |
$currenturl=~s/^http\:\/\///; |
$currenturl=~s/^[^\/]+//; |
$currenturl=~s/^[^\/]+//; |
|
|
# alreadyHere allows us to only open the maps necessary to view |
# alreadyHere allows us to only open the maps necessary to view |
# the current location once, while at the same time remembering |
# the current location once, while at the same time remembering |
# the current location. Without that check, the user would never |
# the current location. Without that check, the user would never |
Line 210 sub handler {
|
Line 215 sub handler {
|
# Here's a simple example of the iterator. |
# Here's a simple example of the iterator. |
# Preprocess the map: Look for current URL, force inlined maps to display |
# Preprocess the map: Look for current URL, force inlined maps to display |
|
|
# This currently does very little... |
my $mapIterator = $navmap->getIterator(undef, undef, \%filterHash, 1); |
#my $mapEventualIterator = Apache::lonnavmaps::iterator->new($navmap, undef, undef, {}, |
|
#undef, $condition); |
|
|
|
my $mapIterator = $navmap->getIterator(undef, undef, {}, 1); |
|
my $found = 0; |
my $found = 0; |
my $depth = 1; |
my $depth = 1; |
my $currentUrlIndex = 0; # keeps track of when the current resource is found, |
my $currentUrlIndex = 0; # keeps track of when the current resource is found, |
# so we can back up a few and put the anchor above the |
# so we can back up a few and put the anchor above the |
# current resource |
# current resource |
|
my $currentUrlDelta = 5; # change this to change how many resources are displayed |
|
# before the current resource when using #current |
$mapIterator->next(); # discard the first BEGIN_MAP |
$mapIterator->next(); # discard the first BEGIN_MAP |
my $curRes = $mapIterator->next(); |
my $curRes = $mapIterator->next(); |
my $counter = 0; |
my $counter = 0; |
Line 237 sub handler {
|
Line 240 sub handler {
|
# show it by making sure the containing maps |
# show it by making sure the containing maps |
# are open. |
# are open. |
|
|
|
# This is why we have to use the main iterator instead of the |
|
# potentially faster DFS: The count has to be the same, so |
|
# the order has to be the same, which DFS won't give us. |
$currentUrlIndex = $counter; |
$currentUrlIndex = $counter; |
|
|
|
# Ensure the parent maps are open |
for my $map (@{$mapStack}) { |
for my $map (@{$mapStack}) { |
if ($condition) { |
if ($condition) { |
undef $filterHash{$map->map_pc()}; |
undef $filterHash{$map->map_pc()}; |
Line 286 sub handler {
|
Line 293 sub handler {
|
|
|
$counter = 0; |
$counter = 0; |
|
|
|
# Print the 'current' anchor here if it would fall off the top |
|
if ($currentUrlIndex - $currentUrlDelta < 0) { |
|
$r->print('<a name="current" />'); |
|
} |
|
|
while ($depth > 0) { |
while ($depth > 0) { |
# If we're in a new style course, and this is a BEGIN_MAP, END_MAP, or |
# If this is an inlined map, cancel the shift to the right, |
# map resource and the stack depth is only one, just plain ignore this resource |
# which has the effect of making the map look inlined |
# entirely. (This has the effect of inlining the resources in that map |
|
# in the nav map.) |
|
if ($inlineTopLevelMaps && scalar(@{$mapIterator->getStack()}) == 1 && |
if ($inlineTopLevelMaps && scalar(@{$mapIterator->getStack()}) == 1 && |
ref($curRes) && $curRes->is_map()) { |
ref($curRes) && $curRes->is_map()) { |
# We let the normal depth stuff occur, but we need to shift everything |
|
# over by one to the left to make it look right. |
|
$deltadepth = -1; |
$deltadepth = -1; |
$curRes = $mapIterator->next(); |
$curRes = $mapIterator->next(); |
next; |
next; |
Line 319 sub handler {
|
Line 327 sub handler {
|
if ($depth == 1) { $deltadepth = 0; } # we're done shifting, because we're |
if ($depth == 1) { $deltadepth = 0; } # we're done shifting, because we're |
# out of the inlined map |
# out of the inlined map |
|
|
# Is this resource being blotted out? |
# Is this resource being ignored because it is in a random-out |
|
# map and it was not selected? |
if (ref($curRes) && !advancedUser() && $curRes->randomout()) { |
if (ref($curRes) && !advancedUser() && $curRes->randomout()) { |
$curRes = $mapIterator->next(); |
$curRes = $mapIterator->next(); |
next; # and totally ignore this resource |
next; # if yes, then just ignore this resource |
} |
} |
|
|
if (ref($curRes) && $curRes->src()) { |
if (ref($curRes) && $curRes->src()) { |
Line 333 sub handler {
|
Line 342 sub handler {
|
my $condensed = 0; |
my $condensed = 0; |
|
|
if ($curRes->is_problem()) { |
if ($curRes->is_problem()) { |
# Is it multipart? |
|
|
|
|
# Is it multipart? |
if ($multipart) { |
if ($multipart) { |
# If it's multipart, see if part 0 is "open" |
# If it's multipart, see if part 0 is "open" |
# if it is, display all parts, if it isn't, |
# if it is, display all parts, if it isn't, |
# just display first |
# just display first |
if (!$curRes->opendate("0")) { |
if (!$curRes->opendate("0")) { |
@parts = ("0"); # just display the zero-th part |
# no parts are open, display as one part |
|
@parts = ("0"); |
$condensed = 1; |
$condensed = 1; |
} else { |
} else { |
# Otherwise, only display part 0 if we want to |
# Otherwise, only display part 0 if we want to |
Line 348 sub handler {
|
Line 358 sub handler {
|
if ($curRes->hasDiscussion() || $curRes->getFeedback()) { |
if ($curRes->hasDiscussion() || $curRes->getFeedback()) { |
shift @parts; |
shift @parts; |
} else { |
} else { |
# If there's discussion or feedback, that counts |
|
# as a difference, so display the parts. |
|
|
|
# Now, we decide whether to condense the |
# Now, we decide whether to condense the |
# parts due to similarity |
# parts due to similarity |
my $status = $curRes->status($parts[1]); |
my $status = $curRes->status($parts[1]); |
Line 391 sub handler {
|
Line 398 sub handler {
|
} else { |
} else { |
$parts[0] = "0"; # this is to get past foreach loop below |
$parts[0] = "0"; # this is to get past foreach loop below |
# you can consider a non-problem resource as a resource |
# you can consider a non-problem resource as a resource |
# with only one part without loss |
# with only one part without loss, and it simplifies the looping |
} |
} |
|
|
# Is it a multipart problem with a single part, now in |
# Is it a multipart problem with a single part, now in |
# @parts with "0" filtered out? If so, forget it's a multi-part |
# @parts with "0" filtered out? If so, 'forget' it's a multi-part |
# problem and treat it like a single-part problem. |
# problem and treat it like a single-part problem. |
if ( scalar(@parts) == 1 ) { |
if ( scalar(@parts) == 1 ) { |
$multipart = 0; |
$multipart = 0; |
Line 403 sub handler {
|
Line 410 sub handler {
|
|
|
# Display one part, in event of network error. |
# Display one part, in event of network error. |
# If this is a single part, we can at least show the correct |
# If this is a single part, we can at least show the correct |
# status, but if it's multipart, we're lost. |
# status, but if it's multipart, we're lost, since we can't |
|
# retreive the metadata to count the parts |
if ($curRes->{RESOURCE_ERROR}) { |
if ($curRes->{RESOURCE_ERROR}) { |
@parts = ("0"); |
@parts = ("0"); |
} |
} |
|
|
# Step two: Show the parts |
# Step Two: Print the actual data. |
|
|
|
# For each part we intend to display... |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
|
|
my $deltalevel = 0; # for inserting the branch icon |
my $deltalevel = 0; # for inserting the branch icon |
my $nonLinkedText = ""; # unlinked stuff after title |
my $nonLinkedText = ""; # unlinked stuff after title |
|
|
# For each thing we're displaying... |
|
|
|
my $stack = $mapIterator->getStack(); |
my $stack = $mapIterator->getStack(); |
my $src = getLinkForResource($stack); |
my $src = getLinkForResource($stack); |
|
|
|
# Pass the correct symb on the querystring, so the |
|
# remote will figure out where we are if we click a link |
my $srcHasQuestion = $src =~ /\?/; |
my $srcHasQuestion = $src =~ /\?/; |
my $link = $src. |
my $link = $src. |
($srcHasQuestion?'&':'?') . |
($srcHasQuestion?'&':'?') . |
'symb='.&Apache::lonnet::escape($curRes->symb()). |
'symb='.&Apache::lonnet::escape($curRes->symb()). |
'"'; |
'"'; |
my $title = $curRes->title(); |
|
if (!$title) { |
my $title = $curRes->compTitle(); |
$title = $curRes->src(); |
|
$title = substr ($title, rindex($title, "/") + 1); |
|
} |
|
my $partLabel = ""; |
my $partLabel = ""; |
my $newBranchText = ""; |
my $newBranchText = ""; |
|
|
# If this is a new branch, label it so |
# If this is a new branch, label it so |
# (temporary, this should be an icon w/ alt text) |
|
if ($isNewBranch) { |
if ($isNewBranch) { |
$newBranchText = "<img src=\"/adm/lonIcons/branch.gif\" border=\"0\">"; |
$newBranchText = "<img src=\"/adm/lonIcons/branch.gif\" border=\"0\">"; |
$isNewBranch = 0; |
$isNewBranch = 0; |
$deltalevel = 1; |
$deltalevel = 1; # reserves space for the branch icon |
} |
} |
|
|
# links to open and close the folders |
# links to open and close the folders |
Line 509 sub handler {
|
Line 515 sub handler {
|
# FIRST COL: The resource indentation, branch icon, name, and anchor |
# FIRST COL: The resource indentation, branch icon, name, and anchor |
$r->print(" <tr bgcolor=\"$backgroundColor\"><td align=\"left\" valign=\"center\" width=\"60%\">\n"); |
$r->print(" <tr bgcolor=\"$backgroundColor\"><td align=\"left\" valign=\"center\" width=\"60%\">\n"); |
|
|
# anchor for current resource... - 5 is deliberate: If it's that |
# Print the anchor if necessary |
# high on the screen, don't bother focusing on it. Also this will |
if ($counter == $currentUrlIndex - $currentUrlDelta) { |
# print multiple anchors if this is an expanded multi-part problem... |
|
# who cares? |
|
if ($counter == $currentUrlIndex - 5) { |
|
$r->print('<a name="current" />'); |
$r->print('<a name="current" />'); |
} |
} |
|
|
Line 523 sub handler {
|
Line 526 sub handler {
|
} |
} |
|
|
$r->print(" ${newBranchText}${linkopen}$icon${linkclose}\n"); |
$r->print(" ${newBranchText}${linkopen}$icon${linkclose}\n"); |
|
#$r->print($curRes->awarded($part)); |
|
|
my $curMarkerBegin = ""; |
my $curMarkerBegin = ""; |
my $curMarkerEnd = ""; |
my $curMarkerEnd = ""; |
Line 543 sub handler {
|
Line 547 sub handler {
|
} |
} |
|
|
$r->print(" $curMarkerBegin<a href=\"$link\">$title$partLabel</a> $curMarkerEnd $nonLinkedText"); |
$r->print(" $curMarkerBegin<a href=\"$link\">$title$partLabel</a> $curMarkerEnd $nonLinkedText"); |
#$r->print(" TDV:" . $curRes->{DATA}->{TOP_DOWN_VAL}); # temp |
|
#$r->print(" BUV:" . $curRes->{DATA}->{BOT_UP_VAL}); # temp |
|
#$r->print(" DD:" . $curRes->{DATA}->{DISPLAY_DEPTH}); # temp |
|
|
|
if ($curRes->{RESOURCE_ERROR}) { |
if ($curRes->{RESOURCE_ERROR}) { |
$r->print(&Apache::loncommon::help_open_topic ("Navmap_Host_Down", |
$r->print(&Apache::loncommon::help_open_topic ("Navmap_Host_Down", |
'<font size="-1">Host down</font>')); |
'<font size="-1">Host down</font>')); |
} |
} |
|
|
|
# SECOND COL: Is there text, feedback, errors?? |
my $discussionHTML = ""; my $feedbackHTML = ""; |
my $discussionHTML = ""; my $feedbackHTML = ""; |
|
|
# SECOND COL: Is there text, feedback, errors?? |
|
if ($curRes->hasDiscussion()) { |
if ($curRes->hasDiscussion()) { |
$discussionHTML = $linkopen . |
$discussionHTML = $linkopen . |
'<img border="0" src="/adm/lonMisc/chat.gif" />' . |
'<img border="0" src="/adm/lonMisc/chat.gif" />' . |
Line 577 sub handler {
|
Line 578 sub handler {
|
|
|
# Is this the first displayed part of a multi-part problem |
# Is this the first displayed part of a multi-part problem |
# that has not been condensed, so we should suppress these two |
# that has not been condensed, so we should suppress these two |
# columns? |
# columns so we don't display useless status info about part |
|
# "0"? |
my $firstDisplayed = !$condensed && $multipart && $part eq "0"; |
my $firstDisplayed = !$condensed && $multipart && $part eq "0"; |
|
|
# THIRD COL: Problem status icon |
# THIRD COL: Problem status icon |
Line 595 sub handler {
|
Line 597 sub handler {
|
} |
} |
|
|
# FOURTH COL: Text description |
# FOURTH COL: Text description |
#$r->print("<td $colorizer align=\"right\" valign=\"center\">\n"); |
|
$r->print("<td align=\"right\" valign=\"center\">\n"); |
$r->print("<td align=\"right\" valign=\"center\">\n"); |
|
|
if ($curRes->kind() eq "res" && |
if ($curRes->kind() eq "res" && |
Line 727 sub getDescription {
|
Line 728 sub getDescription {
|
} |
} |
} |
} |
|
|
|
# This puts a human-readable name on the ENV variable. |
sub advancedUser { |
sub advancedUser { |
return $ENV{'user.adv'}; |
return $ENV{'user.adv'}; |
} |
} |
Line 772 sub timeToHumanString {
|
Line 774 sub timeToHumanString {
|
$delta = -$delta; |
$delta = -$delta; |
} |
} |
|
|
# Is it in the future? |
|
if ( $delta > 0 ) { |
if ( $delta > 0 ) { |
# Is it less then a minute away? |
|
my $tense = $inPast ? " ago" : ""; |
my $tense = $inPast ? " ago" : ""; |
my $prefix = $inPast ? "" : "in "; |
my $prefix = $inPast ? "" : "in "; |
|
|
|
# Less then a minute |
if ( $delta < $minute ) { |
if ( $delta < $minute ) { |
if ($delta == 1) { return "${prefix}1 second$tense"; } |
if ($delta == 1) { return "${prefix}1 second$tense"; } |
return "$prefix$delta seconds$tense"; |
return "$prefix$delta seconds$tense"; |
} |
} |
|
|
# Is it less then an hour away? |
# Less then an hour |
if ( $delta < $hour ) { |
if ( $delta < $hour ) { |
# If so, use minutes |
# If so, use minutes |
my $minutes = floor($delta / 60); |
my $minutes = floor($delta / 60); |
Line 876 sub new {
|
Line 879 sub new {
|
$self->{GENERATE_COURSE_USER_OPT} = shift; |
$self->{GENERATE_COURSE_USER_OPT} = shift; |
$self->{GENERATE_EMAIL_DISCUSS_STATUS} = shift; |
$self->{GENERATE_EMAIL_DISCUSS_STATUS} = shift; |
|
|
# Resource cache stores navmapresource's as we reference them. We generate |
# Resource cache stores navmap resources as we reference them. We generate |
# them on-demand so we don't pay for creating resources unless we use them. |
# them on-demand so we don't pay for creating resources unless we use them. |
$self->{RESOURCE_CACHE} = {}; |
$self->{RESOURCE_CACHE} = {}; |
|
|
Line 1029 sub courseMapDefined {
|
Line 1032 sub courseMapDefined {
|
sub getIterator { |
sub getIterator { |
my $self = shift; |
my $self = shift; |
my $iterator = Apache::lonnavmaps::iterator->new($self, shift, shift, |
my $iterator = Apache::lonnavmaps::iterator->new($self, shift, shift, |
shift, undef, shift, |
shift, undef, shift); |
$ENV{'form.direction'}); |
|
return $iterator; |
return $iterator; |
} |
} |
|
|
Line 1121 sub finishResource {
|
Line 1123 sub finishResource {
|
return $self->getById($firstResource); |
return $self->getById($firstResource); |
} |
} |
|
|
# -------------------------------------------- Figure out a cascading parameter |
# Parmval reads the parm hash and cascades the lookups. parmval_real does |
# |
# the actual lookup; parmval caches the results. |
# For this function to work |
|
# |
|
# * parmhash needs to be tied |
|
# * courseopt and useropt need to be initialized for this user and course |
|
# |
|
|
|
sub parmval { |
sub parmval { |
my $self = shift; |
my $self = shift; |
my ($what,$symb)=@_; |
my ($what,$symb)=@_; |
Line 1230 sub parmval_real {
|
Line 1226 sub parmval_real {
|
|
|
package Apache::lonnavmaps::iterator; |
package Apache::lonnavmaps::iterator; |
|
|
# This package must precede "navmap" because "navmap" uses it. In |
|
# order to keep the documentation order straight, the iterator is documented |
|
# after the navmap object. |
|
|
|
=pod |
=pod |
|
|
=back |
=back |
Line 1254 getIterator behaves as follows:
|
Line 1246 getIterator behaves as follows:
|
|
|
=over 4 |
=over 4 |
|
|
=item B<getIterator>(firstResource, finishResource, filterHash, condition, direction): All parameters are optional. firstResource is a resource reference corresponding to where the iterator should start. It defaults to navmap->firstResource() for the corresponding nav map. finishResource corresponds to where you want the iterator to end, defaulting to navmap->finishResource(). filterHash is a hash used as a set containing strings representing the resource IDs, defaulting to empty. Condition is a 1 or 0 that sets what to do with the filter hash: If a 0, then only resource that exist IN the filterHash will be recursed on. If it is a 1, only resources NOT in the filterHash will be recursed on. Defaults to 0, which is to say, do not recurse unless explicitly asked to. Direction specifies which direction to recurse, either FORWARD or BACKWARD, with FORWARD being default. |
=item * B<getIterator>(firstResource, finishResource, filterHash, condition): All parameters are optional. firstResource is a resource reference corresponding to where the iterator should start. It defaults to navmap->firstResource() for the corresponding nav map. finishResource corresponds to where you want the iterator to end, defaulting to navmap->finishResource(). filterHash is a hash used as a set containing strings representing the resource IDs, defaulting to empty. Condition is a 1 or 0 that sets what to do with the filter hash: If a 0, then only resource that exist IN the filterHash will be recursed on. If it is a 1, only resources NOT in the filterHash will be recursed on. Defaults to 0. |
|
|
Thus, by default, all resources will be shown. Change the condition to a 1 without changing the hash, and only the top level of the map will be shown. Changing the condition to 1 and including some values in the hash will allow you to selectively examine parts of the navmap, while leaving it on 0 and adding things to the hash will allow you to selectively ignore parts of the nav map. See the handler code for examples: By default, the condition is 0 and all folders are closed unless explicitly opened. Clicking "Show All Resources" will use a condition of 1 and an empty filterHash, resulting in all resources being shown. |
Thus, by default, only top-level resources will be shown. Change the condition to a 1 without changing the hash, and all resources will be shown. Changing the condition to 1 and including some values in the hash will allow you to selectively suppress parts of the navmap, while leaving it on 0 and adding things to the hash will allow you to selectively add parts of the nav map. See the handler code for examples. |
|
|
The iterator will return either a reference to a resource object, or a token representing something in the map, such as the beginning of a new branch. The possible tokens are: |
The iterator will return either a reference to a resource object, or a token representing something in the map, such as the beginning of a new branch. The possible tokens are: |
|
|
Line 1358 sub new {
|
Line 1350 sub new {
|
my $resultingVal = $curRes->{DATA}->{$valName}; |
my $resultingVal = $curRes->{DATA}->{$valName}; |
my $nextResources = $curRes->$nextResourceMethod(); |
my $nextResources = $curRes->$nextResourceMethod(); |
my $resourceCount = scalar(@{$nextResources}); |
my $resourceCount = scalar(@{$nextResources}); |
|
|
if ($resourceCount == 1) { |
if ($resourceCount == 1) { |
my $current = $nextResources->[0]->{DATA}->{$valName} || 999999999; |
my $current = $nextResources->[0]->{DATA}->{$valName} || 999999999; |
$nextResources->[0]->{DATA}->{$valName} = min($resultingVal, $current); |
$nextResources->[0]->{DATA}->{$valName} = min($resultingVal, $current); |
Line 1371 sub new {
|
Line 1363 sub new {
|
} |
} |
} |
} |
} |
} |
if (ref($curRes) && $curRes->is_map() && $direction == FORWARD()) { |
|
my $firstResource = $curRes->map_start(); |
|
my $finishResource = $curRes->map_finish(); |
|
my $newIterator = Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, |
|
$firstResource, |
|
$finishResource, |
|
$self->{FILTER}, |
|
$self->{ALREADY_SEEN}, |
|
$self->{CONDITION}); |
|
} |
|
|
|
# Assign the final val |
# Assign the final val |
if (ref($curRes) && $direction == BACKWARD()) { |
if (ref($curRes) && $direction == BACKWARD()) { |
Line 1454 sub next {
|
Line 1436 sub next {
|
my $here; |
my $here; |
while ( $i >= 0 && !$found ) { |
while ( $i >= 0 && !$found ) { |
if ( scalar(@{$self->{STACK}->[$i]}) > 0 ) { |
if ( scalar(@{$self->{STACK}->[$i]}) > 0 ) { |
$here = $self->{HERE} = shift @{$self->{STACK}->[$i]}; |
$here = pop @{$self->{STACK}->[$i]}; |
$found = 1; |
$found = 1; |
$newDepth = $i; |
$newDepth = $i; |
} |
} |
Line 1472 sub next {
|
Line 1454 sub next {
|
} |
} |
} |
} |
|
|
|
# If this is not a resource, it must be an END_BRANCH marker we want |
|
# to return directly. |
|
if (!ref($here)) { |
|
if ($here == END_BRANCH()) { # paranoia, in case of later extension |
|
$self->{CURRENT_DEPTH}--; |
|
return $here; |
|
} |
|
} |
|
|
|
# Otherwise, it is a resource and it's safe to store in $self->{HERE} |
|
$self->{HERE} = $here; |
|
|
# Get to the right level |
# Get to the right level |
if ( $self->{CURRENT_DEPTH} > $newDepth ) { |
if ( $self->{CURRENT_DEPTH} > $newDepth ) { |
push @{$self->{STACK}->[$newDepth]}, $here; |
push @{$self->{STACK}->[$newDepth]}, $here; |
Line 1491 sub next {
|
Line 1485 sub next {
|
# So we need to look at all the resources we can get to from here, |
# So we need to look at all the resources we can get to from here, |
# categorize them if we haven't seen them, remember if we have a new |
# categorize them if we haven't seen them, remember if we have a new |
my $nextUnfiltered = $here->getNext(); |
my $nextUnfiltered = $here->getNext(); |
|
my $maxDepthAdded = -1; |
|
|
for (@$nextUnfiltered) { |
for (@$nextUnfiltered) { |
if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) { |
if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) { |
push @{$self->{STACK}->[$_->{DATA}->{DISPLAY_DEPTH}]}, $_; |
my $depth = $_->{DATA}->{DISPLAY_DEPTH}; |
|
push @{$self->{STACK}->[$depth]}, $_; |
$self->{ALREADY_SEEN}->{$_->{ID}} = 1; |
$self->{ALREADY_SEEN}->{$_->{ID}} = 1; |
|
if ($maxDepthAdded < $depth) { $maxDepthAdded = $depth; } |
} |
} |
} |
} |
|
|
|
# Is this the end of a branch? If so, all of the resources examined above |
|
# led to lower levels then the one we are currently at, so we push a END_BRANCH |
|
# marker onto the stack so we don't forget. |
|
# Example: For the usual A(BC)(DE)F case, when the iterator goes down the |
|
# BC branch and gets to C, it will see F as the only next resource, but it's |
|
# one level lower. Thus, this is the end of the branch, since there are no |
|
# more resources added to this level or above. |
|
my $isEndOfBranch = $maxDepthAdded < $self->{CURRENT_DEPTH}; |
|
if ($isEndOfBranch) { |
|
push @{$self->{STACK}->[$self->{CURRENT_DEPTH}]}, END_BRANCH(); |
|
} |
|
|
# That ends the main iterator logic. Now, do we want to recurse |
# That ends the main iterator logic. Now, do we want to recurse |
# down this map (if this resource is a map)? |
# down this map (if this resource is a map)? |
if ($self->{HERE}->is_map() && |
if ($self->{HERE}->is_map() && |
Line 1549 sub populateStack {
|
Line 1558 sub populateStack {
|
|
|
package Apache::lonnavmaps::DFSiterator; |
package Apache::lonnavmaps::DFSiterator; |
|
|
# UNDOCUMENTED: This is a private library, it should not generally be used |
# Not documented in the perldoc: This is a simple iterator that just walks |
# by the outside world. What it does is walk through the nav map in a |
# through the nav map and presents the resources in a depth-first search |
# depth-first fashion. This is not appropriate for most uses, but it is |
# fashion, ignorant of conditionals, randomized resources, etc. It presents |
# used by the main iterator for pre-processing. It also is able to isolate |
# BEGIN_MAP and END_MAP, but does not understand branches at all. It is |
# much of the complexity of the main iterator, so the main iterator is much |
# useful for pre-processing of some kind, and is in fact used by the main |
# simpler. |
# iterator that way, but that's about it. |
# There is no real benefit in merging the main iterator and this one into one class... |
# One could imagine merging this into the init routine of the main iterator, |
# all the logic in DFSiterator would need to be replicated, you gain no performance, |
# but this might as well be left seperate, since it is possible some other |
# at best, you just make one massively complicated iterator in place of two |
# use might be found for it. - Jeremy |
# somewhat complicated ones. ;-) - Jeremy |
|
|
|
# Here are the tokens for the iterator, replicated from iterator for convenience: |
|
|
|
sub BEGIN_MAP { return 1; } # begining of a new map |
sub BEGIN_MAP { return 1; } # begining of a new map |
sub END_MAP { return 2; } # end of the map |
sub END_MAP { return 2; } # end of the map |
sub BEGIN_BRANCH { return 3; } # beginning of a branch |
|
sub END_BRANCH { return 4; } # end of a branch |
|
sub FORWARD { return 1; } # go forward |
sub FORWARD { return 1; } # go forward |
sub BACKWARD { return 2; } |
sub BACKWARD { return 2; } |
|
|
# Params: nav map, start resource, end resource, filter, condition, |
# Params: Nav map ref, first resource id/ref, finish resource id/ref, |
# already seen hash ref |
# filter hash ref (or undef), already seen hash or undef, condition |
|
# (as in main iterator), direction FORWARD or BACKWARD (undef->forward). |
sub new { |
sub new { |
# magic invocation to create a class instance |
# magic invocation to create a class instance |
my $proto = shift; |
my $proto = shift; |
Line 1581 sub new {
|
Line 1585 sub new {
|
$self->{NAV_MAP} = shift; |
$self->{NAV_MAP} = shift; |
return undef unless ($self->{NAV_MAP}); |
return undef unless ($self->{NAV_MAP}); |
|
|
# Handle the parameters |
|
$self->{FIRST_RESOURCE} = shift || $self->{NAV_MAP}->firstResource(); |
$self->{FIRST_RESOURCE} = shift || $self->{NAV_MAP}->firstResource(); |
$self->{FINISH_RESOURCE} = shift || $self->{NAV_MAP}->finishResource(); |
$self->{FINISH_RESOURCE} = shift || $self->{NAV_MAP}->finishResource(); |
|
|
Line 1600 sub new {
|
Line 1603 sub new {
|
$self->{CONDITION} = shift; |
$self->{CONDITION} = shift; |
$self->{DIRECTION} = shift || FORWARD(); |
$self->{DIRECTION} = shift || FORWARD(); |
|
|
# Flag: Have we started yet? If not, the first action is to return BEGIN_MAP. |
# Flag: Have we started yet? |
$self->{STARTED} = 0; |
$self->{STARTED} = 0; |
|
|
# Should we continue calling the recursive iterator, if any? |
# Should we continue calling the recursive iterator, if any? |
Line 1614 sub new {
|
Line 1617 sub new {
|
$self->{RECURSIVE_DEPTH} = 0; |
$self->{RECURSIVE_DEPTH} = 0; |
|
|
# For keeping track of our branches, we maintain our own stack |
# For keeping track of our branches, we maintain our own stack |
$self->{BRANCH_STACK} = []; |
$self->{STACK} = []; |
# If the size shrinks, we exhausted a branch |
|
$self->{BRANCH_STACK_SIZE} = 0; |
|
$self->{BRANCH_DEPTH} = 0; |
|
|
|
# For returning two things in a forced sequence |
|
$self->{FORCE_NEXT} = undef; |
|
|
|
# Start with the first resource |
# Start with the first resource |
if ($self->{DIRECTION} == FORWARD) { |
if ($self->{DIRECTION} == FORWARD) { |
push @{$self->{BRANCH_STACK}}, $self->{FIRST_RESOURCE}; |
push @{$self->{STACK}}, $self->{FIRST_RESOURCE}; |
} else { |
} else { |
push @{$self->{BRANCH_STACK}}, $self->{FINISH_RESOURCE}; |
push @{$self->{STACK}}, $self->{FINISH_RESOURCE}; |
} |
} |
$self->{BRANCH_STACK_SIZE} = 1; |
|
|
|
bless($self); |
bless($self); |
return $self; |
return $self; |
} |
} |
|
|
# Note... this function is *touchy*. I strongly recommend tracing |
|
# through it with the debugger a few times on a non-trivial map before |
|
# modifying it. Order is *everything*. |
|
sub next { |
sub next { |
my $self = shift; |
my $self = shift; |
|
|
# Iterator logic goes here |
|
|
|
# Are we using a recursive iterator? If so, pull from that and |
# Are we using a recursive iterator? If so, pull from that and |
# watch the depth; we want to resume our level at the correct time. |
# watch the depth; we want to resume our level at the correct time. |
if ($self->{RECURSIVE_ITERATOR_FLAG}) { |
if ($self->{RECURSIVE_ITERATOR_FLAG}) { |
Line 1660 sub next {
|
Line 1651 sub next {
|
return $next; |
return $next; |
} |
} |
|
|
# Is this return value pre-determined? |
|
if (defined($self->{FORCE_NEXT})) { |
|
my $tmp = $self->{FORCE_NEXT}; |
|
$self->{FORCE_NEXT} = undef; |
|
return $tmp; |
|
} |
|
|
|
# Is there a current resource to grab? If not, then return |
# Is there a current resource to grab? If not, then return |
# END_BRANCH and END_MAP in succession. |
# END_MAP, which will end the iterator. |
if (scalar(@{$self->{BRANCH_STACK}}) == 0) { |
if (scalar(@{$self->{STACK}}) == 0) { |
if ($self->{BRANCH_DEPTH} > 0) { |
return $self->END_MAP(); |
$self->{FORCE_NEXT} = $self->END_MAP(); |
|
$self->{BRANCH_DEPTH}--; |
|
return $self->END_BRANCH(); |
|
} else { |
|
return $self->END_MAP(); |
|
} |
|
} |
} |
|
|
# Have we not yet begun? If not, return BEGIN_MAP and |
# Have we not yet begun? If not, return BEGIN_MAP and |
Line 1686 sub next {
|
Line 1664 sub next {
|
return $self->BEGIN_MAP; |
return $self->BEGIN_MAP; |
} |
} |
|
|
# Did the branch stack shrink since last run? If so, |
|
# we exhausted a branch last time, therefore, we're about |
|
# to start a new one. (We know because we already checked to see |
|
# if the stack was empty.) |
|
if ( scalar (@{$self->{BRANCH_STACK}}) < $self->{BRANCH_STACK_SIZE}) { |
|
$self->{BRANCH_STACK_SIZE} = scalar(@{$self->{BRANCH_STACK}}); |
|
$self->{BRANCH_DEPTH}++; |
|
return $self->BEGIN_BRANCH(); |
|
} |
|
|
|
# Remember the size for comparision next time. |
|
$self->{BRANCH_STACK_SIZE} = scalar(@{$self->{BRANCH_STACK}}); |
|
|
|
# If the next resource we mean to return is going to need |
|
# a lower branch level, terminate branches until we get |
|
# there. |
|
|
|
# Get the next resource in the branch |
# Get the next resource in the branch |
$self->{HERE} = pop @{$self->{BRANCH_STACK}}; |
$self->{HERE} = pop @{$self->{STACK}}; |
|
|
# Are we at the right depth? If not, close a branch and return |
# remember that we've seen this, so we don't return it again later |
# the current resource onto the branch stack |
|
# Note: There seems to be some bugs here, so don't rely |
|
# on this, use the real iterator instead. |
|
if (defined($self->{HERE}->{DATA}->{ITERATOR_DEPTH}) |
|
&& $self->{HERE}->{DATA}->{ITERATOR_DEPTH} < |
|
$self->{BRANCH_DEPTH} ) { |
|
$self->{BRANCH_DEPTH}--; |
|
# return it so we can pick it up eventually |
|
push @{$self->{BRANCH_STACK}}, $self->{HERE}; |
|
return $self->END_BRANCH(); |
|
} |
|
|
|
# We always return it after this point and never before |
|
# (proof: look at just the return statements), so we |
|
# remember that we've seen this. |
|
$self->{ALREADY_SEEN}->{$self->{HERE}->{ID}} = 1; |
$self->{ALREADY_SEEN}->{$self->{HERE}->{ID}} = 1; |
|
|
# Get the next possible resources |
# Get the next possible resources |
Line 1734 sub next {
|
Line 1680 sub next {
|
my $next = []; |
my $next = []; |
|
|
# filter the next possibilities to remove things we've |
# filter the next possibilities to remove things we've |
# already seen. Also, remember what branch depth they should |
# already seen. |
# be displayed at, since there's no other reliable way to tell. |
|
foreach (@$nextUnfiltered) { |
foreach (@$nextUnfiltered) { |
if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) { |
if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) { |
push @$next, $_; |
push @$next, $_; |
$_->{DATA}->{ITERATOR_DEPTH} = |
|
$self->{BRANCH_DEPTH} + 1; |
|
} |
} |
} |
} |
|
|
# Handle branch cases: |
|
# Nothing is available next: BRANCH_END |
|
# 1 thing next: standard non-branch |
|
# 2+ things next: have some branches |
|
my $nextCount = scalar(@$next); |
|
if ($nextCount == 0) { |
|
# Return this and on the next run, close the branch up if we're |
|
# in a branch |
|
if ($self->{BRANCH_DEPTH} > 0 ) { |
|
$self->{FORCE_NEXT} = $self->END_BRANCH(); |
|
$self->{BRANCH_DEPTH}--; |
|
} |
|
} |
|
|
|
while (@$next) { |
while (@$next) { |
# copy the next possibilities over to the branch stack |
# copy the next possibilities over to the stack |
# in the right order |
push @{$self->{STACK}}, shift @$next; |
push @{$self->{BRANCH_STACK}}, shift @$next; |
|
} |
|
|
|
if ($nextCount >= 2) { |
|
$self->{FORCE_NEXT} = $self->BEGIN_BRANCH(); |
|
$self->{BRANCH_DEPTH}++; |
|
return $self->{HERE}; |
|
} |
} |
|
|
# If this is a map and we want to recurse down it... (not filtered out) |
# If this is a map and we want to recurse down it... (not filtered out) |
Line 1786 sub next {
|
Line 1708 sub next {
|
return $self->{HERE}; |
return $self->{HERE}; |
} |
} |
|
|
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 1875 sub navHash {
|
Line 1775 sub navHash {
|
|
|
B<Metadata Retreival> |
B<Metadata Retreival> |
|
|
These are methods that help you retrieve metadata about the resource: |
These are methods that help you retrieve metadata about the resource: Method names are based on the fields in the compiled course representation. |
|
|
=over 4 |
=over 4 |
|
|
|
=item * B<compTitle>: Returns a "composite title", that is equal to $res->title() if the resource has a title, and is otherwise the last part of the URL (e.g., "problem.problem"). |
|
|
=item * B<ext>: Returns true if the resource is external. |
=item * B<ext>: Returns true if the resource is external. |
|
|
=item * B<goesto>: Returns the "goesto" value from the compiled nav map. (It is likely you want to use B<getNext> instead.) |
=item * B<goesto>: Returns the "goesto" value from the compiled nav map. (It is likely you want to use B<getNext> instead.) |
|
|
=item * B<kind>: Returns the kind of the resource from the compiled nav map. |
=item * B<kind>: Returns the kind of the resource from the compiled nav map. |
|
|
=item * B<randomout>: Returns true if this resource was chosen to NOT be shown to the user by the random map selection feature. |
=item * B<randomout>: Returns true if this resource was chosen to NOT be shown to the user by the random map selection feature. In other words, this is usually false. |
|
|
=item * B<randompick>: Returns true for a map if the randompick feature is being used on the map. (?) |
=item * B<randompick>: Returns true for a map if the randompick feature is being used on the map. (?) |
|
|
Line 1928 sub symb {
|
Line 1830 sub symb {
|
} |
} |
sub title { my $self=shift; return $self->navHash("title_", 1); } |
sub title { my $self=shift; return $self->navHash("title_", 1); } |
sub to { my $self=shift; return $self->navHash("to_", 1); } |
sub to { my $self=shift; return $self->navHash("to_", 1); } |
|
sub compTitle { |
|
my $self = shift; |
|
my $title = $self->title(); |
|
if (!$title) { |
|
$title = $self->src(); |
|
$title = substr($title, rindex($title, '/') + 1); |
|
} |
|
return $title; |
|
} |
=pod |
=pod |
|
|
B<Predicate Testing the Resource> |
B<Predicate Testing the Resource> |
Line 1945 These methods are shortcuts to deciding
|
Line 1855 These methods are shortcuts to deciding
|
|
|
=item * B<is_problem>: Returns true if the resource is a problem. |
=item * B<is_problem>: Returns true if the resource is a problem. |
|
|
=item * B<is_sequence>: Returns true if the resource sequence. |
=item * B<is_sequence>: Returns true if the resource is a sequence. |
|
|
=back |
=back |
|
|
Line 1974 sub is_sequence {
|
Line 1884 sub is_sequence {
|
return ($src =~ /sequence$/); |
return ($src =~ /sequence$/); |
} |
} |
|
|
|
# Private method: Shells out to the parmval in the nav map, handler parts. |
|
|
|
|
|
|
# Move this into POD: In order to use these correctly, courseopt |
|
# and useropt need to be generated |
|
sub parmval { |
sub parmval { |
my $self = shift; |
my $self = shift; |
my $what = shift; |
my $what = shift; |
Line 2093 sub answerdate {
|
Line 1998 sub answerdate {
|
} |
} |
return $self->parmval("answerdate", $part); |
return $self->parmval("answerdate", $part); |
} |
} |
|
sub awarded { |
|
(my $self, my $part) = @_; |
|
return $self->parmval("awarded", $part); |
|
} |
sub duedate { |
sub duedate { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
return $self->parmval("duedate", $part); |
return $self->parmval("duedate", $part); |
Line 2262 sub extractParts {
|
Line 2171 sub extractParts {
|
|
|
=head2 Resource Status |
=head2 Resource Status |
|
|
Problem resources have status information, reflecting their various dates and completion statuses. You can obtain this information and import symbolic constants to represent the status. |
Problem resources have status information, reflecting their various dates and completion statuses. |
|
|
There are two aspects to the status: the date-related information and the completion information. |
There are two aspects to the status: the date-related information and the completion information. |
|
|
Line 2279 Idiomatic usage of these two methods wou
|
Line 2188 Idiomatic usage of these two methods wou
|
... use it here ... |
... use it here ... |
} |
} |
|
|
|
Which you use depends on exactly what you are looking for. The status() function has been optimized for the nav maps display and may not precisely match what you need elsewhere. |
|
|
|
The symbolic constants shown below can be accessed through the resource object: $res->OPEN. |
|
|
=over 4 |
=over 4 |
|
|
=item * B<getDateStatus>($part): ($part defaults to 0). A convenience function that returns a symbolic constant telling you about the date status of the part. The possible return values are: |
=item * B<getDateStatus>($part): ($part defaults to 0). A convenience function that returns a symbolic constant telling you about the date status of the part. The possible return values are: |
Line 2415 sub getCompletionStatus {
|
Line 2328 sub getCompletionStatus {
|
|
|
B<Composite Status> |
B<Composite Status> |
|
|
Along with directly returning the date or completion status, the resource object includes a convenience function B<status>() that will combine the two status tidbits into one composite status that can represent the status of the resource as a whole. The precise logic is documented in the comments of the status method. The following results may be returned, all available as methods on the resource object ($res->NETWORK_FAILURE()): |
Along with directly returning the date or completion status, the resource object includes a convenience function B<status>() that will combine the two status tidbits into one composite status that can represent the status of the resource as a whole. The precise logic is documented in the comments of the status method. The following results may be returned, all available as methods on the resource object ($res->NETWORK_FAILURE): |
|
|
=over 4 |
=over 4 |
|
|
Line 2519 sub status {
|
Line 2432 sub status {
|
|
|
=over 4 |
=over 4 |
|
|
=item * B<getNext>($alreadySeenHashRef): Retreive an array of the possible next resources after this one. Always returns an array, even in the one- or zero-element case. The "alreadySeenHashRef" is an optional parameter that can be passed in to the method. If $$alreadySeenHashRef{$res->id()} is true in that hash, getNext will not return it in the list. In other words, you can use it to suppress resources you've already seen in the getNext method directly. |
=item * B<getNext>(): Retreive an array of the possible next resources after this one. Always returns an array, even in the one- or zero-element case. |
|
|
=item * B<getPrevious>($alreadySeenHashRef): Retreive an array of the possible previous resources from this one. Always returns an array, even in the one- or zero-element case. $alreadySeenHashRef is the same as in getNext. |
=item * B<getPrevious>(): Retreive an array of the possible previous resources from this one. Always returns an array, even in the one- or zero-element case. |
|
|
=cut |
=cut |
|
|
sub getNext { |
sub getNext { |
my $self = shift; |
my $self = shift; |
my $alreadySeenHash = shift; |
|
my @branches; |
my @branches; |
my $to = $self->to(); |
my $to = $self->to(); |
foreach my $branch ( split(/,/, $to) ) { |
foreach my $branch ( split(/,/, $to) ) { |
Line 2535 sub getNext {
|
Line 2447 sub getNext {
|
my $next = $choice->goesto(); |
my $next = $choice->goesto(); |
$next = $self->{NAV_MAP}->getById($next); |
$next = $self->{NAV_MAP}->getById($next); |
|
|
# Don't remember it if we've already seen it or if |
# Don't remember it if the student doesn't have browse priviledges |
# the student doesn't have browse priviledges |
# future note: this may properly belong in the client of the resource |
my $browsePriv = &Apache::lonnet::allowed('bre', $self->src); |
my $browsePriv = &Apache::lonnet::allowed('bre', $self->src); |
if (!defined($alreadySeenHash) || |
if (!($browsePriv ne '2' && $browsePriv ne 'F')) { |
!defined($alreadySeenHash->{$next->{ID}}) || |
push @branches, $next; |
($browsePriv ne '2' && $browsePriv ne 'F')) { |
} |
push @branches, $next; |
|
} |
|
} |
} |
return \@branches; |
return \@branches; |
} |
} |
|
|
sub getPrevious { |
sub getPrevious { |
my $self = shift; |
my $self = shift; |
my $alreadySeenHash = shift; |
|
my @branches; |
my @branches; |
my $from = $self->from(); |
my $from = $self->from(); |
foreach my $branch ( split /,/, $from) { |
foreach my $branch ( split /,/, $from) { |
Line 2557 sub getPrevious {
|
Line 2466 sub getPrevious {
|
my $prev = $choice->comesfrom(); |
my $prev = $choice->comesfrom(); |
$prev = $self->{NAV_MAP}->getById($prev); |
$prev = $self->{NAV_MAP}->getById($prev); |
|
|
# Skip it if we've already seen it or the user doesn't have |
# Don't remember it if the student doesn't have browse priviledges |
# browse privs |
# future note: this may properly belong in the client of the resource |
my $browsePriv = &Apache::lonnet::allowed('bre', $self->src); |
my $browsePriv = &Apache::lonnet::allowed('bre', $self->src); |
if (!defined($alreadySeenHash) || |
if (!($browsePriv ne '2' && $browsePriv ne 'F')) { |
!defined($alreadySeenHash->{$prev->{ID}}) || |
|
($browsePriv ne '2' && $browsePriv ne 'F')) { |
|
push @branches, $prev; |
push @branches, $prev; |
} |
} |
} |
} |