--- loncom/homework/functionplotresponse.pm 2010/10/08 23:26:04 1.8
+++ loncom/homework/functionplotresponse.pm 2010/10/09 00:00:04 1.9
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: functionplotresponse.pm,v 1.8 2010/10/08 23:26:04 www Exp $
+# $Id: functionplotresponse.pm,v 1.9 2010/10/09 00:00:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -125,8 +125,8 @@ sub update_script {
function updatePointCoordinates_$id(coordinateName) {
var x = document.ggbApplet_$id.getXcoord(coordinateName);
var y = document.ggbApplet_$id.getYcoord(coordinateName);
- coordinateMap_$id\[coordinateName + ".x"] = x;
- coordinateMap_$id\[coordinateName + ".y"] = y;
+ document.lonhomework.elements["HWVAL_$id\_" + coordinateName + "_x"].value = x;
+ document.lonhomework.elements["HWVAL_$id\_" + coordinateName + "_y"].value = y;
}
// ]]>
@@ -148,17 +148,36 @@ sub update_register {
sub set_coordinate {
my ($id,$variable,$x,$y)=@_;
return (<\n".
+ "\n";
+}
+
+#
# Initialize a new coordinate variable at set a listener on it
#
sub new_coordinate {
my ($id,$variable,$x,$y)=@_;
+ &generate_input_field($id,$variable,$x,$y);
return &set_coordinate($id,$variable,$x,$y).&update_register($id,$variable);
}
@@ -313,6 +332,7 @@ sub start_functionplotresponse {
undef %Apache::functionplotresponse::splineinity;
undef %Apache::functionplotresponse::splinescalex;
undef %Apache::functionplotresponse::splinescaley;
+ $Apache::functionplotresponse::inputfields='';
$Apache::functionplotresponse::counter=0;
# Internal ID to mark the applet and its coordinates
my $internalid = $Apache::inputtags::part.'_'.&Apache::response::start_response($parstack,$safeeval);
@@ -356,6 +376,8 @@ sub end_functionplotresponse {
}
# close the init script
$result.=&end_init_script();
+# generate the input fields
+ $result.=$Apache::functionplotresponse::inputfields;
# actually start the