[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm randomlylabel.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 23 Jan 2003 18:26:10 -0000


www		Thu Jan 23 13:26:10 2003 EDT

  Modified files:              
    /loncom/homework	randomlabel.pm randomlylabel.pm 
  Log:
  randomlabel.pm did not replicate the file (part of Bug #1187).
  Calls repcopy now. Delivers "broken" image if file could not be replicated
  for some reason.
  Side fix:
  Users had problems with foo.GIF as background image. Made regular expressions
  case-insensitive.
  
  
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.41 loncom/homework/randomlabel.pm:1.42
--- loncom/homework/randomlabel.pm:1.41	Tue Dec  3 05:32:57 2002
+++ loncom/homework/randomlabel.pm	Thu Jan 23 13:26:10 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.41 2002/12/03 10:32:57 sakharuk Exp $
+# $Id: randomlabel.pm,v 1.42 2003/01/23 18:26:10 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -86,6 +86,9 @@
   my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
   if ( $bgimg !~ /^http:/ ) {
     $bgimg=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$bgimg);
+    if (&Apache::lonnet::repcopy($bgimg) ne OK) {
+	$bgimg='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif';
+    }
   }
   my $w= &check_int(&Apache::lonxml::get_param('width',$parstack,$safeeval));
   my $h= &check_int(&Apache::lonxml::get_param('height',$parstack,$safeeval));
@@ -97,7 +100,7 @@
       $result.="BGIMG=".&Apache::lonnet::escape($bgimg);
   } elsif ($target eq 'tex') {
     my $newbgimg = $bgimg;
-    $bgimg=~s/(.gif|.jpg|.png)$/.eps/;
+    $bgimg=~s/\.(gif|jpg|png|jpeg)$/\.eps/i;
     $bgimg= &Apache::lonnet::filelocation($bgimg);
     if (not $ENV{'request.role'}=~/^au\./) {
 	$bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/;
Index: loncom/homework/randomlylabel.pm
diff -u loncom/homework/randomlylabel.pm:1.4 loncom/homework/randomlylabel.pm:1.5
--- loncom/homework/randomlylabel.pm:1.4	Mon Dec 16 09:41:15 2002
+++ loncom/homework/randomlylabel.pm	Thu Jan 23 13:26:10 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # randomlabel.png: composite together text and images into 1 image
 #
-# $Id: randomlylabel.pm,v 1.4 2002/12/16 14:41:15 matthew Exp $
+# $Id: randomlylabel.pm,v 1.5 2003/01/23 18:26:10 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,7 +39,7 @@
 sub get_image {
     my ($imgsrc,$set_trans)=@_;
     my $image;
-    if ($imgsrc !~ /\.(png|jpg|jpeg)$/) {
+    if ($imgsrc !~ /\.(png|jpg|jpeg)$/i) {
 	my $conv_image = Image::Magick->new;
 	my $current_figure = $conv_image->Read('filename'=>$imgsrc);
 	$conv_image->Set('magick'=>'png');