[LON-CAPA-cvs] cvs: rat / lonpageflip.pm

raeburn raeburn at source.lon-capa.org
Sat Mar 14 17:56:14 EDT 2015


raeburn		Sat Mar 14 21:56:14 2015 EDT

  Modified files:              
    /rat	lonpageflip.pm 
  Log:
  - When LON-CAPA navigation arrows are used to move between resources check 
    if > 10 minutes since last check for content change.
    If course changed after "Big Hash" last tied for current user's session,
    course is re-initialized or Switch Server link is displayed, as needed.
  
  
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.86 rat/lonpageflip.pm:1.87
--- rat/lonpageflip.pm:1.86	Thu Dec 11 13:16:49 2014
+++ rat/lonpageflip.pm	Sat Mar 14 21:56:13 2015
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.86 2014/12/11 13:16:49 raeburn Exp $
+# $Id: lonpageflip.pm,v 1.87 2015/03/14 21:56:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,6 +36,7 @@
 use Apache::Constants qw(:common :http REDIRECT);
 use Apache::lonnet;
 use Apache::loncommon();
+use Apache::lonuserstate;
 use Apache::lonlocal;
 use HTML::TokeParser;
 use GDBM_File;
@@ -269,6 +270,29 @@
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
   if (($env{'form.postdata'})&&($env{'request.course.fn'})) {
       $env{'form.postdata'}=~/(\w+)\:(.*)/;
+
+      if ($env{'request.course.id'}) {
+          # 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;
+              }
+          }
+      }
+
       my $direction=$1;
       my $currenturl=$2;
       if ($currenturl=~m|^/enc/|) {




More information about the LON-CAPA-cvs mailing list