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

raeburn raeburn at source.lon-capa.org
Mon Jun 7 15:04:20 EDT 2021


raeburn		Mon Jun  7 19:04:20 2021 EDT

  Modified files:              
    /rat	lonpageflip.pm 
  Log:
  - Bug 6907
    If first resource in a course is deep-link only, and we are not accessing via 
    deep-link, first accessible resource is one that is not deep-link only.
  
  
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.103 rat/lonpageflip.pm:1.104
--- rat/lonpageflip.pm:1.103	Thu Apr 29 17:45:25 2021
+++ rat/lonpageflip.pm	Mon Jun  7 19:04:20 2021
@@ -2,7 +2,7 @@
 #
 # Page flip handler
 #
-# $Id: lonpageflip.pm,v 1.103 2021/04/29 17:45:25 raeburn Exp $
+# $Id: lonpageflip.pm,v 1.104 2021/06/07 19:04:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -99,7 +99,7 @@
 }
 
 sub move {
-    my ($next,$endupmap,$direction) = @_;
+    my ($next,$endupmap,$direction,$firstres) = @_;
     my $safecount=0;
     my $allowed=0;
     my $deeplinkonly=0;
@@ -116,7 +116,7 @@
 	    $allowed = 0;
 	} else {
 	    my $priv = &Apache::lonnet::allowed('bre',$url,$symb);
-	    $allowed = (($priv eq 'F') || ($priv eq '2'));
+	    $allowed = (($priv eq 'F') || ($priv eq '2') || ($priv eq 'A'));
 	}
         $deeplinkonly = 0;
         if ($hash{'deeplinkonly_'.$next}) {
@@ -128,7 +128,7 @@
                     $deeplinkonly = 1;
                 }
             }
-        } elsif ($hash{'deeplinkonly_'.$prev}) {
+        } elsif (($hash{'deeplinkonly_'.$prev}) && (!$firstres)) {
             my ($value,$level) = split(/:/,$hash{'deeplinkonly_'.$prev});
             if ($level eq 'resource') {
                 $deeplinkonly = 1;
@@ -262,9 +262,11 @@
 	    my ($name,$value) = split(/=/,$pair);
 	    $args{&unescape($name)} = &unescape($value);
 	}
-        if (!&Apache::lonnet::allowed('bre',$url,$args{'symb'})) {
+        my $priv = &Apache::lonnet::allowed('bre',$url,$args{'symb'});
+        my $allowed = (($priv eq 'F') || ($priv eq '2') || ($priv eq 'A'));
+        if (!$allowed) {
 # Wow, we cannot see this ... move forward to the next one that we can see
-	    my ($newrid,$newmap)=&move($hash{'first_rid'},$hash{'first_mapurl'},'forward');
+	    my ($newrid,$newmap)=&move($hash{'first_rid'},$hash{'first_mapurl'},'forward',1);
 # Build the new URL
 	    my ($newmapid,$newresid)=split(/\./,$newrid);
 	    my $symb=&Apache::lonnet::encode_symb($newmap,$newresid,$hash{'src_'.$newrid});




More information about the LON-CAPA-cvs mailing list