--- loncom/interface/lonnavdisplay.pm 2011/12/28 04:11:05 1.21 +++ loncom/interface/lonnavdisplay.pm 2015/03/01 20:47:54 1.30 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA -# Navigate Maps Handler +# Navigate Maps Display Handler # -# $Id: lonnavdisplay.pm,v 1.21 2011/12/28 04:11:05 raeburn Exp $ +# $Id: lonnavdisplay.pm,v 1.30 2015/03/01 20:47:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,7 +30,7 @@ package Apache::lonnavdisplay; use strict; -use Apache::Constants qw(:common :http); +use Apache::Constants qw(:common :http REDIRECT); use Apache::lonmenu(); use Apache::loncommon(); use Apache::lonnavmaps(); @@ -38,7 +38,6 @@ use Apache::lonhtmlcommon(); use Apache::lonnet; use Apache::lonlocal; use Apache::londocs(); -use Time::HiRes qw( gettimeofday tv_interval ); sub handler { my $r = shift; @@ -47,27 +46,20 @@ sub handler { sub real_handler { my $r = shift; - #my $t0=[&gettimeofday()]; # Handle header-only request if ($r->header_only) { - if ($env{'browser.mathml'}) { - &Apache::loncommon::content_type($r,'text/xml'); - } else { - &Apache::loncommon::content_type($r,'text/html'); - } + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK; } - # Send header, don't cache this page - if ($env{'browser.mathml'}) { - &Apache::loncommon::content_type($r,'text/xml'); - } else { + # Check for critical messages and redirect if present. + my ($redirect,$url) = &Apache::loncommon::critical_redirect(300); + if ($redirect) { &Apache::loncommon::content_type($r,'text/html'); + $r->header_out(Location => $url); + return REDIRECT; } - &Apache::loncommon::no_cache($r); - - my %toplinkitems=(); # Create the nav map my $navmap = Apache::lonnavmaps::navmap->new(); @@ -78,6 +70,9 @@ sub real_handler { $env{'user.reinit'} = 1; return HTTP_NOT_ACCEPTABLE; } + + # Send header, don't cache this page + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; # ------------------------------------------------------------ Get query string @@ -100,7 +95,11 @@ sub real_handler { $start_page = &Apache::loncommon::start_page($title,undef,$args); } $r->print($start_page. - ''); + ''); &startContentScreen($r,'navmaps'); $r->rflush(); @@ -113,6 +112,7 @@ sub real_handler { return OK; } + my %toplinkitems=(); my @resources = $navmap->retrieveResources(); my $sequenceCount = 0; my $problemCount = 0; @@ -246,7 +246,7 @@ sub real_handler { @@ -279,8 +279,6 @@ sub real_handler { $r->print("

".&mt("This course is empty.")."

"); } } - #my $td=&tv_interval($t0); - #$r->print("
$td"); &endContentScreen($r); $r->print(&Apache::loncommon::end_page()); $r->rflush(); @@ -292,8 +290,17 @@ sub startContentScreen { my ($r,$mode)=@_; $r->print("\n".''."\n");