--- loncom/homework/randomlabel.pm 2002/04/08 21:28:53 1.23
+++ loncom/homework/randomlabel.pm 2002/04/26 18:19:40 1.25
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.23 2002/04/08 21:28:53 matthew Exp $
+# $Id: randomlabel.pm,v 1.25 2002/04/26 18:19:40 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -57,6 +57,7 @@
# (21,54) : $GroupTwo[2] = "TEXT-2"
# ===========================================
package Apache::randomlabel;
+use Apache::lonnet;
use strict;
use Apache::edit;
@@ -106,9 +107,11 @@ sub start_randomlabel {
$result.="";
} elsif ($target eq 'tex') {
$bgimg=~s/(.gif|.jpg)$/.eps/;
- $bgimg=~s/http:\/\/[^\/]*/\/home\/httpd\/html/;
+ $bgimg= &Apache::lonnet::filelocation($bgimg);
+ $bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/;
+ $bgimg=~s/\/$//;
$result.='\vspace*{2mm} \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.
- $bgimg.'}\setlength{\unitlength}{1mm} \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')'
+ $bgimg.'}\setlength{\unitlength}{1mm} \begin{picture}(0,0)('.$texwidth.','.$texwidth*$h/$w.')'
} elsif ($target eq 'edit') {
$result.=&Apache::edit::tag_start($target,$token);
$result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';
@@ -142,7 +145,7 @@ sub end_randomlabel {
if( $count != 0) { $result.= ""; }
$result .= "
";
} elsif ($target eq 'tex') {
- $result='\end{picture}';
+ $result='\end{picture}\\\\';
} elsif ($target eq 'edit') {
$result.=&Apache::edit::end_table;
}
@@ -258,7 +261,7 @@ sub end_labelgroup {
my $y = $Apache::randomlabel::ycoord[$i];
my $value = $Apache::randomlabel::value[$i];
# my $tcX=$x*($texwidth/$wwidth) - $texwidth;
- my $tcX=$x*($texwidth/$wwidth);
+ my $tcX=($x-10)*($texwidth/$wwidth);
# my $tcY=$TY1-$y*($TY1/$wheight)-2;
my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );
my $tcY=$TY1-$y*($TY1/$wheight)+$texwidth*$ratio;