--- loncom/homework/functionplotresponse.pm 2011/11/24 15:43:08 1.87 +++ loncom/homework/functionplotresponse.pm 2011/11/26 01:35:26 1.88 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # Functionplot responses # -# $Id: functionplotresponse.pm,v 1.87 2011/11/24 15:43:08 www Exp $ +# $Id: functionplotresponse.pm,v 1.88 2011/11/26 01:35:26 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -49,10 +49,14 @@ BEGIN { # sub geogebra_startcode { - my ($id)=@_; + my ($id,$width,$height)=@_; + $width=int(1.*$width); + $height=int(1.*$height); + unless ($width) { $width=700; } + unless ($height) { $height=400; } return (< + codebase="/adm/geogebra/" width="$width" height="$height" MAYSCRIPT> ENDSTARTCODE } @@ -1248,7 +1252,11 @@ sub start_functionplotresponse { .&Apache::edit::end_row() .&Apache::edit::start_spanning_row() ."\n"; - $result.=&Apache::edit::text_arg('Label x-axis:','xlabel', + $result.=&Apache::edit::text_arg('Width (pixels):','width', + $token,'6').' '. + &Apache::edit::text_arg('Height (pixels):','height', + $token,'6').'
'. + &Apache::edit::text_arg('Label x-axis:','xlabel', $token,'6').' '. &Apache::edit::text_arg('Minimum x-value:','xmin', $token,'4').' '. @@ -1271,7 +1279,7 @@ sub start_functionplotresponse { &Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack, - $safeeval,'xlabel','xmin','xmax','ylabel','ymin','ymax', + $safeeval,'width','height','xlabel','xmin','xmax','ylabel','ymin','ymax', 'xaxisvisible','yaxisvisible','gridvisible','answerdisplay'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } @@ -1986,7 +1994,9 @@ sub end_functionplotelements { # generate the input fields $result.=$Apache::functionplotresponse::inputfields; # actually start the -tag - $result.=&geogebra_startcode($internalid); + $result.=&geogebra_startcode($internalid, + &Apache::lonxml::get_param('width',$parstack,$safeeval,-2), + &Apache::lonxml::get_param('height',$parstack,$safeeval,-2)); # load the spline bytecode $result.=&geogebra_spline_program(); # set default parameters