[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonnavdisplay.pm

raeburn raeburn at source.lon-capa.org
Wed Mar 11 11:43:40 EDT 2015


raeburn		Wed Mar 11 15:43:40 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonnavdisplay.pm 
  Log:
  - For 2.11
    Backport 1.29, 1.30, 1.31
  
  
Index: loncom/interface/lonnavdisplay.pm
diff -u loncom/interface/lonnavdisplay.pm:1.22.4.5 loncom/interface/lonnavdisplay.pm:1.22.4.6
--- loncom/interface/lonnavdisplay.pm:1.22.4.5	Thu May 22 12:25:32 2014
+++ loncom/interface/lonnavdisplay.pm	Wed Mar 11 15:43:40 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Display Handler
 #
-# $Id: lonnavdisplay.pm,v 1.22.4.5 2014/05/22 12:25:32 raeburn Exp $
+# $Id: lonnavdisplay.pm,v 1.22.4.6 2015/03/11 15:43:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,7 +38,6 @@
 use Apache::lonnet;
 use Apache::lonlocal;
 use Apache::londocs();
-#use Time::HiRes qw( gettimeofday tv_interval );
 
 sub handler {
     my $r = shift;
@@ -47,14 +46,9 @@
 
 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;
     }
@@ -67,15 +61,26 @@
         return REDIRECT;
     }
 
-    # Send header, don't cache this page
-    if ($env{'browser.mathml'}) {
-        &Apache::loncommon::content_type($r,'text/xml');
-    } else {
+    # Check if course needs to be re-initialized
+    my $loncaparev = $r->dir_config('lonVersion');
+    my ($result, at reinit) = &Apache::loncommon::needs_coursereinit($loncaparev);
+
+    if ($result eq 'switch') {
         &Apache::loncommon::content_type($r,'text/html');
+        $r->send_http_header;
+        $r->print(&Apache::loncommon::check_release_result(@reinit));
+        return OK;
+    } elsif ($result eq 'update') {
+        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
+        if ($ferr) {
+            my $requrl = $r->uri;
+            $env{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
+            $env{'user.reinit'} = 1;
+            return HTTP_NOT_ACCEPTABLE;
+        }
     }
-    &Apache::loncommon::no_cache($r);
-
-    my %toplinkitems=();
 
     # Create the nav map
     my $navmap = Apache::lonnavmaps::navmap->new();
@@ -86,6 +91,9 @@
         $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
@@ -121,6 +129,7 @@
         return OK;
     }
 
+    my %toplinkitems=();
     my @resources = $navmap->retrieveResources();
     my $sequenceCount = 0;
     my $problemCount = 0;
@@ -287,8 +296,6 @@
             $r->print("<p><span class=\"LC_info\">".&mt("This course is empty.")."</span></p>");
         }
     }
-    #my $td=&tv_interval($t0);
-    #$r->print("<br />$td");
     &endContentScreen($r);
     $r->print(&Apache::loncommon::end_page());
     $r->rflush();




More information about the LON-CAPA-cvs mailing list