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

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 16 Sep 2002 19:06:57 -0000


sakharuk		Mon Sep 16 15:06:57 2002 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Added image replication (gif,eps,ps,..) in <allow> tag.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.88 loncom/xml/londefdef.pm:1.89
--- loncom/xml/londefdef.pm:1.88	Mon Sep 16 13:40:09 2002
+++ loncom/xml/londefdef.pm	Mon Sep 16 15:06:57 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.88 2002/09/16 17:40:09 sakharuk Exp $
+# $Id: londefdef.pm,v 1.89 2002/09/16 19:06:57 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1711,15 +1711,23 @@
 	    } 
 	   return $currentstring;
 	}
-
 #-- <allow> tag
-
         sub start_allow {
-	    my ($target,$token) = @_;
-
+	    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
             $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
                                         $token->[2]->{'src'};
-
+	    my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval);
+	    if (not -e '/home/httpd/html'.$src) {
+            #replicates image itself
+		&Apache::lonnet::repcopy($src);
+	        #replicates eps or ps 
+		my $newsrc = $src;
+		$newsrc =~ s/(.gif|.jpg)$/.eps/;
+ 		if (not-e $newsrc && &Apache::lonnet::repcopy($newsrc) ne 'OK') {
+		    $newsrc =~ s/\.ps$/\.eps/;
+		    &Apache::lonnet::repcopy($newsrc);
+		}
+	    }
 	   return '';
 	}
         sub end_allow {