\n");
-
- # Print the anchor if necessary
- if ($counter == $currentUrlIndex - $currentUrlDelta) {
- $r->print('');
- }
-
- # print indentation
- for (my $i = 0; $i < $indentLevel - $deltalevel + $deltadepth; $i++) {
- $r->print($indentString);
- }
-
- $r->print(" ${newBranchText}${linkopen}$icon${linkclose}\n");
-
- my $curMarkerBegin = "";
- my $curMarkerEnd = "";
-
- # Is this the current resource?
- if ($curRes->src() eq $currenturl && !$displayedHereMarker) {
- $curMarkerBegin = '> ';
- $curMarkerEnd = ' <';
- $displayedHereMarker = 1;
- }
-
- if ($curRes->is_problem() && $part ne "0" && !$condensed) {
- $partLabel = " (Part $part)";
- $title = "";
- }
- if ($multipart && $condensed) {
- $nonLinkedText .= ' (' . $curRes->countParts() . ' parts)';
- }
-
- $r->print(" $curMarkerBegin$title$partLabel $curMarkerEnd $nonLinkedText");
-
- if ($curRes->{RESOURCE_ERROR}) {
- $r->print(&Apache::loncommon::help_open_topic ("Navmap_Host_Down",
- 'Host down'));
- }
-
- # SECOND COL: Is there text, feedback, errors??
- my $discussionHTML = ""; my $feedbackHTML = "";
-
- if ($curRes->hasDiscussion()) {
- $discussionHTML = $linkopen .
- '' .
- $linkclose;
- }
-
- if ($curRes->getFeedback()) {
- my $feedback = $curRes->getFeedback();
- foreach (split(/\,/, $feedback)) {
- if ($_) {
- $feedbackHTML .= ' '
- . '';
- }
- }
- }
-
- $r->print(" | $discussionHTML$feedbackHTML | ");
-
- # Is this the first displayed part of a multi-part problem
- # that has not been condensed, so we should suppress these two
- # columns so we don't display useless status info about part
- # "0"?
- my $firstDisplayed = !$condensed && $multipart && $part eq "0";
-
- # THIRD COL: Problem status icon
- if ($curRes->is_problem() &&
- !$firstDisplayed) {
- my $icon = $statusIconMap{$curRes->status($part)};
- my $alt = $iconAltTags{$icon};
- if ($icon) {
- $r->print("$linkopen$linkclose | \n");
- } else {
- $r->print(" | \n");
- }
- } else { # not problem, no icon
- $r->print(" | \n");
- }
-
- # FOURTH COL: Text description
- $r->print("\n");
-
- if ($curRes->kind() eq "res" &&
- $curRes->is_problem() &&
- !$firstDisplayed) {
- $r->print ("") if ($color);
- $r->print (getDescription($curRes, $part));
- $r->print ("") if ($color);
- }
- if ($curRes->is_map() && advancedUser() && $curRes->randompick()) {
- $r->print('(randomly select ' . $curRes->randompick() .')');
- }
+ # If we found no problems, print a note to that effect.
+ if (!$foundDoableProblem) {
+ $r->print("All homework assignments have been completed.
");
+ }
+ } else {
+ &add_linkitem(\%toplinkitems,'firsthomework',
+ 'location.href="navmaps?jumpToFirstHomework"',
+ "Go To My First Homework Problem");
+ }
+
+ my $suppressEmptySequences = 0;
+ my $filterFunc = undef;
+ my $resource_no_folder_link = 0;
+
+ # Display only due homework.
+ my $showOnlyHomework = 0;
+ if ($ENV{'form.showOnlyHomework'} eq "1") {
+ $showOnlyHomework = 1;
+ $suppressEmptySequences = 1;
+ $filterFunc = sub { my $res = shift;
+ return $res->completable() || $res->is_map();
+ };
+ &add_linkitem(\%toplinkitems,'everything',
+ 'location.href="locatnavmaps?sort='.$ENV{'form.sort'}.'"',
+ "Show Everything");
+ $r->print("".&mt("Uncompleted Homework")." ");
+ $ENV{'form.filter'} = '';
+ $ENV{'form.condition'} = 1;
+ $resource_no_folder_link = 1;
+ } else {
+ &add_linkitem(\%toplinkitems,'uncompleted',
+ 'location.href="navmaps?sort='.$ENV{'form.sort'}.
+ '&showOnlyHomework=1"',
+ "Show Only Uncompleted Homework");
+ }
+
+ my %selected=($ENV{'form.sort'} => 'selected=on');
+ my $sort_html=("");
+ # renderer call
+ my $renderArgs = { 'cols' => [0,2,3],
+ 'sort' => $ENV{'form.sort'},
+ 'url' => '/adm/navmaps',
+ 'navmap' => $navmap,
+ 'suppressNavmap' => 1,
+ 'suppressEmptySequences' => $suppressEmptySequences,
+ 'filterFunc' => $filterFunc,
+ 'resource_no_folder_link' => $resource_no_folder_link,
+ 'sort_html'=> $sort_html,
+ 'r' => $r,
+ 'caller' => 'navmapsdisplay',
+ 'linkitems' => \%toplinkitems};
+ my $render = render($renderArgs);
+ $navmap->untieHashes();
- $r->print(" |
\n");
- }
+ # If no resources were printed, print a reassuring message so the
+ # user knows there was no error.
+ if ($renderArgs->{'counter'} == 0) {
+ if ($showOnlyHomework) {
+ $r->print("