version 1.18, 2002/05/03 20:44:46
|
version 1.20, 2002/07/29 20:43:47
|
Line 55 sub end_imageresponse {
|
Line 55 sub end_imageresponse {
|
return ''; |
return ''; |
} |
} |
|
|
%Apache::response::foilgroup={}; |
%Apache::response::foilgroup=(); |
sub start_foilgroup { |
sub start_foilgroup { |
%Apache::response::foilgroup={}; |
%Apache::response::foilgroup=(); |
$Apache::imageresponse::conceptgroup=0; |
$Apache::imageresponse::conceptgroup=0; |
&Apache::response::setrandomnumber(); |
&Apache::response::setrandomnumber(); |
return ''; |
return ''; |
Line 114 sub displayfoils {
|
Line 114 sub displayfoils {
|
|
|
sub gradefoils { |
sub gradefoils { |
my (@whichopt) = @_; |
my (@whichopt) = @_; |
my $result=''; |
|
my $x; |
my $x; |
my $y; |
my $y; |
my $result; |
my $result; |
Line 174 sub end_foilgroup {
|
Line 173 sub end_foilgroup {
|
|
|
sub start_conceptgroup { |
sub start_conceptgroup { |
$Apache::imageresponse::conceptgroup=1; |
$Apache::imageresponse::conceptgroup=1; |
%Apache::response::conceptgroup={}; |
%Apache::response::conceptgroup=(); |
return ''; |
return ''; |
} |
} |
|
|
Line 244 sub end_text {
|
Line 243 sub end_text {
|
|
|
sub start_image { |
sub start_image { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
if ($target eq 'web') { &Apache::lonxml::startredirection; } |
if ($target eq 'web' || $target eq 'tex') { &Apache::lonxml::startredirection; } |
return ''; |
return ''; |
} |
} |
|
|
sub end_image { |
sub end_image { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
my $currentstring = ''; |
if ($target eq 'web') { |
if ($target eq 'web') { |
my $name = $Apache::imageresponse::curname; |
my $name = $Apache::imageresponse::curname; |
my $image = &Apache::lonxml::endredirection; |
my $image = &Apache::lonxml::endredirection; |
Line 260 sub end_image {
|
Line 260 sub end_image {
|
} else { |
} else { |
$Apache::response::foilgroup{"$name.image"} = $image; |
$Apache::response::foilgroup{"$name.image"} = $image; |
} |
} |
} |
} elsif ($target eq 'tex') { |
return ''; |
my $src = &Apache::lonxml::endredirection; |
|
$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); |
|
my $width_param = ''; |
|
my $height_param = ''; |
|
my $scaling = .3; |
|
my $image = Image::Magick->new; |
|
my $current_figure = $image->Read($src); |
|
$width_param = $image->Get('width') * $scaling;; |
|
$height_param = $image->Get('height') * $scaling;; |
|
undef $image; |
|
my $epssrc = $src; |
|
$epssrc =~ s/(\.gif|\.jpg)$/\.eps/i; |
|
if (not -e $epssrc) { |
|
my $localfile = $epssrc; |
|
$localfile =~ s/.*(\/res)/$1/; |
|
my $file; |
|
my $path; |
|
if ($localfile =~ m!(.*)/([^/]*)$!) { |
|
$file = $2; |
|
$path = $1.'/'; |
|
} |
|
my $signal_eps = 0; |
|
my @content_directory = &Apache::lonnet::dirlist($path); |
|
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
|
my @tempo_array = split(/&/,$content_directory[$iy]); |
|
$content_directory[$iy] = $tempo_array[0]; |
|
if ($file eq $tempo_array[0]) { |
|
$signal_eps = 1; |
|
last; |
|
} |
|
} |
|
if ($signal_eps) { |
|
my $eps_file = &Apache::lonnet::getfile($localfile); |
|
} else { |
|
$localfile = $src; |
|
$localfile =~ s/.*(\/res)/$1/; |
|
my $as = &Apache::lonnet::getfile($src); |
|
} |
|
} |
|
my $file; |
|
my $path; |
|
if ($src =~ m!(.*)/([^/]*)$!) { |
|
$file = $2; |
|
$path = $1.'/'; |
|
} |
|
my $newsrc = $src; |
|
$newsrc =~ s/(\.gif|\.jpg)$/\.eps/i; |
|
$file=~s/(\.gif|\.jpg)$/\.eps/i; |
|
#do we have any specified size of the picture? |
|
my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval); |
|
my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval); |
|
my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval); |
|
if ($TeXwidth ne '') { |
|
$width_param = $TeXwidth; |
|
} elsif ($TeXheight ne '') { |
|
$width_param = $TeXheight/$height_param*$width_param; |
|
} elsif ($width ne '') { |
|
$width_param = $width*$scaling; |
|
} |
|
#where can we find the picture? |
|
if (-e $newsrc) { |
|
if ($path) { |
|
$currentstring .= '\vskip 0 mm \noindent\graphicspath{{'.$path.'}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} '; |
|
} |
|
} else { |
|
my $temp_file; |
|
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; |
|
$temp_file = Apache::File->new('>>'.$filename); |
|
print $temp_file "$src\n"; |
|
$currentstring .= '\vskip 0 mm \graphicspath{{/home/httpd/prtspool/}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} '; |
|
} |
|
} |
|
return $currentstring; |
} |
} |
|
|
sub start_rectangle { |
sub start_rectangle { |