--- loncom/homework/functionplotresponse.pm 2010/10/09 20:02:02 1.11
+++ loncom/homework/functionplotresponse.pm 2010/10/09 22:31:49 1.12
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: functionplotresponse.pm,v 1.11 2010/10/09 20:02:02 www Exp $
+# $Id: functionplotresponse.pm,v 1.12 2010/10/09 22:31:49 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,7 +33,7 @@ use Apache::lonlocal;
use Apache::lonnet;
BEGIN {
- &Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline'));
+ &Apache::lonxml::register('Apache::functionplotresponse',('functionplotresponse','backgroundplot','spline','splinerule'));
}
#
@@ -285,6 +285,21 @@ sub end_backgroundplot {
}
#
+#
+#
+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 '';
+}
+
+
+#
#
#
# Unfortunately, GeoGebra seems to want all splines after everything else, so we need to store them
@@ -389,10 +404,40 @@ sub start_functionplotresponse {
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 $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)
+ .'
'.&mt('Function Plot Question').' | '
+ .''.&mt('Delete?').' '
+ .&Apache::edit::deletelist($target,$token)
+ .' | '
+ ." "
+ .&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');
- } elsif ($target eq 'web') {
+ } elsif ($target eq 'web') {
# paste in the update routine to receive stuff back from the applet
$result.=&update_script($internalid);
# start the initscript for this applet
@@ -413,7 +458,7 @@ sub end_functionplotresponse {
my $partid=$Apache::inputtags::part;
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'
&& &Apache::response::submitted()
&& $Apache::lonhomework::type eq 'exam') {
@@ -425,8 +470,16 @@ sub end_functionplotresponse {
&& $Apache::lonhomework::type ne 'exam') {
my ($response,%coords)=&get_answer_from_form_fields($internalid);
$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') {
# Now is the time to render all of the stored splines
foreach my $label (keys(%Apache::functionplotresponse::splineorder)) {
|