--- loncom/homework/response.pm	2008/09/05 21:32:56	1.201
+++ loncom/homework/response.pm	2008/09/23 19:15:57	1.205
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.201 2008/09/05 21:32:56 riegler Exp $
+# $Id: response.pm,v 1.205 2008/09/23 19:15:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -486,9 +486,6 @@ sub start_mathresponse {
 						   $safeeval);
 	    $Apache::inputtags::answertxt{$id}=[$answer];
 	}
-        if ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER') {
-            $result.=&edit_mathresponse_button($id,"HWVAL_$id");
-        }
 
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::tag_start($target,$token);
@@ -575,6 +572,12 @@ sub end_mathresponse {
     }
     if ($target eq 'web') {
 	&setup_prior_tries_hash(\&format_prior_response_math);
+        my $partid = $Apache::inputtags::part;
+        my $id = $Apache::inputtags::response[-1];
+        if (($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')
+           && (&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffeditor') ne 'yes')) {
+            $result.=&edit_mathresponse_button($id,"HWVAL_$id");
+        }
     }
 
     pop(@Apache::lonxml::namespace);
@@ -1189,7 +1192,7 @@ sub submitted {
     }
     # Submit All button on a .page was pressed
     if (defined($env{'form.all_submit'})) { return 1; }
-    # otherwise no submission occured
+    # otherwise no submission occurred
     return 0;
 }