Diff for /loncom/homework/randomlabel.pm between versions 1.15 and 1.20

version 1.15, 2002/03/06 20:29:03 version 1.20, 2002/03/22 22:00:55
Line 69  sub start_randomlabel { Line 69  sub start_randomlabel {
   my $result='';    my $result='';
   $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
     '/res/adm/includes/GLabel.class';      '/res/adm/includes/GLabel.class';
     push (@Apache::lonxml::namespace,'randomlabel');
   my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);    my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
   
   if ( $bgimg !~ /^http:/ ) {    if ( $bgimg !~ /^http:/ ) {
Line 101  sub start_randomlabel { Line 101  sub start_randomlabel {
     $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$texwidth*$h/$w.')'      $bgimg.'}\setlength{\unitlength}{1mm}  \begin{picture}('.$texwidth.','.$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).' ';
     $result.=&Apache::edit::browse('bgimg').'<br />'.      $result.=&Apache::edit::browse('bgimg').' ';
       $result.=&Apache::edit::search('bgimg').'<br />'.
         &Apache::edit::text_arg('Width(pixel):' ,'width'   ,$token,6).          &Apache::edit::text_arg('Width(pixel):' ,'width'   ,$token,6).
         &Apache::edit::text_arg('Height(pixel):','height'  ,$token,6).          &Apache::edit::text_arg('Height(pixel):','height'  ,$token,6).
         &Apache::edit::text_arg('TeXWidth(mm):' ,'texwidth',$token,6).          &Apache::edit::text_arg('TeXWidth(mm):' ,'texwidth',$token,6).
Line 247  sub end_labelgroup { Line 248  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;  #      my $tcX=$x*($texwidth/$wwidth) - $texwidth;
       my $tcY=$TY1-$y*($TY1/$wheight)-2;        my $tcX=$x*($texwidth/$wwidth);
   #      my $tcY=$TY1-$y*($TY1/$wheight)-2;
         my $ratio=($wwidth > 0 ? $wheight/$wwidth : 1 );
         my $tcY=$TY1-$y*($TY1/$wheight)+$texwidth*$ratio;
       $tcX=sprintf('%.2f',$tcX);        $tcX=sprintf('%.2f',$tcX);
       $tcY=sprintf('%.2f',$tcY);        $tcY=sprintf('%.2f',$tcY);
       $result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n";        $result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n";

Removed from v.1.15  
changed lines
  Added in v.1.20


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