[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm randomlabel.pm /xml londefdef.pm

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 06 Nov 2006 23:45:01 -0000


foxr		Mon Nov  6 18:45:01 2006 EDT

  Modified files:              
    /loncom/homework	imageresponse.pm randomlabel.pm 
    /loncom/xml	londefdef.pm 
  Log:
  Factor out ' ' -> '_' substitution when doing print
  preparation of images.
  
  
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.79 loncom/homework/imageresponse.pm:1.80
--- loncom/homework/imageresponse.pm:1.79	Mon Nov  6 06:56:23 2006
+++ loncom/homework/imageresponse.pm	Mon Nov  6 18:44:42 2006
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # image click response style
 #
-# $Id: imageresponse.pm,v 1.79 2006/11/06 11:56:23 foxr Exp $
+# $Id: imageresponse.pm,v 1.80 2006/11/06 23:44:42 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -544,7 +544,6 @@
 	    $graphinclude =~ s/^$commentline//;
 	} else {
 	    my ($path,$file) = &Apache::londefdef::get_eps_image($src);
-	    $file =~ s/\ /\_/g;
 	    my ($height_param,$width_param)=
 		&Apache::londefdef::image_size($src,0.3,$parstack,$safeeval);
 	    $graphinclude = '\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'}';
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.83 loncom/homework/randomlabel.pm:1.84
--- loncom/homework/randomlabel.pm:1.83	Tue Aug 29 06:42:59 2006
+++ loncom/homework/randomlabel.pm	Mon Nov  6 18:44:42 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.83 2006/08/29 10:42:59 foxr Exp $
+# $Id: randomlabel.pm,v 1.84 2006/11/06 23:44:42 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -302,9 +302,7 @@
     #  for latex included filenames.  Therefore:
     #
     my $safe_path = $path;
-    $safe_path =~ s/ /\_/g;
     my $safe_file = $file;
-    $safe_file =~ s/ /\_/g;
 
     my $result ="\n".'\vspace*{2mm}\noindent'."\n".
 	'\parbox{'.$dirtywidth.
@@ -496,7 +494,6 @@
 		#  Note that spaces in e.. \includegraphics cause problems for Latex
 		# so they get replaced by _'s by lonprintout/printout and us:
 		#
-		$image_name =~ s/ /\_/g;
 		my $label_width = &get_label_width($label);
 
 		$result .=  '\includegraphics[width='.$label_width.'mm]{'
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.342 loncom/xml/londefdef.pm:1.343
--- loncom/xml/londefdef.pm:1.342	Mon Nov  6 18:06:19 2006
+++ loncom/xml/londefdef.pm	Mon Nov  6 18:45:00 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.342 2006/11/06 23:06:19 foxr Exp $
+# $Id: londefdef.pm,v 1.343 2006/11/06 23:45:00 foxr Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -2860,9 +2860,7 @@
 	    my ($height_param,$width_param)=
 		&image_size($origsrc,0.3,$parstack,$safeeval);
 	    my $destpath = $path;
-	    $destpath    =~ s/ /\_/g; # Spaces in path cause LaTex to vomit.
 	    my $destfile = $file;
-	    $destfile    =~ s/ /\_/g;
 	    my $size;
 	    if ($width_param)  { $size.='width='.$width_param.' mm,'; }
 	    if ($height_param) { $size.='height='.$height_param.' mm]'; }
@@ -4245,7 +4243,6 @@
     $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
     &Apache::lonxml::debug("Filelocation gives: $src");
     if (! -e $src) {
-	# &Apache::lonnet::logthis("$src does not exist...repcopying");
 	&Apache::lonxml::debug("$src does not exist");
 	if (&Apache::lonnet::repcopy($src) ne 'ok' ) {
 	    &Apache::lonxml::debug("Repcopy of $src failed (1)");
@@ -4257,7 +4254,6 @@
 	    &Apache::lonxml::debug("repcopy of $src ... $didrepcopy");
 	    if ( (not -e $src) ||
 		($didrepcopy ne 'ok')) {
-		# &Apache::lonnet::logthis("queuing $orig_src for dynamic eps gen");
 		&Apache::lonxml::debug("Failed to find or replicate $src");
 
 		#if replication failed try to produce eps file dynamically
@@ -4276,10 +4272,9 @@
 		}
 
 	    }
+
 	}
     } else {
-# 	&Apache::lonnet::logthis("$src exists. queueing for copy.");
-# 	&Apache::lonnet::logthis("Got eps already.. queue for copy");
 	# If the postscript file has spaces in its name,
 	# LaTeX will gratuitiously vomit.  Therefore
 	# queue such files for copy with " " replaced by "_".
@@ -4287,13 +4282,13 @@
 	my $newsrc = $orig_src;
 	$newsrc    =~  s|(.*)/res/|/home/httpd/html/res/|;
 	open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat");
-#	&Apache::lonnet::logthis("Queueing $newsrc for copy");
-	print FILE "$newsrc\n";
+	print FILE "$src\n";
 	close FILE;
 	$src=~s|/home/httpd/html/res|/home/httpd/prtspool|;
 	$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
     }
     my ($path,$file)=($src=~m|(.*)/([^/]*)$|);
+    $file =~ s/ /\_/g;
     &Apache::lonxml::debug("get_eps_image returning: $path / $file<BR />");
     return ($path.'/',$file);
 }