[LON-CAPA-cvs] cvs: loncom / lonenc.pm /homework structuretags.pm /interface lonnavmaps.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 10 Nov 2004 22:20:51 -0000


albertel		Wed Nov 10 17:20:51 2004 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
    /loncom/interface	lonnavmaps.pm 
    /loncom	lonenc.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - trying to get encrypturl to work
  
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.270 loncom/homework/structuretags.pm:1.271
--- loncom/homework/structuretags.pm:1.270	Tue Oct 12 18:55:22 2004
+++ loncom/homework/structuretags.pm	Wed Nov 10 17:20:50 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.270 2004/10/12 22:55:22 albertel Exp $
+# $Id: structuretags.pm,v 1.271 2004/11/10 22:20:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -124,8 +124,10 @@
     }
     my $form_tag_start;
     if (!defined($found{'form'})) {
-	$form_tag_start='<form name="lonhomework" method="post" action="'.
-	    $ENV{'request.uri'}.'">';
+	$form_tag_start='<form name="lonhomework" method="post" action="';
+	my $uri=$ENV{'request.uri'};
+	if ($ENV{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
+	$form_tag_start.=$uri.'">';
     }
     return ($result,$head_tag_start,$body_tag_start,$form_tag_start);
 }
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.302 loncom/interface/lonnavmaps.pm:1.303
--- loncom/interface/lonnavmaps.pm:1.302	Tue Nov  2 16:02:01 2004
+++ loncom/interface/lonnavmaps.pm	Wed Nov 10 17:20:50 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.302 2004/11/02 21:02:01 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.303 2004/11/10 22:20:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -442,7 +442,7 @@
     foreach $res (@$stack) {
         if (defined($res)) {
 	    if ($res->is_page()) {
-		return $res->src();
+		return $res->link();
 	    }
             # in case folder was skipped over as "only sequence"
 	    my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb());
@@ -461,7 +461,7 @@
         if (defined($_)) { $res = $_; }
     }
 
-    return $res->src();
+    return $res->link();
 }
 
 # Convenience function: This separates the logic of how to create
@@ -1854,7 +1854,7 @@
             my $srcHasQuestion = $src =~ /\?/;
             $args->{"resourceLink"} = $src.
                 ($srcHasQuestion?'&':'?') .
-                'symb=' . &Apache::lonnet::escape($curRes->symb()).
+                'symb=' . &Apache::lonnet::escape($curRes->shown_symb()).
 		$anchor;
 
             # Now, display each column.
@@ -3446,6 +3446,7 @@
 # These info functions can be used directly, as they don't return
 # resource information.
 sub comesfrom { my $self=shift; return $self->navHash("comesfrom_", 1); }
+sub encrypted { my $self=shift; return $self->navHash("encrypted_", 1); }
 sub ext { my $self=shift; return $self->navHash("ext_", 1) eq 'true:'; }
 sub from { my $self=shift; return $self->navHash("from_", 1); }
 # considered private and undocumented
@@ -3457,10 +3458,20 @@
     return $self->{NAV_MAP}->{PARM_HASH}->{$self->symb .
                                                '.0.parameter_randompick'};
 }
+sub link {
+    my $self=shift;
+    if ($self->encrypted()) { return &Apache::lonenc::encrypted($self->src); }
+    return $self->src;
+}
 sub src { 
     my $self=shift;
     return $self->navHash("src_", 1);
 }
+sub shown_symb {
+    my $self=shift;
+    if ($self->encrypted()) {return &Apache::lonenc::encrypted($self->symb());}
+    return $self->symb();
+}
 sub symb {
     my $self=shift;
     (my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/;
Index: loncom/lonenc.pm
diff -u loncom/lonenc.pm:1.3 loncom/lonenc.pm:1.4
--- loncom/lonenc.pm:1.3	Tue Nov  9 16:16:31 2004
+++ loncom/lonenc.pm	Wed Nov 10 17:20:50 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # URL translation for encrypted filenames
 #
-# $Id: lonenc.pm,v 1.3 2004/11/09 21:16:31 albertel Exp $
+# $Id: lonenc.pm,v 1.4 2004/11/10 22:20:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,11 +44,14 @@
 	my $handle=$lonid->value;
         $handle=~s/\W//g;
         my $lonidsdir=$r->dir_config('lonIDsDir');
+	$ENV{'request.enc'}=1;
         if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
 # Initialize Environment
             &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
 # Decrypt URL and redirect
-	    $r->internal_redirect(&unencrypted($r->uri));
+	    &Apache::lonnet::logthis("args ".$r->args);
+	    &Apache::lonnet::logthis("uri ".$r->uri);
+	    $r->internal_redirect(&unencrypted($r->uri).'?'.$r->args);
 	    return OK;
 	} 
     }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.567 loncom/lonnet/perl/lonnet.pm:1.568
--- loncom/lonnet/perl/lonnet.pm:1.567	Wed Nov 10 14:03:04 2004
+++ loncom/lonnet/perl/lonnet.pm	Wed Nov 10 17:20:50 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.567 2004/11/10 19:03:04 raeburn Exp $
+# $Id: lonnet.pm,v 1.568 2004/11/10 22:20:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4710,7 +4710,7 @@
 
 sub symbclean {
     my $symb=shift;
-
+    if ($symb=~m|^/enc/|) { $symb=&Apache::lonenc::unencrypted($symb); }
 # remove version from map
     $symb=~s/\.(\d+)\.(\w+)\_\_\_/\.$2\_\_\_/;
 
@@ -4731,7 +4731,9 @@
 }
 
 sub decode_symb {
-    my ($map,$resid,$url)=split(/\_\_\_/,shift);
+    my $symb=shift;
+    if ($symb=~m|^/enc/|) { $symb=&Apache::lonenc::unencrypted($symb); }
+    my ($map,$resid,$url)=split(/___/,$symb);
     return (&fixversion($map),$resid,&fixversion($url));
 }
 
@@ -5565,7 +5567,7 @@
     {
 	use integer;
 	my $test=(2**32)+1;
-	if ($test != 0) { $_64bit=1; }
+	if ($test != 0) { $_64bit=1; } else { $_64bit=0; }
 	&logthis(" Detected 64bit platform ($_64bit)");
     }
 }