aimmath-commit Mailing List for AiM Assessment in Mathematics (Page 7)
Brought to you by:
gustav_delius,
npstrick
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(73) |
Aug
(96) |
Sep
(240) |
Oct
(34) |
Nov
(12) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(6) |
Mar
(17) |
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(19) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(14) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gus...@us...> - 2003-10-27 16:10:12
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv22210/mod/math_assignment Modified Files: lib.php Log Message: removed a complicated regular expression search that managed to crash apache Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** lib.php 20 Oct 2003 03:02:56 -0000 1.38 --- lib.php 27 Oct 2003 16:10:08 -0000 1.39 *************** *** 463,487 **** /// Function which checks an AiM page to see if AiM has thrown an error from which we can recover - /* - // remove everything up to and including the html tag - if (!preg_match("/<html(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) - return false; // no HTML data found - $data = substr($data, $matches[0][1]); - - // seach for a head tag - if (preg_match("/<head(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) { - // we have a head section - $data = substr($data, $matches[0][1] + strlen($matches[0][0])); - - // check for user not registered error - if (preg_match("/<title>(.*)\bNot registered\b(.*)<\/title>/si", $data)) - return 1; - - // --- further checks returning different error codes to go here as required --- - - } - return 0; - */ - if (strpos($data,"<html") === false) return false; // no HTML data found; --- 463,466 ---- *************** *** 627,698 **** $grade = -1; $max_grade = -1; - $error = false; - - /* - // remove everything up to and including the html tag - if (!preg_match("/<html(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) - return ""; // no HTML data found - $data = substr($data, $matches[0][1]); - - $data = preg_replace("/^[\s\S]*<html(?:\s[^<>]*?|)>/i", "", $data); - - // seach for a head tag - if (preg_match("/<head(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) { - // we have a head section - $data = substr($data, $matches[0][1] + strlen($matches[0][0])); - - // check for error pages - if (preg_match("/<title>(.*)\bError\b(.*)<\/title>/si", $data)) { - $error = true; - } - - // remove head but look out for scripts - while (true) { - - if (!preg_match("/<\/head>|<script(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) - return ""; // head never ends - $data = substr($data, $matches[0][1]); - if (strcasecmp($matches[0][0], "</head>") == 0) { - $data = substr($data, 7); - break; - } - - // we have found a script - extract it - if (!preg_match("/<\/script>/i", $data, $matches, PREG_OFFSET_CAPTURE)) - return ""; // unterminated script - $out .= substr($data, 0, $matches[0][1] + 9); - $data = substr($data, $matches[0][1] + 9); - } - } - - // search for body tag - if(!preg_match("/<body(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) - return ""; // no body found - $data = substr($data, $matches[0][1] + strlen($matches[0][0])); - - // search for end of body - if(!preg_match("/<\/body>/i", $data, $matches, PREG_OFFSET_CAPTURE)) - return ""; // unterminated body - $data = substr($data, 0, $matches[0][1]); - - $out .= $data; // add body to output (NOTE that this means we can modify $data now) - - if (!$error) { - // extract grades (if present) - if (preg_match("/<table(?:\s[^<>]*?|)\sclass=(\"|'|)marktable\\1(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) { - $data = substr($data, $matches[0][1] + strlen($matches[0][0])); - if (preg_match("/<\/table>/i", $data, $matches, PREG_OFFSET_CAPTURE)) { - $data = substr($data, 0, $matches[0][1]); - // find the row which gives the totals - if (preg_match("/<td(?:\s[^<>]*?|)>Total<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>/si", $data, $matches)) { - if (empty($CFG->math_assignment_grade_multiplier)) - $CFG->math_assignment_grade_multiplier = 1.0; - $max_grade = (int) (((float) decodeHTML($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); - $grade = (int) (((float) decodeHTML($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); - } - } - } - } - */ // extract scripts and add to $out --- 606,609 ---- *************** *** 722,728 **** // Remove unwanted links $unwanted = array(">Download<",">Browse source<",">Edit home page<",">Download results<", ! ">Edit register<",">Student details<",">Hide hidden quizzes<",">Hide hidden questions<"); $out = str_replace($unwanted,"><",$out); ! // covert the URLs if ($old_url) { --- 633,644 ---- // Remove unwanted links $unwanted = array(">Download<",">Browse source<",">Edit home page<",">Download results<", ! ">Edit register<",">Student details<",">Hide hidden quizzes<",">Hide hidden questions<", ! ">New Quiz<"); $out = str_replace($unwanted,"><",$out); ! ! // Remove unwanted text ! $unwanted = array('Click here to select a new quiz.'); ! $out = str_replace($unwanted,'',$out); ! // covert the URLs if ($old_url) { *************** *** 745,787 **** $out = preg_replace("/<td(?:\s[^<>]*?|)>(?:\s|<\!--(?:.(?!-->))*.?-->)*<a(?:\s[^<>]*?|)\shref=\"javascript:close\(\)\">(?:.(?!<\/a>))*?.?<\/a>(?:\s|<\!--(?:.(?!-->))*.?-->)*<\/td>/si", "", $out); $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=\"javascript:close\(\)\">(?:.(?!<\/a>))*?.?<\/a>/si", "", $out); // make help links open in a new window $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=(\"|'|)([^\"<>]*)\/help.html\\1(\s[^<>]*?|)>Help<\/a>/i", "<a href=\"\\2/help.html\"\\3 target=\"_popup\">Help</a>", $out); // remove new quiz links $out = preg_replace("/<tr(?:\s[^<>]*?|)>(?:.(?!<td\s|<td>))*?.?<td(?:\s[^<>]*?|)>(?:\s|<\!--(?:.(?!-->))*.?-->)*<a(?:\s[^<>]*?|)\shref=(?(?=\")\"[^\"<>]*?\"(?=\W)|\S*?)>New Quiz<\/a>(?:\s|<\!--(?:.(?!-->))*.?-->)*<\/td>(.(?!<td\s|<td>))*?.?<td(?:\s[^<>]*?|)>(.(?!<\/td>))*?.?<\/td>(.(?!<\/tr>))*?.?<\/tr>/si", "", $out); $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=[^<>]*>New Quiz<\/a>/i", "", $out); - - /* - // modify download links - $commonpostdata = ""; - $commonpostdata = math_assignment_add_arg_to_url_data($commonpostdata, "SubjectName", $subject->name); - $commonpostdata = math_assignment_add_arg_to_url_data($commonpostdata, "QuizName", $math_assignment->aimquiz); - $commonpostdata = math_assignment_add_arg_to_url_data($commonpostdata, "Password", $subject->password); - // modify download quiz links - $postdata = math_assignment_add_arg_to_url_data($commonpostdata, "Command", "analyze/Quiz"); - $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "DownloadQuiz"); - $out = preg_replace("/javascript:DownloadQuiz\(\);/i", htmlspecialchars("$old_url?$postdata"), $out); - // modify download register links - $postdata = math_assignment_add_arg_to_url_data($commonpostdata, "Command", "admin/Register"); - $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "DownloadRegister"); - $out = preg_replace("/javascript:DownloadRegister\(\);/i", htmlspecialchars("$old_url?$postdata"), $out); - // modify download source links - $postdata = math_assignment_add_arg_to_url_data($commonpostdata, "Command", "admin/SourceFile"); - $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "DownloadSource"); - $postdata = math_assignment_add_arg_to_url_data($postdata, "SourceFile", ""); - $out = preg_replace("/javascript:DownloadSource\(('|\")([^()]*?)\\1\);/i", htmlspecialchars("$old_url?$postdata=\\2"), $out); - if (array_key_exists("SourceFile", $_POST)) { - $postdata = math_assignment_add_arg_to_url_data($commonpostdata, "Command", "admin/SourceFile"); - $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "DownloadSource"); - $postdata = math_assignment_add_arg_to_url_data($postdata, "SourceFile", $_POST['SourceFile']); - $out = preg_replace("/javascript:DownloadSource\(\);/i", htmlspecialchars("$old_url?$postdata"), $out); - } - unset($commonpostdata); - - // remove styles (as we haven't loaded the AiM stylesheet) - $out = preg_replace("/<div(?:\s[^<>]*?|)>/i", "", $out); - $out = preg_replace("/<\/div>/i", "", $out); - $out = preg_replace("/<span(?:\s[^<>]*?|)>/i", "", $out); - $out = preg_replace("/<\/span>/i", "", $out); - $out = preg_replace("/(?<=<)(\w*(?:\s[^<>]*?|))\sclass=(?(?=\")\"[^\"<>]*?\"(?=\W)|\S*?(?=>))/i", "\\1", $out); */ --- 661,671 ---- $out = preg_replace("/<td(?:\s[^<>]*?|)>(?:\s|<\!--(?:.(?!-->))*.?-->)*<a(?:\s[^<>]*?|)\shref=\"javascript:close\(\)\">(?:.(?!<\/a>))*?.?<\/a>(?:\s|<\!--(?:.(?!-->))*.?-->)*<\/td>/si", "", $out); $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=\"javascript:close\(\)\">(?:.(?!<\/a>))*?.?<\/a>/si", "", $out); + // make help links open in a new window $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=(\"|'|)([^\"<>]*)\/help.html\\1(\s[^<>]*?|)>Help<\/a>/i", "<a href=\"\\2/help.html\"\\3 target=\"_popup\">Help</a>", $out); + /* // remove new quiz links $out = preg_replace("/<tr(?:\s[^<>]*?|)>(?:.(?!<td\s|<td>))*?.?<td(?:\s[^<>]*?|)>(?:\s|<\!--(?:.(?!-->))*.?-->)*<a(?:\s[^<>]*?|)\shref=(?(?=\")\"[^\"<>]*?\"(?=\W)|\S*?)>New Quiz<\/a>(?:\s|<\!--(?:.(?!-->))*.?-->)*<\/td>(.(?!<td\s|<td>))*?.?<td(?:\s[^<>]*?|)>(.(?!<\/td>))*?.?<\/td>(.(?!<\/tr>))*?.?<\/tr>/si", "", $out); $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=[^<>]*>New Quiz<\/a>/i", "", $out); */ *************** *** 800,808 **** if (function_exists('editer') && $convertlatex) { $out = preg_replace_callback("/<latex>(.*?)<\/latex>/si", create_function('$matches', 'return tex_to_mathml($matches[1]);'), $out); - } - - // remove all links from error pages - if ($error) { - $out = preg_replace("/<a(?:\s[^<>]*?|)>(?:.(?!<\/a>))*?.?<\/a>/si", "", $out); } --- 684,687 ---- |
From: <mo...@us...> - 2003-10-26 04:07:13
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv19719 Modified Files: Number.mpl Log Message: added several prime factorization utilities Index: Number.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Number.mpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Number.mpl 1 Sep 2003 05:55:59 -0000 1.1 --- Number.mpl 26 Oct 2003 04:03:58 -0000 1.2 *************** *** 207,209 **** --- 207,274 ---- ): + `Package/Assign`( + `Number/PrimeFactorizationPlain`, + "Returns a string containing the prime factorization of the positive integer @n@ in a plain format, e.g. \"2^3*5\". See #`Number/PrimeFactorization`# for a proc that returns a LaTeX string that contains the prime factorization.", + proc(n::posint) + local s,pf,i; + if n=1 then return "1" fi: + s:=""; pf:=ifactors(n)[2]; + for i to nops(pf) do + if pf[i][2]=1 then s:=s,pf[i][1]; + else s:=s,pf[i][1],"^",pf[i][2]; fi; + if i<nops(pf) then s:=s,"*" fi: + od: + cat(s); + end + ): + + `Package/Assign`( + `type/PosintString`::type, + "Matches strings consisting entirely of one or more digits 0-9", + proc(s) return StringTools:-RegMatch("^[0-9]+$",s) end + ): + + `Package/Assign`( + `type/PowerString`, + "Matches strings of the form \"m^n\" where @m@ and @n@ are nonnegative integers", + proc(s) return StringTools:-RegMatch("^[0-9]+\\^[0-9]+$",s) end + ): + + `Package/Assign`( + `type/PrimeString`, + "Matches a string that represents a positive prime integer, e.g. \"11\"", + proc(s) return type(s,PosintString) and isprime(parse(s)) end + ): + + `Package/Assign`( + `type/PrimePowerString`, + "Matches a string of the form \"p^n\" where @p@ is a prime and @n@ is a nonnegative integer.", + proc(s) + return type(s,PowerString) and + isprime(parse(StringTools:-Split(s,"^")[1])); + end + ): + + `Package/Assign`( + `type/PrimeFactorizationString`, + "A utility used by #type/PrimeFactorization#", + proc(s) + local S,L; + if type(s,string) then + S:=`Util/RemoveWhiteSpace`(s): + if S="1" then return true fi: + L:=StringTools:-Split(S,"*"); + return type(L,list(Or(PrimeString,PrimePowerString))) + else + false + fi: + end + ): + + `Package/Assign`( + `type/PrimeFactorization`, + "Matches strings which are the prime factorization of a positive integer, e.g. \"2*3^2**7^2*11\". Whitespace is ignored. The factors can be entered in any order and a power of the same prime can occur more than once, e.g. \"2*2*3*3^2\". Zero exponents are also allowed, e.g. \"2*3^0*5^2\". This type is useful when asking the students to enter the prime factorization of a number.", + And(string,PrimeFactorizationString) + ): + EndPackage(): |
From: <mo...@us...> - 2003-10-24 06:38:42
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv23795 Modified Files: Inert.mpl Log Message: a documentation tweak Index: Inert.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Inert.mpl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Inert.mpl 10 Oct 2003 15:39:58 -0000 1.8 --- Inert.mpl 23 Oct 2003 02:31:31 -0000 1.9 *************** *** 44,48 **** <table> ! <tr><td>@h> a:=Rand(1..10); b:=Rand(1..10);@</td></tr> <tr><td>@h> f:=Rand(Plus(a,b),Times(a,b),ToThe(a,b));@</td></tr> <tr><td>@t> What is $@@f@@$?@</td></tr> --- 44,48 ---- <table> ! <tr><td>@h> a:=Rand(2..10); b:=Rand(2..10);@</td></tr> <tr><td>@h> f:=Rand(Plus(a,b),Times(a,b),ToThe(a,b));@</td></tr> <tr><td>@t> What is $@@f@@$?@</td></tr> |
From: <mo...@us...> - 2003-10-22 18:01:23
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv13054 Modified Files: FullPackage.mpl Log Message: fixed a bug in `Package/ConvertAt` Index: FullPackage.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/FullPackage.mpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FullPackage.mpl 10 Oct 2003 09:49:31 -0000 1.4 --- FullPackage.mpl 22 Oct 2003 13:50:24 -0000 1.5 *************** *** 286,291 **** if (i > 0) then d := cat(substring(d,1..(i-1)), ! sprintf("%a",val), ! substring(d,(i+6)..-1)); else break; --- 286,291 ---- if (i > 0) then d := cat(substring(d,1..(i-1)), ! sprintf("%a",val), ! substring(d,(i+6)..-1)); else break; *************** *** 586,590 **** i := i+j+1; else ! k := searchtext("@",s,i+j..-1); if k = 0 then ERROR( --- 586,606 ---- i := i+j+1; else ! # KM - we need to worry about @@ occurring within @..@ ! while true do ! k := searchtext("@",s,i+j..-1); ! if k>0 and i+j+k<=length(s) and ! substring(s,(i+j+k-1)..(i+j+k)) = "@@" then ! t := t, ! substring(s,i..(i+j-2)), ! "<font color='green'>", ! `Package/HTMLEscape`(substring(s,(i+j)..(i+j+k-1))), ! "</font>"; ! if i+j+k=length(s) then k:=0: break; fi: ! i := i+j+k; j:=1; ! else ! break; ! fi: ! od: ! # END KM if k = 0 then ERROR( |
From: <mo...@us...> - 2003-10-22 02:39:04
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv10953 Modified Files: TextQuestion.mpl Log Message: fixed bug that caused an error when a student submitted a sequence as an answer Index: TextQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TextQuestion.mpl 10 Oct 2003 09:49:31 -0000 1.9 --- TextQuestion.mpl 22 Oct 2003 02:30:36 -0000 1.10 *************** *** 370,374 **** if attempt['Answer'] <> NULL then # KM ! if type(attempt['Answer'],string) then html := --- 370,374 ---- if attempt['Answer'] <> NULL then # KM ! if type([attempt['Answer']],[string]) then html := |
From: <gus...@us...> - 2003-10-20 03:36:05
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv8162/lang/en Modified Files: math_assignment.php Log Message: inputting the ID numbers of randomized problem sheets is now working. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** math_assignment.php 6 Oct 2003 00:10:11 -0000 1.22 --- math_assignment.php 20 Oct 2003 03:13:05 -0000 1.23 *************** *** 23,27 **** $string['autoregister'] = "Auto-register Students with AiM"; $string['browsesource'] = "Browse AiM Source"; ! $string['computer'] = "Computer"; $string['comment'] = "Comment"; $string['commented'] = "Commented"; --- 23,27 ---- $string['autoregister'] = "Auto-register Students with AiM"; $string['browsesource'] = "Browse AiM Source"; ! $string['computer'] = "AiM"; $string['comment'] = "Comment"; $string['commented'] = "Commented"; *************** *** 41,48 **** --- 41,50 ---- $string['emailssent'] = "Emails Sent"; $string['emailstudents'] = "Email Students"; + $string['enterid'] = "Please enter the ID number from the problem sheet that you received in class: "; $string['externalurl'] = "link to URL"; $string['failed'] = "Error : Could not save the changes made."; $string['failedaimsetup'] = "Error : Either the AiM quiz specified could not be loaded (check that you entered the name correctly) or it was found to have a maximum grade of zero. If you are sure that neither case applies then contact the administrator."; $string['failedupload'] = "Error : Could not upload the \$a."; + $string['generateid'] = "Alternatively you can generate a new version of the problems. You should only use this option if you did not receive a problem sheet in class. "; $string['gradeemailmessage'] = "Your script has been marked and placed in the pigeonholes for collection."; $string['gradeemailobtained'] = "You obtained"; *************** *** 52,55 **** --- 54,59 ---- $string['guestsno'] = "Sorry, guests can not view or attempt assignments"; $string['html'] = "HTML"; + $string['idinvalid'] = "The problem sheet ID \$a is not valid. You must have mistyped it. Please try again."; + $string['idtaken'] = "The problem sheet ID \$a has already been claimed by another student. If you are sure that this is the ID of YOUR problem sheet then please contact your lecturer."; $string['invalid'] = "Error : Invalid entry"; $string['invalidgrademultiplier'] = "Grade multiplier must be a number between 0.1 and 10000 inclusive."; *************** *** 65,69 **** $string['outputfuture'] = "Mathematics will be displayed using"; $string['outputprobs'] = "Mathematics not displaying correctly?"; ! $string['paper'] = "Paper"; $string['problems'] = "Problem sheet"; $string['marksheet'] = "Mark sheet"; --- 69,73 ---- $string['outputfuture'] = "Mathematics will be displayed using"; $string['outputprobs'] = "Mathematics not displaying correctly?"; ! $string['paper'] = "Manual"; $string['problems'] = "Problem sheet"; $string['marksheet'] = "Mark sheet"; *************** *** 92,95 **** --- 96,100 ---- $string['serverinuse'] = "Error : Can not delete server as one or more assignments depend on it."; $string['singlequestion'] = "single question"; + $string['showsheet'] = "Show sheet"; $string['solutions'] = "Solution sheet"; $string['solutiontime'] = "Solutions available after"; |
From: <gus...@us...> - 2003-10-20 03:34:53
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv6453/mod/math_assignment Modified Files: aimpage.php lib.php pdfgen.php setseed.php view.php Log Message: inputting the ID numbers of randomized problem sheets is now working. Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** aimpage.php 2 Oct 2003 19:42:15 -0000 1.15 --- aimpage.php 20 Oct 2003 03:02:55 -0000 1.16 *************** *** 49,59 **** } } - - require_login($course->id); - - add_to_log($course->id, "math_assignment", "aimpage", "aimpage.php?id=$cm->id", "$math_assignment->id"); - - // Process arguments - if (!$subject = get_record("math_assignment_subject", "course", $course->id)) { error(get_string("noaccess", "math_assignment")); --- 49,52 ---- *************** *** 62,65 **** --- 55,64 ---- error(get_string("noaccess", "math_assignment")); } + + require_login($course->id); + + add_to_log($course->id, "math_assignment", "aimpage", "aimpage.php?id=$cm->id", "$math_assignment->id"); + + // Process arguments // browse through the data which has been POSTed to us *************** *** 79,82 **** --- 78,82 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); + $postdata = math_assignment_add_arg_to_url_data($postdata, "KeepQuestionOrder", "true"); } else if (strcasecmp($aimaction, "source") == 0) { // load the edit source page *************** *** 106,110 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); } ! else { // default to show quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage"); --- 106,131 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); } ! else { // user is student ! // get student seed if appropriate ! if (record_exists("math_assignment_seed", "assignment", $math_assignment->id)) { ! if (!$seeddata = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) { ! // no seed has been assigned to student yet, so ask ! // Print the page header ! if ($course->category) { ! $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->"; ! } ! else ! $navigation = ""; ! $strmath_assignments = get_string("modulenameplural", "math_assignment"); ! $strmath_assignment = get_string("modulename", "math_assignment"); ! $straimpage = get_string("aimpage", "math_assignment"); ! print_header("$course->shortname: $math_assignment->name", "$course->fullname", ! "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> <a href=\"view.php?id=$cm->id\">$math_assignment->name</a> -> $straimpage", ! "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm), $usexml); ! include("seed.html"); ! die; ! } ! } ! // default to show quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage"); *************** *** 133,141 **** if (array_key_exists("outputchange", $_POST) && array_key_exists("postdata", $_POST)) { if (strcmp($_POST['outputchange'], "html") == 0 || strcmp($_POST['outputchange'], "xml") == 0) { ! // set the cookie ! setcookie("output", $_POST['outputchange'], 0x7FFFFFFF); ! $_COOKIE['output'] = $_POST['outputchange']; ! $postdata = $_POST['postdata']; ! $_POST = array(); } } --- 154,162 ---- if (array_key_exists("outputchange", $_POST) && array_key_exists("postdata", $_POST)) { if (strcmp($_POST['outputchange'], "html") == 0 || strcmp($_POST['outputchange'], "xml") == 0) { ! // set the cookie ! setcookie("output", $_POST['outputchange'], 0x7FFFFFFF); ! $_COOKIE['output'] = $_POST['outputchange']; ! $postdata = $_POST['postdata']; ! $_POST = array(); } } Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** lib.php 19 Oct 2003 10:01:43 -0000 1.37 --- lib.php 20 Oct 2003 03:02:56 -0000 1.38 *************** *** 320,324 **** $strviewproblems = get_string("viewproblems", "math_assignment"); $return .= "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>"; ! $return .= math_assignment_help_button("viewproblems", $strviewproblems, false); } if (($solurl) and ($math_assignment->solutiontime < time())) { --- 320,324 ---- $strviewproblems = get_string("viewproblems", "math_assignment"); $return .= "<a href=\"$proburl\" target=\"problems\">$strviewproblems</a>"; ! //$return .= math_assignment_help_button("viewproblems", $strviewproblems, false); } if (($solurl) and ($math_assignment->solutiontime < time())) { *************** *** 331,335 **** $strviewsolutions = get_string("viewsolutions", "math_assignment"); $return .= "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; ! $return .= math_assignment_help_button("viewsolutions", $strviewsolutions, false); } else if(($solurl) && isteacher($math_assignment->course)) { --- 331,335 ---- $strviewsolutions = get_string("viewsolutions", "math_assignment"); $return .= "<a href=\"$solurl\" target=\"solutions\">$strviewsolutions</a>"; ! //$return .= math_assignment_help_button("viewsolutions", $strviewsolutions, false); } else if(($solurl) && isteacher($math_assignment->course)) { *************** *** 416,420 **** else $data .= "&" . urlencode($item); ! if ($value) $data .= "=" . urlencode($value); } --- 416,420 ---- else $data .= "&" . urlencode($item); ! if ($value <> "") $data .= "=" . urlencode($value); } *************** *** 686,691 **** // find the row which gives the totals if (preg_match("/<td(?:\s[^<>]*?|)>Total<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>/si", $data, $matches)) { ! if (empty($CFG->math_assignment_grade_multiplier)) ! $CFG->math_assignment_grade_multiplier = 1.0; $max_grade = (int) (((float) decodeHTML($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); $grade = (int) (((float) decodeHTML($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); --- 686,691 ---- // find the row which gives the totals if (preg_match("/<td(?:\s[^<>]*?|)>Total<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>(?:.(?!<td\s|<td>))*.?<td(?:\s[^<>]*?|)>((?:.(?!<\/td>))*?.?)<\/td>/si", $data, $matches)) { ! if (empty($CFG->math_assignment_grade_multiplier)) ! $CFG->math_assignment_grade_multiplier = 1.0; $max_grade = (int) (((float) decodeHTML($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); $grade = (int) (((float) decodeHTML($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pdfgen.php 19 Oct 2003 10:01:44 -0000 1.19 --- pdfgen.php 20 Oct 2003 03:02:56 -0000 1.20 *************** *** 10,13 **** --- 10,15 ---- optional_variable($printcopies); // number of randomized copies to send to printer optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. + // This may be overruled by the student's saved seed. + global $USER; if (! $site = get_site()) { *************** *** 47,50 **** --- 49,76 ---- } } + + // get student seed if appropriate + if (isstudent($course->id) and record_exists("math_assignment_seed", "assignment", $math_assignment->id)) { + if (!$seeddata = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) { + // no seed has been assigned to student yet, so ask + // Print the page header + if ($course->category) { + $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->"; + } + else + $navigation = ""; + $strmath_assignments = get_string("modulenameplural", "math_assignment"); + $strmath_assignment = get_string("modulename", "math_assignment"); + $straimpage = get_string("showsheet", "math_assignment"); + print_header("$course->shortname: $math_assignment->name", "$course->fullname", + "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> <a href=\"view.php?id=$cm->id\">$math_assignment->name</a> -> $straimpage", + "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm), $usexml); + include("seed.html"); + die; + } else { + $seed = $seeddata->seed; + } + } + // Create temp file names *************** *** 74,79 **** } math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, "$tempfile$i", $newseed->seed); ! echo exec("gsview32 -p prmaths1.york.ac.uk $tempfile$i.pdf"); ! echo "Sheet sent to gsview"; } } --- 100,108 ---- } math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, "$tempfile$i", $newseed->seed); ! // I would now like to send the sheet directly to the printer but that does not work for unknown reasons ! // so for now I am satisfied with having the sheet saved on disk and I will send them all to the printer ! // from the file manager later. ! //echo exec("gsview32 -p prmaths1.york.ac.uk $tempfile$i.pdf"); ! echo "Sheet $i generated<br>"; } } *************** *** 92,97 **** go by the extension when it ignores the headers. This would need testing in a broken version of IE. */ if ($file = @fopen("$tempfile.pdf", "rb")) { // the 'b' is for compatibility with Windoze - // tell the browser that it is pdf header("Content-type: application/pdf"); --- 121,129 ---- go by the extension when it ignores the headers. This would need testing in a broken version of IE. */ + /* This occasionally has hanged in the past and if it happens again I will have to use redirect + even though that has the disadvantage of not + deleting the pdf file afterwards. + */ if ($file = @fopen("$tempfile.pdf", "rb")) { // the 'b' is for compatibility with Windoze // tell the browser that it is pdf header("Content-type: application/pdf"); *************** *** 104,119 **** @fclose($file); } ! else { ! $errlog = htmlentities(implode('', file("$tempfile.log"))); ! } } @unlink("$tempfile.pdf"); ! if (strlen($errlog) > 0) { ! error("There was a problem while compiling the tex source!<br> ! pdflatex wrote the following log file:<br><br> ! <pre>$errlog</pre>"); // error message ! } --- 136,148 ---- @fclose($file); } ! ! /* ! redirect("$tempfile.pdf"); ! */ } @unlink("$tempfile.pdf"); ! *************** *** 147,151 **** // attempt to register them automatically if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); } // retry --- 176,180 ---- // attempt to register them automatically if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); } // retry *************** *** 233,237 **** $texcommand = "pdftex"; } ! // for Unix work in temp directory if (strpos($_ENV["OS"], "Win") === false) { --- 262,266 ---- $texcommand = "pdftex"; } ! // for Unix work in temp directory if (strpos($_ENV["OS"], "Win") === false) { *************** *** 243,246 **** --- 272,283 ---- exec("$texcommand $tempfile.tex"); } + + if (!file_exists("$tempfile.pdf")) { + $errlog = htmlentities(implode('', file("$tempfile.log"))); + error("There was a problem while compiling the tex source!<br> + pdflatex wrote the following log file:<br><br> + <pre>$errlog</pre>"); + } + // delete temporary files @unlink("$tempfile.tex"); Index: setseed.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/setseed.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setseed.php 8 Oct 2003 19:49:41 -0000 1.1 --- setseed.php 20 Oct 2003 03:02:56 -0000 1.2 *************** *** 5,12 **** require_once("../../config.php"); require_variable($sheetid); require_variable($assignment); ! require_variable($student); if (! $math_assignment = get_record("math_assignment", "id", $assignment)) { --- 5,14 ---- require_once("../../config.php"); + require_once("lib.php"); require_variable($sheetid); require_variable($assignment); ! global $USER; ! $student = $USER->id; if (! $math_assignment = get_record("math_assignment", "id", $assignment)) { *************** *** 18,21 **** --- 20,31 ---- } + if (! $subject = get_record("math_assignment_subject", "course", $math_assignment->course)) { + error("AiM subject is misconfigured"); + } + + if (! $server = get_record("math_assignment_server", "id", $subject->server)) { + error("AiM subject is misconfigured"); + } + require_login(); *************** *** 29,55 **** error("Sorry, you shouldn't be on this page!"); } ! ! if ($seed = get_record("math_assignment_seed", "assignment", $assignment, "student", $student)) { ! error("You already entered an ID for this assignment."); ! } ! print_header("$course->shortname: $math_assignment->name", "$course->fullname", "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name", "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm)); ! ! if (!$seed = get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) { ! // The ID number does not exist ! notice(get_string("idinvalid", "math_assignment")); } ! ! // ID number is valid ! if (isset($seed->student)) { ! // but this ID number was already entered by a ! // different student ! notice(get_string("idtaken", "math_assignment")); } // Everything is o.k., so assign seed to student ! set_field($math_assignment_seed, "student", $student, "assignment", $assignment, "seed", $sheetid); redirect($_SERVER["HTTP_REFERER"]); --- 39,108 ---- error("Sorry, you shouldn't be on this page!"); } ! print_header("$course->shortname: $math_assignment->name", "$course->fullname", "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name", "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm)); ! ! // generate random seed if sheetid = 0 ! if ($sheetid == 0) { ! $sheetid = mt_rand (10000000,99999999); ! // make sure seed hasn't already been used ! while (get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) { ! $sheetid = mt_rand (10000000,99999999); ! } ! $seeddata->seed = $sheetid; ! $seeddata->student = $student; ! $seeddata->assignment = $assignment; ! if (!insert_record("math_assignment_seed", $seeddata, $returnid=false)) { ! error("Couldn't add seed $newseed->seed to database"); ! } } ! else { // check if given sheetid is valid ! if (record_exists("math_assignment_seed", "assignment", $assignment, "student", $student)) { ! error("You already entered an ID for this assignment. The system should not have brought you to this page."); ! } ! if (!$seed = get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) { ! // The ID number does not exist ! notice(get_string("idinvalid", "math_assignment", $sheetid)); ! } ! // ID number is valid ! if (isset($seed->student)) { ! // but this ID number was already entered by a ! // different student ! notice(get_string("idtaken", "math_assignment", $sheetid)); ! } } // Everything is o.k., so assign seed to student ! if (!set_field("math_assignment_seed", "student", $student, "assignment", $assignment, "seed", $sheetid)) { ! error("Problem writing to seed database table"); ! } ! ! // request quiz page once to set seed on AiM ! $postdata = ""; ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "SeedPassword", $subject->password); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Seed", $sheetid); ! ! // load the AiM page and grab the result ! $data = math_assignment_get_aim_output($server->address, $postdata, "html"); ! ! // check if we need to sooth any AiM grumbles ! $error = math_assignment_check_aim_output($data); ! if ($error == 1) { // user not registered ! if ($CFG->math_assignment_auto_register) { ! // attempt to register them automatically ! if (!math_assignment_register_with_aim($server, $subject)) { ! error(get_string("nooutput", "math_assignment"), "view.php?id=$cm->id"); ! } ! // retry ! $data = math_assignment_get_aim_output($server->address, $postdata, "html"); ! } ! } ! redirect($_SERVER["HTTP_REFERER"]); Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** view.php 8 Oct 2003 19:49:41 -0000 1.19 --- view.php 20 Oct 2003 03:02:56 -0000 1.20 *************** *** 13,18 **** optional_variable($sort, "lastname"); // column to sort optional_variable($sortdir, "asc"); // direction to sort - - global $USER; if (! $site = get_site()) { --- 13,16 ---- *************** *** 85,89 **** if (strcasecmp($sort, "firstname") != 0) { // to improve speed if (strcasecmp($sort, "totalgrade") != 0) ! $sort = "lastname"; // not valid so use default instead } } --- 83,87 ---- if (strcasecmp($sort, "firstname") != 0) { // to improve speed if (strcasecmp($sort, "totalgrade") != 0) ! $sort = "lastname"; // not valid so use default instead } } *************** *** 151,161 **** if ($hasboth) { if ($student->papergrade >= 0) ! $myxls->InsertNumber($student->papergrade); else ! $myxls->InsertText(""); if ($student->aimgrade >= 0) ! $myxls->InsertNumber($student->aimgrade); else ! $myxls->InsertText(""); } $myxls->InsertNumber($student->totalgrade); --- 149,159 ---- if ($hasboth) { if ($student->papergrade >= 0) ! $myxls->InsertNumber($student->papergrade); else ! $myxls->InsertText(""); if ($student->aimgrade >= 0) ! $myxls->InsertNumber($student->aimgrade); else ! $myxls->InsertText(""); } $myxls->InsertNumber($student->totalgrade); *************** *** 187,194 **** if ($hasboth) { if ($student->papergrade >= 0) ! echo "$student->papergrade"; echo "\t"; if ($student->aimgrade >= 0) ! echo "$student->aimgrade"; echo "\t"; } --- 185,192 ---- if ($hasboth) { if ($student->papergrade >= 0) ! echo "$student->papergrade"; echo "\t"; if ($student->aimgrade >= 0) ! echo "$student->aimgrade"; echo "\t"; } *************** *** 229,237 **** echo "<td>"; if ($student->aimgrade >= 0) ! echo $student->aimgrade; else echo " "; echo "</td><td>"; if ($student->papergrade >= 0) ! echo $student->papergrade; else echo " "; echo "</td>"; --- 227,235 ---- echo "<td>"; if ($student->aimgrade >= 0) ! echo $student->aimgrade; else echo " "; echo "</td><td>"; if ($student->papergrade >= 0) ! echo $student->papergrade; else echo " "; echo "</td>"; *************** *** 240,244 **** echo "<td>"; if ($student->totalgrade > 0) ! echo $student->totalgrade; else echo " "; echo "</td>"; --- 238,242 ---- echo "<td>"; if ($student->totalgrade > 0) ! echo $student->totalgrade; else echo " "; echo "</td>"; *************** *** 279,287 **** } if ($haspaper) { ! echo "<b>$strpaper $strgrade :</b> "; if ($grade->papergrade >= 0) ! echo "$grade->papergrade / $math_assignment->papergrade"; else ! print_string("notmarked", "math_assignment"); echo "<br />"; } --- 277,287 ---- } if ($haspaper) { ! echo "<b>"; ! if ($hasaim) echo "$strpaper "; ! echo "$strgrade :</b> "; if ($grade->papergrade >= 0) ! echo "$grade->papergrade / $math_assignment->papergrade"; else ! print_string("notmarked", "math_assignment"); echo "<br />"; } *************** *** 289,304 **** echo "<b>$strcomputer $strgrade :</b> "; if ($grade->aimgrade >= 0) ! echo "$grade->aimgrade / $math_assignment->aimgrade"; else ! print_string("notattempted", "math_assignment"); if ($grade->aimoverride > AIMOVR_RESET) { ! echo " ("; ! print_string("gradeoverride", "math_assignment"); ! echo ")"; } echo "<br />"; if ($grade->aimcomment) ! echo "<b>" . $course->teacher . " " . get_string("comment", "math_assignment") . ! ":</b> " . nl2br(htmlspecialchars($grade->aimcomment)) . "<br />"; } if ($hasboth) { --- 289,304 ---- echo "<b>$strcomputer $strgrade :</b> "; if ($grade->aimgrade >= 0) ! echo "$grade->aimgrade / $math_assignment->aimgrade"; else ! print_string("notattempted", "math_assignment"); if ($grade->aimoverride > AIMOVR_RESET) { ! echo " ("; ! print_string("gradeoverride", "math_assignment"); ! echo ")"; } echo "<br />"; if ($grade->aimcomment) ! echo "<b>" . $course->teacher . " " . get_string("comment", "math_assignment") . ! ":</b> " . nl2br(htmlspecialchars($grade->aimcomment)) . "<br />"; } if ($hasboth) { *************** *** 306,312 **** echo "<b>$strtotal $strgrade :</b> "; if ($totalgrade >= 0) ! echo " $totalgrade / $totalmax"; else ! print_string("notmarked", "math_assignment"); } } --- 306,312 ---- echo "<b>$strtotal $strgrade :</b> "; if ($totalgrade >= 0) ! echo " $totalgrade / $totalmax"; else ! print_string("notmarked", "math_assignment"); } } *************** *** 318,322 **** if ($subject = get_record("math_assignment_subject", "course", $course->id)) { if ($server = get_record("math_assignment_server", "id", $subject->server)) ! $zonelink = $server->password; } echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right"); --- 318,322 ---- if ($subject = get_record("math_assignment_subject", "course", $course->id)) { if ($server = get_record("math_assignment_server", "id", $subject->server)) ! $zonelink = $server->password; } echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right"); *************** *** 344,390 **** $picture = print_user_picture($student->userid, $course->id, $student->picture, false, true); if ($student->papergrade >= 0) ! $papergrade = $student->papergrade; else ! $papergrade = ""; $papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />"; if ($student->aimgrade >= 0) ! $aimgrade = $student->aimgrade; else ! $aimgrade = ""; if ($student->aimoverride > AIMOVR_RESET) { ! $edited = "$stredited ("; ! $editedclose = ")"; } else if ($student->aimcomment) { ! $edited = "$strcommented ("; ! $editedclose = ")"; } else { ! $edited = ""; ! $editedclose = ""; } $email = "<a href=\"mailto:$student->email\">"; if ($CFG->math_assignment_default_email_host) { ! if (preg_match("/^(.*)@(.*)$/", $student->email, $matches)) { ! if (strcmp($matches[2], $CFG->math_assignment_default_email_host) == 0) ! $email .= "$matches[1]</a>"; ! else ! $email .= "$student->email</a>"; ! } ! else ! $email .= "$student->email</a>"; } else ! $email .= "$student->email</a>"; if ($hasboth) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade); else if ($haspaper) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade); else if ($hasaim) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose"); $i++; --- 344,390 ---- $picture = print_user_picture($student->userid, $course->id, $student->picture, false, true); if ($student->papergrade >= 0) ! $papergrade = $student->papergrade; else ! $papergrade = ""; $papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />"; if ($student->aimgrade >= 0) ! $aimgrade = $student->aimgrade; else ! $aimgrade = ""; if ($student->aimoverride > AIMOVR_RESET) { ! $edited = "$stredited ("; ! $editedclose = ")"; } else if ($student->aimcomment) { ! $edited = "$strcommented ("; ! $editedclose = ")"; } else { ! $edited = ""; ! $editedclose = ""; } $email = "<a href=\"mailto:$student->email\">"; if ($CFG->math_assignment_default_email_host) { ! if (preg_match("/^(.*)@(.*)$/", $student->email, $matches)) { ! if (strcmp($matches[2], $CFG->math_assignment_default_email_host) == 0) ! $email .= "$matches[1]</a>"; ! else ! $email .= "$student->email</a>"; ! } ! else ! $email .= "$student->email</a>"; } else ! $email .= "$student->email</a>"; if ($hasboth) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade); else if ($haspaper) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade); else if ($hasaim) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose"); $i++; *************** *** 407,414 **** echo "</td></tr></table></form>\n"; if (!$math_assignment->papersheetsreturned) { ! echo "<table border=\"0\" align=\"center\"><tr><td>"; ! $options = array("id"=>$cm->id); ! print_single_button("email.php", $options, get_string("emailstudents", "math_assignment")); ! echo "</td></tr></table>\n"; } } --- 407,414 ---- echo "</td></tr></table></form>\n"; if (!$math_assignment->papersheetsreturned) { ! echo "<table border=\"0\" align=\"center\"><tr><td>"; ! $options = array("id"=>$cm->id); ! print_single_button("email.php", $options, get_string("emailstudents", "math_assignment")); ! echo "</td></tr></table>\n"; } } *************** *** 436,460 **** } } ! else { // This is for the student ! // First get seed ! if (!$seed = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) { ! // No seed set yet, so ask the student ! echo "<form action=\"setseed.php\" method=\"GET\">\n"; ! echo get_string("enterid", "math_assignment"); ! echo "<input type=\"text\" name=\"sheetid\" size=\"8\" maxlength=\"8\" />\n"; ! echo "<input type=\"hidden\" name=\"assignment\" value=\"$math_assignment->id\" />\n"; ! echo "<input type=\"hidden\" name=\"student\" value=\"$USER->id\" />\n"; ! echo "<input type=\"submit\" value=\"Submit\"><br />"; ! } ! else { ! echo math_assignment_get_file_links($math_assignment, "center"); ! if ($hasaim) { ! if ($grade->aimoverride > AIMOVR_RESET) { ! echo "<p align=\"center\">"; ! print_string("gradeoverridemsg", "math_assignment"); ! echo "</p>"; ! } ! echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>"; } } } --- 436,448 ---- } } ! else { ! echo math_assignment_get_file_links($math_assignment, "center"); ! if ($hasaim) { ! if ($grade->aimoverride > AIMOVR_RESET) { ! echo "<p align=\"center\">"; ! print_string("gradeoverridemsg", "math_assignment"); ! echo "</p>"; } + echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>"; } } |
Update of /cvsroot/aimmath/moodle/lang/en/help/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv18595/lang/en/help/math_assignment Modified Files: addupdate_quiz.html addupdate_solutions.html addupdate_timedue.html admin_quiz.html index.html mods.html Log Message: updates to some of the help files Index: addupdate_quiz.html =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/help/math_assignment/addupdate_quiz.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** addupdate_quiz.html 18 Sep 2003 17:30:09 -0000 1.2 --- addupdate_quiz.html 19 Oct 2003 10:32:06 -0000 1.3 *************** *** 1,7 **** <P ALIGN=CENTER><B>Quiz Field</B></P> ! <P>This field only shows if an AiM subject has been created for you on an AiM server. If you enter the name of a quiz that has been set up on AiM then this quiz will become an integral part of the <?php echo get_string("modulename","math_assignment") ?>. </P> ! <p>If you click on the AiM administration link the AiM subject administration page will open in a separate window. This may be useful for looking up the names of the quizzes that have been set up or for example. </p> --- 1,7 ---- <P ALIGN=CENTER><B>Quiz Field</B></P> ! <P>This field only shows if an AiM subject has been created for you on an AiM server. The drop-down list shows all the quizzes that has been set up on AiM for this course. If you select a quiz from the list then it will become an integral part of the <?php echo get_string("modulename","math_assignment") ?>. </P> ! </p> *************** *** 10,13 **** --- 10,14 ---- <LI>Parent : <A href="help.php?module=math_assignment&file=addupdate.html">Add or Update <?php echo get_string("modulename","math_assignment") ?></A> <LI>Previous Field : <A href="help.php?module=math_assignment&file=addupdate_maxgrade.html"><?php echo get_string("maxgrade","math_assignment") ?></A> + <LI>Next Field : <A href="help.php?module=math_assignment&file=addupdate_style.html"><?php echo get_string("aimstyle","math_assignment") ?></A> <LI><A href="help.php?module=moodle&file=index.html">Help Index</A> </UL> Index: addupdate_solutions.html =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/help/math_assignment/addupdate_solutions.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** addupdate_solutions.html 18 Sep 2003 17:30:09 -0000 1.1 --- addupdate_solutions.html 19 Oct 2003 10:32:06 -0000 1.2 *************** *** 7,11 **** <li><b><?php echo get_string("externalurl","math_assignment") ?>:</b> If your <?php echo get_string("solutions","math_assignment") ?> is already available on the web then you don't have to upload it to Moodle. You can simply link to it by pasting the full URL (including the http://) into this field.</li> </ul> ! The <?php echo get_string("solutions","math_assignment") ?> will only be visible to the students after the due date. <p> If your <?php echo get_string("modulename","math_assignment") ?> does not contain a <?php echo get_string("aimquiz","math_assignment") ?> then you can post your <?php echo get_string("solutions","math_assignment") ?> in any electronic format. However the pdf format is the recommended format because most computers will be able to display this. Postscript is possible but not as convenient for students who may want to look at the <?php echo get_string("solutions","math_assignment") ?> at home because the postscript files are longer and not every computer has a postscript viewer. --- 7,11 ---- <li><b><?php echo get_string("externalurl","math_assignment") ?>:</b> If your <?php echo get_string("solutions","math_assignment") ?> is already available on the web then you don't have to upload it to Moodle. You can simply link to it by pasting the full URL (including the http://) into this field.</li> </ul> ! The <?php echo get_string("solutions","math_assignment") ?> will only be visible to the students after a specified time. see <A href="help.php?module=math_assignment&file=addupdate_solutiontime.html"><?php echo get_string("solutiontime","math_assignment") ?></A>. <p> If your <?php echo get_string("modulename","math_assignment") ?> does not contain a <?php echo get_string("aimquiz","math_assignment") ?> then you can post your <?php echo get_string("solutions","math_assignment") ?> in any electronic format. However the pdf format is the recommended format because most computers will be able to display this. Postscript is possible but not as convenient for students who may want to look at the <?php echo get_string("solutions","math_assignment") ?> at home because the postscript files are longer and not every computer has a postscript viewer. *************** *** 17,20 **** <LI>Parent : <A href="help.php?module=math_assignment&file=addupdate.html">Add or Update <?php echo get_string("modulename","math_assignment") ?></A> <LI>Previous Field : <A href="help.php?module=math_assignment&file=addupdate_problems.html"><?php echo get_string("problems","math_assignment") ?></A> ! <LI>Next Field : <A href="help.php?module=math_assignment&file=addupdate_maxgrade.html"><?php echo get_string("maxgrade","math_assignment") ?></A> </UL> --- 17,20 ---- <LI>Parent : <A href="help.php?module=math_assignment&file=addupdate.html">Add or Update <?php echo get_string("modulename","math_assignment") ?></A> <LI>Previous Field : <A href="help.php?module=math_assignment&file=addupdate_problems.html"><?php echo get_string("problems","math_assignment") ?></A> ! <LI>Next Field : <A href="help.php?module=math_assignment&file=addupdate_solutiontime.html"><?php echo get_string("solutiontime","math_assignment") ?></A> </UL> Index: addupdate_timedue.html =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/help/math_assignment/addupdate_timedue.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** addupdate_timedue.html 18 Sep 2003 17:30:09 -0000 1.1 --- addupdate_timedue.html 19 Oct 2003 10:32:06 -0000 1.2 *************** *** 1,5 **** <P ALIGN=CENTER><B><?php echo get_string("timedue","math_assignment") ?></B></P> ! <p>Here you set the date and the time when your students have to hand in the <?php echo get_string("modulename","math_assignment") ?>. You could for example set this to the start time of the lecture during which you collect the student's work. After this time the system will allow the students to view the <?php echo get_string("solutions","math_assignment") ?>. If the <?php echo get_string("modulename","math_assignment") ?> contains a <?php echo get_string("aimquiz","math_assignment") ?> then this will automatically be set up to close at the same time. The <?php echo get_string("timedue","math_assignment") ?> will be shown to the student when he views the <?php echo get_string("modulename","math_assignment") ?>. <P><B>Links:</B></P> --- 1,5 ---- <P ALIGN=CENTER><B><?php echo get_string("timedue","math_assignment") ?></B></P> ! <p>Here you set the date and the time when your students have to hand in the <?php echo get_string("modulename","math_assignment") ?>. You could for example set this to the start time of the lecture during which you collect the student's work. If the <?php echo get_string("modulename","math_assignment") ?> contains a <?php echo get_string("aimquiz","math_assignment") ?> then this will automatically be set up to close at the same time. The <?php echo get_string("timedue","math_assignment") ?> will be shown to the student when he views the <?php echo get_string("modulename","math_assignment") ?>. <P><B>Links:</B></P> Index: admin_quiz.html =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/help/math_assignment/admin_quiz.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** admin_quiz.html 9 Sep 2003 18:31:07 -0000 1.1 --- admin_quiz.html 19 Oct 2003 10:32:06 -0000 1.2 *************** *** 8,70 **** The toolbar at the top of the subject admin page has links allowing you to save or reload options for the quiz, to <a href='#try_quiz'>try ! it</a>, to <a href='#admin_sourcedir'>browse the source files</a> for ! the questions in the quiz, and to <a href='#analyze_quiz'>view the results</a>. - The options that can be changed are as follows: - <ul> - <li><b>The title:</b> a descriptive title for the quiz. - </li> - <li><b>The due date:</b> the date after which students will be - allowed to see the solutions, but will not be allowed to change - their answers. You can set this to 'none' if desired. - </li> - <li><b>The weight:</b> if the subject has quizzes - <tt><font color='green'>q<sub>1</sub>,...,q<sub>n</sub></font></tt> - with weights - <tt><font color='green'>w<sub>1</sub>,...,w<sub>n</sub></font></tt>, - and a student's marks are - <tt><font color='green'>m<sub>1</sub>,...,m<sub>n</sub></font></tt>, - then the overall score is taken to be - <tt><font color='green'>w<sub>1</sub>m<sub>1</sub>+...+w<sub>n</sub>m<sub>n</sub></font></tt>. - </li> - <li><b>The access level:</b> this can be 'all', 'registered' or - 'none'. If it is 'registered', then guests cannot access the quiz; - if it is 'none', then no students can access the quiz. The quiz - selection page shown to students will not include quizzes that they - do not have permission to access. - </li> - <li><b>The mode:</b> this can be 'practice', 'assessment' or - 'strict'. In <em>practice mode</em>, students can try the questions - repeatedly and the system will tell them whether their answers are - right or wrong (except for multiple choice questions), and may give - some additional feedback. At any stage, students can ask to see the - solutions. After that, they can try the quiz again, but it will be - randomized differently. The due date has no effect. In - <em>assessment mode</em>, the system will again tell students - whether their answers are correct, but it will not allow them to - see the solutions until the due date has passed, at which point they - will not be allowed to change their answers. <em>Strict mode</em> - is similar except that before the due date, the system will give the - students no feedback at all about the correctness of their answers - (although it will still give feedback about syntax and type - checking.) - </li> - </ul> - <a name='quiz_table'><h3>The question table:</h3></a> - After the quiz options form, there is a table of questions. - <p> - Some quizzes (for example, those under constructions) may be hidden - from students. By default, these are also not shown in the subject - administration page; however, you can include them by clicking 'Show - unused questions'. Unless <a href='#selector'>selector functions</a> - are in use, all visible questions will be included in the quiz, and - hidden questions will be excluded. There is also a link at the top of - the quiz marked 'Use all questions', which forces all available - questions to be unhidden and included in the quiz. - </p> <p> Unless the <a href='#selector'>random question order</a> flag is --- 8,17 ---- The toolbar at the top of the subject admin page has links allowing you to save or reload options for the quiz, to <a href='#try_quiz'>try ! it</a>, and to <a href='#analyze_quiz'>view the results</a>. <a name='quiz_table'><h3>The question table:</h3></a> <p> Unless the <a href='#selector'>random question order</a> flag is *************** *** 96,100 **** </li> <li>The 'Hide' link ensures that the question is not included in the ! quiz, and the 'Delete' link deletes the compiled question file. The corresponding source file is not deleted, however. </li> --- 43,49 ---- </li> <li>The 'Hide' link ensures that the question is not included in the ! quiz, and ! </li> ! <li>The 'Delete' link deletes the compiled question file. The corresponding source file is not deleted, however. </li> Index: index.html =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/help/math_assignment/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.html 9 Sep 2003 18:31:07 -0000 1.1 --- index.html 19 Oct 2003 10:32:06 -0000 1.2 *************** *** 1,3 **** ! <P>Aim Quiz</P> <UL> <LI>User pages --- 1,3 ---- ! <P>Math Assignment</P> <UL> <LI>User pages Index: mods.html =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/help/math_assignment/mods.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mods.html 18 Sep 2003 17:30:09 -0000 1.2 --- mods.html 19 Oct 2003 10:32:06 -0000 1.3 *************** *** 1,4 **** <p><img valign="absmiddle" src="<?php echo "$CFG->wwwroot"; ?>/mod/math_assignment/icon.gif"> <b><?php echo get_string("modulename","math_assignment") ?></b></p> <ul> ! <p>This module allows you to create <?php echo get_string("modulenameplural","math_assignment") ?> with randomly generated problem sheets and questions marked by hand and by computer using the AiM system. </p> </ul> --- 1,4 ---- <p><img valign="absmiddle" src="<?php echo "$CFG->wwwroot"; ?>/mod/math_assignment/icon.gif"> <b><?php echo get_string("modulename","math_assignment") ?></b></p> <ul> ! <p>This module allows you to post and grade <?php echo get_string("modulenameplural","math_assignment") ?>. These can either be conventional problem and solution sheets or they can contain randomized questions from AiM (<a href="http://aiminfo.net">aiminfo.net</a>).</p> </ul> |
From: <gus...@us...> - 2003-10-19 10:05:20
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv15495/mod/math_assignment Modified Files: lib.php mod.html pdfgen.php Log Message: minor tweaks including drop-down list with all AiM quizzes on mod.html Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** lib.php 5 Oct 2003 22:54:16 -0000 1.36 --- lib.php 19 Oct 2003 10:01:43 -0000 1.37 *************** *** 1,5 **** <?PHP // $Id$ ! @include_once("../../lib/t2mml/edit.php"); // TeX to MathML converter script /// Library of functions and constants for module math_assignment --- 1,5 ---- <?PHP // $Id$ ! //@include_once("../../lib/t2mml/edit.php"); // TeX to MathML converter script /// Library of functions and constants for module math_assignment *************** *** 502,505 **** --- 502,525 ---- echo "//done hiding --></script>\n"; return true; + } + + function math_assignment_quizlist($course) { + /// returns an array with all the quiz names + + $subject = get_record("math_assignment_subject", "course", $course); + $server = get_record("math_assignment_server", "id", $subject->server); + + $postdata = ""; + $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Subject"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "LoadSubjectOptions"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); + // load the AiM page and grab the result + $data = math_assignment_get_aim_output($server->address, $postdata, "html"); + + preg_match_all("/\\<td align=\"left\"\\>([^<].+)?\\<\/td\\>/", $data, $quizzes); + + return $quizzes[1]; + } Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mod.html 5 Oct 2003 22:54:16 -0000 1.23 --- mod.html 19 Oct 2003 10:01:44 -0000 1.24 *************** *** 31,35 **** } if (!isset($form->aimquiz)) { ! $form->aimquiz = ""; } if (!isset($form->aimfocus)) { --- 31,35 ---- } if (!isset($form->aimquiz)) { ! $form->aimquiz = "None"; } if (!isset($form->aimfocus)) { *************** *** 49,52 **** --- 49,54 ---- } // Now we set the defaults + if ($form->aimquiz == "") $form->aimquiz = "None"; + if (!$form->name) $form->name = get_string("modulename", "math_assignment") . ($form->section ? " $form->section" : ""); *************** *** 133,137 **** print_date_selector("dueday", "duemonth", "dueyear", $form->timedue); echo " - "; ! print_time_selector("duehour", "dueminute", $form->timedue, 5); helpbutton("addupdate_timedue", $strtimedue, "math_assignment"); ?></td> --- 135,139 ---- print_date_selector("dueday", "duemonth", "dueyear", $form->timedue); echo " - "; ! print_time_selector("duehour", "dueminute", $form->timedue, 15); helpbutton("addupdate_timedue", $strtimedue, "math_assignment"); ?></td> *************** *** 206,210 **** </td> <td> ! <?php choose_from_menu ($options, "solutions", $form->solutions, $strnone, "sheet_change('solutions', 'list');", ""); ?> <?php if (math_assignment_is_tex_file("$rootdir/$form->solutions")) { --- 208,212 ---- </td> <td> ! <?php choose_from_menu($options, "solutions", $form->solutions, $strnone, "sheet_change('solutions', 'list');", ""); ?> <?php if (math_assignment_is_tex_file("$rootdir/$form->solutions")) { *************** *** 239,243 **** <td align="right"><p><b><?php echo $strsolutiontime; ?>:</b></td> <td><?php ! print_time_selector("solutionhour", "solutionminute", $form->solutiontime, 5); helpbutton("addupdate_solutiontime", $strsolutiontime, "math_assignment"); ?></td> --- 241,245 ---- <td align="right"><p><b><?php echo $strsolutiontime; ?>:</b></td> <td><?php ! print_time_selector("solutionhour", "solutionminute", $form->solutiontime, 15); helpbutton("addupdate_solutiontime", $strsolutiontime, "math_assignment"); ?></td> *************** *** 272,280 **** <td align="right"><p><b><?php echo $straimquiz; ?>:</b></p></td> <td> ! <input type="text" name="aimquiz" size="40" maxlength="255" value="<?php p($form->aimquiz); ?>" /> ! <?php ! helpbutton("addupdate_quiz", $straimquiz, "math_assignment"); ! echo "<a href=\"$CFG->wwwroot/mod/math_assignment/subjectpage.php?id=$form->course\" ! target=\"subject\">AiM administration</a>"; ?> </td> --- 274,285 ---- <td align="right"><p><b><?php echo $straimquiz; ?>:</b></p></td> <td> ! <?php ! $quizzes = math_assignment_quizlist($form->course); ! foreach ($quizzes as $quiz) { ! $quizarray[$quiz] = $quiz; ! } ! choose_from_menu($quizarray, "aimquiz", $form->aimquiz, ! $strnone, "", "None"); ! helpbutton("addupdate_quiz", $straimquiz, "math_assignment"); ?> </td> Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pdfgen.php 8 Oct 2003 19:49:41 -0000 1.18 --- pdfgen.php 19 Oct 2003 10:01:44 -0000 1.19 *************** *** 73,78 **** error("Couldn't add $i seed $newseed->seed to database"); } ! math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $newseed->seed); ! exec("\"c:\\Program Files\\ghostgum\\gsview\\gsview32.exe\" $tempfile.pdf"); } } --- 73,79 ---- error("Couldn't add $i seed $newseed->seed to database"); } ! math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, "$tempfile$i", $newseed->seed); ! echo exec("gsview32 -p prmaths1.york.ac.uk $tempfile$i.pdf"); ! echo "Sheet sent to gsview"; } } *************** *** 109,120 **** @unlink("$tempfile.pdf"); - @unlink("$tempfile.tex"); - @unlink("$tempfile.aux"); - @unlink("$tempfile.log"); - if (isset($imageurls)) { - foreach ($imageurls as $key => $imageurl) { - @unlink("$tempfile$key.jpg"); - } - } if (strlen($errlog) > 0) { --- 110,113 ---- *************** *** 249,252 **** --- 242,254 ---- else { exec("$texcommand $tempfile.tex"); + } + // delete temporary files + @unlink("$tempfile.tex"); + @unlink("$tempfile.aux"); + @unlink("$tempfile.log"); + if (isset($imageurls)) { + foreach ($imageurls as $key => $imageurl) { + @unlink("$tempfile$key.jpg"); + } } return true; |
From: <mo...@us...> - 2003-10-15 15:37:26
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv16129 Modified Files: Random.mpl Log Message: changed Rand(Frac()) so it accepts a denominator = 1 Index: Random.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Random.mpl,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Random.mpl 13 Oct 2003 21:16:37 -0000 1.11 --- Random.mpl 15 Oct 2003 15:37:22 -0000 1.12 *************** *** 80,84 **** <LI>if the argument is of the form @Vec(x[1],...,x[k])@ then the Maple vector @vector([Rand(x[1]),...,Rand(x[k])])@ is returned. Similiarly @ListVec(x[1],...,x[k])@ returns @[Rand(x[1]),...,Rand(x[k])]@ and @SeqVec(x[1],...,x[k])@ returns @Rand(x[1]),...,Rand(x[k])@ <LI>if the argument is of the form @Permute([x[1],...,x[k]])@ then a random permutation of the list @[Rand(x[1]),...,Rand(x[k])]@ is returned. Similarly if the argument is of the form @Permute(x[1],...,x[k])@ then a random permutation of the sequence @Rand(x[1]),...,Rand(x[k])@ is returned. ! <LI>if the argument is of the form @Partition(x)@ where @Rand(x)@ returns a positive integer @n@, then a list of positive integers whose sum is @n@ is returned (with elements in random order). If the argument is of the form @Partition(x,k)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms. Similarly if the argument is of the form @Partition(n,k,M)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@. Finally if the argument is of the form @Partition(n,k,M,m)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@ and no term less than @Rand(m)@. <LI>if the argument is of the form @Frac(n,d)@ then an improper fraction whose integer part is @Rand(n)@ and whose denominator is @Rand(d)@ is returned, i.e. if @N:=Rand(n)@, @M:=Rand(d)@, and @a:=Rand(1..M-1)@ then @(N*M+a)/M@ is returned. <LI>if the argument is @Null@, then @NULL@ is returned (i.e. @Rand(Null)@ returns @NULL@). --- 80,86 ---- <LI>if the argument is of the form @Vec(x[1],...,x[k])@ then the Maple vector @vector([Rand(x[1]),...,Rand(x[k])])@ is returned. Similiarly @ListVec(x[1],...,x[k])@ returns @[Rand(x[1]),...,Rand(x[k])]@ and @SeqVec(x[1],...,x[k])@ returns @Rand(x[1]),...,Rand(x[k])@ <LI>if the argument is of the form @Permute([x[1],...,x[k]])@ then a random permutation of the list @[Rand(x[1]),...,Rand(x[k])]@ is returned. Similarly if the argument is of the form @Permute(x[1],...,x[k])@ then a random permutation of the sequence @Rand(x[1]),...,Rand(x[k])@ is returned. ! <LI>if the argument is of the form @Partition(x)@ where @Rand(x)@ returns a positive integer @n@, then a list of positive integers whose sum is @n@ is returned (with elements in random order). If the argument is of the form @Partition(x,k)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms. Similarly if the argument is of the form @Partition(n,k,M)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@. Finally if the argument is of the form @Partition(n,k,M,m)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@ and no term less than @Rand(m)@ An argument ! of the form @SeqPartition()@ works exactly the same as @Partition()@ except ! that it returns a sequence instead of a list. <LI>if the argument is of the form @Frac(n,d)@ then an improper fraction whose integer part is @Rand(n)@ and whose denominator is @Rand(d)@ is returned, i.e. if @N:=Rand(n)@, @M:=Rand(d)@, and @a:=Rand(1..M-1)@ then @(N*M+a)/M@ is returned. <LI>if the argument is @Null@, then @NULL@ is returned (i.e. @Rand(Null)@ returns @NULL@). *************** *** 310,313 **** --- 312,318 ---- ans:=[seq(mn-1,i=1..s)]+Rand(Partition(n-s*(mn-1),s,mx-mn+1)); fi; + # SeqPartition(...) + elif type(r,specfunc(anything,'SeqPartition')) then + ans:=op(Rand(Partition(op(r)))) # Frac(integerpart,den) elif type(r,specfunc(anything,'Frac')) then *************** *** 315,321 **** error "Syntax: Frac(integerpart,den)"; fi; ! n:=Rand(op(1,r)); m:=Rand(op(2,r)); a:=Rand(1..m-1); ! ans:=(a+n*m)/m; ! # Random Expressions from a family of operators elif type(r,specfunc(anything,Expression)) then --- 320,330 ---- error "Syntax: Frac(integerpart,den)"; fi; ! n:=Rand(op(1,r)); m:=Rand(op(2,r)); ! if m=1 then ! ans:=n ! else ! a:=Rand(1..m-1); ! ans:=(a+n*m)/m; ! fi: # Random Expressions from a family of operators elif type(r,specfunc(anything,Expression)) then |
From: <mo...@us...> - 2003-10-15 14:55:05
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv7435 Modified Files: LaTeX.mpl Log Message: fixes bug in latex/latex/float Index: LaTeX.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/LaTeX.mpl,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** LaTeX.mpl 10 Oct 2003 15:39:58 -0000 1.13 --- LaTeX.mpl 15 Oct 2003 14:54:53 -0000 1.14 *************** *** 439,450 **** exponent:=exponent+shift; fi: ! # if its greater than one, we're all set ! if mantissa*10^exponent>1 then ipart:=(mantissa-(mantissa mod 10^(-exponent)))/10^(-exponent); fracpart:=mantissa mod 10^(-exponent); if fracpart=0 then return cat(sign,ipart) else ! return cat(sign,ipart,".",fracpart) fi: # otherwise we need the leading zero and the other zeros --- 439,452 ---- exponent:=exponent+shift; fi: ! # if its greater than or equal to one, we're all set ! if mantissa>=10^(-exponent) then ipart:=(mantissa-(mantissa mod 10^(-exponent)))/10^(-exponent); fracpart:=mantissa mod 10^(-exponent); + # pad zeros on the left if needed + filler:=-exponent-length(fracpart); if fracpart=0 then return cat(sign,ipart) else ! return cat(sign,ipart,".","0"$filler,fracpart) fi: # otherwise we need the leading zero and the other zeros |
From: <mo...@us...> - 2003-10-13 21:17:40
|
Update of /cvsroot/aimmath/AIM/doc In directory sc8-pr-cvs1:/tmp/cvs-serv7927 Modified Files: AuthoringPackages.html AuthoringTtH.html AuthoringTtH.tex Log Message: updated documentation Index: AuthoringPackages.html =================================================================== RCS file: /cvsroot/aimmath/AIM/doc/AuthoringPackages.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AuthoringPackages.html 29 Sep 2003 21:13:19 -0000 1.3 --- AuthoringPackages.html 13 Oct 2003 21:17:34 -0000 1.4 *************** *** 34,43 **** <li><a href="aim/Number.html"><b>Number</b></a> - utilities for dealing with the representations of integers (Roman numerals, converting numbers to words, etc)</li> ! <li><a href="Random.html"><b>Random</b></a> - This package defines some utility functions for generating random questions. The Rand() command is an all purpose recursive random-thing-maker.</li> ! <li><b>Keys()</b> - an authoring utility that makes it easy to generate quiz question ! selector functions</li> <li><b>Nice</b> - `Nice/Monomial`(), `Nice/Binomial`(), `Nice/Trinomial`() are utilities that produce "nice" monomials, binomials, and trinomials similar to those usually found in textbook questions.</li> </ul> </BODY> --- 34,46 ---- <li><a href="aim/Number.html"><b>Number</b></a> - utilities for dealing with the representations of integers (Roman numerals, converting numbers to words, etc)</li> ! <li><a href="Random.html"><b>Random</b></a> - defines some utility functions for generating random questions. The Rand() command is an all purpose recursive random-thing-maker.</li> ! <li><a href="aim/AnswerHints.html"><b>AnswerHints</b></a> - This package ! defines utilities useful for detecting common mathematical errors in ! students' answers</li> <li><b>Nice</b> - `Nice/Monomial`(), `Nice/Binomial`(), `Nice/Trinomial`() are utilities that produce "nice" monomials, binomials, and trinomials similar to those usually found in textbook questions.</li> + <li><b>Keys()</b> - an authoring utility that makes it easy to generate quiz question + selector functions</li> </ul> </BODY> Index: AuthoringTtH.html =================================================================== RCS file: /cvsroot/aimmath/AIM/doc/AuthoringTtH.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AuthoringTtH.html 27 Sep 2003 20:47:23 -0000 1.1 --- AuthoringTtH.html 13 Oct 2003 21:17:34 -0000 1.2 *************** *** 1,6 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ! "http://www.w3.org/TR/html4/loose.dtd"> <html> ! <meta name="GENERATOR" content="TtH 3.40"> <style type="text/css"> div.p { margin-top: 7pt;}</style> <style type="text/css"><!-- --- 1,6 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ! "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> [...1015 lines suppressed...] ! ! <div class="p"><!----></div> ! <HR NOSHADE SIZE=1></blockquote> ! ! <div class="p"><!----></div> ! <h2><a name="tth_sEc7"> ! 7</a> Question Selector Utilities</h2> <div class="p"><!----></div> *************** *** 2603,2606 **** by <a href="http://hutchinson.belmont.ma.us/tth/"> T<sub><font size="-1">T</font></sub>H</a>, ! version 3.40.<br />On 27 Sep 2003, 16:34.</small> </html> --- 2705,2708 ---- by <a href="http://hutchinson.belmont.ma.us/tth/"> T<sub><font size="-1">T</font></sub>H</a>, ! version 3.30.<br />On 12 Oct 2003, 20:58.</small> </html> Index: AuthoringTtH.tex =================================================================== RCS file: /cvsroot/aimmath/AIM/doc/AuthoringTtH.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AuthoringTtH.tex 27 Sep 2003 20:47:23 -0000 1.1 --- AuthoringTtH.tex 13 Oct 2003 21:17:34 -0000 1.2 *************** *** 1038,1042 **** \code{vector([Rand(x}$_{\code{1}}$% \code{),...,Rand(x}$_{\code{k}}$% ! \code{)])} is returned. \begin{Ex} --- 1038,1052 ---- \code{vector([Rand(x}$_{\code{1}}$% \code{),...,Rand(x}$_{\code{k}}$% ! \code{)])} is returned. Similarly \code{ListVec(x}$_{% ! \code{1}}$\code{,...,x}$_{% ! \code{k}}$\code{)} returns the Maple list ! \code{[Rand(x}$_{\code{1}}$% ! \code{),...,Rand(x}$_{\code{k}}$% ! \code{)]} and \code{SeqVec(x}$_{% ! \code{1}}$\code{,...,x}$_{% ! \code{k}}$\code{)} returns the Maple sequence ! \code{Rand(x}$_{\code{1}}$% ! \code{),...,Rand(x}$_{\code{k}}$% ! \code{)}. \begin{Ex} *************** *** 1882,1885 **** --- 1892,1957 ---- number $x$. Thus the student can enter any string that correctly represents the decimal representation of the fraction $x$ and receive full credit. + + \section{The AnswerHints Package} + + AiM provides automatic feedback to students for common syntax errors in their + answer. However the question author might also like to provide feedback + on common mathematical errors in syntactically correct student answers. + The \code{AnswerHints} package contains functions that check for common + mathematical errors in a student's answer. This package currently contains only + one routine, but it is hoped that the number of utilities provided will increase + in the future. + + \subsection{Checking for sign errors} + + The call \code{`Hints/CheckSigns`(ans,rightans)} returns true if it can + determine if \code{ans} differs from the \code{rightans} only by having the + wrong signs in zero or more subexpressions. Note that this routine will also + return true if \code{ans} is equal to \code{rightans}. This is usually not a + problem, however, since the most obvious way to use such a utility is to call + it in the solution proc after it has already been determined (perhaps by more + sophisticated methods) that the answer is incorrect, as in the following + example. + + \begin{Example} + We are feeling generous today, so let's give the student a half credit and a + hint if their answer differs from the correct answer only by incorrect signs + in one or more places. + + \begin{codeblock} + \begin{verbatim} + l> f,a,x,rightans + h> f:=a*exp(a*x-a); + rightans:=subs(a=-1,f); + t> Simplify $@f@$ if $a=-1$. + s> [proc(ans) + if `aim/Test`(ans,rightans) then + return 1.0 + elif `Hints/CheckSigns`(ans,rightans) then + `aim/t`("{\\it Check your signs!}"); + return 0.5 + else + return 0.0 + fi; + end, + rightans + ] + end> + \end{verbatim} + \end{codeblock} + + This will produce the question: + + \begin{question} + Simplify $ae^{ax-a}$ if $a=-1$. + \end{question} + + The student will receive half credit and a warning to check their signs for any + of the following answers: + + $$-e^{-x-1},-e^{x+1},-e^{x-1},e^{-x+1},e^{-x-1},e^{x+1},e^{x-1}$$ + + \end{Example} + \section{Question Selector Utilities} |
From: <mo...@us...> - 2003-10-13 21:16:43
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv7760 Modified Files: Random.mpl Log Message: added SeqVec and ListVec options Index: Random.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Random.mpl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Random.mpl 20 Sep 2003 21:46:08 -0000 1.10 --- Random.mpl 13 Oct 2003 21:16:37 -0000 1.11 *************** *** 78,82 **** or product of n terms computed from @Rand(A)@ is returned. For @SUM@, @Prod@, @Set@, @SET@, @List@, and @Seq@ the @n@ elements will be distinct. For @DupSeq@ and @DupList@ there can be repetitions among the @n@ elements. <LI>if the argument is of the form @Set(A,B,f)@, @AIMSET(A,B,f)@, @List(A,B,f)@, @Seq(A,B,f)@, @SUM(A,B,f)@, or @Prod(A,B,f)@ then a natural number @n=Rand(B)@ is computed and a set, list, sequence, sum, or product of @n@ terms computed from @Rand(A)@ is returned containing distinct terms, where @f@ is a boolean function of two variables used to compare two terms to see if they are considered to be equal (thus allowing one to supply the definition of \"distinct\"). ! <LI>if the argument is of the form @Vec(x[1],...,x[k])@ then the Maple vector @vector([Rand(x[1]),...,Rand(x[k])])@ is returned. <LI>if the argument is of the form @Permute([x[1],...,x[k]])@ then a random permutation of the list @[Rand(x[1]),...,Rand(x[k])]@ is returned. Similarly if the argument is of the form @Permute(x[1],...,x[k])@ then a random permutation of the sequence @Rand(x[1]),...,Rand(x[k])@ is returned. <LI>if the argument is of the form @Partition(x)@ where @Rand(x)@ returns a positive integer @n@, then a list of positive integers whose sum is @n@ is returned (with elements in random order). If the argument is of the form @Partition(x,k)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms. Similarly if the argument is of the form @Partition(n,k,M)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@. Finally if the argument is of the form @Partition(n,k,M,m)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@ and no term less than @Rand(m)@. --- 78,82 ---- or product of n terms computed from @Rand(A)@ is returned. For @SUM@, @Prod@, @Set@, @SET@, @List@, and @Seq@ the @n@ elements will be distinct. For @DupSeq@ and @DupList@ there can be repetitions among the @n@ elements. <LI>if the argument is of the form @Set(A,B,f)@, @AIMSET(A,B,f)@, @List(A,B,f)@, @Seq(A,B,f)@, @SUM(A,B,f)@, or @Prod(A,B,f)@ then a natural number @n=Rand(B)@ is computed and a set, list, sequence, sum, or product of @n@ terms computed from @Rand(A)@ is returned containing distinct terms, where @f@ is a boolean function of two variables used to compare two terms to see if they are considered to be equal (thus allowing one to supply the definition of \"distinct\"). ! <LI>if the argument is of the form @Vec(x[1],...,x[k])@ then the Maple vector @vector([Rand(x[1]),...,Rand(x[k])])@ is returned. Similiarly @ListVec(x[1],...,x[k])@ returns @[Rand(x[1]),...,Rand(x[k])]@ and @SeqVec(x[1],...,x[k])@ returns @Rand(x[1]),...,Rand(x[k])@ <LI>if the argument is of the form @Permute([x[1],...,x[k]])@ then a random permutation of the list @[Rand(x[1]),...,Rand(x[k])]@ is returned. Similarly if the argument is of the form @Permute(x[1],...,x[k])@ then a random permutation of the sequence @Rand(x[1]),...,Rand(x[k])@ is returned. <LI>if the argument is of the form @Partition(x)@ where @Rand(x)@ returns a positive integer @n@, then a list of positive integers whose sum is @n@ is returned (with elements in random order). If the argument is of the form @Partition(x,k)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms. Similarly if the argument is of the form @Partition(n,k,M)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@. Finally if the argument is of the form @Partition(n,k,M,m)@ then a partition of @n@ is returned having exactly @Rand(k)@ terms and no term greater than @Rand(M)@ and no term less than @Rand(m)@. *************** *** 261,264 **** --- 261,270 ---- elif type(r,specfunc(anything,Vec)) then ans:=vector([seq(Rand(op(i,r)),i=1..nops(r))]); + # SeqVec(...) + elif type(r,specfunc(anything,SeqVec)) then + ans:=seq(Rand(op(i,r)),i=1..nops(r)); + # ListVec(...) + elif type(r,specfunc(anything,ListVec)) then + ans:=[seq(Rand(op(i,r)),i=1..nops(r))]; # Permute(...) elif type(r,specfunc(anything,Permute)) then |
From: <mo...@us...> - 2003-10-13 21:16:13
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv7632 Modified Files: AnswerHints.mpl Log Message: improvements to Hints/CheckSigns Index: AnswerHints.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/AnswerHints.mpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AnswerHints.mpl 10 Oct 2003 15:42:44 -0000 1.1 --- AnswerHints.mpl 13 Oct 2003 21:15:58 -0000 1.2 *************** *** 19,24 **** is equal to @rightans@. ", ! proc(ans,rightans) ! local And,elt,relt,absans,absrightans,Member; if type(rightans,InertExpr) then --- 19,24 ---- is equal to @rightans@. ", ! proc(_ans,_rightans) ! local ans,rightans,And,elt,relt,absans,absrightans,Member; if type(rightans,InertExpr) then *************** *** 37,40 **** --- 37,43 ---- end: + # this converts answers like exp(1)^x to exp(x) + ans:=simplify(_ans); rightans:=simplify(_rightans); + try if type({ans,rightans},{set(list)}) then *************** *** 58,67 **** nops(ans)=nops(rightans) and `Hints/CheckSigns`([op(ans)],[op(rightans)]); ! elif type({ans,rightans},set(`+`)) or ! type({ans,rightans},set(`*`)) then ! return `Hints/CheckSigns`({op(ans)},{op(rightans)}) elif type({ans,rightans},set(algebraic)) then return `aim/Test`(abs(ans),abs(rightans)) ! fi: catch : end: return false; --- 61,74 ---- nops(ans)=nops(rightans) and `Hints/CheckSigns`([op(ans)],[op(rightans)]); ! elif type({ans,rightans},set(`+`)) or ! type({ans,rightans},set(`*`))then ! return `Hints/CheckSigns`({op(ans)},{op(rightans)}) ! # check if just one of the two is a product and look for x vs -x ! elif (type(rightans,`*`) and member(-1,{op(rightans)})) or ! (type(ans,`*`) and member(-1,{op(ans)})) then ! return `Hints/CheckSigns`(abs(ans),abs(rightans)) elif type({ans,rightans},set(algebraic)) then return `aim/Test`(abs(ans),abs(rightans)) ! fi: catch : end: return false; |
From: <mo...@us...> - 2003-10-10 15:44:18
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv13572 Modified Files: PackageList Log Message: Starting a new package: AnswerHints. Similar to SyntaxHints, but for catching mathematical errors, not syntax errors. Index: PackageList =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/PackageList,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PackageList 10 Oct 2003 09:44:58 -0000 1.6 --- PackageList 10 Oct 2003 15:44:14 -0000 1.7 *************** *** 18,21 **** --- 18,22 ---- aim/Mark aim/SyntaxHints + aim/AnswerHints aim/Decimal aim/SET |
From: <mo...@us...> - 2003-10-10 15:42:49
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv13337 Added Files: AnswerHints.mpl Log Message: Starting a new package: AnswerHints. Similar to SyntaxHints, but for catching mathematical errors, not syntax errors. --- NEW FILE: AnswerHints.mpl --- # Copyright (C) 2003 Ken Monks # Distributed without warranty under the GPL - see README for details read("Package.mpl"): Package("aim/AnswerHints", "This package contains functions that check for common mathematical errors (as opposed to syntax errors) in a student's answer and provide some guidance to them about possible causes for errors in their answers. "): ###################################################################### `Package/Assign`( `Hints/CheckSigns`::boolean, "This routine returns @true@ if it can determine if @ans@ differs from the @rightans@ only by having the wrong signs in zero or more subexpressions. Note that this routine will also return @true@ if @ans@ is equal to @rightans@. ", proc(ans,rightans) local And,elt,relt,absans,absrightans,Member; if type(rightans,InertExpr) then return `Hints/CheckSigns`(ans,Value(rightans)) elif type(rightans,SET) then return `Hints/CheckSigns`(ans,rightans['toSet']) fi: And:=proc() evalb({args}={true}); end: Member:=proc(e,S) local i: for i in S do if `Hints/CheckSigns`(e,i) then return i fi: od: return NULL: end: try if type({ans,rightans},{set(list)}) then return nops(ans)=nops(rightans) and And(op(zip(`Hints/CheckSigns`,ans,rightans))) elif type({ans,rightans},{set(set)}) then if nops(ans)<>nops(rightans) then return false fi: absans:=map(abs,ans); absrightans:=map(abs,rightans); for elt in absans do relt:=Member(elt,absrightans); if relt=NULL then return false else absrightans:=absrightans minus {relt}; fi: od: return true; elif type({ans,rightans},set(function)) or type({ans,rightans},set(`^`)) then return op(0,ans)=op(0,rightans) and nops(ans)=nops(rightans) and `Hints/CheckSigns`([op(ans)],[op(rightans)]); elif type({ans,rightans},set(`+`)) or type({ans,rightans},set(`*`)) then return `Hints/CheckSigns`({op(ans)},{op(rightans)}) elif type({ans,rightans},set(algebraic)) then return `aim/Test`(abs(ans),abs(rightans)) fi: catch : end: return false; end ): EndPackage(): |
From: <mo...@us...> - 2003-10-10 15:40:05
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv12648 Modified Files: Inert.mpl LaTeX.mpl Log Message: improved implementation of the Inert package Index: Inert.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Inert.mpl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Inert.mpl 23 Sep 2003 21:35:32 -0000 1.7 --- Inert.mpl 10 Oct 2003 15:39:58 -0000 1.8 *************** *** 138,142 **** cat("InertFunction\\left(",TeX(args),"\\right)") end, ! "Returns a LaTeX string representation of this function evaluated on its args. The default method returns the string formed by concatenating the @inertFunction@ with the LaTeX form of the arguments in parentheses. Usually overridden by the constructor. " ], --- 138,142 ---- cat("InertFunction\\left(",TeX(args),"\\right)") end, ! "Returns a LaTeX string representation of this function evaluated on its args. The default method returns the string formed by concatenating the name @InertFunction@ with the LaTeX form of the arguments in parentheses. Usually overridden by the constructor. Note that when creating your own @Inert@ objects keep in mind that the arguments will often be @InertExpr@ objects whose @Value@ is of the correct type, so any routine that overrides this routine should handle them appropriately. " ], *************** *** 203,211 **** ", proc(this,F::Inert) ! local f,d,ARGS,Values,R; this['InertFunction']:=eval(F); ! ARGS:=args[3..nargs]; ! R:=this['setArgs',ARGS]; # if an error string is returned, let them know # ttd, change this to try/catch and pass along the error for better reporting? --- 203,210 ---- ", proc(this,F::Inert) ! local f,d,Values,R; this['InertFunction']:=eval(F); ! R:=this['setArgs',args[3..nargs]]; # if an error string is returned, let them know # ttd, change this to try/catch and pass along the error for better reporting? *************** *** 241,245 **** NewArgs:=args[2..nargs]; fi; ! NewArgs:=[NewArgs]; # now check that the new args have the correct quantity and are in the domain --- 240,244 ---- NewArgs:=args[2..nargs]; fi; ! NewArgs:=map(eval,[NewArgs]); # now check that the new args have the correct quantity and are in the domain *************** *** 256,260 **** if not d(Values) then # if a string is returned the arguments were invalid ! return sprintf("Invalid arguments for Inert function %s: %q",F['Name'],Values); fi; --- 255,259 ---- if not d(Values) then # if a string is returned the arguments were invalid ! return sprintf("Invalid arguments for Inert function %s: %q",F['Name'],`Inert/Note`(Values)); fi; *************** *** 269,275 **** G['NeedsParentheses'] and F['Precedence']>G['Precedence'] then ! ParenArgs:=eval(ParenArgs),cat("\\left(",i['TeX'],"\\right)") else ! ParenArgs:=eval(ParenArgs),i['TeX']; fi: else --- 268,276 ---- G['NeedsParentheses'] and F['Precedence']>G['Precedence'] then ! # WAS: ParenArgs:=eval(ParenArgs),cat("\\left(",i['TeX'],"\\right)") ! ParenArgs:=eval(ParenArgs),Parentheses(i) else ! # WAS: ParenArgs:=eval(ParenArgs),i['TeX']; ! ParenArgs:=eval(ParenArgs),eval(i) fi: else *************** *** 317,320 **** --- 318,322 ---- local a,g,NewArgs,Xvar,Xval; + if type(f,constant) then f *************** *** 330,343 **** Apply(f,op(Indets(f,symbol))=args[2],args[3..-1]) elif type(args[2],symbol=anything) then - Xvar:=op(1,args[2]); Xval:=op(2,args[2]); NewArgs:=NULL; ! g:=eval(copy(f)); ! for a in g['Args'] do ! NewArgs:=eval(NewArgs),eval(Apply(eval(a),args[2..-1])); od: ! g['setArgs',NewArgs]; ! eval(g); else f --- 332,342 ---- Apply(f,op(Indets(f,symbol))=args[2],args[3..-1]) elif type(args[2],symbol=anything) then Xvar:=op(1,args[2]); Xval:=op(2,args[2]); NewArgs:=NULL; ! for a in f['Args'] do ! NewArgs:=eval(NewArgs),eval(Apply(a,args[2..-1])); od: ! return `new/InertExpr`(f['InertFunction'],NewArgs) else f *************** *** 473,477 **** end, -1, # Nargs ! 'algebraic',# Domain "Identity", # Name false, # Needs parentheses --- 472,476 ---- end, -1, # Nargs ! 'anything', # Domain "Identity", # Name false, # Needs parentheses *************** *** 494,502 **** `Inert/Decimal`::Inert, "This inert represents the identity map for reals. It formats a real constant as a floating point number to certain specifications. The first argument is the number to be formatted. The optional second argument is a formatting string suitable to be used as a first argument for @sprintf@. If no format string is specified, @Decimal(r)@ will format the float @r@ in a ! \"reasonable\" manner.", `new/Inert`( proc(x) x end, # Map (we ignore the formatting string) # TeX ! proc(x::constant,s::string) local d,n,t,man,ex,sf; if nargs=1 then if abs(evalf(x))=0.0 then --- 493,503 ---- `Inert/Decimal`::Inert, "This inert represents the identity map for reals. It formats a real constant as a floating point number to certain specifications. The first argument is the number to be formatted. The optional second argument is a formatting string suitable to be used as a first argument for @sprintf@. If no format string is specified, @Decimal(r)@ will format the float @r@ in a ! \"reasonable\" manner. If @x@ is an @InertExpr@ whose value is a float, @TeX(Decimal(x))@ returns the existing formatting, i.e. @TeX(x)@. To override the existing format use @Decimal(Value(x))@ instead.", `new/Inert`( proc(x) x end, # Map (we ignore the formatting string) # TeX ! proc(x::{constant,InertExpr},s::string) local d,n,t,man,ex,sf; + + if type(x,InertExpr) then return x['TeX'] fi: if nargs=1 then if abs(evalf(x))=0.0 then *************** *** 542,546 **** `Package/Assign`( `Inert/Plus`::Inert, ! "The Inert + function. Associative and produces a signed sum. Ex: Plus(1,-2,3) formats as 1-2+3", `new/Inert`(`+`, # TeX --- 543,547 ---- `Package/Assign`( `Inert/Plus`::Inert, ! "The Inert + function. Associative and produces a signed sum. Simplifies @0+a@ and @a+0@ to @a@. Ex: @Plus(1,-2,0)@ formats as @1-2@", `new/Inert`(`+`, # TeX *************** *** 552,556 **** s:=""; for i to nargs do ! if not (args[i]=0 or (args[i]="0")) then if i>1 and not s="" then s:=s,"\\,",`aim/LaTeX/Signed`(args[i]); --- 553,557 ---- s:=""; for i to nargs do ! if not Value(args[i])=0 then if i>1 and not s="" then s:=s,"\\,",`aim/LaTeX/Signed`(args[i]); *************** *** 672,683 **** `new/Inert`(`-`, proc(x) # TeX ! if type(x,negative) or ! (type(x,InertExpr) and ! StringTools:-Remove( ! rcurry(member,{"{"," ","}"}),TeX(x))[1..1]="-") ! then ! return cat("-",Parentheses(x)[TeX]) else ! return PercentStringToProc("-%1")(x) fi: end, --- 673,680 ---- `new/Inert`(`-`, proc(x) # TeX ! if `aim/StartsNegative`(x) then ! return cat("-\\left(",TeX(x),"\\right)") else ! return cat("-",TeX(x)) fi: end, *************** *** 733,737 **** `Package/Assign`( `Inert/Times`::Inert, ! "The Inert * function. Uses concatentation to denote a product.", `new/Inert`(`*`, # Map proc() # TeX --- 730,734 ---- `Package/Assign`( `Inert/Times`::Inert, ! "The Inert * function. Uses concatentation to denote a product. Associative and simplifies @1*a@ and @a*1@ to @a@.", `new/Inert`(`*`, # Map proc() # TeX *************** *** 743,761 **** s:=""; for i to nargs do ! if not (args[i]=1 or (args[i]="1")) then if i=1 and nargs>1 and args[1]=-1 then s:="-"; else if not (s="-" or s="") then ! u:=StringTools:-Remove( ! rcurry(member,{"{"," ","}"}),s); ! t:=StringTools:-Remove(rcurry(member,{"{"," ","}"}), ! TeX(args[i])); ! if length(u)>0 and ! `Util/Numeric`(u[-1..-1]) and ! length(t)>0 and ! (`Util/Numeric`(t[1..1]) or t[1..1]="-") then ! s:=cat(s,"\\cdot{}",TeX(args[i])); else s:=cat(s,"\\,",TeX(args[i])); --- 740,761 ---- s:=""; for i to nargs do ! if not args[i]=1 then if i=1 and nargs>1 and args[1]=-1 then s:="-"; else if not (s="-" or s="") then ! u:=`aim/LaTeX/CleanNonprinting`(s); ! t:=`aim/LaTeX/CleanNonprinting`(TeX(args[i])); ! if length(u)>0 and length(t)>0 and ! `Util/Numeric`(u[-1..-1]) then ! if `Util/Numeric`(t[1..1]) then ! s:=cat(s,"\\cdot{}",TeX(args[i])); ! elif t[1..1]="-" then ! s:=cat(s,"\\cdot{}\\left(", ! TeX(args[i]),"\\right)"); ! else ! s:=cat(s,"\\,",TeX(args[i])); ! fi: else s:=cat(s,"\\,",TeX(args[i])); *************** *** 865,874 **** `Package/Assign`( `Inert/ToThe`::Inert, ! "The Inert ^ function. Inserts a ^ between terms and is not associative.", `new/Inert`(`^`, # Map proc(a,b) # TeX ! if b=1 or b="1" then TeX(a) ! elif b=0 or b="0" then "1" elif type(a,negative) or type(a,float) then --- 865,874 ---- `Package/Assign`( `Inert/ToThe`::Inert, ! "The Inert ^ function. Inserts a ^ between terms and is not associative. Simplifies @a^1@ to @a@ and @a^0@ to @1@.", `new/Inert`(`^`, # Map proc(a,b) # TeX ! if Value(b)=1 then TeX(a) ! elif Value(b)=0 then "1" elif type(a,negative) or type(a,float) then *************** *** 938,942 **** `Inert/Exp`::Inert, "The Inert exponential function.", ! `new/Inert`( exp, # Map proc(x) # TeX if x=1 then --- 938,942 ---- `Inert/Exp`::Inert, "The Inert exponential function.", ! `new/Inert`( exp, # Map proc(x) # TeX if x=1 then Index: LaTeX.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/LaTeX.mpl,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LaTeX.mpl 19 Sep 2003 04:11:15 -0000 1.12 --- LaTeX.mpl 10 Oct 2003 15:39:58 -0000 1.13 *************** *** 750,757 **** (type(r,`*`) and type(op(1,r),negative)) then # pull negative signs out front return cat(" - ",TeX(-r)) ! elif type(r,string) and r[1]="-" then # it already has a negative out front ! return cat(" - ",r[2..-1]) ! elif type(r,InertExpr) and r['TeX'][1]="-" then # it already has a negative out front ! return cat(" - ",r['TeX'][2..-1]) else return cat(" + ",TeX(r)) --- 750,755 ---- (type(r,`*`) and type(op(1,r),negative)) then # pull negative signs out front return cat(" - ",TeX(-r)) ! elif `aim/StartsNegative`(r) then # it already has a negative out front ! return TeX(r) else return cat(" + ",TeX(r)) |
From: <nps...@us...> - 2003-10-10 09:49:36
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv16821/WEB-INF/maple/aim Modified Files: MatrixQuestion.mpl MultiQuestion.mpl Question.mpl TextQuestion.mpl Added Files: PartialFraction.mpl Log Message: --- NEW FILE: PartialFraction.mpl --- read("Package.mpl"): Package("aim/PartialFraction"," This package contains a number of useful functions for use in questions about partial fractions. " ): `Package/Assign`( `type/AffineTerm`::boolean, "An expression @t@ is of type @AffineTerm(y)@ if it has the form @ay+b@, where @a@ and @b@ are of type @complexcons@ and @a<>0@. The variable used defaults to @x@, so an expression has type @AffineTerm@ iff it has type @AffineTerm(x)@. ", proc(term,xx_) local xx,a,b; xx := `if`(nargs > 1,xx_,x); type(term, {identical(xx), `&+`(identical(xx),complexcons), `&+`(complexcons,identical(xx)), `&*`(complexcons,identical(xx)), `&+`(`&*`(complexcons,identical(xx)),complexcons), `&+`(complexcons,`&*`(complexcons,identical(xx)))}); end ): `Package/Assign`( `type/QuadraticTerm`::boolean, "An expression @t@ is of type @QuadraticTerm(y)@ if it has the form @ay<sup>2</sup>+by+c@, where @a@, @b@ and @c@ are of type @complexcons@ and @a<>0@. The variable used defaults to @x@, so an expression has type @QuadraticTerm@ iff it has type @QuadraticTerm(x)@. ", proc(term,xx_) local xx,a,b; xx := `if`(nargs > 1,xx_,x); if not(type(term,polynom(complexcons,xx))) then return(false); fi; return(evalb(degree(expand(term),xx) = 2)); end ): `Package/Assign`( `type/PartialFractionTerm`::boolean, "An expression @t@ is of type @PartialFractionTerm(y)@ if it is a constant multiple of an integer power of @y@, or a negative integer power of an expression of type @AffineTerm(y)@. The variable used defaults to @x@, so an expression has type @PartialFractionTerm@ iff it has type @PartialFractionTerm(x)@. ", proc(term,xx_) local xx,u; xx := `if`(nargs > 1,xx_,x); u := term; if type(u,`*`) then u := remove(type,u,complexcons); fi; evalb( type(u,complexcons) or type(u,identical(xx)) or type(u,identical(xx)^integer) or type(u,AffineTerm(xx)^negint) ) end ): `Package/Assign`( `type/QuadraticPartialFractionTerm`::boolean, "An expression @t@ is of type @QuadraticPartialFractionTerm(y)@ if it is a constant multiple of an integer power of @y@, or a negative integer power of an expression of type @AffineTerm(y)@ or @QuadraticTerm(y)@. The variable used defaults to @x@, so an expression has type @PartialFractionTerm@ iff it has type @PartialFractionTerm(x)@. ", proc(term,xx_) local xx; xx := `if`(nargs > 1,xx_,x); evalb( type(term,complexcons) or type(term,identical(xx)) or type(term,identical(xx)^integer) or type(term,AffineTerm(xx)^negint) or type(term,QuadraticTerm(xx)^negint) ) end ): `Package/Assign`( `type/PartialFraction`, "An expression is of type @PartialFraction(y)@ if it is a (possibly empty) sum of terms of type @PartialFractionTerm(y)@. The variable used defaults to @x@, so an expression has type @PartialFraction@ iff it has type @PartialFraction(x)@. ", proc(expr,xx_) local xx; xx := `if`(nargs > 1,xx_,x); `aim/TestEqual`(expr,0) or type(expr,PartialFractionTerm(xx)) or (type(expr,`+`) and type([op(expr)],list(PartialFractionTerm(xx)))); end ): `Package/Assign`( `type/QuadraticPartialFraction`, "An expression is of type @QuadraticPartialFraction(y)@ if it is a (possibly empty) sum of terms of type @QuadraticPartialFractionTerm(y)@. ", proc(expr,xx_) local xx; xx := `if`(nargs > 1,xx_,x); `aim/TestEqual`(expr,0) or type(expr,PartialFractionTerm(xx)) or (type(expr,`+`) and type([op(expr)],list(QuadraticPartialFractionTerm(xx)))); end ): `Package/Assign`( `type/ObviousRational`::boolean, "An expression is of type @ObviousRational(y)@ if it is a product of integer powers of polynomials in @y@ with coefficients of type @complexcons@. ", proc(expr,xx_) local xx,u; xx := `if`(nargs > 1,xx_,x); if type(expr,polynom(complexcons,xx)) then return(true); fi; if type(expr,`*`) then for u in op(expr) do if not(type(u,{polynom(complexcons,xx), polynom(complexcons,xx)^negint})) then return(false); fi; od; return(true); fi; return(false); end ): `Class/Declare`( `aim/PartialFraction/Expression`, "", ['Field','Value'::algebraic, "The value of the partial fraction, as an ordinary Maple expression." ], ['Field','Variable'::string = "x", "The name of the variable used in the partial fraction expression." ], ['Field','Poles'::list(complexcons), "The list of poles of the function. As usual, if @f(x)=p(x)/q(x)@ where @deg(p(x))≥deg(q(x))@, we say that @f(x)@ has a pole of order @deg(p(x))-deg(q(x))@ at @infinity@. " ], ['Field','OrderTable'::table, "This table stores the orders of the poles" ], ['Method','PoleOrder'::integer, "", proc(this,a::complexcons) local n; n := eval(this['OrderTable'][a]); `if`(type([n],[integer]),n,0); end ], ['Field','CoefficientTable'::table, "This table @t@ is set up so that @t[a,n]@ is the coefficient of @(x-a)<SUP>-n</SUP>@ for finite @a@ and @n>0@, and @t[infinity,n]@ is the coefficient of @x<SUP>n</SUP>@ for @n≥0@. " ], ['Method','Coefficient'::complexcons, "", proc(this,a::complexcons,n::integer) local c; c := eval(this['CoefficientTable'][a,n]); `if`(type([c],[complexcons]),c,0); end ], ['Field','BadTerms',""], ['Constructor', "", proc(this,f,xx_,prep_::boolean) local ff,xx,prep,vars,g; ff := Value(f); if nargs > 2 then xx := xx_; else vars := remove(type,indets(ff,symbol),complexcons); if nops(vars) = 1 then xx := op(1,vars); else error(__("Cannot determine variable")); fi; fi; this['Variable'] := convert(xx,string); prep := `if`(nargs > 3,prep_,false); if prep then g := convert(ff,parfrac,xx,{I,sqrt(2),sqrt(3),sqrt(5),sqrt(7)}); else g := ff; fi; this['Value'] := g; `aim/PartialFraction/Analyze`(this,g,xx); if prep and (this['BadTerms'] <> []) then error(__("Could not convert to partial fraction form.")); fi; end] ): `Class/Declare`( `aim/PartialFraction/Problem`, "", ['IncludedField','Expression'::`aim/PartialFraction/Expression`,""], ['Field','FunctionName'::string,""], ['Field','Question', "An expression to be presented to the student for conversion to partial fraction form. This may be an #InertExpr# object. " ], ['Field','RightAnswer', "The correct partial fraction form of the question. This may be an #InertExpr# object. " ], ['Method','SetRightAnswer', "", proc(this) local xx,poles,orders,cfs,a,i,rightans; xx := convert(this['Variable'],name); poles := eval(this['Poles']); orders := eval(this['OrderTable']); cfs := eval(this['CoefficientTable']); rightans := []; for a in poles do if a <> infinity then for i from 1 to orders[a] do if cfs[a,i] <> 0 then rightans := [op(rightans),Over(cfs[a,i],ToThe(Plus(xx,-a),i))]; fi; od; fi; od; if type(orders[infinity],integer) then if cfs[infinity,0] <> 0 then rightans := [op(rightans),cfs[infinity,0]]; fi; if orders[infinity] > 0 and cfs[infinity,1] <> 0 then rightans := [op(rightans),Times(cfs[infinity,1],xx)]; fi; for i from 2 to orders[infinity] do if cfs[infinity,i] <> 0 then rightans := [op(rightans),Times(cfs[infinity,i],ToThe(xx,i))]; fi; od; fi; this['RightAnswer'] := Plus(op(rightans)); end ], ['Field','GeneralCoefficientTable'::table,""], ['Field','GeneralForm',""], ['Method','SetGeneralForm', "", proc(this) local xx,poles,orders,gcfs,a,i,j,v,vars,nv,nextvar,terms; vars := [`latex/latex/copy`('A'), `latex/latex/copy`('B'), `latex/latex/copy`('C'), `latex/latex/copy`('D '), `latex/latex/copy`('E'), `latex/latex/copy`('F'), `latex/latex/copy`('G'), `latex/latex/copy`('H'), `latex/latex/copy`('K'), `latex/latex/copy`('L'), `latex/latex/copy`('M'), `latex/latex/copy`('N'), `latex/latex/copy`('P'), `latex/latex/copy`('Q'), `latex/latex/copy`('R'), `latex/latex/copy`('S'), `latex/latex/copy`('T'), `latex/latex/copy`('U'), `latex/latex/copy`('V'), `latex/latex/copy`('W'), `latex/latex/copy`('X'), `latex/latex/copy`('Y'), `latex/latex/copy`('Z')]; nv := nops(vars); xx := convert(this['Variable'],name); poles := eval(this['Poles']); orders := eval(this['OrderTable']); gcfs := eval(this['GeneralCoefficientTable']); terms := []; j := 0; nextvar := proc() j := j+1; if j > nv then error(__("Too many terms")); fi; vars[j]; end; for a in poles do if a <> infinity then for i from 1 to orders[a] do gcfs[a,i] := nextvar(); terms := [op(terms),Over(gcfs[a,i],ToThe(Plus(xx,-a),i))]; od; fi; od; if type(orders[infinity],integer) then if cfs[infinity,0] <> 0 then gcfs[infinity,0] := nextvar(); terms := [op(terms),gcfs[infinity,0]]; fi; if orders[infinity] > 0 and cfs[infinity,1] <> 0 then gcfs[infinity,1] := nextvar(); terms := [op(terms),Times(gcfs[infinity,1],xx)]; fi; for i from 2 to orders[infinity] do if cfs[infinity,i] <> 0 then gcfs[infinity,i] := nextvar(); terms := [op(terms),Times(gcfs[infinity,i],ToThe(xx,i))]; fi; od; fi; this['GeneralForm'] := terms; end ], ['Field','Numerator',""], ['Field','Denominator',""], ['Method','SetNumerator', "", proc(this) local f,d,n,terms,rewrite,xx; f := Value(this['Question']); xx := convert(this['Variable'],name); rewrite := evalb(not(type(f,ObviousRational(x)))); if rewrite then f := factor(f); fi; terms := `if`(type(f,`*`),[op(f)],[f]); d,n := selectremove(type,terms,anything^negint); d := 1/`*`(op(d)); n := `*`(op(n)); if rewrite then n := expand(n); d := expand(d); fi; this['Denominator'] := d; this['Numerator'] := n; end ], ['Field','FactoredForm',"" ], ['Method','SetFactored', "", proc(this) this['FactoredForm'] := factor(this['Value'],{I,sqrt(2),sqrt(3),sqrt(5),sqrt(7)}); end ], ['Field','Solution'::`HTML/String`, "" ], ['Method','SetSolution', "", proc(this) local poles,poletable,xx,fname,r,infinityterm,d, gentop,gtcoll,numcoll,eqns,i,cfs,gcfs,sols,p,u,v,oldD; global D; oldD := eval(D); unprotect('D'); unassign('D'); xx := convert(this['Variable'],name); fname := this['FunctionName']; poles := this['Poles']; if poles[-1] = infinity then poles := poles[1..-2]; fi; if poles = [] then poletable := "There are no poles.\n<br>\n"; elif nops(poles) = 1 then p := poles[1]; poletable := sprintf( __("There is a pole of order $%d$ at $%A = %s$, and no other poles."), this['PoleOrder',p],xx,`aim/LaTeX`(p)); else poletable := cat( __("The poles and their orders are as follows:"),"\n", "\\begin{tabular}{ll}\n", "{\\bf ",__("Pole"),"} & {\\bf ",__("Order"),"} \\\\ \n", op(map(p -> sprintf("$%s$ & %d \\\\ \n",`aim/LaTeX`(p),this['PoleOrder',p]),poles)), "\\end{tabular}\n") fi; if member(infinity,this['Poles']) then r := this['PoleOrder',infinity]; if r = 0 then infinityterm := __("The numerator and denominator have the same degree, so the partial fraction decomposition should include a constant term."); elif r = 1 then infinityterm := sprintf(__("The degree of the numerator is one more than that of the denominator, so the partial fraction decomposition should include a constant term and a multiple of $%A$."),xx); else infinityterm := sprintf(__("There is a gap of %d between the degree of the denominator and the degree of the numerator, so the partial fraction decomposition chould contain multiples of $%A^i$ for i from 0 to %d."),r,xx,r); fi; else infinityterm := ""; fi; d := Value(this['Denominator']); gentop := []; for u in this['GeneralForm'] do v := Value(u)*d; if not(type(v,polynom(complexcons,xx))) then v := expand(factor(v)); fi; gentop := [op(gentop),v]; od; gtcoll := collect(`+`(op(gentop)),xx); numcoll := collect(Value(this['Numerator']),xx); eqns := NULL; for i from 0 to degree(gtcoll,xx) do eqns := eqns, `aim/LaTeX`(coeff(gtcoll,xx,i)), " & = & ", `aim/LaTeX`(coeff(numcoll,xx,i)), " \\\\ \n"; od; eqns := [eqns][1..-2]; eqns := cat("\\begin{eqnarray*}\n",op(eqns),"\n\\end{eqnarray*}\n"); cfs := eval(this['CoefficientTable']); gcfs := eval(this['GeneralCoefficientTable']); sols := NULL; for p in this['Poles'] do for i from `if`(p = infinity,0,1) to this['PoleOrder',p] do sols := sols, `aim/LaTeX`(gcfs[p,i]), " & = & ", `aim/LaTeX`(cfs[p,i]), " \\\\ \n"; od; od; sols := [sols][1..-2]; sols := cat("\\begin{eqnarray*}\n",op(sols),"\n\\end{eqnarray*}\n"); this['Solution'] := cat( "<latex>", sprintf(__("The function %s can be factored as"),fname), "\n\\[",`aim/LaTeX`(this['FactoredForm'])," \\]\n", poletable,"\n\n", infinityterm,"\n\n", __("The general form is thus"), "\n\\[ ", `if`(fname = "","",cat(fname," = ")), `aim/LaTeX`(Plus(op(this['GeneralForm']))), ". \\]\n", __("We set this equal to"), "\n\\[ ",`aim/LaTeX`(this['FactoredForm'])," \\]\n", sprintf(__("We then multiply both sides by $%s$, and multiply everything out to get"), `aim/LaTeX`(this['Denominator'])), "\n\\begin{eqnarray*}\n ", `aim/LaTeX`(this['Numerator']), " & = & ", `aim/LaTeX`(Plus(op(gentop))), "\\\\ \n", `aim/LaTeX`(numcoll), " & = & ", `aim/LaTeX`(gtcoll),"\n", "\\end{eqnarray*}\n", __("By comparing coefficients, we see that"),eqns, __("These equations can be solved to give"),sols, __("The partial fraction decomposition is thus"), "\n\\[ ", `if`(fname = "","",cat(fname," = ")), `aim/LaTeX`(this['RightAnswer']), ". \\]\n</latex>\n" ); D := eval(oldD); protect('D'); this['Solution']; end ], ['Constructor', "", proc(this,f,xx_) local ff,xx,vars,g; ff := Value(f); if nargs > 2 then xx := xx_; else vars := remove(type,indets(ff,symbol),complexcons); if nops(vars) = 1 then xx := op(1,vars); else error(__("Cannot determine variable")); fi; fi; this['Question'] := eval(f); this['Expression'] := `new/aim/PartialFraction/Expression`(ff,xx,true); this['GeneralCoefficientTable'] := table([]); this['SetRightAnswer']; this['SetNumerator']; this['SetGeneralForm']; this['SetFactored']; end] ): `Package/Assign`( `aim/PartialFraction/Analyze`, "", proc(tbl::table,g,xx) local terms,poles,orders,cfs,bad,badterms, t,u,v,i,n,a,c,d,rightans; if `aim/TestEqual`(g,0) then terms := []; elif type(g,`+`) then terms := [op(g)]; else terms := [g]; fi; poles := NULL; orders := table([]); cfs := table([]); badterms := NULL; for t in terms do bad := false; if type(t,complexcons) then a := infinity; n := 0; c := 1; else if type(t,`*`) then c,u := selectremove(type,t,complexcons); else c := 1; u := t; fi; if type(u,identical(xx)) then a := infinity; n := 1; elif type(u,identical(xx)^posint) then a := infinity; n := op(2,u); elif type(u,AffineTerm(xx)^negint) then v := op(1,u); d := coeff(v,xx); c := c/d; a := eval(subs(xx = 0,-v/d)); n := -op(2,u); else bad := true; badterms := badterms,t; fi; fi; if not(bad) then poles := poles,a; if type([orders[a]],[integer]) then orders[a] := max(orders[a],n); else orders[a] := n; fi; if type([cfs[a,n]],[complexcons]) then cfs[a,n] := cfs[a,n] + c; else cfs[a,n] := c; fi; fi; od; poles := [op({poles})]; poles := sort(poles, (a,b) -> evalb(is((Re(a) < Re(b)) or ((Re(a) = Re(b)) and (Im(a) < Im(b)))) = true)); for a in poles do for i from 1 to orders[a] do if not(type([cfs[a,i]],[complexcons])) then cfs[a,i] := 0; fi; od; od; if not(type([cfs[infinity,0]],[complexcons])) then cfs[infinity,0] := 0; fi; tbl['Poles'] := poles; tbl['OrderTable'] := eval(orders); tbl['CoefficientTable'] := eval(cfs); tbl['BadTerms'] := [badterms]; end ): `Package/Assign`( `aim/PartialFraction/Test`::[numeric,string,string], "", proc(a, Q::`aim/PartialFraction/Problem`) local argtype,ans,attempt,xx,t,vars,extravars,extrapoles,missingpoles, p,polestring,i,quadterms,nastyterms,msg; if type(a,`aim/Question/Attempt`) then argtype := "attempt"; ans := a['Answer']; attempt := eval(a); elif type(a,`aim/Question/ShortAttempt`) then argtype := "shortattempt"; ans := a['Answer']; attempt := `aim/Question/MakeAttempt`(a); else argtype := "ordinary"; ans := eval(a); attempt := `new/aim/Question/Attempt`(); attempt['Answer'] := ans; fi; if `aim/TestEqual`(a,Q['Value']) then attempt['RawMark'] := 1; return([1,"",""]); fi; attempt['RawMark'] := 0; if length(Q['Variable']) = 1 then msg := `aim/CheckAlgebraic`(a,{Q['Variable']}); if msg <> "" then attempt['IsValid'] := false; attempt['ValidationMessage'] := msg; attempt['ValidationNote'] := "checkalgebraic"; return([0,msg,"checkalgebraic"]); fi; fi; xx := convert(Q['Variable'],name); vars := remove(type,indets(a,symbol),complexcons); extravars := vars minus {xx}; if extravars <> {} then attempt['AddAnswerNote',__("Extra variables")]; attempt['AddFeedback', sprintf(__("Your answer depends on the following variable(s): %A.\nIt should only depend on %A."), extravars,xx)]; return([0,attempt['Feedback'],attempt['AnswerNote']]); fi; t := `new/aim/PartialFraction/Expression`(a,xx); if t['BadTerms'] <> [] then quadterms,nastyterms := selectremove(type,t['BadTerms'],QuadraticPartialFractionTerm(xx)); if nastyterms = {} then attempt['AddAnswerNote',__("Quadratic terms")]; attempt['AddFeedback', cat( sprintf( __("Your answer is not a valid partial fraction decomposition. Such a decomposition may only contain terms of the form c %A<SUP>n</SUP> (with n ≥ 0) or c(%A - a)<SUP>-n</SUP> (with n > 0). Your answer contains the following terms, which are not of this form:"),xx,xx), `aim/LaTeX/Display`({op(t['BadTerms'])}), __("These might be valid in a quadratic partial fraction decomposition, but this question asked for an ordinary partial fraction decomposition.") ) ]; else attempt['AddAnswerNote',__("Bad terms")]; attempt['AddFeedback', cat( sprintf( __("Your answer is not a valid partial fraction decomposition. Such a decomposition may only contain terms of the form c %A<SUP>n</SUP> (with n ≥ 0) or c(%A - a)<SUP>-n</SUP> (with n > 0). Your answer contains the following terms, which are not of this form:"),xx,xx), `aim/LaTeX/Display`({op(t['BadTerms'])}) ) ]; fi; return([0,attempt['Feedback'],attempt['AnswerNote']]); fi; extrapoles := {op(t['Poles'])} minus {op(Q['Poles'])}; missingpoles := {op(Q['Poles'])} minus {op(t['Poles'])}; if extrapoles <> {} then attempt['AddAnswerNote',__("Extra poles")]; polestring := `Util/CommaJoin`(op(map((p,v) -> sprintf(" $%A=%s$",v,`aim/LaTeX`(p)),extrapoles,xx))); attempt['AddFeedback', cat( sprintf(__("Your answer has poles in the following place(s): <latex>%s</latex>"),polestring), "<br>", __("There should not be poles at any of these values, so you must have found the wrong general form for the partial fraction decomposition.")) ]; return([0,attempt['Feedback'],attempt['AnswerNote']]); fi; if missingpoles <> {} then attempt['AddAnswerNote',__("Missing poles")]; polestring := `Util/CommaJoin`(op(map((p,v) -> sprintf(" $%A=%s$",v,`aim/LaTeX`(p)),t['Poles'],xx))); attempt['AddFeedback', sprintf(__("Your answer is missing some terms. You have poles in the following place(s): <latex>%s</latex>. There are some other values of %A where you should also have poles, so you must have found the wrong general form for the partial fraction decomposition."),polestring,xx) ]; return([0,attempt['Feedback'],attempt['AnswerNote']]); fi; for p in Q['Poles'] do if Q['PoleOrder',p] <> t['PoleOrder',p] then attempt['AddAnswerNote',__("Wrong orders")]; attempt['AddFeedback', __("Your answer has poles in the right places, but some or all of the poles have the wrong order, so you must have found the wrong general form for the partial fraction decomposition.") ]; return([0,attempt['Feedback'],attempt['AnswerNote']]); fi; od; for p in Q['Poles'] do for i from `if`(p=infinity,0,1) to Q['PoleOrder',p] do if Q['Coefficient',p,i] <> t['Coefficient',p,i] then attempt['AddAnswerNote',__("Wrong coefficients")]; attempt['AddFeedback', __("Your answer has the right general form (in particular, you have the right poles and the right orders) but some or all of the coefficients are wrong.")]; return([0,attempt['Feedback'],attempt['AnswerNote']]); fi; od; od; attempt['RawMark'] := 1; return([1,"",""]); end ): EndPackage(): Index: MatrixQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/MatrixQuestion.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MatrixQuestion.mpl 25 Aug 2003 21:47:19 -0000 1.3 --- MatrixQuestion.mpl 10 Oct 2003 09:49:31 -0000 1.4 *************** *** 281,285 **** catch: attempt['SetMarkingError', ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] ))]; --- 281,285 ---- catch: attempt['SetMarkingError', ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] ))]; Index: MultiQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/MultiQuestion.mpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MultiQuestion.mpl 1 Sep 2003 05:55:59 -0000 1.4 --- MultiQuestion.mpl 10 Oct 2003 09:49:31 -0000 1.5 *************** *** 248,252 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 248,252 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); Index: Question.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Question.mpl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Question.mpl 4 Oct 2003 01:21:17 -0000 1.8 --- Question.mpl 10 Oct 2003 09:49:31 -0000 1.9 *************** *** 467,471 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 467,471 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); *************** *** 550,554 **** else attempt['RawMark'] := 0.; ! attempt['BasicFeedbck'] := ""; fi; RETURN(); --- 550,554 ---- else attempt['RawMark'] := 0.; ! attempt['BasicFeedback'] := ""; fi; RETURN(); *************** *** 588,592 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 588,592 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); *************** *** 658,662 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 658,662 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); *************** *** 700,704 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 700,704 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); *************** *** 1806,1810 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 1806,1810 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); *************** *** 1941,1945 **** catch: err := ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); --- 1941,1945 ---- catch: err := ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] )); Index: TextQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TextQuestion.mpl 4 Oct 2003 01:21:18 -0000 1.8 --- TextQuestion.mpl 10 Oct 2003 09:49:31 -0000 1.9 *************** *** 215,219 **** catch: attempt['SetMarkingError', ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] ))]; --- 215,219 ---- catch: attempt['SetMarkingError', ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] ))]; *************** *** 453,457 **** local vrsion,question,reqtype,floatok,listok,tlimit, rawans,parsereport, ! status,ans,forbiddenwords,badwords,err, bracketmsg,starsmsg,minusmsg,msg,t; --- 453,457 ---- local vrsion,question,reqtype,floatok,listok,tlimit, rawans,parsereport, ! status,val,ans,forbiddenwords,badwords,err, bracketmsg,starsmsg,minusmsg,msg,t; *************** *** 501,504 **** --- 501,505 ---- parsereport := `aim/SafeParse`(rawans); status := parsereport['Status']; + val := parsereport['Value']; if (status = "Parse error") then *************** *** 572,576 **** try ! ans := timelimit(tlimit,eval(parsereport['Value'])); catch "time expired": attempt['Answer'] := NULL; --- 573,577 ---- try ! ans := timelimit(tlimit,eval(val)); catch "time expired": attempt['Answer'] := NULL; *************** *** 585,589 **** attempt['SetValidationError', ! sprintf(__("Error in %s: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] ))]; --- 586,590 ---- attempt['SetValidationError', ! sprintf(__("Error in %a: %s"), lastexception[1], StringTools[FormatMessage]( lastexception[ 2 .. -1 ] ))]; *************** *** 632,636 **** fi; ! msg := `aim/CheckArcTrig`(parsereport['Value']); if msg <> "" then attempt['AddValidationNote',__("bad inverse trig")]; --- 633,637 ---- fi; ! msg := `aim/CheckArcTrig`(val); if msg <> "" then attempt['AddValidationNote',__("bad inverse trig")]; *************** *** 639,643 **** fi; ! msg := `aim/CheckNames`(ans); if msg <> "" then attempt['AddValidationNote',__("dubious names")]; --- 640,644 ---- fi; ! msg := `aim/CheckNames`(val); if msg <> "" then attempt['AddValidationNote',__("dubious names")]; *************** *** 650,654 **** fi; ! msg := `aim/CheckFunnyFunctions`(ans); if msg <> "" then attempt['AddValidationNote',__("funny function")]; --- 651,655 ---- fi; ! msg := `aim/CheckFunnyFunctions`(val); if msg <> "" then attempt['AddValidationNote',__("funny function")]; *************** *** 658,662 **** fi; ! msg := `aim/CheckBadIndeterminates`(rawans,ans); if msg <> "" then attempt['AddValidationNote',__("bad indeterminates")]; --- 659,663 ---- fi; ! msg := `aim/CheckBadIndeterminates`(rawans,val); if msg <> "" then attempt['AddValidationNote',__("bad indeterminates")]; |
From: <nps...@us...> - 2003-10-10 09:49:36
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/locales In directory sc8-pr-cvs1:/tmp/cvs-serv16821/WEB-INF/maple/locales Modified Files: en.mpl Log Message: Index: en.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/locales/en.mpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** en.mpl 1 Sep 2003 20:22:23 -0000 1.4 --- en.mpl 10 Oct 2003 09:49:31 -0000 1.5 *************** *** 110,113 **** --- 110,119 ---- "You may have <ul> + <li>entered something like <tt><font color='red'>ab</font></tt> for + <tt><font color='green'>a</font></tt> + times + <tt><font color='green'>b</font></tt>, + instead of <font color='green'>a*b</font> + </li> <li>misspelled the name of a standard mathematical function, or used a name not recognized by Maple. *************** *** 159,162 **** --- 165,175 ---- ": + __("#Explain constant functions (%s,%s,%s,%A,%s)") := + "The correct syntax for %s times %s is %s; this is probably what you + meant. (For a perfectly sensible reason that we will not go into, + Maple takes %A to mean the number %s.) + <br /> + ": + __("#Explain no dot") := "<font color='red'>Your answer contains the dot operator.</font> *************** *** 191,195 **** <font color='green'><tt>x[3]</tt></font> for <font color='blue'>x<sub>3</sub></font>). If you just want to group ! terms, you must use round brackets. ": --- 204,209 ---- <font color='green'><tt>x[3]</tt></font> for <font color='blue'>x<sub>3</sub></font>). If you just want to group ! terms, you must use round brackets. To enter a set, use curly ! brackets. ": |
From: <nps...@us...> - 2003-10-10 09:49:36
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv16821/WEB-INF/maple Modified Files: FullPackage.mpl OSWin.c Util.mpl Util0.mpl Log Message: Index: FullPackage.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/FullPackage.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FullPackage.mpl 25 Aug 2003 21:47:18 -0000 1.3 --- FullPackage.mpl 10 Oct 2003 09:49:31 -0000 1.4 *************** *** 149,153 **** if (assigned(`Package/Name`)) then ! ERROR("Already defining a package"); fi; --- 149,154 ---- if (assigned(`Package/Name`)) then ! EndPackage(); ! # ERROR("Already defining a package"); fi; Index: OSWin.c =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/OSWin.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OSWin.c 25 Aug 2003 21:47:18 -0000 1.2 --- OSWin.c 10 Oct 2003 09:49:31 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- #include <time.h> #include <Windows.h> + #define _WIN32_WINNT 0x0501 void cookdate(DWORD t,WORD *r) *************** *** 53,54 **** --- 54,89 ---- } + + /* + char **listfiles(char *dir) + { + WIN32_FIND_DATA FindFileData; + HANDLE hFind = NULL; + LPCTSTR lpDirSpec[MAXPATH]; // directory specification + + strncpy (lpDirSpec, dir, sizeof(dir)); + strncpy (lpDirSpec, "\*", 3); + + hFind = FindFirstFile(lpDirSpec, &FindFileData); + + if (hFind == INVALID_HANDLE_VALUE) { + return (-1); + } else { + wsprintf ("First file name is %s\n", FindFileData.cFileName); + while (FindNextFile(hFind, &FindFileData) != 0) { + wsprintf ("Next file name is %s\n", FindFileData.cFileName); + } + + DWORD dwError = GetLastError(); + if (dwError == ERROR_NO_MORE_FILES) { + FindClose(hFind); + } else { + wsprintf ("FindNextFile error. Error is %u\n", dwError); + return (-1); + } + } + return (0); + } + */ + + Index: Util.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Util.mpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Util.mpl 1 Sep 2003 05:53:28 -0000 1.4 --- Util.mpl 10 Oct 2003 09:49:31 -0000 1.5 *************** *** 93,96 **** --- 93,102 ---- ): + `Package/Assign`( + `Util/ToUpperCase`::string, + "Convert @s@ to upper case", + eval(util_touppercase) + ): + ###################################################################### Index: Util0.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Util0.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Util0.mpl 25 Aug 2003 21:47:18 -0000 1.3 --- Util0.mpl 10 Oct 2003 09:49:31 -0000 1.4 *************** *** 116,119 **** --- 116,129 ---- end: + util_touppercase := + proc(s::string) + local b,f; + + b := convert(s,bytes); + f := proc(c) if (96 < c and c < 123) then c - 32; else c; fi; end; + convert(map(f,b),bytes); + + end: + ###################################################################### |
From: <nps...@us...> - 2003-10-10 09:48:34
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv16686/WEB-INF/maple/aim Modified Files: SyntaxHints.mpl Log Message: Numerous minor bug fixes and improvements. There is also a new function `aim/CheckAlgebraic`(ans,vars::list(string)). This can be used for more extensive syntax checking when the answer is supposed to be an algebraic function of some single-letter variables. At the moment you need to call this function explicitly in your marking procedure. Index: SyntaxHints.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/SyntaxHints.mpl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SyntaxHints.mpl 19 Sep 2003 04:11:15 -0000 1.5 --- SyntaxHints.mpl 10 Oct 2003 09:48:30 -0000 1.6 *************** *** 293,297 **** "", proc(e::{string ,name}) ! local s,i,j,k,c,badminus,found,msg,note; badminus := NULL; --- 293,297 ---- "", proc(e::{string ,name}) ! local s,t,i,j,k,c,badminus,found,msg,note; badminus := NULL; *************** *** 302,305 **** --- 302,307 ---- while ( found ) do + # j is the index of a minus sign. + # we next find the previous non-blank character k := j-1; while( k > 0 and member(substring(s,k),{" ","\t","\r","\n"})) do *************** *** 344,348 **** if member(c,{"*","^","/","-"}) then ! badminus := j,badminus; fi; fi; --- 346,350 ---- if member(c,{"*","^","/","-"}) then ! badminus := badminus,j; fi; fi; *************** *** 360,375 **** if badminus = NULL then RETURN(["",""]); fi; for j in [badminus] do ! s := ! cat( ! `HTML/Escape`(substring(s,1..(j-1))), ! "<font color='red'>-</font>", ! `HTML/Escape`(substring(s,(j+1)..-1))); od; msg := cat( "<tt><font color='blue'>", ! s, "</font></tt>", "\n<br/>\n",__("#Explain minus"),"\n<br/>\n"); --- 362,380 ---- if badminus = NULL then RETURN(["",""]); fi; + t := ""; + i := 1; for j in [badminus] do ! t := ! cat(t, ! `HTML/Escape`(substring(s,i..(j-1))), ! "<font color='red'>-</font>"); ! i := j+1; od; + t := cat(t,`HTML/Escape`(substring(s,i..(-1)))); msg := cat( "<tt><font color='blue'>", ! t, "</font></tt>", "\n<br/>\n",__("#Explain minus"),"\n<br/>\n"); *************** *** 770,774 **** proc(s::string,e::anything) ! if not(hastype(e,list) and searchtext("[",s) > 0 and searchtext("]",s) > 0) then --- 775,779 ---- proc(s::string,e::anything) ! if not((hastype(e,list) or hastype(e,indexed)) and searchtext("[",s) > 0 and searchtext("]",s) > 0) then *************** *** 917,923 **** @sin(x) * (y+z)@ ", ! proc(e::anything) ! local fx,f,x,fstring0,fstring1,xstring,msg,red; msg := ""; --- 922,929 ---- @sin(x) * (y+z)@ ", ! proc(ee::uneval) ! local e,fx,f,x,fstring0,fstring1,xstring,msg,red; + e := eval(ee,2); msg := ""; *************** *** 952,959 **** fi; ! msg := ! msg, ! sprintf(__("#Explain funny functions (%s,%s,%s)"), ! red(fstring0),red(xstring),red(fstring1,"*(",xstring,")")); RETURN(cat(msg)); --- 958,973 ---- fi; ! if type([f],[numeric]) then ! msg := ! msg, ! sprintf(__("#Explain constant functions (%s,%s,%s,%A,%s)"), ! fstring0,xstring,red(fstring1,"*(",xstring,")"), ! fx,fstring0); ! else ! msg := ! msg, ! sprintf(__("#Explain funny functions (%s,%s,%s)"), ! red(fstring0),red(xstring),red(fstring1,"*(",xstring,")")); ! fi; RETURN(cat(msg)); *************** *** 1002,1005 **** --- 1016,1144 ---- RETURN(eval(t)); + end + ): + + ###################################################################### + + `Package/Assign`( + `aim/CheckAlgebraic`, + "The expression @ans@ is expected to be an algebraic function of the + variables in @vars@. (Here @vars@ is expected to be a set of + strings, each of length one.) If it is not, then this procedure will + look for things like @a(b+c)@ (should be @a*(b+c)@) or @ab@ (should + be @a*b@) or @a2@ (should be @a^2@) or @A@ (should be @a@). It will + return an HTML string reporting any such problems that it has + detected. + ", + proc(ans::anything,vars::set(string)) + local func, head, body, bbody, msg, nams, lcvars, n, lcn, ucn, goodn, badn, + isalpha, isdigit, chars, greenchars, i, m, lcm, ucm, goodm, badm; + + if map(length,vars) <> {1} then + error(__("Variable names in `aim/CheckAlgebraic` must have length one.")); + fi; + + nams := `aim/AllNames`(ans) minus + (vars union {op(`aim/SafeParse/OKNames`)}); + lcvars := map(`Util/ToLowerCase`,vars); + for n in nams do + lcn := `Util/ToLowerCase`(n); + ucn := `Util/ToUpperCase`(n); + if member(lcn,lcvars) then + goodn := `if`(member(lcn,vars),lcn,ucn); + badn := `if`(member(lcn,vars),ucn,lcn); + return( + sprintf( + __("Your answer involves the variable <tt><font color='red'>%s</font></tt>, which is not relevant for this question. Perhaps you mean <tt><font color='green'>%s</font></tt> instead. (Remember that Maple is case-sensitive.)"), + badn,goodn)); + fi; + + isalpha := proc(c) + local cc; + cc := op(1,convert(c,bytes)); + evalb((cc >=65 and cc <= 90) or + (cc >=97 and cc <= 122)) + end; + + isdigit := proc(c) + local cc; + cc := op(1,convert(c,bytes)); + evalb(cc >=48 and cc <= 57); + end; + + if length(n) > 1 then + chars := map(c -> convert([c],bytes),convert(n,bytes)); + if isalpha(chars[1]) and isalpha(chars[2]) then + i := 2; + while i < nops(chars) and isalpha(chars[i+1]) do + i := i+1; + od; + chars := chars[1..i]; + greenchars := + map( s-> cat("<tt><font color='green'>",s,"</font></tt>"), + chars); + msg := + sprintf( + __("Your answer involves the variable <tt><font color='red'>%s</font></tt>, which is not relevant in this problem. Perhaps you mean the product of %s and %s instead, in which case you should enter %s. "), + cat(op(chars)), + `Util/CommaJoin`(op(greenchars[1..-2])), + greenchars[-1], + `Util/JoinString`("<font color='red'>*</font>",op(chars))); + for m in chars do + lcm := `Util/ToLowerCase`(m); + ucm := `Util/ToUpperCase`(m); + if not(member(m,vars) and member(lcm,lcvars)) then + goodm := `if`(member(lcm,vars),lcm,ucm); + badm := `if`(member(lcm,vars),ucm,lcm); + msg := cat(msg, + sprintf( + __("If so, you should note that this involves the variable <tt><font color='red'>%s</font></tt>, which is not relevant for this question. Perhaps you mean <tt><font color='green'>%s</font></tt> instead. (Remember that Maple is case-sensitive.)"), + badm,goodm)); + return(msg); + fi; + od; + return(msg); + elif isalpha(chars[1]) and isdigit(chars[2]) then + i := 2; + while i < nops(chars) and isdigit(chars[i+1]) do + i := i+1; + od; + chars := chars[1..i]; + msg := + sprintf( + __("Your answer involves the variable <tt><font color='red'>%s</font></tt>, which is not relevant in this problem. Perhaps you mean <font color='blue'>%s<sup>%s</sup></font> instead, in which case you should enter <tt><font color='green'>%s</font></tt> "), + cat(op(chars)), + chars[1], + cat(op(chars[2..-1])), + cat(chars[1],"^",op(chars[2..-1]))); + return(msg); + fi; + fi; + return( + sprintf( + __("Your answer involves the variable <tt><font color='red'>%s</font></tt>, which is not relevant in this problem; so there is some confusion somewhere. "),n)) + + od; + + func := indets(ans,function); + + if func <> {} then + func := op(1,func); + head := op(0,func); + if type([head],[symbol]) then + body := sprintf("%Q",op(func)); + bbody := cat("(",body,")"); + if nops(func) > 1 then body := bbody; fi; + head := convert(head,string); + if not(member(head,{op(`aim/SafeParse/OKNames`)})) then + msg := + sprintf( + __("Your answer contains the expression <font color='red'>%A</font>. To Maple, this means the function <font color='blue'>%s</font> applied to the argument(s) <font color='blue'>%s</font>, just as <font color='blue'>f(x+y)</font> refers to the function <font color='blue'>f</font> applied to <font color='blue'>x+y</font>. This is probably not what you mean here. Perhaps you mean <font color='blue'>%s</font> times <font color='blue'>%s</font>, in which case you should enter <tt><font color='green'>%s*%s</font></tt> instead."),func,head,body,head,body,head,bbody); + return(msg); + fi; + fi; + fi; + + return(""); end ): |
From: <nps...@us...> - 2003-10-10 09:45:06
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv16170/WEB-INF/maple Modified Files: PackageList Log Message: Added PartialFraction package Index: PackageList =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/PackageList,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PackageList 12 Sep 2003 12:22:39 -0000 1.5 --- PackageList 10 Oct 2003 09:44:58 -0000 1.6 *************** *** 22,25 **** --- 22,26 ---- aim/Inert aim/Number + aim/PartialFraction aim/Diff aim/Int |
From: <gus...@us...> - 2003-10-08 19:49:46
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv9801 Modified Files: pdfgen.php view.php Added Files: setseed.php Log Message: further work towards randomized problem sheets --- NEW FILE: setseed.php --- <?php // $Id: setseed.php,v 1.1 2003/10/08 19:49:41 gustav_delius Exp $ /// This page uses the form submitted from view.php to set the /// student's seed require_once("../../config.php"); require_variable($sheetid); require_variable($assignment); require_variable($student); if (! $math_assignment = get_record("math_assignment", "id", $assignment)) { error("Course module is incorrect"); } if (! $course = get_record("course", "id", $math_assignment->course)) { error("Course is misconfigured"); } require_login(); if ($course->category) { $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->"; } else $navigation = ""; if (!isstudent($course->id)) { error("Sorry, you shouldn't be on this page!"); } if ($seed = get_record("math_assignment_seed", "assignment", $assignment, "student", $student)) { error("You already entered an ID for this assignment."); } print_header("$course->shortname: $math_assignment->name", "$course->fullname", "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name", "", "", true, update_module_button($cm->id, $course->id, $strmath_assignment), navmenu($course, $cm)); if (!$seed = get_record("math_assignment_seed", "assignment", $assignment, "seed", $sheetid)) { // The ID number does not exist notice(get_string("idinvalid", "math_assignment")); } // ID number is valid if (isset($seed->student)) { // but this ID number was already entered by a // different student notice(get_string("idtaken", "math_assignment")); } // Everything is o.k., so assign seed to student set_field($math_assignment_seed, "student", $student, "assignment", $assignment, "seed", $sheetid); redirect($_SERVER["HTTP_REFERER"]); ?> Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pdfgen.php 6 Oct 2003 00:11:07 -0000 1.17 --- pdfgen.php 8 Oct 2003 19:49:41 -0000 1.18 *************** *** 9,12 **** --- 9,13 ---- optional_variable($type, "problems"); // "problems" or "solutions" optional_variable($printcopies); // number of randomized copies to send to printer + optional_variable($seed, 0); // seed to be passed to AiM. 0 means no seed set. if (! $site = get_site()) { *************** *** 30,35 **** add_to_log($course->id, "math_assignment", "pdfgen", "pdfgen.php?id=$math_assignment->id", $type); ! // check that the request is valid ! if ($solutions) { if (time() < $math_assignment->solutiontime and !isteacher($course->id)) { --- 31,35 ---- add_to_log($course->id, "math_assignment", "pdfgen", "pdfgen.php?id=$math_assignment->id", $type); ! // check that the request is valid if ($solutions) { if (time() < $math_assignment->solutiontime and !isteacher($course->id)) { *************** *** 38,42 **** } ! // Create temp file names if (strpos($_ENV["OS"], "Win") === false) { if (!$tempfile = tempnam("/tmp","pdf")) { --- 38,52 ---- } ! if ($math_assignment->aimquiz) { ! ! if (!$subject = get_record("math_assignment_subject", "course", $course->id)) { ! error(get_string("noaccess", "math_assignment")); ! } ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) { ! error(get_string("noaccess", "math_assignment")); ! } ! } ! ! // Create temp file names if (strpos($_ENV["OS"], "Win") === false) { if (!$tempfile = tempnam("/tmp","pdf")) { *************** *** 47,61 **** $tempfile = substr(md5(microtime()), 0, 6); } ! // if there is an aim quiz load it into $data ! $data = ""; ! if ($math_assignment->aimquiz) { ! if (!$subject = get_record("math_assignment_subject", "course", $course->id)) { ! error(get_string("noaccess", "math_assignment")); } ! if (!$server = get_record("math_assignment_server", "id", $subject->server)) { ! error(get_string("noaccess", "math_assignment")); } $postdata = ""; --- 57,137 ---- $tempfile = substr(md5(microtime()), 0, 6); } + + $errlog = ""; + ! if ($printcopies > 0) { ! $newseed->assignment = $math_assignment->id; ! $newseed->student = NULL; ! for ($i = 1; $i <= $printcopies; $i++) { ! $newseed->seed = mt_rand (10000000,99999999); ! // make sure seed hasn't already been used ! while (get_record("math_assignment_seed", "assignment", $newseed->assignment, "seed", $newseed->seed)) { ! $newseed->seed = mt_rand (10000000,99999999); ! } ! if (!insert_record("math_assignment_seed", $newseed, $returnid=false)) { ! error("Couldn't add $i seed $newseed->seed to database"); ! } ! math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $newseed->seed); ! exec("\"c:\\Program Files\\ghostgum\\gsview\\gsview32.exe\" $tempfile.pdf"); ! } ! } ! else { ! math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $seed); ! // output of pdf ! ! /* I have just noticed the following in the php documentation on this issue of using Content-disposition headers: ! Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. ! There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading ! to Service Pack 2 or later. ! Darn MS! ! One possible way round this might be to use slash arguments with the last arguent 'problems.pdf' when a ! problem sheet is required and 'solutions.pdf' when solutions are required. With luck this might fool IE which seems to ! go by the extension when it ignores the headers. This would need testing in a broken version of IE. */ ! ! if ($file = @fopen("$tempfile.pdf", "rb")) { // the 'b' is for compatibility with Windoze ! ! // tell the browser that it is pdf ! header("Content-type: application/pdf"); ! if ($solutions) ! header("Content-disposition: inline; filename=solutions.pdf"); ! else ! header("Content-disposition: inline; filename=problems.pdf"); ! header('Cache-Control: public'); ! @fpassthru($file); // chuck all the data direct to the browser and close the handle ! @fclose($file); } ! else { ! $errlog = htmlentities(implode('', file("$tempfile.log"))); } + } + + @unlink("$tempfile.pdf"); + @unlink("$tempfile.tex"); + @unlink("$tempfile.aux"); + @unlink("$tempfile.log"); + if (isset($imageurls)) { + foreach ($imageurls as $key => $imageurl) { + @unlink("$tempfile$key.jpg"); + } + } + + if (strlen($errlog) > 0) { + error("There was a problem while compiling the tex source!<br> + pdflatex wrote the following log file:<br><br> + <pre>$errlog</pre>"); // error message + } + + + function math_assignment_generate_pdf($math_assignment, $course, $subject, $server, $type, $tempfile, $seed=0) { + // This function generates a sheet of type $type (problem or solution) for the assignment + // $math_assignment and stores it in $tempfile.pdf + + global $CFG; + + // if there is an aim quiz load it into $data + $data = ""; + if ($math_assignment->aimquiz) { $postdata = ""; *************** *** 65,68 **** --- 141,147 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); + if ($seed > 0) { + $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizSeed", $seed); + } // load the AiM page and grab the result *************** *** 83,88 **** } ! // convert images ! if (preg_match_all("/<img src=\"([^\"]+jpg)\"/",$data,$imagematches)) { $imageurls = $imagematches[1]; --- 162,166 ---- } ! // convert images if (preg_match_all("/<img src=\"([^\"]+jpg)\"/",$data,$imagematches)) { $imageurls = $imagematches[1]; *************** *** 97,108 **** } ! // split into individual questions ! $questions = preg_split("/id=\"question(\d+)\"/",$data); array_shift($questions); ! ! // Add questions to lecturer's tex file or to dummy ! if ($type == "problems") { if ($math_assignment->problemsisurl) { --- 175,183 ---- } ! // split into individual questions $questions = preg_split("/id=\"question(\d+)\"/",$data); array_shift($questions); ! // Add questions to lecturer's tex file or to dummy if ($type == "problems") { if ($math_assignment->problemsisurl) { *************** *** 142,151 **** } ! // Insert course and assignment name if required $latex = str_replace("\coursename","$course->fullname",$latex); $latex = str_replace("\assignmentname","$math_assignment->name",$latex); ! // generate pdf file from $latex ! if (!$fp=fopen("$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); --- 217,231 ---- } ! // Insert course and assignment name and sheet id if required $latex = str_replace("\coursename","$course->fullname",$latex); $latex = str_replace("\assignmentname","$math_assignment->name",$latex); + $latex = str_replace("\aimid","$seed",$latex); + + // Insert problem sheet id + if ($type == "problems" and $seed > 0) { + $latex = str_replace("\begin{document}", "\begin{document}\begin{flushright}Problem sheet ID: $seed\end{flushright}", $latex); + } ! // generate pdf file from $latex if (!$fp=fopen("$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); *************** *** 170,223 **** exec("$texcommand $tempfile.tex"); } - // output of pdf - - /* We need to remove the temporary file so we had better output it to the browser directly rather than redirecting. - If we redirect we have no idea when the file is no longer needed. */ - //redirect("$tempfile.pdf"); - - /* I have just noticed the following in the php documentation on this issue of using Content-disposition headers: - Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. - There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading - to Service Pack 2 or later. - Darn MS! - One possible way round this might be to use slash arguments with the last arguent 'problems.pdf' when a - problem sheet is required and 'solutions.pdf' when solutions are required. With luck this might fool IE which seems to - go by the extension when it ignores the headers. This would need testing in a broken version of IE. */ - - $errlog = ""; - if ($file = @fopen("$tempfile.pdf", "rb")) { // the 'b' is for compatibility with Windoze - - // tell the browser that it is pdf - header("Content-type: application/pdf"); - if ($solutions) - header("Content-disposition: inline; filename=solutions.pdf"); - else - header("Content-disposition: inline; filename=problems.pdf"); - header('Cache-Control: public'); - @fpassthru($file); // chuck all the data direct to the browser and close the handle - @fclose($file); - } - else { - $errlog = htmlentities(implode('', file("$tempfile.log"))); - } - - @unlink("$tempfile.pdf"); - @unlink("$tempfile.tex"); - @unlink("$tempfile.aux"); - @unlink("$tempfile.log"); - if (isset($imageurls)) { - foreach ($imageurls as $key => $imageurl) { - @unlink("$tempfile$key.jpg"); - } - } - - if (strlen($errlog) > 0) { - error("There was a problem while compiling the tex source!<br> - pdflatex wrote the following log file:<br><br> - <pre>$errlog</pre>"); // error message - } - - function math_assignment_aim_to_latex($data,$type) { --- 250,256 ---- exec("$texcommand $tempfile.tex"); } + return true; + } function math_assignment_aim_to_latex($data,$type) { Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** view.php 26 Sep 2003 22:23:23 -0000 1.18 --- view.php 8 Oct 2003 19:49:41 -0000 1.19 *************** *** 13,16 **** --- 13,18 ---- optional_variable($sort, "lastname"); // column to sort optional_variable($sortdir, "asc"); // direction to sort + + global $USER; if (! $site = get_site()) { *************** *** 83,87 **** if (strcasecmp($sort, "firstname") != 0) { // to improve speed if (strcasecmp($sort, "totalgrade") != 0) ! $sort = "lastname"; // not valid so use default instead } } --- 85,89 ---- if (strcasecmp($sort, "firstname") != 0) { // to improve speed if (strcasecmp($sort, "totalgrade") != 0) ! $sort = "lastname"; // not valid so use default instead } } *************** *** 149,159 **** if ($hasboth) { if ($student->papergrade >= 0) ! $myxls->InsertNumber($student->papergrade); else ! $myxls->InsertText(""); if ($student->aimgrade >= 0) ! $myxls->InsertNumber($student->aimgrade); else ! $myxls->InsertText(""); } $myxls->InsertNumber($student->totalgrade); --- 151,161 ---- if ($hasboth) { if ($student->papergrade >= 0) ! $myxls->InsertNumber($student->papergrade); else ! $myxls->InsertText(""); if ($student->aimgrade >= 0) ! $myxls->InsertNumber($student->aimgrade); else ! $myxls->InsertText(""); } $myxls->InsertNumber($student->totalgrade); *************** *** 185,192 **** if ($hasboth) { if ($student->papergrade >= 0) ! echo "$student->papergrade"; echo "\t"; if ($student->aimgrade >= 0) ! echo "$student->aimgrade"; echo "\t"; } --- 187,194 ---- if ($hasboth) { if ($student->papergrade >= 0) ! echo "$student->papergrade"; echo "\t"; if ($student->aimgrade >= 0) ! echo "$student->aimgrade"; echo "\t"; } *************** *** 227,235 **** echo "<td>"; if ($student->aimgrade >= 0) ! echo $student->aimgrade; else echo " "; echo "</td><td>"; if ($student->papergrade >= 0) ! echo $student->papergrade; else echo " "; echo "</td>"; --- 229,237 ---- echo "<td>"; if ($student->aimgrade >= 0) ! echo $student->aimgrade; else echo " "; echo "</td><td>"; if ($student->papergrade >= 0) ! echo $student->papergrade; else echo " "; echo "</td>"; *************** *** 238,242 **** echo "<td>"; if ($student->totalgrade > 0) ! echo $student->totalgrade; else echo " "; echo "</td>"; --- 240,244 ---- echo "<td>"; if ($student->totalgrade > 0) ! echo $student->totalgrade; else echo " "; echo "</td>"; *************** *** 279,285 **** echo "<b>$strpaper $strgrade :</b> "; if ($grade->papergrade >= 0) ! echo "$grade->papergrade / $math_assignment->papergrade"; else ! print_string("notmarked", "math_assignment"); echo "<br />"; } --- 281,287 ---- echo "<b>$strpaper $strgrade :</b> "; if ($grade->papergrade >= 0) ! echo "$grade->papergrade / $math_assignment->papergrade"; else ! print_string("notmarked", "math_assignment"); echo "<br />"; } *************** *** 287,302 **** echo "<b>$strcomputer $strgrade :</b> "; if ($grade->aimgrade >= 0) ! echo "$grade->aimgrade / $math_assignment->aimgrade"; else ! print_string("notattempted", "math_assignment"); if ($grade->aimoverride > AIMOVR_RESET) { ! echo " ("; ! print_string("gradeoverride", "math_assignment"); ! echo ")"; } echo "<br />"; if ($grade->aimcomment) ! echo "<b>" . $course->teacher . " " . get_string("comment", "math_assignment") . ! ":</b> " . nl2br(htmlspecialchars($grade->aimcomment)) . "<br />"; } if ($hasboth) { --- 289,304 ---- echo "<b>$strcomputer $strgrade :</b> "; if ($grade->aimgrade >= 0) ! echo "$grade->aimgrade / $math_assignment->aimgrade"; else ! print_string("notattempted", "math_assignment"); if ($grade->aimoverride > AIMOVR_RESET) { ! echo " ("; ! print_string("gradeoverride", "math_assignment"); ! echo ")"; } echo "<br />"; if ($grade->aimcomment) ! echo "<b>" . $course->teacher . " " . get_string("comment", "math_assignment") . ! ":</b> " . nl2br(htmlspecialchars($grade->aimcomment)) . "<br />"; } if ($hasboth) { *************** *** 304,310 **** echo "<b>$strtotal $strgrade :</b> "; if ($totalgrade >= 0) ! echo " $totalgrade / $totalmax"; else ! print_string("notmarked", "math_assignment"); } } --- 306,312 ---- echo "<b>$strtotal $strgrade :</b> "; if ($totalgrade >= 0) ! echo " $totalgrade / $totalmax"; else ! print_string("notmarked", "math_assignment"); } } *************** *** 316,320 **** if ($subject = get_record("math_assignment_subject", "course", $course->id)) { if ($server = get_record("math_assignment_server", "id", $subject->server)) ! $zonelink = $server->password; } echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right"); --- 318,322 ---- if ($subject = get_record("math_assignment_subject", "course", $course->id)) { if ($server = get_record("math_assignment_server", "id", $subject->server)) ! $zonelink = $server->password; } echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right"); *************** *** 342,388 **** $picture = print_user_picture($student->userid, $course->id, $student->picture, false, true); if ($student->papergrade >= 0) ! $papergrade = $student->papergrade; else ! $papergrade = ""; $papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />"; if ($student->aimgrade >= 0) ! $aimgrade = $student->aimgrade; else ! $aimgrade = ""; if ($student->aimoverride > AIMOVR_RESET) { ! $edited = "$stredited ("; ! $editedclose = ")"; } else if ($student->aimcomment) { ! $edited = "$strcommented ("; ! $editedclose = ")"; } else { ! $edited = ""; ! $editedclose = ""; } $email = "<a href=\"mailto:$student->email\">"; if ($CFG->math_assignment_default_email_host) { ! if (preg_match("/^(.*)@(.*)$/", $student->email, $matches)) { ! if (strcmp($matches[2], $CFG->math_assignment_default_email_host) == 0) ! $email .= "$matches[1]</a>"; ! else ! $email .= "$student->email</a>"; ! } ! else ! $email .= "$student->email</a>"; } else ! $email .= "$student->email</a>"; if ($hasboth) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade); else if ($haspaper) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade); else if ($hasaim) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose"); $i++; --- 344,390 ---- $picture = print_user_picture($student->userid, $course->id, $student->picture, false, true); if ($student->papergrade >= 0) ! $papergrade = $student->papergrade; else ! $papergrade = ""; $papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />"; if ($student->aimgrade >= 0) ! $aimgrade = $student->aimgrade; else ! $aimgrade = ""; if ($student->aimoverride > AIMOVR_RESET) { ! $edited = "$stredited ("; ! $editedclose = ")"; } else if ($student->aimcomment) { ! $edited = "$strcommented ("; ! $editedclose = ")"; } else { ! $edited = ""; ! $editedclose = ""; } $email = "<a href=\"mailto:$student->email\">"; if ($CFG->math_assignment_default_email_host) { ! if (preg_match("/^(.*)@(.*)$/", $student->email, $matches)) { ! if (strcmp($matches[2], $CFG->math_assignment_default_email_host) == 0) ! $email .= "$matches[1]</a>"; ! else ! $email .= "$student->email</a>"; ! } ! else ! $email .= "$student->email</a>"; } else ! $email .= "$student->email</a>"; if ($hasboth) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade); else if ($haspaper) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, $papergrade); else if ($hasaim) ! $table->data[] = array($picture, $student->firstname, $student->lastname, $email, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose"); $i++; *************** *** 405,412 **** echo "</td></tr></table></form>\n"; if (!$math_assignment->papersheetsreturned) { ! echo "<table border=\"0\" align=\"center\"><tr><td>"; ! $options = array("id"=>$cm->id); ! print_single_button("email.php", $options, get_string("emailstudents", "math_assignment")); ! echo "</td></tr></table>\n"; } } --- 407,414 ---- echo "</td></tr></table></form>\n"; if (!$math_assignment->papersheetsreturned) { ! echo "<table border=\"0\" align=\"center\"><tr><td>"; ! $options = array("id"=>$cm->id); ! print_single_button("email.php", $options, get_string("emailstudents", "math_assignment")); ! echo "</td></tr></table>\n"; } } *************** *** 434,446 **** } } ! else { ! echo math_assignment_get_file_links($math_assignment, "center"); ! if ($hasaim) { ! if ($grade->aimoverride > AIMOVR_RESET) { ! echo "<p align=\"center\">"; ! print_string("gradeoverridemsg", "math_assignment"); ! echo "</p>"; } - echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>"; } } --- 436,460 ---- } } ! else { // This is for the student ! // First get seed ! if (!$seed = get_record("math_assignment_seed", "assignment", $math_assignment->id, "student", $USER->id)) { ! // No seed set yet, so ask the student ! echo "<form action=\"setseed.php\" method=\"GET\">\n"; ! echo get_string("enterid", "math_assignment"); ! echo "<input type=\"text\" name=\"sheetid\" size=\"8\" maxlength=\"8\" />\n"; ! echo "<input type=\"hidden\" name=\"assignment\" value=\"$math_assignment->id\" />\n"; ! echo "<input type=\"hidden\" name=\"student\" value=\"$USER->id\" />\n"; ! echo "<input type=\"submit\" value=\"Submit\"><br />"; ! } ! else { ! echo math_assignment_get_file_links($math_assignment, "center"); ! if ($hasaim) { ! if ($grade->aimoverride > AIMOVR_RESET) { ! echo "<p align=\"center\">"; ! print_string("gradeoverridemsg", "math_assignment"); ! echo "</p>"; ! } ! echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>"; } } } |
From: <mo...@us...> - 2003-10-07 22:15:56
|
Update of /cvsroot/aimmath/AIM/bin/tth_exe In directory sc8-pr-cvs1:/tmp/cvs-serv25091 Modified Files: tth.exe tth Added Files: tth_linux.tar.gz tth_exeV3_30.zip Log Message: reverting to tth version 3.30 from version 3.40 to avoid formatting problems with the newer version --- NEW FILE: tth_linux.tar.gz --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tth_exeV3_30.zip --- (This appears to be a binary file; contents omitted.) Index: tth.exe =================================================================== RCS file: /cvsroot/aimmath/AIM/bin/tth_exe/tth.exe,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsmB21Cg and /tmp/cvsPyVzSh differ Index: tth =================================================================== RCS file: /cvsroot/aimmath/AIM/bin/tth_exe/tth,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvssMSwyg and /tmp/cvsyi3BIr differ |
From: <gus...@us...> - 2003-10-06 00:11:16
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv23091/mod/math_assignment Modified Files: pdfgen.php version.php Log Message: added math_assignment_seed table Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pdfgen.php 5 Oct 2003 22:54:16 -0000 1.16 --- pdfgen.php 6 Oct 2003 00:11:07 -0000 1.17 *************** *** 8,11 **** --- 8,12 ---- require_variable($id); // math_assignment id optional_variable($type, "problems"); // "problems" or "solutions" + optional_variable($printcopies); // number of randomized copies to send to printer if (! $site = get_site()) { Index: version.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** version.php 5 Oct 2003 22:54:16 -0000 1.13 --- version.php 6 Oct 2003 00:11:08 -0000 1.14 *************** *** 6,10 **** ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003100501; // The (date) version of this module $module->cron = 60; // How often should cron check this module (seconds)? --- 6,10 ---- ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003100502; // The (date) version of this module $module->cron = 60; // How often should cron check this module (seconds)? |