[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm

riegler lon-capa-cvs-allow@mail.lon-capa.org
Thu, 04 Sep 2008 13:49:19 -0000


riegler		Thu Sep  4 09:49:19 2008 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  
  
  removed edit_formularesponse_button
  using identical subrouting edit_mathresponse_button in response.pm instead
  moved Edit Answer button behing textfield
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.227 loncom/homework/caparesponse/caparesponse.pm:1.228
--- loncom/homework/caparesponse/caparesponse.pm:1.227	Sat Jul 26 11:06:43 2008
+++ loncom/homework/caparesponse/caparesponse.pm	Thu Sep  4 09:49:19 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.227 2008/07/26 15:06:43 raeburn Exp $
+# $Id: caparesponse.pm,v 1.228 2008/09/04 13:49:19 riegler Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -312,7 +312,6 @@
 	}
         if (($token->[1] eq 'formularesponse') && 
             ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')) {
-            $result.=&edit_formula_button($id,"HWVAL_$id");
         }
 	if (  &Apache::response::show_answer() ) {
 	    &set_answertext($tag_internal_answer_name,$target,$token,$tagstack,
@@ -322,22 +321,6 @@
     return $result;
 }
 
-sub edit_formula_button {
-    my ($id,$field)=@_;
-    my $button=&mt('Edit Answer');
-    my $helplink=&Apache::loncommon::help_open_topic('Formula_Editor');
-    return(<<ENDFORMULABUTTON);
-<script language="JavaScript">
-function edit_${id}_${field} (textarea) {
-    thenumber = textarea;
-    thedata = document.forms['lonhomework'].elements[textarea].value;
-    newwin = window.open("/adm/dragmath/applet/MaximaPopup.html","","width=565,height=400,resizable");
-}
-</script>
-<input type='button' value='$button' onclick="javascript:edit_${id}_${field}('${field}');void(0);" />$helplink
-ENDFORMULABUTTON
-}
-
 sub set_answertext {
     my ($name,$target,$token,$tagstack,$parstack,$parser,$safeeval,
 	$response_level) = @_;
@@ -530,12 +513,12 @@
 		&Apache::lonxml::debug($$parstack[-1] . "\n<br>");
 		
 		if ( &Apache::response::submitted('scantron')) {
-		    &add_in_tag_answer($parstack,$safeeval);
-		    my ($values,$display)=&make_numerical_bubbles($partid,$id,
-						  $target,$parstack,$safeeval);
-		    $response=$values->[$response];
-		}
-		$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
+	    &add_in_tag_answer($parstack,$safeeval);
+	    my ($values,$display)=&make_numerical_bubbles($partid,$id,
+					  $target,$parstack,$safeeval);
+	    $response=$values->[$response];
+	}
+	$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
 		my ($ad,$msg,$name)=&check_submission($response,$partid,$id,
 						      $tag,$parstack,
 						      $safeeval);
@@ -622,6 +605,11 @@
 		}
 	    }
 	}
+        if (($target eq 'web') && ($tag eq 'formularesponse')
+            && ($Apache::lonhomework::type ne 'exam')) {
+           $result.=&Apache::response::edit_mathresponse_button($id,"HWVAL_$id");
+        }
+            
 	&Apache::response::setup_prior_tries_hash(\&format_prior_response_numerical);
     } elsif ($target eq 'edit') {
 	$result.='</td></tr>'.&Apache::edit::end_table;