--- loncom/interface/lonnavdisplay.pm 2006/10/10 20:16:26 1.1
+++ loncom/interface/lonnavdisplay.pm 2008/10/20 03:25:49 1.5
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavdisplay.pm,v 1.1 2006/10/10 20:16:26 albertel Exp $
+# $Id: lonnavdisplay.pm,v 1.5 2008/10/20 03:25:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,6 +37,7 @@ use Apache::lonnavmaps();
use Apache::lonhtmlcommon();
use Apache::lonnet;
use Apache::lonlocal;
+use Time::HiRes qw( gettimeofday tv_interval );
sub handler {
my $r = shift;
@@ -70,7 +71,7 @@ sub real_handler {
"Select Action");
if ($ENV{QUERY_STRING} eq 'collapseExternal') {
&Apache::lonnet::put('environment',{'remotenavmap' => 'off'});
- &Apache::lonnet::appenv('environment.remotenavmap' => 'off');
+ &Apache::lonnet::appenv({'environment.remotenavmap' => 'off'});
my $menu=&Apache::lonmenu::reopenmenu();
my $navstatus=&Apache::lonmenu::get_nav_status();
if ($menu) {
@@ -109,7 +110,7 @@ ENDSUBM
}
if ($ENV{QUERY_STRING} =~ /^launchExternal/) {
&Apache::lonnet::put('environment',{'remotenavmap' => 'on'});
- &Apache::lonnet::appenv('environment.remotenavmap' => 'on');
+ &Apache::lonnet::appenv({'environment.remotenavmap' => 'on'});
my $menu=&Apache::lonmenu::reopenmenu();
my $navstatus=&Apache::lonmenu::get_nav_status();
if ($menu) {
@@ -132,6 +133,7 @@ MENU
if (!defined($navmap)) {
my $requrl = $r->uri;
$env{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized";
+ $env{'user.reinit'} = 1;
return HTTP_NOT_ACCEPTABLE;
}
$r->send_http_header;
@@ -224,19 +226,19 @@ MENU
my $curRes;
my $foundDoableProblem = 0;
my $minimumduedate;
-
+ my $now = time();
+
while ($curRes = $iterator->next()) {
if (ref($curRes) && $curRes->is_problem()) {
my $status = $curRes->status();
- if ($curRes->completable()) {
- my $thisduedate=$curRes->duedate();
- unless ($foundDoableProblem) {
- $minimumduedate=$thisduedate;
- }
+ my $thisduedate=$curRes->duedate();
+ if ($thisduedate > $now
+ && $curRes->completable()) {
$foundDoableProblem = 1;
- if ($thisduedate<=$minimumduedate) {
+ if (!defined($minimumduedate)
+ || $thisduedate<$minimumduedate) {
# Pop open all previous maps
my $stack = $iterator->getStack();
pop @$stack; # last resource in the stack is the problem
@@ -254,7 +256,9 @@ MENU
# If we found no problems, print a note to that effect.
if (!$foundDoableProblem) {
- $r->print("All homework assignments have been completed.
");
+ $r->print(""
+ .&mt("All homework assignments have been completed.")
+ ."
");
}
} else {
&Apache::lonnavmaps::add_linkitem(\%toplinkitems,'firsthomework',
@@ -320,9 +324,9 @@ MENU
# user knows there was no error.
if ($renderArgs->{'counter'} == 0) {
if ($showOnlyHomework) {
- $r->print("
".&mt("All homework is currently completed").".
"); + $r->print("".&mt("All homework is currently completed.")."
"); } else { # both jumpToFirstHomework and normal use the same: course must be empty - $r->print("This course is empty.
"); + $r->print("".&mt("This course is empty.")."
"); } } #my $td=&tv_interval($t0);