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

raeburn raeburn at source.lon-capa.org
Fri Mar 13 18:40:35 EDT 2015


raeburn		Fri Mar 13 22:40:35 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonquickgrades.pm 
  Log:
  - For 2.11
    Backport 1.105, 1.106
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.49.6.1 loncom/interface/lonquickgrades.pm:1.49.6.2
--- loncom/interface/lonquickgrades.pm:1.49.6.1	Thu May 22 12:44:24 2014
+++ loncom/interface/lonquickgrades.pm	Fri Mar 13 22:40:35 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.49.6.1 2014/05/22 12:44:24 raeburn Exp $
+# $Id: lonquickgrades.pm,v 1.49.6.2 2015/03/13 22:40:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,14 +44,6 @@
 sub real_handler {
     my $r = shift;
 
-    # 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::get_unprocessed_cgi($ENV{QUERY_STRING});
 
     # Handle header-only request
@@ -65,6 +57,37 @@
         return OK;
     }
 
+    unless (&Apache::lonnet::allowed('mgr')) {
+        # 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;
+        }
+
+        # 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;
+            }
+        }
+    }
+
     # Send header, don't cache this page
     &Apache::loncommon::no_cache($r);
     $r->send_http_header;




More information about the LON-CAPA-cvs mailing list