[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Fri, 07 Feb 2003 21:55:44 -0000
This is a MIME encoded message
--bowersj21044654944
Content-Type: text/plain
bowersj2 Fri Feb 7 16:55:44 2003 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
The "here" marker is no longer working perfectly but I need to commit
this so I don't lose it.
This further splits out the render routine so that it automatically
does some stuff that I found was really useful when trying to get the
navmaps into the wizard. The actual nav maps handler is now little more then
a routine that sends out the right headers, prints some title information,
does some error checking, and calls "render".
Also, "render" can be passed the Apache response object to write
the nav map directly.
Also killed quite a few small bits of dead code, mostly useless variables.
These were mostly remnents of very old algorithms that needed them as
flags or something, but are no longer used or necessary.
--bowersj21044654944
Content-Type: text/plain
Content-Disposition: attachment; filename="bowersj2-20030207165544.txt"
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.139 loncom/interface/lonnavmaps.pm:1.140
--- loncom/interface/lonnavmaps.pm:1.139 Thu Feb 6 17:58:12 2003
+++ loncom/interface/lonnavmaps.pm Fri Feb 7 16:55:44 2003
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.139 2003/02/06 22:58:12 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.140 2003/02/07 21:55:44 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -56,21 +56,23 @@
# Some data
+my $resObj = "Apache::lonnavmaps::resource";
+
# Keep these mappings in sync with lonquickgrades, which uses the colors
# instead of the icons.
my %statusIconMap =
- ( Apache::lonnavmaps::resource->NETWORK_FAILURE => '',
- Apache::lonnavmaps::resource->NOTHING_SET => '',
- Apache::lonnavmaps::resource->CORRECT => 'navmap.correct.gif',
- Apache::lonnavmaps::resource->EXCUSED => 'navmap.correct.gif',
- Apache::lonnavmaps::resource->PAST_DUE_NO_ANSWER => 'navmap.wrong.gif',
- Apache::lonnavmaps::resource->PAST_DUE_ANSWER_LATER => 'navmap.wrong.gif',
- Apache::lonnavmaps::resource->ANSWER_OPEN => 'navmap.wrong.gif',
- Apache::lonnavmaps::resource->OPEN_LATER => '',
- Apache::lonnavmaps::resource->TRIES_LEFT => 'navmap.open.gif',
- Apache::lonnavmaps::resource->INCORRECT => 'navmap.wrong.gif',
- Apache::lonnavmaps::resource->OPEN => 'navmap.open.gif',
- Apache::lonnavmaps::resource->ATTEMPTED => 'navmap.open.gif' );
+ ( $resObj->NETWORK_FAILURE => '',
+ $resObj->NOTHING_SET => '',
+ $resObj->CORRECT => 'navmap.correct.gif',
+ $resObj->EXCUSED => 'navmap.correct.gif',
+ $resObj->PAST_DUE_NO_ANSWER => 'navmap.wrong.gif',
+ $resObj->PAST_DUE_ANSWER_LATER => 'navmap.wrong.gif',
+ $resObj->ANSWER_OPEN => 'navmap.wrong.gif',
+ $resObj->OPEN_LATER => '',
+ $resObj->TRIES_LEFT => 'navmap.open.gif',
+ $resObj->INCORRECT => 'navmap.wrong.gif',
+ $resObj->OPEN => 'navmap.open.gif',
+ $resObj->ATTEMPTED => 'navmap.open.gif' );
my %iconAltTags =
( 'navmap.correct.gif' => 'Correct',
@@ -79,17 +81,17 @@
# Defines a status->color mapping, null string means don't color
my %colormap =
- ( Apache::lonnavmaps::resource->NETWORK_FAILURE => '',
- Apache::lonnavmaps::resource->CORRECT => '',
- Apache::lonnavmaps::resource->EXCUSED => '#3333FF',
- Apache::lonnavmaps::resource->PAST_DUE_ANSWER_LATER => '',
- Apache::lonnavmaps::resource->PAST_DUE_NO_ANSWER => '',
- Apache::lonnavmaps::resource->ANSWER_OPEN => '#006600',
- Apache::lonnavmaps::resource->OPEN_LATER => '',
- Apache::lonnavmaps::resource->TRIES_LEFT => '',
- Apache::lonnavmaps::resource->INCORRECT => '',
- Apache::lonnavmaps::resource->OPEN => '',
- Apache::lonnavmaps::resource->NOTHING_SET => '' );
+ ( $resObj->NETWORK_FAILURE => '',
+ $resObj->CORRECT => '',
+ $resObj->EXCUSED => '#3333FF',
+ $resObj->PAST_DUE_ANSWER_LATER => '',
+ $resObj->PAST_DUE_NO_ANSWER => '',
+ $resObj->ANSWER_OPEN => '#006600',
+ $resObj->OPEN_LATER => '',
+ $resObj->TRIES_LEFT => '',
+ $resObj->INCORRECT => '',
+ $resObj->OPEN => '',
+ $resObj->NOTHING_SET => '' );
# And a special case in the nav map; what to do when the assignment
# is not yet done and due in less then 24 hours
my $hurryUpColor = "#FF0000";
@@ -117,8 +119,6 @@
sub real_handler {
my $r = shift;
- &Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
-
# Handle header-only request
if ($r->header_only) {
if ($ENV{'browser.mathml'}) {
@@ -164,83 +164,6 @@
# Now that we've displayed some stuff to the user, init the navmap
$navmap->init();
- $r->print('<table border="0" cellpadding="2" cellspacing="0">');
- my $date=localtime;
- $r->print('<tr><td align="right" valign="bottom">Key: </td>');
-
- # Print discussions and feedback header
- if ($navmap->{LAST_CHECK}) {
- $r->print('<td align="center" valign="bottom"> '.
- '<img src="/adm/lonMisc/chat.gif"> New discussion since '.
- strftime("%A, %b %e at %I:%M %P", localtime($navmap->{LAST_CHECK})).
- '</td><td align="center" valign="bottom"> '.
- '<img src="/adm/lonMisc/feedback.gif"> New message (click to open)<p>'.
- '</td>');
- } else {
- $r->print('<td align="center" valign="bottom"> '.
- '<img src="/adm/lonMisc/chat.gif"> Discussions</td><td align="center" valign="bottom">'.
- ' <img src="/adm/lonMisc/feedback.gif"> New message (click to open)'.
- '</td>');
- }
- $r->print('</tr></table>');
-
- my $condition = 0;
- if ($ENV{'form.condition'}) {
- $condition = 1;
- }
-
- # Determine where the "here" marker is and where the screen jumps to.
- my $hereType; # the type of marker, SYMB, URL, or NOTHING
- my $here; # the actual URL or SYMB for the here marker
- my $jumpType; # The type of the thing we have a jump for, SYMB or URL
- my $jump; # the SYMB/URL of the resource we need to jump to
-
- if ( $ENV{'form.alreadyHere'} ) { # we came from a user's manipulation of the nav page
- # If this is a click on a folder or something, we want to preserve the "here"
- # from the querystring, and get the new "jump" marker
- $hereType = $ENV{'form.hereType'};
- $here = $ENV{'form.here'};
- $jumpType = $ENV{'form.jumpType'} || NOTHING();
- $jump = $ENV{'form.jump'};
- } else { # the user is visiting the nav map from the remote
- # We're coming from the remote. We have either a url, a symb, or nothing,
- # and we need to figure out what.
- # Preference: Symb
-
- if ($ENV{'form.symb'}) {
- $hereType = $jumpType = SYMB();
- $here = $jump = $ENV{'form.symb'};
- } elsif ($ENV{'form.postdata'}) {
- # couldn't find a symb, is there a URL?
- my $currenturl = $ENV{'form.postdata'};
- $currenturl=~s/^http\:\/\///;
- $currenturl=~s/^[^\/]+//;
-
- $hereType = $jumpType = URL;
- $here = $jump = $currenturl;
- } else {
- # Nothing
- $hereType = $jumpType = NOTHING();
- }
- }
-
-
- # alreadyHere allows us to only open the maps necessary to view
- # the current location once, while at the same time remembering
- # the current location. Without that check, the user would never
- # be able to close those maps; the user would close it, and the
- # currenturl scan would re-open it.
- my $queryAdd = "&alreadyHere=1";
-
- if ($condition) {
- $r->print("<a href=\"navmaps?condition=0&filter=&$queryAdd" .
- "&hereType=$hereType&here=" . Apache::lonnet::escape($here) .
- "\">Close All Folders</a>");
- } else {
- $r->print("<a href=\"navmaps?condition=1&filter=&$queryAdd" .
- "&hereType=$hereType&here=" . Apache::lonnet::escape($here) .
- "\">Open All Folders</a>");
- }
$r->print('<br> ');
$r->rflush();
@@ -252,101 +175,11 @@
return OK;
}
- my $res = "Apache::lonnavmaps::resource";
-
- my %filterHash;
- # Figure out what we're not displaying
- foreach (split(/\,/, $ENV{"form.filter"})) {
- if ($_) {
- $filterHash{$_} = "1";
- }
- }
-
- # Begin the HTML table
- # four cols: resource + indent, chat+feedback, icon, text string
- $r->print('<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n");
-
- # This needs to be updated to use symbs from the remote,
- # instead of uris. The changes to this and the main rendering
- # loop should be obvious.
- # Here's a simple example of the iterator.
- # Preprocess the map: Look for current URL, open necessary maps
-
- my $mapIterator = $navmap->getIterator(undef, undef, undef, 1);
- my $found = 0;
- my $depth = 1;
- my $currentJumpIndex = 0; # keeps track of when the current resource is found,
- # so we can back up a few and put the anchor above the
- # current resource
- my $currentJumpDelta = 2; # change this to change how many resources are displayed
- # before the current resource when using #current
- $mapIterator->next(); # discard the first BEGIN_MAP
- my $curRes = $mapIterator->next();
- my $counter = 0;
- my $foundJump = ($jumpType == NOTHING()); # look for jump point if we have one
- my $looped = 0;
-
- # We only need to do this if we need to open the maps to show the
- # current position. This will change the counter so we can't count
- # for the jump marker with this loop.
- while ($depth > 0 && !$ENV{'form.alreadyHere'}) {
- if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
- if ($curRes == $mapIterator->END_MAP()) { $depth--; }
-
- if (ref($curRes) && !$ENV{'form.alreadyHere'} &&
- ($hereType == SYMB() && $curRes->symb() eq $here) ||
- (ref($curRes) && $hereType == URL() && $curRes->src() eq $here)) {
- my $mapStack = $mapIterator->getStack();
-
- # Ensure the parent maps are open
- for my $map (@{$mapStack}) {
- if ($condition) {
- undef $filterHash{$map->map_pc()};
- } else {
- $filterHash{$map->map_pc()} = 1;
- }
- }
- $ENV{'form.alreadyHere'} = 1;
- }
- $looped = 1;
-
- $curRes = $mapIterator->next();
- }
-
- $mapIterator = $navmap->getIterator(undef, undef, \%filterHash, 0);
- $depth = 1;
- $mapIterator->next();
- $curRes = $mapIterator->next();
-
- while ($depth > 0 && !$foundJump) {
- if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
- if ($curRes == $mapIterator->END_MAP()) { $depth--; }
- if (ref($curRes)) { $counter++; }
-
- if (ref($curRes) &&
- (($jumpType == SYMB() && $curRes->symb() eq $jump) ||
- ($jumpType == URL() && $curRes->src() eq $jump))) {
- # If this is the correct resource, be sure to
- # show it by making sure the containing maps
- # 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.
- $currentJumpIndex = $counter;
- $foundJump = 1;
- }
-
- $curRes = $mapIterator->next();
- }
-
# renderer call
- $mapIterator = $navmap->getIterator(undef, undef, \%filterHash, 0);
- my $render = render({ 'cols' => [0,1,2,3], 'iterator' => $mapIterator,
- 'url' => '/adm/navmaps',
- 'queryString' => 'alreadyHere=1',
- 'currentJumpIndex' => $currentJumpIndex});
- $r->print($render);
+ my $render = render({ 'cols' => [0,1,2,3],
+ 'url' => '/adm/navmaps',
+ 'printKey' => 1,
+ 'r' => $r});
$navmap->untieHashes();
@@ -654,9 +487,13 @@
=head2 Parameters
+Most of these parameters are only useful if you are *not* using the folder interface (i.e., the default first column), which is probably the common case. If you are using this interface, then you should be able to get away with just using 'cols' (to specify the columns shown), 'url' (necessary for the folders to link to the current screen correctly), and possibly 'queryString' if your app calls for it. In that case, maintaining the state of the folders will be done automatically.
+
=over 4
-=item * B<iterator>: A reference to a fresh ::iterator to use from the navmaps. The rendering will reflect the options passed to the iterator, so you can use that to just render a certain part of the course, if you like.
+=item * B<iterator>: A reference to a fresh ::iterator to use from the navmaps. The rendering will reflect the options passed to the iterator, so you can use that to just render a certain part of the course, if you like. If one is not passed, the renderer will attempt to construct one from ENV{'form.filter'} and ENV{'form.condition'} information.
+
+=item * B<navmap>: A reference to a navmap, used only if an iterator is not passed in. If this is necessary to make an iterator but it is not passed in, a new one will be constructed based on ENV info. This is useful to do basic error checking before passing it off to render.
=item * B<cols>: An array reference
@@ -664,11 +501,11 @@
=item * B<condenseParts>: A flag. If yes (default), if all parts of the problem have the same status and that status is Nothing Set, Correct, or Network Failure, then only one line will be displayed for that resource anyhow. If no, all parts will always be displayed. If showParts is 0, this is ignored.
-=item * B<jumpCount>: A string identifying the URL to place the anchor 'curloc' at. Default to no anchor at all. It is the responsibility of the renderer user to ensure that the #curloc is in the URL.
+=item * B<jumpCount>: A string identifying the URL to place the anchor 'curloc' at. Default to no anchor at all. It is the responsibility of the renderer user to ensure that the #curloc is in the URL. By default, determined through the use of the ENV{} 'jump' and 'jumpType' information.
-=item * B<hereURL>: A URL identifying where to place the 'here' marker.
+=item * B<hereURL>: A URL identifying where to place the 'here' marker. By default, will pull this from the ENV{'form.here*'} info.
-=item * B<hereSymb>: A Symb identifying where to place the 'here' marker.
+=item * B<hereSymb>: A Symb identifying where to place the 'here' marker. Default same as hereURL.
=item * B<indentString>: A string identifying the indentation string to use. By default, this is a 25 pixel whitespace image with no alt text.
@@ -676,10 +513,14 @@
=item * B<url>: The url the folders will link to, which should be the current page. Required if the resource info column is shown.
-=item * B<currentJumpIndex>: Describes the currently-open row number to cause the browser to jump to, because the user just opened that folder.
+=item * B<currentJumpIndex>: Describes the currently-open row number to cause the browser to jump to, because the user just opened that folder. By default, pulled from the Jump information in the ENV{'form.*'}.
=item * B<r>: The standard Apache response object. If you pass this to the render, it will use it to flush the table every 20 rows and handle the rendering itself.
+=item * B<printKey>: If true, print the key that appears on the top of the standard navmaps. Default is false.
+
+=item * B<printCloseAll>: If true, print the "Close all folders" or "open all folders" links. Default is true.
+
=back
=head2 Additional Info
@@ -720,7 +561,6 @@
# If this is a new branch, label it so
if ($params->{'isNewBranch'}) {
$newBranchText = "<img src='/adm/lonIcons/branch.gif' border='0' />";
- $params->{'isNewBranch'} = 0;
}
# links to open and close the folder
@@ -757,7 +597,8 @@
. $params->{'hereType'} . '&here=' .
&Apache::lonnet::escape($params->{'here'}) .
'&jumpType=' . SYMB() . '&jump=' .
- &Apache::lonnet::escape($resource->symb()) . "'>";
+ &Apache::lonnet::escape($resource->symb()) .
+ "&folderManip=1'>";
}
if ($resource->randomout()) {
@@ -766,10 +607,12 @@
# We're done preparing and finally ready to start the rendering
my $result = "<td align='left' valign='center'>";
-
+
+ my $indentLevel = $params->{'indentLevel'};
+ if ($newBranchText) { $indentLevel--; }
+
# print indentation
- for (my $i = 0; $i < $params->{'indentLevel'} -
- $params->{'deltaLevel'}; $i++) {
+ for (my $i = 0; $i < $indentLevel; $i++) {
$result .= $params->{'indentString'};
}
@@ -913,39 +756,223 @@
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 $it = $args->{'iterator'};
- if (!defined($it)) {
- # no iterator, no nav map.
- return '';
+ my $mustCloseNavMap = 0;
+ my $navmap;
+ if (defined($args->{'navmap'})) {
+ $navmap = $args->{'navmap'};
}
-
- my $showParts = setDefault($args->{'showParts'}, 1);
- my $condenseParts = setDefault($args->{'condenseParts'}, 1);
+
+ my $queryString = $args->{'queryString'};
my $jumpToURL = $args->{'jumpToURL'};
my $jumpToSymb = $args->{'jumpToSymb'};
+ my $jumpType;
my $hereURL = $args->{'hereURL'};
my $hereSymb = $args->{'hereSymb'};
- # keeps track of when the current resource is found,
- # so we can back up a few and put the anchor above the
- # current resource
+ my $hereType;
+ my $here;
+ my $jump;
my $currentJumpIndex = setDefault($args->{'currentJumpIndex'}, 0);
my $currentJumpDelta = 2; # change this to change how many resources are displayed
# before the current resource when using #current
- my $r = $args->{'r'};
+
+ # If we were passed 'here' information, we are not rendering
+ # after a folder manipulation, and we were not passed an
+ # iterator, make sure we open the folders to show the "here"
+ # marker
+ my $filterHash = {};
+ # Figure out what we're not displaying
+ foreach (split(/\,/, $ENV{"form.filter"})) {
+ if ($_) {
+ $filterHash->{$_} = "1";
+ }
+ }
+
+ my $condition = 0;
+ if ($ENV{'form.condition'}) {
+ $condition = 1;
+ }
+
+ if (!$ENV{'form.folderManip'} && !defined($args->{'iterator'})) {
+ # Step 1: Check to see if we have a navmap
+ if (!defined($navmap)) {
+ $navmap = Apache::lonnavmaps::navmap->new(
+ $ENV{"request.course.fn"}.".db",
+ $ENV{"request.course.fn"}."_parms.db", 1, 1);
+ $mustCloseNavMap = 1;
+ }
+ $navmap->init();
+
+ # Step two: Locate what kind of here marker is necessary
+ # Determine where the "here" marker is and where the screen jumps to.
+
+ # We're coming from the remote. We have either a url, a symb, or nothing,
+ # and we need to figure out what.
+ # Preference: Symb
+
+ if ($ENV{'form.symb'}) {
+ $hereType = $jumpType = SYMB();
+ $here = $jump = $ENV{'form.symb'};
+ } elsif ($ENV{'form.postdata'}) {
+ # couldn't find a symb, is there a URL?
+ my $currenturl = $ENV{'form.postdata'};
+ $currenturl=~s/^http\:\/\///;
+ $currenturl=~s/^[^\/]+//;
+
+ $hereType = $jumpType = URL;
+ $here = $jump = $currenturl;
+ } else {
+ # Nothing
+ $hereType = $jumpType = NOTHING();
+ }
+ # Step three: Ensure the folders are open
+ my $mapIterator = $navmap->getIterator(undef, undef, undef, 1);
+ my $depth = 1;
+ $mapIterator->next(); # discard the first BEGIN_MAP
+ my $curRes = $mapIterator->next();
+ my $counter = 0;
+ my $found = 0;
+
+ # We only need to do this if we need to open the maps to show the
+ # current position. This will change the counter so we can't count
+ # for the jump marker with this loop.
+ while ($depth > 0 && !$found) {
+ if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
+ if ($curRes == $mapIterator->END_MAP()) { $depth--; }
+
+ if (ref($curRes) &&
+ ($hereType == SYMB() && $curRes->symb() eq $here) ||
+ (ref($curRes) && $hereType == URL() && $curRes->src() eq $here)) {
+ my $mapStack = $mapIterator->getStack();
+
+ # Ensure the parent maps are open
+ for my $map (@{$mapStack}) {
+ if ($condition) {
+ undef $filterHash->{$map->map_pc()};
+ } else {
+ $filterHash->{$map->map_pc()} = 1;
+ }
+ }
+ $found = 1;
+ }
+
+ $curRes = $mapIterator->next();
+ }
+
+ # Since we changed the folders, (re-)locate the jump point, if any
+ $mapIterator = $navmap->getIterator(undef, undef, $filterHash, 0);
+ $depth = 1;
+ $mapIterator->next();
+ $curRes = $mapIterator->next();
+ my $foundJump = 0;
+
+ while ($depth > 0 && !$foundJump) {
+ if ($curRes == $mapIterator->BEGIN_MAP()) { $depth++; }
+ if ($curRes == $mapIterator->END_MAP()) { $depth--; }
+ if (ref($curRes)) { $counter++; }
+
+ if (ref($curRes) &&
+ (($jumpType == SYMB() && $curRes->symb() eq $jump) ||
+ ($jumpType == URL() && $curRes->src() eq $jump))) {
+
+ # 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.
+ $currentJumpIndex = $counter;
+ $foundJump = 1;
+ }
+
+ $curRes = $mapIterator->next();
+ }
+ }
+ if ( !defined($args->{'iterator'}) && $ENV{'form.folderManip'} ) { # we came from a user's manipulation of the nav page
+ # If this is a click on a folder or something, we want to preserve the "here"
+ # from the querystring, and get the new "jump" marker
+ $hereType = $ENV{'form.hereType'};
+ $here = $ENV{'form.here'};
+ $jumpType = $ENV{'form.jumpType'} || NOTHING();
+ $jump = $ENV{'form.jump'};
+ }
-
+ my $it = $args->{'iterator'};
+ if (!defined($it)) {
+ # Construct a default iterator based on $ENV{'form.'} information
+
+ # Step 1: Check to see if we have a navmap
+ if (!defined($navmap)) {
+ $navmap = Apache::lonnavmaps::navmap->new(
+ $ENV{"request.course.fn"}.".db",
+ $ENV{"request.course.fn"}."_parms.db", 1, 1);
+ $mustCloseNavMap = 1;
+ }
+ # Paranoia: Make sure it's ready
+ $navmap->init();
+
+ $args->{'iterator'} = $it = $navmap->getIterator(undef, undef, $filterHash, $condition);
+ }
+
+ my $showParts = setDefault($args->{'showParts'}, 1);
+ my $condenseParts = setDefault($args->{'condenseParts'}, 1);
+ # keeps track of when the current resource is found,
+ # so we can back up a few and put the anchor above the
+ # current resource
+ my $r = $args->{'r'};
+ my $printKey = $args->{'printKey'};
+ my $printCloseAll = $args->{'printCloseAll'};
+ if (!defined($printCloseAll)) { $printCloseAll = 1; }
+
+ # Print key?
+ if ($printKey) {
+ $result .= '<table border="0" cellpadding="2" cellspacing="0">';
+ my $date=localtime;
+ $result.='<tr><td align="right" valign="bottom">Key: </td>';
+ if ($navmap->{LAST_CHECK}) {
+ $result .=
+ '<img src="/adm/lonMisc/chat.gif"> New discussion since '.
+ strftime("%A, %b %e at %I:%M %P", localtime($navmap->{LAST_CHECK})).
+ '</td><td align="center" valign="bottom"> '.
+ '<img src="/adm/lonMisc/feedback.gif"> New message (click to open)<p>'.
+ '</td>';
+ } else {
+ $result .= '<td align="center" valign="bottom"> '.
+ '<img src="/adm/lonMisc/chat.gif"> Discussions</td><td align="center" valign="bottom">'.
+ ' <img src="/adm/lonMisc/feedback.gif"> New message (click to open)'.
+ '</td>';
+ }
+
+ $result .= '</tr></table>';
+ }
+
+ if ($printCloseAll) {
+ if ($condition) {
+ $result.="<a href=\"navmaps?condition=0&filter=&$queryString" .
+ "&hereType=$hereType&here=" . Apache::lonnet::escape($here) .
+ "\">Close All Folders</a>";
+ } else {
+ $result.="<a href=\"navmaps?condition=1&filter=&$queryString" .
+ "&hereType=$hereType&here=" . Apache::lonnet::escape($here) .
+ "\">Open All Folders</a>";
+ }
+ }
+
+ if ($r) {
+ $r->print($result);
+ $r->rflush();
+ $result = "";
+ }
# End parameter setting
# Data
- my $result .= '<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n";
+ $result .= '<table cellspacing="0" cellpadding="3" border="0" bgcolor="#FFFFFF">' ."\n";
my $res = "Apache::lonnavmaps::resource";
my %condenseStatuses =
( $res->NETWORK_FAILURE => 1,
@@ -995,15 +1022,6 @@
}
$args->{'counter'}++;
- # reserve space for branch symbol
- $args->{'deltalevel'} = $args->{'isNewBranch'}? 1 : 0;
- if ($args->{'indentLevel'} - $args->{'deltalevel'} < 0) {
- # If this would be at a negative depth (top-level maps in
- # new-style courses, we want to suppress their title display)
- # then ignore it.
- $curRes = $it->next();
- next;
- }
# Does it have multiple parts?
$args->{'multipart'} = 0;
@@ -1114,6 +1132,7 @@
$result .= $colHTML . "\n";
}
$result .= " </tr>\n";
+ $args->{'isNewBranch'} = 0;
}
if ($r && $rownum % 20 == 0) {
@@ -1131,6 +1150,14 @@
}
$result .= "</table>";
+
+ if ($r) {
+ $r->print($result);
+ $result = "";
+ $r->rflush();
+ }
+
+ if ($mustCloseNavMap) { $navmap->untieHashes(); }
return $result;
}
@@ -1200,6 +1227,7 @@
$self->{HASH_TIED} = 1;
$self->{NAV_HASH} = \%navmaphash;
$self->{PARM_HASH} = \%parmhash;
+ $self->{INITED} = 0;
bless($self);
@@ -1208,6 +1236,7 @@
sub init {
my $self = shift;
+ if ($self->{INITED}) { return; }
# If the course opt hash and the user opt hash should be generated,
# generate them
@@ -1313,6 +1342,7 @@
}
$self->{PARM_CACHE} = {};
+ $self->{INITED} = 1;
}
# Internal function: Takes a key to look up in the nav hash and implements internal
@@ -1964,7 +1994,7 @@
# A hash, used as a set, of resource already seen
$self->{ALREADY_SEEN} = shift;
- if (!defined($self->{ALREADY_SEEN})) { $self->{ALREADY_SEEN} = {} };
+ if (!defined($self->{ALREADY_SEEN})) { $self->{ALREADY_SEEN} = {} };
$self->{CONDITION} = shift;
$self->{DIRECTION} = shift || FORWARD();
@@ -2087,7 +2117,7 @@
A resource only makes sense in the context of a navmap, as some of the data is stored in the navmap object.
-You will probably never need to instantiate this object directly. Use Apache::lonnavmap::navmap, and use the "start" method to obtain the starting resource.
+You will probably never need to instantiate this object directly. Use Apache::lonnavmaps::navmap, and use the "start" method to obtain the starting resource.
=head2 Public Members
@@ -2217,8 +2247,6 @@
=item * B<is_problem>: Returns true if the resource is a problem type, false otherwise. (Looks at the extension on the src field; might need more to work correctly.)
=item * B<is_page>: Returns true if the resource is a page.
-
-=item * B<is_problem>: Returns true if the resource is a problem.
=item * B<is_sequence>: Returns true if the resource is a sequence.
--bowersj21044654944--