--- rat/lonpageflip.pm 2021/06/07 19:04:20 1.104 +++ rat/lonpageflip.pm 2021/07/19 14:26:40 1.105 @@ -2,7 +2,7 @@ # # Page flip handler # -# $Id: lonpageflip.pm,v 1.104 2021/06/07 19:04:20 raeburn Exp $ +# $Id: lonpageflip.pm,v 1.105 2021/07/19 14:26:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -256,9 +256,13 @@ sub first_accessible_resource { if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { $furl=$hash{'first_url'}; - my %args; - my ($url,$args) = split(/\?/,$furl); - foreach my $pair (split(/\&/,$args)) { + my (%args,$url,$argstr); + if ($furl =~ m{^/enc/}) { + ($url,$argstr) = split(/\?/,&Apache::lonenc::unencrypted($furl)); + } else { + ($url,$argstr) = split(/\?/,$furl); + } + foreach my $pair (split(/\&/,$argstr)) { my ($name,$value) = split(/=/,$pair); $args{&unescape($name)} = &unescape($value); } @@ -268,13 +272,17 @@ sub first_accessible_resource { # 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',1); # Build the new URL - my ($newmapid,$newresid)=split(/\./,$newrid); - my $symb=&Apache::lonnet::encode_symb($newmap,$newresid,$hash{'src_'.$newrid}); - $furl=&add_get_param($hash{'src_'.$newrid},{ 'symb' => $symb }); - if ($hash{'encrypted_'.$newrid}) { - $furl=&Apache::lonenc::encrypted($furl); + if ($newrid eq '') { + $furl = '/adm/navmaps'; + } else { + my ($newmapid,$newresid)=split(/\./,$newrid); + my $symb=&Apache::lonnet::encode_symb($newmap,$newresid,$hash{'src_'.$newrid}); + $furl=&add_get_param($hash{'src_'.$newrid},{ 'symb' => $symb }); + if ($hash{'encrypted_'.$newrid}) { + $furl=&Apache::lonenc::encrypted($furl); + } } - } + } untie(%hash); return $furl; } else {