--- loncom/homework/randomlabel.pm	2003/11/11 00:25:24	1.53
+++ loncom/homework/randomlabel.pm	2004/01/08 20:28:20	1.55
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.53 2003/11/11 00:25:24 albertel Exp $
+# $Id: randomlabel.pm,v 1.55 2004/01/08 20:28:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -107,8 +107,8 @@ sub start_randomlabel {
 	my $newbgimg = $bgimg;
 	$bgimg=~s/\.(gif|jpg|png|jpeg)$/\.eps/i;
 	$bgimg= &Apache::lonnet::filelocation($bgimg);
-	$bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/;
-	$bgimg=~s/\/$//;
+	$bgimg=~s|http:/[^/]*//home/httpd/html|;
+	$bgimg=~s|/$||;
 	#if no eps file try to replicate it
 	if (not-e $bgimg) {
 	    if (&Apache::lonnet::repcopy($bgimg) ne OK ) {
@@ -122,12 +122,14 @@ sub start_randomlabel {
 		    my $temp_file;
 		    my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
 		    $temp_file = Apache::File->new('>>'.$filename);
-		    $newbgimg =~ s/(.*)\/res\//\/home\/httpd\/html\/res\//;
+		    $newbgimg =~ s|(.*)/res/|/home/httpd/html/res/|;
 		    print $temp_file "$newbgimg\n";
-		    $bgimg=~s/\/home\/httpd\/html\/res/\/home\/httpd\/prtspool/;		}
+		    $bgimg=~s|/home/httpd/html/res|/home/httpd/prtspool|;
+		    $bgimg=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
+		}
 	    }
 	}
-	$bgimg=~s/\/$//;
+	$bgimg=~s|/$||;
 	my $dirtywidth=$texwidth+5;
 	$result.='\vspace*{2mm}\noindent \parbox{'.$dirtywidth.' mm}{  \noindent \epsfxsize='.
 	    $texwidth.' mm \epsffile{'.$bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.