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

www lon-capa-cvs@mail.lon-capa.org
Fri, 23 Apr 2004 15:43:41 -0000


www		Fri Apr 23 11:43:41 2004 EDT

  Modified files:              
    /rat	lonuserstate.pm 
  Log:
  Continued work on hidden and encrypted URLs
  
  
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.73 rat/lonuserstate.pm:1.74
--- rat/lonuserstate.pm:1.73	Fri Apr 23 11:23:35 2004
+++ rat/lonuserstate.pm	Fri Apr 23 11:43:41 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.73 2004/04/23 15:23:35 www Exp $
+# $Id: lonuserstate.pm,v 1.74 2004/04/23 15:43:41 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -289,10 +289,14 @@
 			$randompick{$referid}=$token->[2]->{'value'};
                     }
                     if ($token->[2]->{'name'} eq 'parameter_encrypturl') {
-			$encurl{$referid}=$token->[2]->{'value'};
+			if ($token->[2]->{'value'}=~/^yes$/i) {
+			    $encurl{$referid}=1;
+			}
                     }
                     if ($token->[2]->{'name'} eq 'parameter_hiddenresource') {
-			$hiddenurl{$referid}=$token->[2]->{'value'};
+			if ($token->[2]->{'value'}=~/^yes$/i) {
+			    $hiddenurl{$referid}=1;
+			}
                     }
                 } 
 
@@ -571,10 +575,17 @@
 	    $hash{$_}=&putinversion($hash{$_});
 	}
     }
+# ---------------------------------------------------------------- Encrypt URLs
+    foreach (keys %encurl) {
+	$hash{'src_'.$_}=&Apache::lonenc::encrypted($hash{'src_'.$_});
+    }
+# ----------------------------------------------- Close hashes to finally store
+# --------------------------------- Routine must pass this point, no early outs
     unless ((untie(%hash)) && (untie(%parmhash))) {
       &Apache::lonnet::logthis("<font color=blue>WARNING: ".
                        "Could not untie coursemap $fn for $uri.</font>"); 
     }
+# ---------------------------------------------------- Store away initial state
     {
      my $cfh;
      if ($cfh=Apache::File->new(">$fn.state")) {