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

raeburn raeburn@source.lon-capa.org
Tue, 23 Feb 2010 05:00:16 -0000


raeburn		Tue Feb 23 05:00:16 2010 EDT

  Modified files:              
    /rat	lonsequence.pm 
  Log:
  - Need to encrypt URL if bighash indicates that it should be encrypted, 
    and user does not have advanced role.  
  
  
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.39 rat/lonsequence.pm:1.40
--- rat/lonsequence.pm:1.39	Sat May 16 23:21:12 2009
+++ rat/lonsequence.pm	Tue Feb 23 05:00:16 2010
@@ -2,7 +2,7 @@
 #
 # Sequence Handler
 #
-# $Id: lonsequence.pm,v 1.39 2009/05/16 23:21:12 bisitz Exp $
+# $Id: lonsequence.pm,v 1.40 2010/02/23 05:00:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -217,6 +217,7 @@
   my $dismapid='';
   my $exitdisid = '';
   my $arrow_dir = '';
+  my $is_encrypted = '';
 
   if (($env{'request.course.fn'}) && (!$env{'form.forceselect'})) {
        my $last;
@@ -247,6 +248,9 @@
 	       if (!$env{'request.role.adv'}) {
 		   $randomout = $bighash{'randomout_'.$disid};
 	       }
+               if (!$env{'request.role.adv'}) {
+                   $is_encrypted = $bighash{'encrypted_'.$disid};
+               }
            } elsif (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
                     &GDBM_READER(),0640)) {
                $last=$hash{'last_known'};
@@ -266,6 +270,9 @@
 		   if (!$env{'request.role.adv'}) {
 		       $randomout = $bighash{'randomout_'.$disid};
 		   }
+                   if (!$env{'request.role.adv'}) {
+                       $is_encrypted = $bighash{'encrypted_'.$disid};
+                   }
                }
  	   }
            $exitdisid = $disid;
@@ -279,11 +286,15 @@
 # now either disurl is set (going to first page), or we need another display
    if ($disurl) {
 # -------------------------------------------------- Has first or last resource
+      my $showdisurl = $disurl;
+      if ($is_encrypted) {
+          $showdisurl = &Apache::lonenc::encrypted($disurl);
+      }
       &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid],
 				'last_known' => [$disurl,$dismapid]); 
       &Apache::loncommon::content_type($r,'text/html');
       $r->header_out(Location => &Apache::lonnet::absolute_url($ENV{'SERVER_NAME'}).
-                                 $disurl);
+                                 $showdisurl);
       return REDIRECT;
    } else {
        &Apache::loncommon::content_type($r,'text/html');