Diff for /loncom/homework/randomlabel.pm between versions 1.86 and 1.89

version 1.86, 2007/05/10 10:27:22 version 1.89, 2007/06/20 17:33:33
Line 70  my $cgi_id; Line 70  my $cgi_id;
 my $scale_factor; # image scale factor.  my $scale_factor; # image scale factor.
 my $label_xscale;                # Label scale factor (needed for gnuplot).  my $label_xscale;                # Label scale factor (needed for gnuplot).
 my $label_yscale;  my $label_yscale;
   my $dirty_width_adjust = 5;     # Width adjustment for e.g. gnuplot images.
   
 BEGIN {  BEGIN {
     &Apache::lonxml::register('Apache::randomlabel',('randomlabel','labelgroup','location','label','bgimg'));      &Apache::lonxml::register('Apache::randomlabel',('randomlabel','labelgroup','location','label','bgimg'));
Line 147  sub start_randomlabel { Line 147  sub start_randomlabel {
     } elsif ($target eq 'tex' && defined($bgimg)) {      } elsif ($target eq 'tex' && defined($bgimg)) {
  $result.=&make_eps_image($bgimg,$parstack,$safeeval);   $result.=&make_eps_image($bgimg,$parstack,$safeeval);
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
           my $only = join(',',&Apache::loncommon::filecategorytypes('Pictures'));
  $result.=&Apache::edit::tag_start($target,$token);   $result.=&Apache::edit::tag_start($target,$token);
  $Apache::edit::bgimgsrc=   $Apache::edit::bgimgsrc=
     &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);      &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
  $Apache::edit::bgimgsrccurdepth=$Apache::lonxml::curdepth;   $Apache::edit::bgimgsrccurdepth=$Apache::lonxml::curdepth;
  $result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';   $result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';
  $result.=&Apache::edit::browse('bgimg').' ';   $result.=&Apache::edit::browse('bgimg',undef,undef,$only).' ';
  $result.=&Apache::edit::search('bgimg').'<br />'.   $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).
Line 164  sub start_randomlabel { Line 165  sub start_randomlabel {
      'height','texwidth');       'height','texwidth');
  if ($constructtag) {   if ($constructtag) {
     $result = &Apache::edit::rebuild_tag($token);      $result = &Apache::edit::rebuild_tag($token);
     $result.=&Apache::edit::handle_insert();  
  }   }
     }      }
     return $result;      return $result;
Line 268  sub end_bgimg { Line 268  sub end_bgimg {
  &Apache::lonxml::debug("height $height_param");   &Apache::lonxml::debug("height $height_param");
  &Apache::lonxml::debug("Width $width_param");   &Apache::lonxml::debug("Width $width_param");
  &Apache::lonxml::debug("Scale factors: $label_xscale $label_yscale");   &Apache::lonxml::debug("Scale factors: $label_xscale $label_yscale");
  my $dirty_width = $width_param + 5;   my $dirty_width = $width_param + $dirty_width_adjust;
    my $x_offset    = -$dirty_width_adjust/2.0;
  #   #
  #  Somewhere here it looks like height_param and   #  Somewhere here it looks like height_param and
  #  width_param got backwards...   #  width_param got backwards...
Line 276  sub end_bgimg { Line 277  sub end_bgimg {
  $result .= '\parbox{'.$dirty_width.'mm}{';   $result .= '\parbox{'.$dirty_width.'mm}{';
  $result  .= " $src \n";   $result  .= " $src \n";
  $result  .= '\setlength{\unitlength}{1mm}'."\n";   $result  .= '\setlength{\unitlength}{1mm}'."\n";
  $result  .= '\begin{picture}('."$height_param,$width_param)";   $result  .= '\begin{picture}('."$width_param,$height_param)";
  $result  .= "(0,-$width_param)";   $result  .= "($x_offset,-$height_param)";
  $result  .= "\n";   $result  .= "\n";
  $Apache::lonxml::debug = 0;   $Apache::lonxml::debug = 0;
   
Line 353  sub start_labelgroup { Line 354  sub start_labelgroup {
      'TeXsize');       'TeXsize');
  if ($constructtag) {   if ($constructtag) {
     $result = &Apache::edit::rebuild_tag($token);      $result = &Apache::edit::rebuild_tag($token);
     $result.=&Apache::edit::handle_insert();  
  }   }
     }      }
     return $result;      return $result;
Line 539  sub start_location { Line 539  sub start_location {
     $safeeval,'x','y','value');      $safeeval,'x','y','value');
  if ($constructtag) {   if ($constructtag) {
     $result = &Apache::edit::rebuild_tag($token);      $result = &Apache::edit::rebuild_tag($token);
     $result.=&Apache::edit::handle_insert();  
  }   }
     }      }
     $Apache::lonxml::debug = 0;      $Apache::lonxml::debug = 0;

Removed from v.1.86  
changed lines
  Added in v.1.89


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