From: Chris S. <san...@us...> - 2005-11-17 21:54:28
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22101/scripts Modified Files: stackAuthor.php stackCAS.php stackQuestion.php stackUnix.php stackUtility.php stackWin.php Log Message: Lots of small changes - switching simplification off finally. Changes to help MathML, add the multiplication sign option. Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** stackAuthor.php 8 Nov 2005 09:41:40 -0000 1.48 --- stackAuthor.php 17 Nov 2005 21:54:19 -0000 1.49 *************** *** 392,396 **** $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','Simplify','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); --- 392,396 ---- $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','Simplify','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','MultiplicationSign'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); *************** *** 881,885 **** $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Complex no','Language'); $fieldname = 'quiz'.'[quizOptions]'; --- 881,885 ---- $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','MultiplicationSign','Complex no','Language'); $fieldname = 'quiz'.'[quizOptions]'; *************** *** 1302,1306 **** $options_headings = array('',get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('QuizMode','InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Complex no','Language'); $fieldname = 'subject'.'[subjectOptions]'; --- 1302,1306 ---- $options_headings = array('',get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('QuizMode','InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','MultiplicationSign','Complex no','Language'); $fieldname = 'subject'.'[subjectOptions]'; Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** stackQuestion.php 8 Nov 2005 19:39:42 -0000 1.50 --- stackQuestion.php 17 Nov 2005 21:54:19 -0000 1.51 *************** *** 61,64 **** --- 61,70 ---- $stackOptions['Display']['CAS_TYPE'] = 'string'; + // 'MultiplicationSign' + $stackOptions['MultiplicationSign']['type'] = 'list'; + $stackOptions['MultiplicationSign']['values'] = array('(none)','cross','dot'); + $stackOptions['MultiplicationSign']['default'] = '(none)'; + $stackOptions['MultiplicationSign']['CAS_KEY'] = 'make_multsgn'; + $stackOptions['MultiplicationSign']['CAS_TYPE'] = 'fun'; // 'Complex j'; *************** *** 1383,1389 **** $this_attempt['FeedBack'] = ''; } ! } ! ! if ('cas-var' == $stackAnswerTest[$atest]['imp']) { $errs = validate_casstring($atest_ops); --- 1389,1393 ---- $this_attempt['FeedBack'] = ''; } ! } else if ('cas-var' == $stackAnswerTest[$atest]['imp']) { $errs = validate_casstring($atest_ops); *************** *** 1404,1408 **** return($this_attempt); } ! } // Clean up the CAS dependent scripts here --- 1408,1416 ---- return($this_attempt); } ! } else { // We need to send the expression to the CAS to get the displayed form. ! ! $this_attempt = CPProcessAnsTest($sa,$sa,'AlgEquiv',$options,$errors); ! ! } // Clean up the CAS dependent scripts here *************** *** 1487,1491 **** } else if ('String' == $atest) { ! $this_attempt['Ans'] = $eans; // Apply a strict string check if (trim($sa) == trim($ta)) { --- 1495,1499 ---- } else if ('String' == $atest) { ! // Apply a strict string check if (trim($sa) == trim($ta)) { *************** *** 1496,1500 **** } else if ('True' == $atest) { ! $this_attempt['Ans'] = $eans; $this_attempt['Result'] = TRUE; --- 1504,1508 ---- } else if ('True' == $atest) { ! $this_attempt['Result'] = TRUE; *************** *** 1503,1507 **** $sa = str_replace("\n",'',$sa); $sa = str_replace("\t",'',$sa); - $this_attempt['Ans'] = array('value'=> $sa, 'display'=> $sa); $ta = str_replace(' ','',strtolower(trim($ta))); --- 1511,1514 ---- *************** *** 1517,1521 **** } else if ('RegExp' == $atest) {// ereg(pattern,string) - $this_attempt['Ans'] = $eans; // Apply a regular expression check --- 1524,1527 ---- *************** *** 2196,2205 **** if ('Form box + JOME' == $options['AllowInputTool']) { ! $ret .= "  <a href=\"javascript:openMathInput('$ffn');\">".get_string('InputTool','stack','')."</a>"; } if ('' != trim($options['SyntaxHint'])) { $hint = htmlspecialchars($options['SyntaxHint']); ! $ret .= "<br /><font size='-1'><em>".get_string('SyntaxHint','stack','').": </em> <tt>{$hint}</tt></font>\n"; } --- 2202,2211 ---- if ('Form box + JOME' == $options['AllowInputTool']) { ! $ret .= " \n <a href=\"javascript:openMathInput('$ffn');\">".get_string('InputTool','stack','')."</a>"; } if ('' != trim($options['SyntaxHint'])) { $hint = htmlspecialchars($options['SyntaxHint']); ! $ret .= "<br /><font size='-1'><em>".get_string('SyntaxHint','stack','').": </em> \n<tt>{$hint}</tt></font>\n"; } Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** stackUtility.php 27 Oct 2005 12:34:36 -0000 1.37 --- stackUtility.php 17 Nov 2005 21:54:19 -0000 1.38 *************** *** 518,522 **** $strin = $wrap.$varin.$wrap; ! $strout = stack_latex_to_html($strin); } else if ('LaTeX Source' == $display) { --- 518,522 ---- $strin = $wrap.$varin.$wrap; ! $strout = stack_latex_to_html($strin,$display); } else if ('LaTeX Source' == $display) { *************** *** 534,537 **** --- 534,538 ---- $strout=$wrap.$varin.$wrap; + } else { // ie ('String' == $display) if ('#NONE#' == $wrap) { *************** *** 789,793 **** $displayed= '\ensuremath{'.$locdisplay.'}'; } else if ('MathML' == $display) { ! $displayed= ' <html>'.$locdisplay.'</html> '; } else { // ('String'==$display) $displayed = '\ensuremath{'.$locdisplay.'}'; --- 790,794 ---- $displayed= '\ensuremath{'.$locdisplay.'}'; } else if ('MathML' == $display) { ! $displayed= '<html>'.$locdisplay.'</html>'; } else { // ('String'==$display) $displayed = '\ensuremath{'.$locdisplay.'}'; *************** *** 840,844 **** // (3) Now LaTeX the result if ('LaTeX Source' != $display) { ! $strin= stack_latex_to_html($strin); } --- 841,845 ---- // (3) Now LaTeX the result if ('LaTeX Source' != $display) { ! $strin= stack_latex_to_html($strin,$display); } *************** *** 985,991 **** if ($stack_stand_alone) { // Then print a header ! //header("Content-Type: text/xml"); ! /* echo '<?xml-stylesheet type="text/xsl" href="mathml/mathml.xsl"?>'; */ ! include("{$stack_root}/html/prehead.html"); echo "<body>\n"; --- 986,992 ---- if ($stack_stand_alone) { // Then print a header ! // For MathML ! //header("Content-Type: text/xml"); ! //include("{$stack_root}/html/mathml_prehead.html"); include("{$stack_root}/html/prehead.html"); echo "<body>\n"; *************** *** 1019,1023 **** } echo "</font></em></p>"; ! } --- 1020,1024 ---- } echo "</font></em></p>"; ! echo "</body>\n</html>\n"; } Index: stackUnix.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUnix.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** stackUnix.php 29 Aug 2005 15:35:23 -0000 1.19 --- stackUnix.php 17 Nov 2005 21:54:19 -0000 1.20 *************** *** 32,36 **** 2 => array('pipe', 'w')); ! $TeXProcess = proc_open($stack_latex['command'],$descriptors, $pipes); fflush($pipes[0]); --- 32,40 ---- 2 => array('pipe', 'w')); ! if ('MathML'==$display) { ! $TeXProcess = proc_open($stack_latex['command-mathml'],$descriptors, $pipes); ! } else { ! $TeXProcess = proc_open($stack_latex['command'],$descriptors, $pipes); ! } fflush($pipes[0]); *************** *** 64,67 **** --- 68,75 ---- } + if ('MathML'==$display) { + $ret = str_replace(" "," ",$ret); + } + return $ret; Index: stackCAS.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackCAS.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stackCAS.php 9 Nov 2005 14:02:37 -0000 1.11 --- stackCAS.php 17 Nov 2005 21:54:19 -0000 1.12 *************** *** 191,196 **** } } ! $cas_cmd = "cab:block([ ans,str{$loclistA}] {$loclistC}, "; $cas_cmd .= " print(\"[ Timestamp = [ $t ], Ans= [ error = [\"), cte(\"ans\",errcatch(ans:$exp1)),"; $cas_cmd .= " print(\" ValidationError = [ \"), str:stack_validate(ans), print(str),"; --- 191,197 ---- } } ! $cas_cmd = "cab:block([ ans,str{$loclistA}] {$loclistC}, "; + $cas_cmd .= " simp:false, "; $cas_cmd .= " print(\"[ Timestamp = [ $t ], Ans= [ error = [\"), cte(\"ans\",errcatch(ans:$exp1)),"; $cas_cmd .= " print(\" ValidationError = [ \"), str:stack_validate(ans), print(str),"; Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** stackWin.php 17 Sep 2005 11:31:05 -0000 1.13 --- stackWin.php 17 Nov 2005 21:54:19 -0000 1.14 *************** *** 19,23 **** * @return string|boolean The converted HTML string or FALSE if there was an error. */ ! function stack_latex_to_html($strin) { global $stack_logfiles,$stack_latex,$stack_root; --- 19,23 ---- * @return string|boolean The converted HTML string or FALSE if there was an error. */ ! function stack_latex_to_html($strin,$display='LaTeX') { global $stack_logfiles,$stack_latex,$stack_root; *************** *** 32,36 **** 2 => array('pipe', 'w')); ! $TeXProcess = proc_open($stack_latex['command'],$descriptors, $pipes); fflush($pipes[0]); --- 32,40 ---- 2 => array('pipe', 'w')); ! if ('MathML'==$display) { ! $TeXProcess = proc_open($stack_latex['command-mathml'],$descriptors, $pipes); ! } else { ! $TeXProcess = proc_open($stack_latex['command'],$descriptors, $pipes); ! } fflush($pipes[0]); *************** *** 62,65 **** --- 66,73 ---- } + if ('MathML'==$display) { + $ret = str_replace(" "," ",$ret); + } + //$ret = '<pre>'.$strin."</pre>\n"; return $ret; |