--- loncom/interface/lonnavmaps.pm 2006/04/10 21:40:08 1.376 +++ loncom/interface/lonnavmaps.pm 2006/04/10 21:55:48 1.377 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.376 2006/04/10 21:40:08 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.377 2006/04/10 21:55:48 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -318,32 +318,38 @@ MENU "Close navigation window"); } - my $jumpToFirstHomework = 0; + # Check to see if the student is jumping to next open, do-able problem if ($ENV{QUERY_STRING} =~ /^jumpToFirstHomework/) { - $jumpToFirstHomework = 1; # Find the next homework problem that they can do. my $iterator = $navmap->getIterator(undef, undef, undef, 1); my $curRes; my $foundDoableProblem = 0; - my $problemRes; + my $minimumduedate; - while (($curRes = $iterator->next()) && !$foundDoableProblem) { + while ($curRes = $iterator->next()) { if (ref($curRes) && $curRes->is_problem()) { my $status = $curRes->status(); if ($curRes->completable()) { - $problemRes = $curRes; + my $thisduedate=$curRes->duedate(); + unless ($foundDoableProblem) { + $minimumduedate=$thisduedate; + } + $foundDoableProblem = 1; - # Pop open all previous maps - my $stack = $iterator->getStack(); - pop @$stack; # last resource in the stack is the problem - # itself, which we don't need in the map stack - my @mapPcs = map {$_->map_pc()} @$stack; - $env{'form.filter'} = join(',', @mapPcs); - - # Mark as both "here" and "jump" - $env{'form.postsymb'} = $curRes->symb(); + if ($thisduedate<=$minimumduedate) { + # Pop open all previous maps + my $stack = $iterator->getStack(); + pop @$stack; # last resource in the stack is the problem + # itself, which we don't need in the map stack + my @mapPcs = map {$_->map_pc()} @$stack; + $env{'form.filter'} = join(',', @mapPcs); + + # Mark as both "here" and "jump" + $env{'form.postsymb'} = $curRes->symb(); + $minimumduedate=$thisduedate; + } } } } @@ -355,7 +361,7 @@ MENU } else { &add_linkitem(\%toplinkitems,'firsthomework', 'location.href="navmaps?jumpToFirstHomework"', - "Show Me My First Homework Problem"); + "Show my first due problem"); } my $suppressEmptySequences = 0; @@ -372,8 +378,8 @@ MENU }; &add_linkitem(\%toplinkitems,'everything', 'location.href="navmaps?sort='.$env{'form.sort'}.'"', - "Show Everything"); - $r->print("

".&mt("Uncompleted Homework")."

"); + "Show everything"); + $r->print("

".&mt("Uncompleted Problems")."

"); $env{'form.filter'} = ''; $env{'form.condition'} = 1; $resource_no_folder_link = 1; @@ -381,7 +387,7 @@ MENU &add_linkitem(\%toplinkitems,'uncompleted', 'location.href="navmaps?sort='.$env{'form.sort'}. '&showOnlyHomework=1"', - "Show Only Uncompleted Homework"); + "Show only uncompleted problems"); } my %selected=($env{'form.sort'} => 'selected=on'); @@ -1603,11 +1609,11 @@ sub render { if ($condition) { $link='"navmaps?condition=0&filter=&'.$queryString. '&here='.&Apache::lonnet::escape($here).'"'; - $text='Close All Folders'; + $text='Close all folders'; } else { $link='"navmaps?condition=1&filter=&'.$queryString. '&here='.&Apache::lonnet::escape($here).'"'; - $text='Open All Folders'; + $text='Open all folders'; } if ($args->{'caller'} eq 'navmapsdisplay') { &add_linkitem($args->{'linkitems'},'changefolder',