version 1.11, 2010/10/09 20:02:02
|
version 1.12, 2010/10/09 22:31:49
|
Line 33 use Apache::lonlocal;
|
Line 33 use Apache::lonlocal;
|
use Apache::lonnet; |
use Apache::lonnet; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline')); |
&Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline','splinerule')); |
} |
} |
|
|
# |
# |
Line 285 sub end_backgroundplot {
|
Line 285 sub end_backgroundplot {
|
} |
} |
|
|
# |
# |
|
# <splinerule ... /> |
|
# |
|
sub start_splinerule { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
my $result=''; |
|
my $internalid = $Apache::inputtags::part.'_'.$Apache::inputtags::response[-1]; |
|
return $result; |
|
} |
|
|
|
sub end_splinerule { |
|
return ''; |
|
} |
|
|
|
|
|
# |
# <spline label="..." order="1,2,3,4" initx="..." inity="..." scalex="..." scaley="..." /> |
# <spline label="..." order="1,2,3,4" initx="..." inity="..." scalex="..." scaley="..." /> |
# |
# |
# Unfortunately, GeoGebra seems to want all splines after everything else, so we need to store them |
# Unfortunately, GeoGebra seems to want all splines after everything else, so we need to store them |
Line 389 sub start_functionplotresponse {
|
Line 404 sub start_functionplotresponse {
|
my $xaxisvisible=(&Apache::lonxml::get_param('xaxisvisible',$parstack,$safeeval)=~/on|true|yes|1/i?'true':'false'); |
my $xaxisvisible=(&Apache::lonxml::get_param('xaxisvisible',$parstack,$safeeval)=~/on|true|yes|1/i?'true':'false'); |
my $yaxisvisible=(&Apache::lonxml::get_param('yaxisvisible',$parstack,$safeeval)=~/on|true|yes|1/i?'true':'false'); |
my $yaxisvisible=(&Apache::lonxml::get_param('yaxisvisible',$parstack,$safeeval)=~/on|true|yes|1/i?'true':'false'); |
my $gridvisible=(&Apache::lonxml::get_param('gridvisible',$parstack,$safeeval)=~/on|true|yes|1/i?'true':'false'); |
my $gridvisible=(&Apache::lonxml::get_param('gridvisible',$parstack,$safeeval)=~/on|true|yes|1/i?'true':'false'); |
|
if ($target eq 'edit') { |
|
$result.=&Apache::edit::start_table($token) |
|
.'<tr><td><span class="LC_nobreak">'.&mt('Function Plot Question').'</span></td>' |
|
.'<td><span class="LC_nobreak">'.&mt('Delete?').' ' |
|
.&Apache::edit::deletelist($target,$token) |
|
.'</span></td>' |
|
."<td> " |
|
.&Apache::edit::end_row() |
|
.&Apache::edit::start_spanning_row() |
|
."\n"; |
|
$result.=&Apache::edit::text_arg('Minimum x-value:','xmin', |
|
$token,'4'). |
|
&Apache::edit::text_arg('Maximum x-value:','xmax', |
|
$token,'4'). |
|
&Apache::edit::select_arg('x-axis visible:','xaxisvisible', |
|
['yes','no'],$token). |
|
&Apache::edit::text_arg('Minimum y-value:','ymin', |
|
$token,'4'). |
|
&Apache::edit::text_arg('Maximum y-value:','ymax', |
|
$token,'4'). |
|
&Apache::edit::select_arg('y-axis visible:','yaxisvisible', |
|
['yes','no'],$token). |
|
&Apache::edit::select_arg('Grid visible:','gridvisible', |
|
['yes','no'],$token). |
|
&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
|
} elsif ($target eq 'modified') { |
|
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
|
$safeeval,'xmin','xmax','ymin','ymax', |
|
'xaxisvisible','yaxisvisible','gridvisible'); |
|
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } |
|
|
if ($target eq 'meta') { |
} elsif ($target eq 'meta') { |
$result=&Apache::response::meta_package_write('functionplotresponse'); |
$result=&Apache::response::meta_package_write('functionplotresponse'); |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
# paste in the update routine to receive stuff back from the applet |
# paste in the update routine to receive stuff back from the applet |
$result.=&update_script($internalid); |
$result.=&update_script($internalid); |
# start the initscript for this applet |
# start the initscript for this applet |
Line 413 sub end_functionplotresponse {
|
Line 458 sub end_functionplotresponse {
|
my $partid=$Apache::inputtags::part; |
my $partid=$Apache::inputtags::part; |
my $internalid = $partid.'_'.$id; |
my $internalid = $partid.'_'.$id; |
|
|
# if ($target eq 'edit') { $result=&Apache::edit::end_table(); } |
if ($target eq 'edit') { $result=&Apache::edit::end_table(); } |
if ($target eq 'grade' |
if ($target eq 'grade' |
&& &Apache::response::submitted() |
&& &Apache::response::submitted() |
&& $Apache::lonhomework::type eq 'exam') { |
&& $Apache::lonhomework::type eq 'exam') { |
Line 425 sub end_functionplotresponse {
|
Line 470 sub end_functionplotresponse {
|
&& $Apache::lonhomework::type ne 'exam') { |
&& $Apache::lonhomework::type ne 'exam') { |
my ($response,%coords)=&get_answer_from_form_fields($internalid); |
my ($response,%coords)=&get_answer_from_form_fields($internalid); |
$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response; |
$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response; |
$Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}='INCORRECT'; |
my %previous=&Apache::response::check_for_previous($response,$partid,$id); |
|
# |
|
# Actually grade |
|
# |
|
my $ad='INCORRECT'; |
|
# |
|
# Store grading info |
|
# |
|
$Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}=$ad; |
|
&Apache::response::handle_previous(\%previous,$ad); |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
# Now is the time to render all of the stored splines |
# Now is the time to render all of the stored splines |
foreach my $label (keys(%Apache::functionplotresponse::splineorder)) { |
foreach my $label (keys(%Apache::functionplotresponse::splineorder)) { |