[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm /xml londefdef.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 23 Aug 2004 15:23:53 -0000


sakharuk		Mon Aug 23 11:23:53 2004 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Bug 2259 (Printing of simplepages and aboutme doesn't work) is fixed. Any critical remarks are welcomed.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.235 loncom/xml/londefdef.pm:1.236
--- loncom/xml/londefdef.pm:1.235	Fri Aug 20 14:43:36 2004
+++ loncom/xml/londefdef.pm	Mon Aug 23 11:23:53 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.235 2004/08/20 18:43:36 sakharuk Exp $
+# $Id: londefdef.pm,v 1.236 2004/08/23 15:23:53 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -2421,17 +2421,6 @@
 	}
     } elsif ($target eq 'tex') {
 	$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
-        #if uploaded restore the path
-	my $old_src=$src;
-	if ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/simplepage\/([^\/]+)$/) {
-	    $src=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$3;
-	    if (not -e $src) {
-		$old_src=~/^\/uploaded\/(.*)$/;
-		$src=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1;
-	    }
-	} elsif ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) {
-	    $src=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3;
-	}
 	#if original gif/jpg/png file exist do following:
 	if (-e $src) {
 	    #what is the image size?
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.526 loncom/lonnet/perl/lonnet.pm:1.527
--- loncom/lonnet/perl/lonnet.pm:1.526	Wed Aug 18 13:04:48 2004
+++ loncom/lonnet/perl/lonnet.pm	Mon Aug 23 11:23:53 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.526 2004/08/18 17:04:48 raeburn Exp $
+# $Id: lonnet.pm,v 1.527 2004/08/23 15:23:53 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1152,6 +1152,7 @@
       $request=new HTTP::Request('POST',"http://".$ENV{'HTTP_HOST'}.$fn);
       $request->content(join('&',map { &escape($_).'='.&escape($form{$_}) } keys %form));
     } else {
+       &logthis('GET'."http://".$ENV{'HTTP_HOST'}.$fn);
       $request=new HTTP::Request('GET',"http://".$ENV{'HTTP_HOST'}.$fn);
     }
 
@@ -5060,7 +5061,21 @@
     $location = $file;
     $location =~ s:/~(.*?)/(.*):/home/$1/public_html/$2:;
   } elsif ($file=~/^\/*uploaded/) { # is an uploaded file
-    $location=$file;
+      if ($file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/(\/)?simplepage\/([^\/]+)$/) {
+	  $location=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$4;
+	  if (not -e $location) {
+	      $file=~/^\/uploaded\/(.*)$/;
+	      $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1;
+	  }
+      } elsif ($file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) {
+	  $location=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3;
+         if (not -e $location) {
+	     $file=~/^\/uploaded\/(.*)$/;
+	     $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1;
+         }
+      } else {
+	  $location=$file;
+      }
   } else {
     $file=~s/^\Q$perlvar{'lonDocRoot'}\E//;
     $file=~s:^/res/:/:;