Diff for /loncom/homework/randomlabel.pm between versions 1.30 and 1.31

version 1.30, 2002/07/18 20:17:45 version 1.31, 2002/07/22 17:15:55
Line 91  sub start_randomlabel { Line 91  sub start_randomlabel {
     } elsif ($bgimg =~ m:^/home/.*/public_html:) {      } elsif ($bgimg =~ m:^/home/.*/public_html:) {
       $bgimg =~ s:^/home/(.*)/public_html:/~$1:;        $bgimg =~ s:^/home/(.*)/public_html:/~$1:;
     }      }
     $bgimg="http://".$ENV{'SERVER_NAME'}.$bgimg;      $bgimg='http://'.$ENV{'SERVER_NAME'}.$bgimg;
   }    }
   my $code = &Apache::lonxml::get_param('code',$parstack,$safeeval);    my $code = &Apache::lonxml::get_param('code',$parstack,$safeeval);
   my $codebase = &Apache::lonxml::get_param('codebase',$parstack,$safeeval);    my $codebase = &Apache::lonxml::get_param('codebase',$parstack,$safeeval);
Line 108  sub start_randomlabel { Line 108  sub start_randomlabel {
   } elsif ($target eq 'tex') {    } elsif ($target eq 'tex') {
     $bgimg=~s/(.gif|.jpg)$/.eps/;      $bgimg=~s/(.gif|.jpg)$/.eps/;
     $bgimg= &Apache::lonnet::filelocation($bgimg);      $bgimg= &Apache::lonnet::filelocation($bgimg);
     $bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/;      if (not $ENV{'request.role'}=~/^au\./) {
    $bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/;
       } else {
    $bgimg=~s/http:\/[^\/]*\/~([^\/]+)/\/home\/$1\/public_html/;
   
       }
     $bgimg=~s/\/$//;      $bgimg=~s/\/$//;
     $result.='\vspace*{2mm}  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.      if ($texwidth==90) {
     $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')'   $result.='\vspace*{2mm}  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.
       $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')';
       } else {
    $result.='\vspace*{2mm}  \noindent \epsfxsize='.$texwidth.' mm \epsffile{'.
       $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')('.(100-$texwidth).','.(100-$texwidth)*$h/$w.')';
       }
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
     $result.=&Apache::edit::tag_start($target,$token);      $result.=&Apache::edit::tag_start($target,$token);
     $result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';      $result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';
Line 145  sub end_randomlabel { Line 155  sub end_randomlabel {
     if( $count != 0) { $result.= "<param name=\"ICOUNT\" value=\"$count\">\n"; }      if( $count != 0) { $result.= "<param name=\"ICOUNT\" value=\"$count\">\n"; }
     $result .= "</applet>\n<BR />";      $result .= "</applet>\n<BR />";
   } elsif ($target eq 'tex') {    } elsif ($target eq 'tex') {
     $result='\end{picture}\\\\ \vskip -3 cm';        $result='\end{picture}\\\\';
         if (@$parstack[-1]=~/\$texwidth\s*=\s*?"90/) { #"
     @$parstack[-1]=~/\$height\s*=\s*?"(.+)?"/;
     my $howtoskipback = $1/45;
     $result.=' \vskip -'.$howtoskipback.' cm ';
         }
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
     $result.=&Apache::edit::end_table;      $result.=&Apache::edit::end_table;
   }    }
Line 267  sub end_labelgroup { Line 282  sub end_labelgroup {
       my $x = $Apache::randomlabel::xcoord[$i];        my $x = $Apache::randomlabel::xcoord[$i];
       my $y = $Apache::randomlabel::ycoord[$i];        my $y = $Apache::randomlabel::ycoord[$i];
       my $value = $Apache::randomlabel::value[$i];        my $value = $Apache::randomlabel::value[$i];
 #      my $tcX=$x*($texwidth/$wwidth) - $texwidth;        #x latex coordinate
       my $tcX=($x-2)*($texwidth/$wwidth);        my $tcX=($x-5)*($texwidth/$wwidth);
 #      my $tcY=$TY1-$y*($TY1/$wheight)-2;        #y latex coordinate
       my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );        my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );
       my $tcY=$TY1-$y*($TY1/$wheight)+$texwidth*$ratio;        my $tcY=$TY1-$y*($TY1/$wheight)+$texwidth*$ratio;
       $tcX=sprintf('%.2f',$tcX);        $tcX=sprintf('%.2f',$tcX);

Removed from v.1.30  
changed lines
  Added in v.1.31


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>