version 1.62, 2005/02/10 23:00:10
|
version 1.68, 2005/05/10 11:24:01
|
Line 36 use Apache::randomlylabel();
|
Line 36 use Apache::randomlylabel();
|
use Apache::londefdef(); |
use Apache::londefdef(); |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::imageresponse',('imageresponse')); |
&Apache::lonxml::register('Apache::imageresponse',('imageresponse')); |
Line 227 sub clean_up_image {
|
Line 228 sub clean_up_image {
|
} |
} |
} else { |
} else { |
$image=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$image); |
$image=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$image); |
if (&Apache::lonnet::repcopy($image) ne OK) { |
&Apache::lonxml::debug("repcopying: $image"); |
|
if (&Apache::lonnet::repcopy($image) ne 'ok') { |
$image='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif'; |
$image='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif'; |
} |
} |
} |
} |
Line 242 sub gradefoils {
|
Line 244 sub gradefoils {
|
my $id=$Apache::inputtags::response['-1']; |
my $id=$Apache::inputtags::response['-1']; |
my $temp=1; |
my $temp=1; |
foreach my $name (@whichopt) { |
foreach my $name (@whichopt) { |
$x=$ENV{"form.HWVAL_$id:$temp.x"}; |
$x=$env{"form.HWVAL_$id:$temp.x"}; |
$y=$ENV{"form.HWVAL_$id:$temp.y"}; |
$y=$env{"form.HWVAL_$id:$temp.y"}; |
&Apache::lonxml::debug("Got a x of $x and a y of $y for $name"); |
&Apache::lonxml::debug("Got a x of $x and a y of $y for $name"); |
if (defined($x) && defined($y) && |
if (defined($x) && defined($y) && |
defined(@{ $Apache::response::foilgroup{"$name.area"} })) { |
defined(@{ $Apache::response::foilgroup{"$name.area"} })) { |
Line 294 sub end_foilgroup {
|
Line 296 sub end_foilgroup {
|
if ($target eq 'web' || $target eq 'tex') { |
if ($target eq 'web' || $target eq 'tex') { |
$result=&displayfoils($target,@whichopt); |
$result=&displayfoils($target,@whichopt); |
} elsif ($target eq 'grade') { |
} elsif ($target eq 'grade') { |
if ( defined $ENV{'form.submitted'}) { &gradefoils(@whichopt); } |
if ( defined $env{'form.submitted'}) { &gradefoils(@whichopt); } |
} elsif ( $target eq 'analyze') { |
} elsif ( $target eq 'analyze') { |
&Apache::response::analyze_store_foilgroup(\@whichopt, |
&Apache::response::analyze_store_foilgroup(\@whichopt, |
['text','image','area']); |
['text','image','area']); |
Line 341 sub insert_foil {
|
Line 343 sub insert_foil {
|
$Apache::imageresponse::curname=''; |
$Apache::imageresponse::curname=''; |
sub start_foil { |
sub start_foil { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
my $result; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'tex' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'tex' || |
$target eq 'analyze') { |
$target eq 'analyze') { |
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); |
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); |
Line 360 sub start_foil {
|
Line 363 sub start_foil {
|
push(@{ $Apache::response::foilgroup{'names'} }, $name); |
push(@{ $Apache::response::foilgroup{'names'} }, $name); |
} |
} |
$Apache::imageresponse::curname=$name; |
$Apache::imageresponse::curname=$name; |
} |
} elsif ($target eq 'edit') { |
return ''; |
$result = &Apache::edit::tag_start($target,$token); |
|
$result .= &Apache::edit::text_arg('Name:','name',$token); |
|
$result .= &Apache::edit::end_row(). |
|
&Apache::edit::start_spanning_row(); |
|
} elsif ($target eq 'modified') { |
|
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
|
$safeeval,'name'); |
|
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } |
|
} |
|
return $result;; |
} |
} |
|
|
sub end_foil { |
sub end_foil { |
Line 455 sub end_image {
|
Line 467 sub end_image {
|
$result=&Apache::edit::end_table(); |
$result=&Apache::edit::end_table(); |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $src = &Apache::lonxml::endredirection(); |
my $src = &Apache::lonxml::endredirection(); |
my ($path,$file) = &Apache::londefdef::get_eps_image($src); |
|
my ($height_param,$width_param)= |
# There may be all sorts of whitespace on fore and aft: |
&Apache::londefdef::image_size($src,0.3,$parstack,$safeeval); |
|
$Apache::response::foilgroup{"$name.image"} ='\vskip 0 mm \noindent\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; |
$src =~ s/\s+$//; |
|
$src =~ s/^\s+//; |
|
|
|
# |
|
# Gnuplot e.g. just generates the latex to put inplace. |
|
# |
|
my $graphinclude; |
|
if ($src =~ /^\\graphicspath/) { |
|
$graphinclude = $src; |
|
} else { |
|
my ($path,$file) = &Apache::londefdef::get_eps_image($src); |
|
my ($height_param,$width_param)= |
|
&Apache::londefdef::image_size($src,0.3,$parstack,$safeeval); |
|
$graphinclude = '\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'}'; |
|
} |
|
$Apache::response::foilgroup{"$name.image"} ='\vskip 0 mm \noindent '.$graphinclude; |
} |
} |
return $result; |
return $result; |
} |
} |