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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 24 Oct 2003 21:25:50 -0000


albertel		Fri Oct 24 17:25:50 2003 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  - works correctly 100% of the time now. :-)
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.186 loncom/xml/londefdef.pm:1.187
--- loncom/xml/londefdef.pm:1.186	Fri Oct 24 17:11:46 2003
+++ loncom/xml/londefdef.pm	Fri Oct 24 17:25:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.186 2003/10/24 21:11:46 albertel Exp $
+# $Id: londefdef.pm,v 1.187 2003/10/24 21:25:50 albertel Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -50,6 +50,7 @@
 use Image::Magick;
 use Apache::lonmenu();
 use Apache::lonmeta();
+use Apache::Constants qw(:common);
 
 $Apache::londefdef::TD_redirection=0;
 
@@ -3332,18 +3333,14 @@
 
 sub image_replication {
     my $src = shift;
-    if (not -e $src) {
-	#replicates image itself
-	&Apache::lonnet::repcopy($src);
-	#replicates eps or ps 
-	my $newsrc = $src;
-	$newsrc =~ s/\.(gif|jpg|jpeg|png)$/.eps/i;
-	if (not -e $newsrc) {
-	    if (&Apache::lonnet::repcopy($newsrc) ne 'OK') {
-		$newsrc =~ s/\.eps$/\.ps/;
-		&Apache::lonnet::repcopy($newsrc);
-	    }
-	}
+    if (not -e $src) { &Apache::lonnet::repcopy($src); }
+    #replicates eps or ps 
+    my $epssrc = my $pssrc = $src;
+    $epssrc =~ s/\.(gif|jpg|jpeg|png)$/.eps/i;
+    $pssrc  =~ s/\.(gif|jpg|jpeg|png)$/.ps/i;
+    if (not -e $epssrc && not -e $pssrc) {
+	my $result=&Apache::lonnet::repcopy($epssrc);
+	if ($result ne OK) { &Apache::lonnet::repcopy($pssrc); }
     }
     return '';
 }