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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 20 Sep 2008 00:28:34 -0000


raeburn		Fri Sep 19 20:28:34 2008 EDT

  Modified files:              (Branch: version_2_7_X)
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  Backport 1.228, 1.229, 1.230, 1.231, 1.234.
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.227.2.2 loncom/homework/caparesponse/caparesponse.pm:1.227.2.3
--- loncom/homework/caparesponse/caparesponse.pm:1.227.2.2	Fri Sep 12 22:46:59 2008
+++ loncom/homework/caparesponse/caparesponse.pm	Fri Sep 19 20:28:34 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.227.2.2 2008/09/13 02:46:59 raeburn Exp $
+# $Id: caparesponse.pm,v 1.227.2.3 2008/09/20 00:28:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -310,10 +310,6 @@
 						    $safeeval);
 	    if ($unit =~ /\S/) { $result.=" (in $unit) "; }
 	}
-        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,
 			    $parstack,$parser,$safeeval,-1);
@@ -322,22 +318,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) = @_;
@@ -626,6 +606,12 @@
 		}
 	    }
 	}
+        if (($target eq 'web') && ($tag eq 'formularesponse')
+            && ($Apache::lonhomework::type ne 'exam') && ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')
+	    && (&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoneditor') ne 'no')) {
+            $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;