--- loncom/interface/lonnavmaps.pm 2002/10/01 19:15:22 1.59 +++ loncom/interface/lonnavmaps.pm 2002/10/03 19:10:28 1.62 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.59 2002/10/01 19:15:22 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.62 2002/10/03 19:10:28 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -878,8 +878,7 @@ sub new_handle { my %condenseStatuses = ( $res->NETWORK_FAILURE => 1, $res->NOTHING_SET => 1, - $res->CORRECT => 1, - $res->OPEN => 1 ); + $res->CORRECT => 1 ); my %filterHash; # Figure out what we're not displaying @@ -897,7 +896,7 @@ sub new_handle { my $curRes = $mapIterator->next(); undef $res; # so we don't accidentally use it later my $indentLevel = -1; - my $indentString = ""; + my $indentString = ""; my $isNewBranch = 0; my $now = time(); @@ -919,13 +918,13 @@ sub new_handle { if (ref($curRes) && $curRes->src()) { # Step one: Decide which parts to show - my @parts; + my @parts = @{$curRes->parts()}; + my $multipart = scalar(@parts) > 1; + my $condensed = 0; + if ($curRes->is_problem()) { # Is it multipart? - @parts = @{$curRes->parts()}; - my $multipart = scalar(@parts) > 1; - if ($multipart) { # If it's multipart, see if part 0 is "open" # if it is, display all parts, if it isn't, @@ -935,7 +934,7 @@ sub new_handle { } else { # Otherwise, only display part 0 if we want to # attach feedback or email information to it - if (!$curRes->hasDiscussion() && !$curRes->getFeedback()) { + if ($curRes->hasDiscussion() || $curRes->getFeedback()) { shift @parts; } else { # If there's discussion or feedback, that counts @@ -943,20 +942,36 @@ sub new_handle { # Now, we decide whether to condense the # parts due to similarity - my $status = $curRes->status($parts[0]); - my $allSame = 1; - for (my $i = 1; $i < scalar(@parts); $i++) { + my $status = $curRes->status($parts[1]); + my $due = $curRes->duedate($parts[1]); + my $open = $curRes->opendate($parts[1]); + my $statusAllSame = 1; + my $dueAllSame = 1; + my $openAllSame = 1; + for (my $i = 2; $i < scalar(@parts); $i++) { if ($curRes->status($parts[$i]) != $status){ - $allSame = 0; + $statusAllSame = 0; + } + if ($curRes->duedate($parts[$i]) != $due ) { + $dueAllSame = 0; + } + if ($curRes->opendate($parts[$i]) != $open) { + $openAllSame = 0; } } # $allSame is true if all the statuses were # the same. Now, if they are all the same and - # match one of the statuses to condense, then - # only display part 0. - if ($allSame && defined($condenseStatuses{$status})){ - @parts = ("0"); + # match one of the statuses to condense, or they + # are all open with the same due date, or they are + # all OPEN_LATER with the same open date, display the + # status of the first non-zero part (to get the 'correct' + # status right, since 0 is never 'correct' or 'open'). + if (($statusAllSame && defined($condenseStatuses{$status})) || + ($dueAllSame && $status == $curRes->OPEN && $statusAllSame)|| + ($openAllSame && $status == $curRes->OPEN_LATER && $statusAllSame) ){ + @parts = ($parts[1]); + $condensed = 1; } } } @@ -999,9 +1014,13 @@ sub new_handle { my $linkopen = ""; my $linkclose = ""; - my $icon = "html.gif"; + my $icon = ""; if ($curRes->is_problem()) { - $icon = "problem.gif"; + if ($part eq "0" || $condensed) { + $icon = ''; + } else { + $icon = $indentString; + } } # Display the correct icon, link to open or shut map @@ -1010,6 +1029,7 @@ sub new_handle { my $nowOpen = !defined($filterHash{$mapId}); $icon = $nowOpen ? "folder_opened.gif" : "folder_closed.gif"; + $icon = ""; $linkopen = "print($indentString); } - $r->print(" ${newBranchText}${linkopen}${linkclose}\n"); + $r->print(" ${newBranchText}${linkopen}$icon${linkclose}\n"); - if ($curRes->is_problem() && $part != "0") { $partLabel = " (Part $part)"; } + if ($curRes->is_problem() && $part != "0" && !$condensed) { + $partLabel = " (Part $part)"; + $title = ""; + } $r->print(" $title$partLabel"); @@ -1066,9 +1088,15 @@ sub new_handle { $r->print("