aimmath-commit Mailing List for AiM Assessment in Mathematics (Page 8)
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-06 00:11:16
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/db In directory sc8-pr-cvs1:/tmp/cvs-serv23091/mod/math_assignment/db Modified Files: mysql.php mysql.sql Log Message: added math_assignment_seed table Index: mysql.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mysql.php 5 Oct 2003 22:54:15 -0000 1.13 --- mysql.php 6 Oct 2003 00:11:07 -0000 1.14 *************** *** 7,10 **** --- 7,18 ---- global $CFG; + if ($oldversion < 2003100502) { + execute_sql("CREATE TABLE `mdl_math_assignment_seed` ( + `assignment` INT( 10 ) NOT NULL , + `student` INT( 10 ) , + `seed` INT( 8 ) NOT NULL , + PRIMARY KEY ( `assignment` , `seed` ) + ) COMMENT = 'seeds for problem sheets'"); + } if ($oldversion < 2003100501) { table_column("math_assignment", "", "solutiontime", "int", "10", "unsigned", "0"); Index: mysql.sql =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.sql,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mysql.sql 5 Oct 2003 22:54:15 -0000 1.12 --- mysql.sql 6 Oct 2003 00:11:07 -0000 1.13 *************** *** 55,58 **** --- 55,66 ---- ) TYPE=MyISAM COMMENT='Final math assignment grade (may be best of several attempts)'; + CREATE TABLE `mdl_math_assignment_seed` ( + `assignment` int(10) NOT NULL default '0', + `student` int(10) default NULL, + `seed` int(8) NOT NULL default '0', + PRIMARY KEY (`assignment`,`seed`) + ) TYPE=MyISAM COMMENT='seeds for problem sheets'; + + INSERT `prefix_config` SET `name`="math_assignment_debug",`value`="0"; INSERT `prefix_config` SET `name`="math_assignment_auto_register",`value`="1"; |
From: <gus...@us...> - 2003-10-06 00:10:15
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv23006/lang/en Modified Files: math_assignment.php Log Message: implemented solution sheet time. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** math_assignment.php 27 Sep 2003 13:36:33 -0000 1.21 --- math_assignment.php 6 Oct 2003 00:10:11 -0000 1.22 *************** *** 93,96 **** --- 93,97 ---- $string['singlequestion'] = "single question"; $string['solutions'] = "Solution sheet"; + $string['solutiontime'] = "Solutions available after"; $string['studentnotattempted'] = "The student has not attempted this assignment."; $string['timedue'] = "Due Date and Time"; |
From: <gus...@us...> - 2003-10-05 22:54:32
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv12173/mod/math_assignment Modified Files: lib.php mod.html pdfgen.php version.php Log Message: implemented solution sheet time. Also some changes in pdfgen. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** lib.php 2 Oct 2003 19:42:15 -0000 1.35 --- lib.php 5 Oct 2003 22:54:16 -0000 1.36 *************** *** 19,22 **** --- 19,28 ---- $math_assignment->timedue = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute); + // solution time + $math_assignment->solutiontime = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute); + if ($math_assignment->solutiontime < $math_assignment->timedue) { + $math_assignment->solutiontime += 86400; + } + // problems $math_assignment->problemsisurl = 0; *************** *** 80,83 **** --- 86,95 ---- $math_assignment->timedue = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute); + // solution time + $math_assignment->solutiontime = make_timestamp($math_assignment->dueyear, $math_assignment->duemonth,$math_assignment->dueday, $math_assignment->duehour, $math_assignment->dueminute); + if ($math_assignment->solutiontime < $math_assignment->timedue) { + $math_assignment->solutiontime += 86400; + } + // problems $math_assignment->problemsisurl = 0; *************** *** 310,314 **** $return .= math_assignment_help_button("viewproblems", $strviewproblems, false); } ! if (($solurl) and ($math_assignment->timedue < time())) { if (isset($return)) $return .= "<br />\n"; --- 322,326 ---- $return .= math_assignment_help_button("viewproblems", $strviewproblems, false); } ! if (($solurl) and ($math_assignment->solutiontime < time())) { if (isset($return)) $return .= "<br />\n"; *************** *** 762,765 **** --- 774,779 ---- // sort out a netscape bug $out = str_replace("<br/>", "<br />", $out); + $out = str_replace("  ", " ", $out); + $out = str_replace(" ", " ", $out); // convert Latex to MathML Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mod.html 26 Sep 2003 22:23:23 -0000 1.22 --- mod.html 5 Oct 2003 22:54:16 -0000 1.23 *************** *** 8,12 **** /* * Variables specific to this module are: ! * name, problems, solutions, aimsubject, aimquiz, papergrade, aimgrade, timedue. * We check that these are setup here. */ --- 8,13 ---- /* * Variables specific to this module are: ! * name, problems, solutions, aimsubject, aimquiz, papergrade, aimgrade, timedue, ! * solutiontime. * We check that these are setup here. */ *************** *** 44,47 **** --- 45,51 ---- $form->timedue = 0; } + if (!isset($form->solutiontime)) { + $form->solutiontime = 0; + } // Now we set the defaults if (!$form->name) *************** *** 82,85 **** --- 86,90 ---- $straimquiz = get_string("aimquiz","math_assignment"); $straimstyle = get_string("aimstyle","math_assignment"); + $strsolutiontime = get_string("solutiontime","math_assignment"); ?> *************** *** 229,232 **** --- 234,245 ---- </table> </td> + </tr> + + <tr valign="top"> + <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> </tr> Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pdfgen.php 2 Oct 2003 19:42:15 -0000 1.15 --- pdfgen.php 5 Oct 2003 22:54:16 -0000 1.16 *************** *** 32,37 **** if ($solutions) { ! if (time() < $math_assignment->timedue and isstudent($course->id)) { ! error("You can not view the solutions until the assignment has closed!"); } } --- 32,37 ---- if ($solutions) { ! if (time() < $math_assignment->solutiontime and !isteacher($course->id)) { ! error("You can not view the solutions yet!"); } } *************** *** 122,127 **** if (math_assignment_is_tex_file($texfile)) { ! $latex = implode ('', file($texfile)); $latex = str_replace('\aimquestion', '$\sphericalangle$ \aimque', $latex); foreach ($questions as $question) { $latex = str_replace_once('\aimque', math_assignment_aim_to_latex($question,$type),$latex); --- 122,132 ---- if (math_assignment_is_tex_file($texfile)) { ! $latex = implode ('', file($texfile)); ! // Make sure that inputs and eps files are taken from the course file directory ! $latex = preg_replace("/\\\input[ ]+(?!amstex)/", "\\\input $CFG->dataroot/$course->id/", $latex); ! $latex = preg_replace("/(?<=[\\W])[\\w]+\\.eps/", "$CFG->dataroot/$course->id/\$1", $latex); ! // \aimquestion prints a \spericalangle before the aim question $latex = str_replace('\aimquestion', '$\sphericalangle$ \aimque', $latex); + // now insert the aim questions foreach ($questions as $question) { $latex = str_replace_once('\aimque', math_assignment_aim_to_latex($question,$type),$latex); *************** *** 136,144 **** } ! // 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 --- 141,148 ---- } ! // 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 *************** *** 147,154 **** fwrite($fp,$latex); fclose($fp); ! if (strpos($_ENV["OS"], "Win") === false) ! exec("cd ".dirname($tempfile)."; pdflatex $tempfile.tex"); ! else ! exec("pdflatex $tempfile.tex"); // output of pdf --- 151,172 ---- fwrite($fp,$latex); fclose($fp); ! ! // decide whether to use latex or tex ! if (strpos($latex, "begin{document}")) { ! $texcommand = "pdflatex"; ! } ! else { ! $texcommand = "pdftex"; ! } ! ! // for Unix work in temp directory ! if (strpos($_ENV["OS"], "Win") === false) { ! exec("cd ".dirname($tempfile)."; $texcommand $tempfile.tex"); ! } ! // for Windows unfortunately the cd doesn't work so we work in the ! // current directory ! else { ! exec("$texcommand $tempfile.tex"); ! } // output of pdf *************** *** 188,193 **** @unlink("$tempfile.aux"); @unlink("$tempfile.log"); ! foreach ($imageurls as $key => $imageurl) { ! @unlink("$tempfile$key.jpg"); } --- 206,213 ---- @unlink("$tempfile.aux"); @unlink("$tempfile.log"); ! if (isset($imageurls)) { ! foreach ($imageurls as $key => $imageurl) { ! @unlink("$tempfile$key.jpg"); ! } } Index: version.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** version.php 26 Sep 2003 22:23:23 -0000 1.12 --- version.php 5 Oct 2003 22:54:16 -0000 1.13 *************** *** 6,10 **** ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092523; // The (date) version of this module $module->cron = 60; // How often should cron check this module (seconds)? --- 6,10 ---- ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003100501; // The (date) version of this module $module->cron = 60; // How often should cron check this module (seconds)? |
From: <gus...@us...> - 2003-10-05 22:54:32
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/db In directory sc8-pr-cvs1:/tmp/cvs-serv12173/mod/math_assignment/db Modified Files: mysql.php mysql.sql Log Message: implemented solution sheet time. Also some changes in pdfgen. Index: mysql.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mysql.php 25 Sep 2003 22:14:09 -0000 1.12 --- mysql.php 5 Oct 2003 22:54:15 -0000 1.13 *************** *** 7,10 **** --- 7,13 ---- global $CFG; + if ($oldversion < 2003100501) { + table_column("math_assignment", "", "solutiontime", "int", "10", "unsigned", "0"); + } if ($oldversion < 2003092001) { table_column("math_assignment", "", "focus", "tinyint", "1", "unsigned", "1"); Index: mysql.sql =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.sql,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mysql.sql 25 Sep 2003 22:14:09 -0000 1.11 --- mysql.sql 5 Oct 2003 22:54:15 -0000 1.12 *************** *** 20,23 **** --- 20,24 ---- aimgrade int(10) unsigned NOT NULL default '0', timedue int(10) unsigned NOT NULL default '0', + solutiontime int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id) |
From: <mo...@us...> - 2003-10-04 01:21:24
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv12533 Modified Files: Compile.mpl Question.mpl TextQuestion.mpl Log Message: added answerboxsize> flag and related modifications Index: Compile.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Compile.mpl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Compile.mpl 19 Sep 2003 04:11:15 -0000 1.7 --- Compile.mpl 4 Oct 2003 01:21:17 -0000 1.8 *************** *** 192,195 **** --- 192,198 ---- iproc,iproclocals,sproc,mproc,mproctext, x,y,err,msg,nam,level,partlabel,title,desc,flagnum, + # KM + ansboxsize,setboxwidth,setboxheight, + # END KM xtype,shft,tlimit; *************** *** 218,221 **** --- 221,227 ---- # DIST tlimit := 2.0; tlimit := Config['TimeLimit']; + ansboxsize := NULL; + setboxwidth := NULL; + setboxheight := NULL; # END *************** *** 441,444 **** --- 447,473 ---- sprintf("questionversion['Prompt'] := `aim/LaTeX/WrapSubs`(%a);\n",text); ########## + # KM + elif flag = "answerboxsize>" then + if ansboxsize = NULL then + try ansboxsize := `Util/Parse`(text); + catch : return [ + sprintf(__("Cannot parse answerboxsize> flag: %s\n%s\n\n"),text,lasterr), + nam,flagnum,lines]; + end: + if not type([ansboxsize],{[nonnegint],[nonnegint,nonnegint]}) then + return [ + sprintf(__("Answer box size must be of the form w or w,h where w and h are nonnegative integers: %A"), + `Util/CommaJoin`(ansboxsize)), + nam,flagnum,lines]; + else + if nops([ansboxsize])=2 then + setboxheight:=sprintf("questionversion['AnswerBoxHeight'] := %d;\n",ansboxsize[2]); + fi: + setboxwidth := sprintf("questionversion['AnswerBoxWidth'] := %d;\n", + [ansboxsize][1]); + fi; + fi: + # END KM + ########## elif flag = "postprompt>" then setpost := *************** *** 664,668 **** fi; ! iproc := iproc,setans,setnote,setprompt,setpost,settype; elif qtype = 'MATRIX' then --- 693,700 ---- fi; ! # KM ! # WAS: iproc := iproc,setans,setnote,setprompt,setpost,settype; ! iproc := iproc,setans,setnote,setprompt,setboxwidth,setboxheight,setpost,settype; ! # END KM elif qtype = 'MATRIX' then *************** *** 1257,1260 **** --- 1289,1295 ---- "answertest>", "answervariable>", + # KM + "answerboxsize>", + # END KM "note>", "prompt>", *************** *** 1288,1291 **** --- 1323,1329 ---- "ap>" = "prompt>", "av>" = "answervariable>", + # KM + "as>" = "answerboxsize>", + # END KM "c>" = "mapletype>", "d>" = "description>", Index: Question.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Question.mpl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Question.mpl 6 Sep 2003 13:13:36 -0000 1.7 --- Question.mpl 4 Oct 2003 01:21:17 -0000 1.8 *************** *** 2153,2160 **** if not(trymode or reviewmode) then href := sprintf("javascript:Focus('%s');", ! this['Label']); nav['AddContents', ! ["td", ! [["a","href" = href],__("Focus")]]]; fi; --- 2153,2160 ---- if not(trymode or reviewmode) then href := sprintf("javascript:Focus('%s');", ! this['Label']); nav['AddContents', ! ["td", ! [["a","href" = href],__("Focus")]]]; fi; *************** *** 2191,2195 **** [["a", "href" = sprintf("javascript:EditSource('%s');", ! this['SourceFile'])], __("Edit source file")])]]); --- 2191,2195 ---- [["a", "href" = sprintf("javascript:EditSource('%s');", ! this['SourceFile'])], __("Edit source file")])]]); *************** *** 2229,2233 **** [["a", "href" = sprintf("javascript:EditSource('%s');", ! this['SourceFile'])], __("Edit source file")])]]); --- 2229,2233 ---- [["a", "href" = sprintf("javascript:EditSource('%s');", ! this['SourceFile'])], __("Edit source file")])]]); *************** *** 2924,2928 **** ['Field','Contents'::{list(`aim/Question/Analysis/Entry`), ! list(`aim/Question/Analysis/Summary/Layer`)}, "" ], --- 2924,2928 ---- ['Field','Contents'::{list(`aim/Question/Analysis/Entry`), ! list(`aim/Question/Analysis/Summary/Layer`)}, "" ], *************** *** 3075,3079 **** ", proc(this,indent_::integer) ! local indent,prefix,html; if nargs > 1 then --- 3075,3079 ---- ", proc(this,indent_::integer) ! local indent,prefix,html,crstring; if nargs > 1 then *************** *** 3085,3092 **** fi; ! html := ""; if this['Key'] <> NULL then ! html := ! sprintf("%s%s%a = %a",html,prefix,this['Key'],this['KeyValue']); fi; if this['IsSplit'] = true then --- 3085,3104 ---- fi; ! html := ""; crstring:=false; if this['Key'] <> NULL then ! # KM ! if type(this['KeyValue'],string) and ! StringTools:-Search("\n",this['KeyValue'])>0 then ! crstring:=true; ! html := ! sprintf("%s%s%a = <center><table><tr><td><pre>%s</pre></td></tr></table></center>", ! html,prefix,this['Key'],this['KeyValue']); ! else ! # END KM ! html := ! sprintf("%s%s%a = %a",html,prefix,this['Key'],this['KeyValue']); ! # KM ! fi: ! # END KM fi; if this['IsSplit'] = true then *************** *** 3096,3100 **** op(map((x,i) -> x['ToHTML',i],this['Contents'],indent+1))); else ! html := sprintf("%s x %d<br/>\n",html,nops(this['Contents'])); fi; --- 3108,3118 ---- op(map((x,i) -> x['ToHTML',i],this['Contents'],indent+1))); else ! # KM ! if not crstring then ! # END KM ! html := sprintf("%s x %d<br/>\n",html,nops(this['Contents'])); ! # KM ! fi: ! # END KM fi; Index: TextQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TextQuestion.mpl 24 Sep 2003 00:16:08 -0000 1.7 --- TextQuestion.mpl 4 Oct 2003 01:21:18 -0000 1.8 *************** *** 58,61 **** --- 58,72 ---- "The question of which this is a version." ], + + # KM + ['Field','AnswerBoxWidth'::nonnegint = 50, + "The width of the html answer box presented to the student for the answer." + ], + + ['Field','AnswerBoxHeight'::nonnegint = 1, + "The width of the html answer box presented to the student for the answer." + ], + # END KM + ['Field','Prompt'::string = __("Answer: "), *************** *** 260,270 **** ", proc(this) cat("<br/>\n", this['Prompt'], ! sprintf( ! "<input type='text' name='RawAnswer%s' size='50' value = '%s'/>", this['Label'], ! this['Attempt']['RawAnswer'] ! ), this['PostPrompt'], "\n<br/>\n" --- 271,351 ---- ", proc(this) + + # KM + local inputbox; + + if this['AnswerBoxHeight'] = 1 then + if this['AnswerBoxWidth'] = 0 then + inputbox:="" + else + inputbox:=sprintf( + cat("<input type='text' name='RawAnswer%s'", + " autocomplete='off' size='%d' value = '%s' />"), + this['Label'], + this['AnswerBoxWidth'], + this['Attempt']['RawAnswer']) + fi + else + inputbox:=sprintf( + cat("<textarea name='RawAnswer%s' cols='%d' rows='%d'", + " wrap='hard' />%s</textarea>"), + this['Label'], + this['AnswerBoxWidth'], + this['AnswerBoxHeight'], + this['Attempt']['RawAnswer']) + fi: + # END KM + cat("<br/>\n", this['Prompt'], ! # KM ! # WAS: sprintf( ! # WAS: "<input type='text' name='RawAnswer%s' size='50' value = '%s'/>", ! # WAS: this['Label'], ! # WAS: this['Attempt']['RawAnswer'] ! # WAS: ), ! inputbox, ! # END KM ! this['PostPrompt'], ! "\n<br/>\n" ! ); ! end ! ], ! ! # KM ! ['Method','AnswerBoxSubstitute'::`HTML/String`, ! "Return the HTML string specifying a disabled text box with grey ! background to show the student's previous raw answer. ! ", ! proc(this) ! local inputbox; ! ! if this['AnswerBoxHeight'] = 1 then ! if this['AnswerBoxWidth'] = 0 then ! inputbox:="" ! else ! inputbox:=sprintf( ! cat("<input type='text' name='RawAnswer%s'", ! " autocomplete='off' size='%d' value = '%s'", ! " style='background-color: #E0E0E0;", ! " color=black' disabled />"), this['Label'], ! this['AnswerBoxWidth'], ! this['Attempt']['RawAnswer']) ! fi ! else ! inputbox:=sprintf( ! cat("<textarea name='RawAnswer%s' cols='%d' rows='%d'", ! " style='background-color: #E0E0E0;", ! " color=black' disabled wrap='hard' />%s</textarea>"), ! this['Label'], ! this['AnswerBoxWidth'], ! this['AnswerBoxHeight'], ! this['Attempt']['RawAnswer']) ! fi: ! ! cat("<br/>\n", ! this['Prompt'], ! inputbox, this['PostPrompt'], "\n<br/>\n" *************** *** 272,275 **** --- 353,357 ---- end ], + # END KM ['Method','ReportLastAnswer'::`HTML/String`, *************** *** 285,297 **** if attempt['RawAnswer'] = "" then html := cat(__("Your last answer was empty"),"\n<br/>\n"); ! else if attempt['Answer'] <> NULL then ! html := ! cat( ! __("Your last answer was: \n"), ! "<latex>\\[", ! `aim/LaTeX`(attempt['Answer']), ! "\\]</latex>\n<br/>\n" ! ); fi; if attempt['IsValid'] <> true then --- 367,395 ---- if attempt['RawAnswer'] = "" then html := cat(__("Your last answer was empty"),"\n<br/>\n"); ! else if attempt['Answer'] <> NULL then ! # KM ! if type(attempt['Answer'],string) then ! ! html := ! cat( ! __("Your last answer was: \n"), ! "<br/><pre>", ! attempt['Answer'], ! "</pre>\n" ! ); ! ! else ! # END KM ! html := ! cat( ! __("Your last answer was: \n"), ! "<latex>\\[", ! `aim/LaTeX`(attempt['Answer']), ! "\\]</latex>\n<br/>\n" ! ); ! # KM ! fi: ! # END KM fi; if attempt['IsValid'] <> true then |
From: <mo...@us...> - 2003-10-04 01:21:09
|
Update of /cvsroot/aimmath/AIM/doc In directory sc8-pr-cvs1:/tmp/cvs-serv12459 Modified Files: format.html Log Message: added answerboxsize> flag and related modifications Index: format.html =================================================================== RCS file: /cvsroot/aimmath/AIM/doc/format.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** format.html 5 Sep 2003 14:00:20 -0000 1.5 --- format.html 4 Oct 2003 01:20:37 -0000 1.6 *************** *** 360,363 **** --- 360,367 ---- <td>Specify the prompt for the student's answer (in LaTeX)</td> </tr> + <tr><td>as></td> + <td><a href="#answerboxsize">answerboxsize></a></td> + <td>Specify the size of the input box for the student's answer</td> + </tr> <tr><td>av></td> <td><a href='#answervariable'>answervariable></a></td> *************** *** 368,372 **** <td><a href='#postprompt'>postprompt></a></td> <td>Specify a string to go directly after the box in which the ! student's answer is entered. </td> </tr> --- 372,376 ---- <td><a href='#postprompt'>postprompt></a></td> <td>Specify a string to go directly after the box in which the ! student's answer is entered (in LaTeX). </td> </tr> *************** *** 482,486 **** </font></pre> ! <a name='answervariable'><h3>answervariable>/av></h3></a> The attached text should be the name of a global variable in which to --- 486,500 ---- </font></pre> ! <a name='answerboxsize'><h3>answerboxsize>/as></h3></a> ! ! The attached text should be either <font color='green'>w</font> or ! <font color='green'>w,h</font> where <font color='green'>w,h</font> are nonnegative integers ! that determine the width and height of the html input box for the student's ! answer. If <font color='green'>h</font> is not specified it defaults to 1. If ! the width is 0 no input box will be displayed (useful for assigning problems ! that are to be handed in on paper). This flag has no effect on ! MATRIX, MC, or MR questions (see <a href="#mapletype"> mapletype></a>). ! ! <h3>answervariable>/av></h3> The attached text should be the name of a global variable in which to |
From: <gus...@us...> - 2003-10-02 19:42:23
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv5256/mod/math_assignment Modified Files: aimpage.php lib.php pdfgen.php Log Message: various minor improvements Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** aimpage.php 30 Sep 2003 07:22:05 -0000 1.14 --- aimpage.php 2 Oct 2003 19:42:15 -0000 1.15 *************** *** 75,79 **** else if (strcasecmp($aimaction, "edit") == 0) { // load the edit quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "ShowHiddenQuestions"); $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuestions", "true"); $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); --- 75,79 ---- else if (strcasecmp($aimaction, "edit") == 0) { // load the edit quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "LoadQuizOptions"); $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuestions", "true"); $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** lib.php 30 Sep 2003 07:22:05 -0000 1.34 --- lib.php 2 Oct 2003 19:42:15 -0000 1.35 *************** *** 758,764 **** $out = preg_replace("/<table border>/", "<table border=\"1\">", $out); $out = preg_replace("/<hr noshade(?=[\s\/])/", "<hr noshade=\"noshade\" ", $out); - // The following doesn't do anything for some reason GWD $out = preg_replace("/width\=([\d]+)/", "width=\"$2\"", $out); $out = preg_replace("/height\=([\d]+)/", "height=\"$2\"", $out); // convert Latex to MathML --- 758,765 ---- $out = preg_replace("/<table border>/", "<table border=\"1\">", $out); $out = preg_replace("/<hr noshade(?=[\s\/])/", "<hr noshade=\"noshade\" ", $out); $out = preg_replace("/width\=([\d]+)/", "width=\"$2\"", $out); $out = preg_replace("/height\=([\d]+)/", "height=\"$2\"", $out); + // sort out a netscape bug + $out = str_replace("<br/>", "<br />", $out); // convert Latex to MathML Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pdfgen.php 30 Sep 2003 22:41:26 -0000 1.14 --- pdfgen.php 2 Oct 2003 19:42:15 -0000 1.15 *************** *** 123,128 **** if (math_assignment_is_tex_file($texfile)) { $latex = implode ('', file($texfile)); foreach ($questions as $question) { ! $latex = str_replace_once("\aimquestion","$\\sphericalangle$ ".math_assignment_aim_to_latex($question,$type),$latex); } } --- 123,129 ---- if (math_assignment_is_tex_file($texfile)) { $latex = implode ('', file($texfile)); + $latex = str_replace('\aimquestion', '$\sphericalangle$ \aimque', $latex); foreach ($questions as $question) { ! $latex = str_replace_once('\aimque', math_assignment_aim_to_latex($question,$type),$latex); } } *************** *** 176,180 **** 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); } --- 177,181 ---- 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); } *************** *** 197,200 **** --- 198,203 ---- } + + function math_assignment_aim_to_latex($data,$type) { // This function is given a chunk of the aimpage corresponding to one question *************** *** 245,257 **** "<latex>,~~~ {\bf $2: } </latex>",$data); ! // delete things meant for the screen only ! // these are delimited by \special{<screen>} .... \special{</screen>} ! $data = preg_replace('/\\\special{<screen>}([\s\S]*)?\\\special{<\/screen>}/', "",$data); - - // preserve things meant for the sheet only - // these are delimited by \special{<sheet> ... </sheet>} - $data = preg_replace('/\\\special{<sheet>([\s\S]*)?<\/sheet>}/', - "\$1",$data); // We might at some point want to replace input box by .... --- 248,254 ---- "<latex>,~~~ {\bf $2: } </latex>",$data); ! // remove small print ! $data = preg_replace("/\\\\small[^}]*./", "",$data); // We might at some point want to replace input box by .... *************** *** 269,272 **** --- 266,280 ---- $questiontex .= $pieces[1]; } + + + // delete things meant for the screen only + // these are delimited by \special{<screen>} .... \special{</screen>} + $questiontex = preg_replace("/\\\special{<screen>}([\s\S]*)\\\special{<\/screen>}/U", + "",$questiontex); + + // preserve things meant for the sheet only + // these are delimited by \special{<sheet> ... </sheet>} + $questiontex = preg_replace('/\\\special{<sheet>([\s\S]*)<\/sheet>}/U', + "\$1",$questiontex); return($questiontex); |
From: <mo...@us...> - 2003-10-01 18:03:25
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple In directory sc8-pr-cvs1:/tmp/cvs-serv6231 Modified Files: OS.mpl Log Message: a minor documentation fix Index: OS.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/OS.mpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OS.mpl 25 Aug 2003 21:47:18 -0000 1.3 --- OS.mpl 1 Oct 2003 18:03:06 -0000 1.4 *************** *** 63,67 **** `Package/Assign`( `OS/ListFiles`::list(string), ! "Return a list of the names of all files in directory @dir@", eval(os_listfiles) ): --- 63,67 ---- `Package/Assign`( `OS/ListFiles`::list(string), ! "Return a list of the names of all files (and subdirectories) in directory @dir@", eval(os_listfiles) ): *************** *** 72,76 **** `Package/Assign`( `OS/ListFilesOnly`::list(string), ! "Return a list of the names of all files in directory @dir@", eval(os_listfilesonly) ): --- 72,76 ---- `Package/Assign`( `OS/ListFilesOnly`::list(string), ! "Return a list of the names of all files in directory @dir@, but does not include subdirectories in the list.", eval(os_listfilesonly) ): |
From: <gus...@us...> - 2003-10-01 16:18:51
|
Update of /cvsroot/aimmath/moodle/lang/en_yo In directory sc8-pr-cvs1:/tmp/cvs-serv15806/lang/en_yo Removed Files: math_assignment.php Log Message: York language file doesn't belong into CVS --- math_assignment.php DELETED --- |
From: <gus...@us...> - 2003-09-30 22:41:35
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv18370/mod/math_assignment Modified Files: pdfgen.php Log Message: implements \specials in the tex to mark parts of the question that should be only for the screen or only for the sheet. Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pdfgen.php 29 Sep 2003 19:21:59 -0000 1.13 --- pdfgen.php 30 Sep 2003 22:41:26 -0000 1.14 *************** *** 74,78 **** // 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 --- 74,78 ---- // 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 *************** *** 245,252 **** "<latex>,~~~ {\bf $2: } </latex>",$data); ! // delete AiM syntax hints (identified by \small) ! $data = preg_replace("/\\\\small[^}]*./", "",$data); // We might at some point want to replace input box by .... //preg_match_all("/<latex>([\s\S]*)?<\/latex>/", $data, $matches); --- 245,258 ---- "<latex>,~~~ {\bf $2: } </latex>",$data); ! // delete things meant for the screen only ! // these are delimited by \special{<screen>} .... \special{</screen>} ! $data = preg_replace('/\\\special{<screen>}([\s\S]*)?\\\special{<\/screen>}/', "",$data); + // preserve things meant for the sheet only + // these are delimited by \special{<sheet> ... </sheet>} + $data = preg_replace('/\\\special{<sheet>([\s\S]*)?<\/sheet>}/', + "\$1",$data); + // We might at some point want to replace input box by .... //preg_match_all("/<latex>([\s\S]*)?<\/latex>/", $data, $matches); |
From: <gus...@us...> - 2003-09-30 07:22:10
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv22414/mod/math_assignment Modified Files: aimpage.php lib.php Log Message: now never hides quizzes or subjects from teacher Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aimpage.php 24 Sep 2003 13:22:22 -0000 1.13 --- aimpage.php 30 Sep 2003 07:22:05 -0000 1.14 *************** *** 75,79 **** else if (strcasecmp($aimaction, "edit") == 0) { // load the edit quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "LoadQuizOptions"); $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); --- 75,80 ---- else if (strcasecmp($aimaction, "edit") == 0) { // load the edit quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "ShowHiddenQuestions"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuestions", "true"); $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); *************** *** 87,91 **** else if (strcasecmp($aimaction, "subject") == 0) { // load the edit subject page $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, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); --- 88,93 ---- else if (strcasecmp($aimaction, "subject") == 0) { // load the edit subject page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Subject"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "ShowHiddenQuizzes"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuizzes", "true"); $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); *************** *** 124,136 **** } } // special case for changing the output type if (count($_POST) == 2) { 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(); } } --- 126,141 ---- } } + // and never hide things from the teacher + $postdata = math_assignment_add_arg_to_url_data($postdata, "ShowHiddenQuestions", "true"); + // special case for changing the output type if (count($_POST) == 2) { 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.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** lib.php 29 Sep 2003 22:25:59 -0000 1.33 --- lib.php 30 Sep 2003 07:22:05 -0000 1.34 *************** *** 690,694 **** // Remove unwanted links $unwanted = array(">Download<",">Browse source<",">Edit home page<",">Download results<", ! ">Edit register<",">Student details<"); $out = str_replace($unwanted,"><",$out); --- 690,694 ---- // 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); |
From: <gus...@us...> - 2003-09-29 22:26:03
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv1431/mod/math_assignment Modified Files: lib.php Log Message: typo corrected Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** lib.php 29 Sep 2003 20:54:23 -0000 1.32 --- lib.php 29 Sep 2003 22:25:59 -0000 1.33 *************** *** 654,659 **** // 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)); --- 654,659 ---- // 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)); *************** *** 871,910 **** if ($students) { foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, email, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->email = $user->email; ! $students[$key]->mailformat = $user->mailformat; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; --- 871,910 ---- if ($students) { foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, email, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->email = $user->email; ! $students[$key]->mailformat = $user->mailformat; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; *************** *** 1068,1072 **** return " " . implode(" ", $output). " "; } ! else return editer($tex); } --- 1068,1072 ---- return " " . implode(" ", $output). " "; } ! else { return editer($tex); } |
From: <gus...@us...> - 2003-09-29 21:46:43
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv9349/mod/math_assignment Modified Files: lib.php Log Message: no longer uses PREG_OFFSET_CAPTURE Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** lib.php 28 Sep 2003 15:23:07 -0000 1.28 --- lib.php 28 Sep 2003 16:23:29 -0000 1.29 *************** *** 597,600 **** --- 597,601 ---- $error = false; + /* // remove everything up to and including the html tag if (!preg_match("/<html(?:\s[^<>]*?|)>/i", $data, $matches, PREG_OFFSET_CAPTURE)) *************** *** 602,605 **** --- 603,608 ---- $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)) { *************** *** 642,646 **** $out .= $data; // add body to output (NOTE that this means we can modify $data now) ! if (!$error) { // extract grades (if present) --- 645,649 ---- $out .= $data; // add body to output (NOTE that this means we can modify $data now) ! if (!$error) { // extract grades (if present) *************** *** 657,660 **** --- 660,683 ---- } } + } + } + */ + + // extract scripts and add to $out + preg_match_all("/<script[\s\S]*?<\/script>/", $data, $scripts); + $out = "\n\n<!-- Start AiM scripts -->\n" . implode("\n",$scripts[0]); + // extract body and add to $out + preg_match("/<body(?:\s[^<>]*?|)>([\s\S]*)?<\/body>/i", $data, $body); + $out .= "\n<!-- End AiM scripts and start AiM body-->\n\n $body[1] \n\n<!-- End AiM body-->\n\n"; + + // extract grades (if present) + if (preg_match("/class=\"marktable\"([\s\S]*)?<\/table>/i", $data, $matches)) { + $data = $matches[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) html_entity_decode($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); + $grade = (int) (((float) html_entity_decode($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); } } |
From: <gus...@us...> - 2003-09-29 21:13:23
|
Update of /cvsroot/aimmath/AIM In directory sc8-pr-cvs1:/tmp/cvs-serv16281 Modified Files: help.html Log Message: replaced old urls by aiminfo.net Index: help.html =================================================================== RCS file: /cvsroot/aimmath/AIM/help.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** help.html 25 Aug 2003 21:47:20 -0000 1.2 --- help.html 29 Sep 2003 21:13:19 -0000 1.3 *************** *** 30,34 **** <B>AiM</B> is a computer system that assists in the teaching of some parts of University mathematics. Your comments and suggestions ! will be very welcome; you can post them on the forum <a href="http://maths-physics.org.uk/aiminfo/mod/forum/view.php?id=14">Using AiM</a>. <br/><br/> --- 30,35 ---- <B>AiM</B> is a computer system that assists in the teaching of some parts of University mathematics. Your comments and suggestions ! will be very welcome; you can post them in the discussion forum on the ! <a href="http://aiminfo.net">AiM website</a>. <br/><br/> |
From: <gus...@us...> - 2003-09-29 21:02:59
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv15969/mod/math_assignment Modified Files: lib.php pdfgen.php Log Message: works on unix and windows but on windows temp files are in math_assignment directory rather than temp directory until we can find out how to change working directory for tex. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** lib.php 28 Sep 2003 23:15:32 -0000 1.30 --- lib.php 29 Sep 2003 19:21:59 -0000 1.31 *************** *** 1041,1043 **** --- 1041,1062 ---- } + function copy_from_url($url, $file) { + if (!$handle = fopen($url, "rb")) + return false; + $contents = ""; + do { + $data = fread($handle, 8192); + if (strlen($data) == 0) { + break; + } + $contents .= $data; + } while(true); + fclose($handle); + if (!$handle = fopen($file, "wb")) + return false; + fwrite($handle, $contents, strlen($contents)); + fclose($handle); + return true; + } + ?> Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pdfgen.php 28 Sep 2003 19:26:18 -0000 1.12 --- pdfgen.php 29 Sep 2003 19:21:59 -0000 1.13 *************** *** 37,45 **** } ! // Create temp directory if it doesn't exist ! $tempdir = "$CFG->dataroot/temp/math_assignment/$math_assignment->id"; ! @mkdir("$CFG->dataroot/temp", $CFG->directorypermissions); ! @mkdir("$CFG->dataroot/temp/math_assignment", $CFG->directorypermissions); ! @mkdir($tempdir, $CFG->directorypermissions); // if there is an aim quiz load it into $data --- 37,49 ---- } ! // Create temp file names ! if (strpos($_ENV["OS"], "Win") === false) { ! if (!$tempfile = tempnam("/tmp","pdf")) { ! error("Sorry, I can't produce the pdf output. Failed to open temporary file."); ! } ! } ! else { ! $tempfile = substr(md5(microtime()), 0, 6); ! } // if there is an aim quiz load it into $data *************** *** 83,90 **** $imageurls = $imagematches[1]; foreach ($imageurls as $key => $imageurl) { ! if (!copy($imageurl,"$tempdir/$key.jpg")) error("Couldn't copy image file to temp directory"); $data = preg_replace("/<img src=\"([^\"]+jpg)\"/", ! "<latex>\n\\begin\{center}\n\\pdfimageresolution=150\n\\pdfximage\{$tempdir/$key.jpg}\\pdfrefximage\\pdflastximage\n\\end\{center}\n</latex>", $data,1 ); --- 87,94 ---- $imageurls = $imagematches[1]; foreach ($imageurls as $key => $imageurl) { ! if (!copy_from_url($imageurl,"$tempfile$key.jpg")) error("Couldn't copy image file to temp directory"); $data = preg_replace("/<img src=\"([^\"]+jpg)\"/", ! "<latex>\n\\begin\{center}\n\\pdfimageresolution=150\n\\pdfximage\{$tempfile$key.jpg}\\pdfrefximage\\pdflastximage\n\\end\{center}\n</latex>", $data,1 ); *************** *** 138,150 **** // generate pdf file from $latex - $tempfile = substr(md5(microtime()), 0, 8); if (!$fp=fopen("$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); fwrite($fp,$latex); fclose($fp); ! exec("pdflatex $tempfile.tex"); ! @unlink("$tempfile.tex"); ! @unlink("$tempfile.aux"); ! @unlink("$tempfile.log"); // output of pdf --- 142,153 ---- // 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."); fwrite($fp,$latex); fclose($fp); ! if (strpos($_ENV["OS"], "Win") === false) ! exec("cd ".dirname($tempfile)."; pdflatex $tempfile.tex"); ! else ! exec("pdflatex $tempfile.tex"); // output of pdf *************** *** 152,156 **** /* 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: --- 155,159 ---- /* 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: *************** *** 162,167 **** 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 --- 165,171 ---- 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 *************** *** 171,183 **** else header("Content-disposition: inline; filename=problems.pdf"); ! fpassthru($file); // chuck all the data direct to the browser and close the handle } else { ! error("It didn't work!"); // error message } @unlink("$tempfile.pdf"); ! */ function math_assignment_aim_to_latex($data,$type) { --- 175,199 ---- 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"); ! 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) { *************** *** 251,265 **** } - - function str_replace_once($needle, $replace, $haystack) { - // Looks for the first occurence of $needle in $haystack - // and replaces it with $replace. - $pos = strpos($haystack, $needle); - if ($pos === false) { - // Nothing found - return $haystack; - } - return substr_replace($haystack, $replace, $pos, strlen($needle)); - } ?> --- 267,270 ---- |
From: <gus...@us...> - 2003-09-29 20:54:33
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv11398/mod/math_assignment Modified Files: lib.php Log Message: now uses ttm on unix Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** lib.php 29 Sep 2003 19:21:59 -0000 1.31 --- lib.php 29 Sep 2003 20:54:23 -0000 1.32 *************** *** 758,765 **** $out = preg_replace("/<table border>/", "<table border=\"1\">", $out); $out = preg_replace("/<hr noshade(?=[\s\/])/", "<hr noshade=\"noshade\" ", $out); // convert Latex to MathML if (function_exists('editer') && $convertlatex) { ! $out = preg_replace_callback("/<latex>(.*?)<\/latex>/si", create_function('$matches', 'return editer($matches[1]);'), $out); } --- 758,768 ---- $out = preg_replace("/<table border>/", "<table border=\"1\">", $out); $out = preg_replace("/<hr noshade(?=[\s\/])/", "<hr noshade=\"noshade\" ", $out); + // The following doesn't do anything for some reason GWD + $out = preg_replace("/width\=([\d]+)/", "width=\"$2\"", $out); + $out = preg_replace("/height\=([\d]+)/", "height=\"$2\"", $out); // convert Latex to MathML if (function_exists('editer') && $convertlatex) { ! $out = preg_replace_callback("/<latex>(.*?)<\/latex>/si", create_function('$matches', 'return tex_to_mathml($matches[1]);'), $out); } *************** *** 1035,1039 **** } ! function decodeHTML($string) { $string = strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES))); $string = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $string); --- 1038,1042 ---- } ! function decodeHTML($string) { // emulates html_entity_decode which only exists in PHP >= 4.3.0 $string = strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES))); $string = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $string); *************** *** 1041,1045 **** } ! function copy_from_url($url, $file) { if (!$handle = fopen($url, "rb")) return false; --- 1044,1048 ---- } ! function copy_from_url($url, $file) { // emulates copy which works with URLSs only in PHP >= 4.3.0 if (!$handle = fopen($url, "rb")) return false; *************** *** 1058,1061 **** --- 1061,1074 ---- fclose($handle); return true; + } + + function tex_to_mathml($tex) { + if (strpos($_ENV["OS"], "Win") === false) { + exec("echo " . escapeshellarg($tex) . " | /usr/local/bin/ttm -r", $output); + return " " . implode(" ", $output). " "; + } + else + return editer($tex); + } } |
From: <gus...@us...> - 2003-09-29 02:41:59
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv24136/mod/math_assignment Modified Files: lib.php Log Message: removed html_entity_decode which requires php 4.3. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** lib.php 28 Sep 2003 16:23:29 -0000 1.29 --- lib.php 28 Sep 2003 23:15:32 -0000 1.30 *************** *** 654,661 **** // 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) html_entity_decode($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); ! $grade = (int) (((float) html_entity_decode($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); } } --- 654,661 ---- // 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)); } } *************** *** 678,683 **** if (empty($CFG->math_assignment_grade_multiplier)) $CFG->math_assignment_grade_multiplier = 1.0; ! $max_grade = (int) (((float) html_entity_decode($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); ! $grade = (int) (((float) html_entity_decode($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); } } --- 678,683 ---- 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)); } } *************** *** 868,907 **** if ($students) { foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, email, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->email = $user->email; ! $students[$key]->mailformat = $user->mailformat; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; --- 868,907 ---- if ($students) { foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, email, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->email = $user->email; ! $students[$key]->mailformat = $user->mailformat; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; *************** *** 1023,1026 **** --- 1023,1043 ---- return true; } + + function str_replace_once($needle, $replace, $haystack) { + // Looks for the first occurence of $needle in $haystack + // and replaces it with $replace. + $pos = strpos($haystack, $needle); + if ($pos === false) { + // Nothing found + return $haystack; + } + return substr_replace($haystack, $replace, $pos, strlen($needle)); + } + + function decodeHTML($string) { + $string = strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES))); + $string = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $string); + return $string; + } ?> |
From: <gus...@us...> - 2003-09-29 02:36:28
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv29069/mod/math_assignment Modified Files: lib.php Log Message: taken out more unwanted links Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** lib.php 28 Sep 2003 11:57:39 -0000 1.27 --- lib.php 28 Sep 2003 15:23:07 -0000 1.28 *************** *** 662,665 **** --- 662,672 ---- // remove Options section (from both Subject and Quiz administration) $out = preg_replace("/<a name=\"Options\"[\s\S]*?<hr noshade=\"true\" \/>/","",$out); + // remove Find student section from Subject administration + $out = preg_replace("/<a name=\"FindStudent\"[\s\S]*?<hr noshade=\"true\" \/>/","",$out); + + // Remove unwanted links + $unwanted = array(">Download<",">Browse source<",">Edit home page<",">Download results<", + ">Edit register<",">Student details<"); + $out = str_replace($unwanted,"><",$out); // covert the URLs *************** *** 689,692 **** --- 696,700 ---- $out = preg_replace("/<a(?:\s[^<>]*?|)\shref=[^<>]*>New Quiz<\/a>/i", "", $out); + /* // modify download links $commonpostdata = ""; *************** *** 721,724 **** --- 729,733 ---- $out = preg_replace("/<\/span>/i", "", $out); $out = preg_replace("/(?<=<)(\w*(?:\s[^<>]*?|))\sclass=(?(?=\")\"[^\"<>]*?\"(?=\W)|\S*?(?=>))/i", "\\1", $out); + */ ////// HACK - sort out non-xml complient AIM output |
From: <gus...@us...> - 2003-09-28 19:26:34
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv10123/mod/math_assignment Modified Files: pdfgen.php Log Message: removed file_get_contents which requires php 4.3. Also hacked temporary file creation. Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pdfgen.php 27 Sep 2003 20:14:37 -0000 1.11 --- pdfgen.php 28 Sep 2003 19:26:18 -0000 1.12 *************** *** 118,122 **** if (math_assignment_is_tex_file($texfile)) { ! $latex = file_get_contents($texfile); foreach ($questions as $question) { $latex = str_replace_once("\aimquestion","$\\sphericalangle$ ".math_assignment_aim_to_latex($question,$type),$latex); --- 118,122 ---- if (math_assignment_is_tex_file($texfile)) { ! $latex = implode ('', file($texfile)); foreach ($questions as $question) { $latex = str_replace_once("\aimquestion","$\\sphericalangle$ ".math_assignment_aim_to_latex($question,$type),$latex); *************** *** 124,128 **** } else { ! $latex = file_get_contents("$CFG->dirroot/mod/math_assignment/$type.tex"); foreach ($questions as $question) { $latex .= "\n\n\\nextq $\\sphericalangle$ ".math_assignment_aim_to_latex($question,$type); --- 124,128 ---- } else { ! $latex = implode ('', file("$CFG->dirroot/mod/math_assignment/$type.tex")); foreach ($questions as $question) { $latex .= "\n\n\\nextq $\\sphericalangle$ ".math_assignment_aim_to_latex($question,$type); *************** *** 138,149 **** // generate pdf file from $latex ! if (!$tempfile = tempnam("/tmp", "pdfsheet")) ! error("Sorry, I can't produce the pdf output. Failed to open temporary file."); if (!$fp=fopen("$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); fwrite($fp,$latex); fclose($fp); ! exec("pdflatex -interaction=batchmode $tempfile.tex"); ! @unlink("$tempnam.tex"); // output of pdf --- 138,150 ---- // generate pdf file from $latex ! $tempfile = substr(md5(microtime()), 0, 8); if (!$fp=fopen("$tempfile.tex","wb")) error("Sorry, I can't produce the pdf output. Failed to open temporary file."); fwrite($fp,$latex); fclose($fp); ! exec("pdflatex $tempfile.tex"); ! @unlink("$tempfile.tex"); ! @unlink("$tempfile.aux"); ! @unlink("$tempfile.log"); // output of pdf *************** *** 151,155 **** /* 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("$tempnam.pdf"); /* I have just noticed the following in the php documentation on this issue of using Content-disposition headers: --- 152,156 ---- /* 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: *************** *** 161,166 **** 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("$tempnam.pdf", "rb")) { // the 'b' is for compatibility with Windoze // tell the browser that it is pdf --- 162,167 ---- 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 *************** *** 177,181 **** } ! @unlink("$tempnam.pdf"); function math_assignment_aim_to_latex($data,$type) { --- 178,183 ---- } ! @unlink("$tempfile.pdf"); ! */ function math_assignment_aim_to_latex($data,$type) { |
From: <gus...@us...> - 2003-09-28 15:13:05
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv22375/mod/math_assignment Modified Files: lib.php Log Message: Removes Options section from both Quiz and Question admin pages. Also sets Quiz Title, Access and Mode when it is set up as assignment. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** lib.php 27 Sep 2003 13:36:33 -0000 1.26 --- lib.php 28 Sep 2003 11:57:39 -0000 1.27 *************** *** 451,454 **** --- 451,455 ---- /// 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)) *************** *** 469,472 **** --- 470,482 ---- } return 0; + */ + + if (strpos($data,"<html") === false) + return false; // no HTML data found; + if (strpos($data,"<head") === false) + return false; // no head section found; + if (preg_match("/<title>(.*)\bNot registered\b(.*)<\/title>/si", $data)) + return 1; // user not registered + return 0; } *************** *** 515,518 **** --- 525,532 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "DueDateMonth", $date['mon']); $postdata = math_assignment_add_arg_to_url_data($postdata, "DueDateYear", $date['year']); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Title", $math_assignment->name); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Weight", "1.0"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Access", "all"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Mode", "assessment"); // load the AiM page and grab the result if (!$data = math_assignment_get_aim_output($server->address, $postdata)) *************** *** 637,644 **** // 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) html_entity_decode($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); ! $grade = (int) (((float) html_entity_decode($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); } } --- 651,658 ---- // 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) html_entity_decode($matches[1])) * ((float) $CFG->math_assignment_grade_multiplier)); ! $grade = (int) (((float) html_entity_decode($matches[2])) * ((float) $CFG->math_assignment_grade_multiplier)); } } *************** *** 646,649 **** --- 660,666 ---- } + // remove Options section (from both Subject and Quiz administration) + $out = preg_replace("/<a name=\"Options\"[\s\S]*?<hr noshade=\"true\" \/>/","",$out); + // covert the URLs if ($old_url) { *************** *** 819,858 **** if ($students) { foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, email, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->email = $user->email; ! $students[$key]->mailformat = $user->mailformat; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; --- 836,875 ---- if ($students) { foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, email, mailformat, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->email = $user->email; ! $students[$key]->mailformat = $user->mailformat; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } } // sort if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; else ! $mult = 1; if (strcasecmp($sort, "id") == 0) ! uksort($students, create_function('$a, $b', 'return (($a > $b) ? 1 : -1) * ' . $mult . ';')); else ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); } break; |
From: <gus...@us...> - 2003-09-28 13:06:35
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim/try In directory sc8-pr-cvs1:/tmp/cvs-serv31512/WEB-INF/maple/aim/try Modified Files: Quiz.mpl Log Message: Corrected QuestionSeed vs QuizSeed confusion that I introduced earlier Index: Quiz.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/try/Quiz.mpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Quiz.mpl 16 Sep 2003 20:22:01 -0000 1.4 --- Quiz.mpl 28 Sep 2003 09:08:21 -0000 1.5 *************** *** 144,149 **** ["td", [["inputtext", ! "name" = "QuestionSeed", ! "value" = {"QuestionSeed"}, "onchange" = "seedchanged=true;"]]]]], [["hr","noshade"]], --- 144,149 ---- ["td", [["inputtext", ! "name" = "QuizSeed", ! "value" = {"QuizSeed"}, "onchange" = "seedchanged=true;"]]]]], [["hr","noshade"]], |
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv21659/mod/math_assignment Modified Files: editgrade.php email.php index.php lib.php mod.html updatepapergrades.php version.php view.php Log Message: More work on emails. Emails to students can now be sent from view.php. Index: editgrade.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/editgrade.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editgrade.php 9 Sep 2003 18:31:07 -0000 1.1 --- editgrade.php 26 Sep 2003 22:23:23 -0000 1.2 *************** *** 39,43 **** $gradeobj->aimgrade = -1; // not attempted $gradeobj->aimtimemodified = 0; ! $gradeobj->aimoverride = 0; $gradeobj->aimcomment = ""; if (isset($grade) && isset($comment)) --- 39,43 ---- $gradeobj->aimgrade = -1; // not attempted $gradeobj->aimtimemodified = 0; ! $gradeobj->aimoverride = AIMOVR_OFF; $gradeobj->aimcomment = ""; if (isset($grade) && isset($comment)) *************** *** 51,64 **** if ($grade == "-") { // reset override (clear grade) $gradeobj->aimgrade = -1; ! $gradeobj->aimoverride = 0; $gradeobj->aimcomment = $comment; } else if ($grade == "") { // clear override (leave grade alone) ! $gradeobj->aimoverride = 0; $gradeobj->aimcomment = $comment; } else if ($grade >= 0 && $grade <= $math_assignment->aimgrade && $comment) { // set override $gradeobj->aimtimemodified = time(); ! $gradeobj->aimoverride = 1; $gradeobj->aimcomment = $comment; $gradeobj->aimgrade = $grade; --- 51,64 ---- if ($grade == "-") { // reset override (clear grade) $gradeobj->aimgrade = -1; ! $gradeobj->aimoverride = AIMOVR_RESET; $gradeobj->aimcomment = $comment; } else if ($grade == "") { // clear override (leave grade alone) ! $gradeobj->aimoverride = AIMOVR_RESET; $gradeobj->aimcomment = $comment; } else if ($grade >= 0 && $grade <= $math_assignment->aimgrade && $comment) { // set override $gradeobj->aimtimemodified = time(); ! $gradeobj->aimoverride = AIMOVR_SET; $gradeobj->aimcomment = $comment; $gradeobj->aimgrade = $grade; *************** *** 69,73 **** $err = math_assignment_update_grades($gradeobj) ? 0 : 1; if (!$err) ! redirect("view.php?id=$cm->id", get_string("changessaved"), 1); } } --- 69,73 ---- $err = math_assignment_update_grades($gradeobj) ? 0 : 1; if (!$err) ! redirect("view.php?id=$cm->id", get_string("changessaved") . "\n" . get_string("delaymessage", "math_assignment", format_time($CFG->maxeditingtime)), 2); } } *************** *** 156,160 **** <td align="right"><p><b><?php echo $strnewgrade; ?>:</b></p></td> <td> ! <input type="text" name="grade" size="20" maxlength="20" value="<?php if ($gradeobj->aimoverride) echo max($gradeobj->aimgrade, 0);?>" /> / <?php echo "$math_assignment->aimgrade "; helpbutton ("editgrade_new", $strnewgrade, "math_assignment"); ?> </td> </tr> --- 156,160 ---- <td align="right"><p><b><?php echo $strnewgrade; ?>:</b></p></td> <td> ! <input type="text" name="grade" size="20" maxlength="20" value="<?php if ($gradeobj->aimoverride > AIMOVR_RESET) echo max($gradeobj->aimgrade, 0);?>" /> / <?php echo "$math_assignment->aimgrade "; helpbutton ("editgrade_new", $strnewgrade, "math_assignment"); ?> </td> </tr> Index: email.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/email.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** email.php 25 Sep 2003 22:14:09 -0000 1.2 --- email.php 26 Sep 2003 22:23:23 -0000 1.3 *************** *** 41,53 **** foreach ($students as $student) { // send email to the student ! if (!math_assignment_email_grades($math_assignment, $student)) $failed++; } } ! if ($failed == count($students)) error(get_string("failed", "math_assignment"), "view.php?id=$cm->id"); // send email to secretaries ! if (!math_assignment_email_all_grades($math_assignment, $students)) ! error(get_string("failed", "math_assignment"), "view.php?id=$cm->id"); // set flag in database //set_field("math_assignment", "papersheetsreturned", "1", "id", $math_assignment->id); --- 41,53 ---- foreach ($students as $student) { // send email to the student ! if (!math_assignment_email_grades($course, $math_assignment, $student)) $failed++; } } ! if ($failed > 0 && $failed == count($students)) error(get_string("failed", "math_assignment"), "view.php?id=$cm->id"); // send email to secretaries ! /*if (!math_assignment_email_all_grades($course, $math_assignment, $students)) ! error(get_string("failed", "math_assignment"), "view.php?id=$cm->id");*/ // set flag in database //set_field("math_assignment", "papersheetsreturned", "1", "id", $math_assignment->id); Index: index.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/index.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** index.php 25 Sep 2003 17:15:41 -0000 1.7 --- index.php 26 Sep 2003 22:23:23 -0000 1.8 *************** *** 152,156 **** $grade->papergrade = -1; $grade->aimgrade = -1; ! $grade->aimoverride = 0; $grade->aimcomment = ""; } --- 152,156 ---- $grade->papergrade = -1; $grade->aimgrade = -1; ! $grade->aimoverride = AIMOVR_OFF; $grade->aimcomment = ""; } *************** *** 164,168 **** else $aimgrade = ""; ! if ($grade->aimoverride) $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } --- 164,168 ---- else $aimgrade = ""; ! if ($grade->aimoverride > AIMOVR_RESET) $aimgrade .= " (" . get_string("gradeoverride", "math_assignment") . ")"; } Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** lib.php 25 Sep 2003 22:14:09 -0000 1.23 --- lib.php 26 Sep 2003 22:23:23 -0000 1.24 *************** *** 5,8 **** --- 5,13 ---- /// Library of functions and constants for module math_assignment + define("AIMOVR_OFF", 0); + define("AIMOVR_RESET", 1); + define("AIMOVR_SET", 2); + define("AIMOVR_ON", 3); + function math_assignment_add_instance($math_assignment) { /// Given an object containing all the necessary data, *************** *** 175,185 **** global $CFG; ! $math_assignments = get_records_sql("SELECT `id`,`course`,`name`,`papergrade`,`aimgrade`,`timedue` FROM `{$CFG->prefix}math_assignment` WHERE `papersheetsreturned` = '0' AND `timedue` < NOW() AND `papergrade` = '0'"); ! if ($math_assignments) { foreach ($math_assignments as $math_assignment) { ! if ($students = math_assignment_get_grades($math_assignment)) ! math_assignment_email_all_grades($math_assignment, $students); } } return true; } --- 180,195 ---- global $CFG; ! $time = time(); ! // look for assignments which need closing ! if ($math_assignments = get_records_sql("SELECT `id`,`course`,`name`,`papergrade`,`aimgrade`,`timedue` FROM `{$CFG->prefix}math_assignment` WHERE `papersheetsreturned` = '0' AND `timedue` < $time AND `papergrade` = '0'")) { foreach ($math_assignments as $math_assignment) { ! if ($course = get_record("course", "id", $math_assignment->course) && $students = math_assignment_get_grades($math_assignment)) ! math_assignment_email_all_grades($course, $math_assignment, $students); } } + // look for emails which need sending + /*$time = time() - $CFG->maxeditingtime; + if ($grades = get_records_sql("SELECT * FROM `{$CFG->prefix}math_assignment_grades` WHERE `aimoverride` = '" . AIMOVR_SET . "' AND `timemodified` < '$time'")) { + }*/ return true; } *************** *** 723,727 **** $changed = true; } ! if ($aimgrade >= 0 && !$entry->aimoverride) { // don't update if the teacher has manually updated $entry->aimgrade = $aimgrade; $entry->aimtimemodified = time(); --- 733,737 ---- $changed = true; } ! if ($aimgrade >= 0 && $entry->aimoverride <= AIMOVR_RESET) { // don't update if the teacher has manually updated $entry->aimgrade = $aimgrade; $entry->aimtimemodified = time(); *************** *** 738,742 **** $entry->aimgrade = $aimgrade; $entry->aimtimemodified = ($aimgrade >= 0) ? time() : 0; ! $entry->aimoverride = 0; $entry->aimcomment = ""; insert_record("math_assignment_grades", $entry, false); --- 748,752 ---- $entry->aimgrade = $aimgrade; $entry->aimtimemodified = ($aimgrade >= 0) ? time() : 0; ! $entry->aimoverride = AIMOVR_OFF; $entry->aimcomment = ""; insert_record("math_assignment_grades", $entry, false); *************** *** 763,767 **** // get the grade from the database if ($entry = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { ! if ($entry->aimoverride) { print_simple_box_start("left"); echo "<b>"; --- 773,777 ---- // get the grade from the database if ($entry = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { ! if ($entry->aimoverride > AIMOVR_RESET) { print_simple_box_start("left"); echo "<b>"; *************** *** 818,822 **** $students[$key]->papergrade = -1; $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = 0 ; $students[$key]->aimcomment = ""; $students[$key]->totalgrade = 0; --- 828,832 ---- $students[$key]->papergrade = -1; $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = AIMOVR_OFF ; $students[$key]->aimcomment = ""; $students[$key]->totalgrade = 0; *************** *** 849,861 **** } ! function math_assignment_email_grades($math_assignment, $student) { /// Function which constructs an email telling the student what their grade is ! // build the email ! // send the email to $student->email ! return true; } ! function math_assignment_email_all_grades($math_assignment, $students) { /// Function which constructs an email listing all the grades found and emails it to the secretaries --- 859,959 ---- } ! function math_assignment_email_grades($course, $math_assignment, $student) { /// Function which constructs an email telling the student what their grade is ! global $CFG; ! ! // send from the main teacher ! if (!$teachers = get_records_sql("SELECT u.*,t.role,t.editall FROM {$CFG->prefix}user u, {$CFG->prefix}user_teachers t WHERE t.course = '$course->id' AND t.userid = u.id AND u.deleted = '0' AND t.authority > '0' ORDER BY t.authority ASC")) ! return false; ! $teacher = reset($teachers); ! $hasaim = $math_assignment->aimquiz; ! $papergrade = min(max((int) $student->papergrade, 0), $math_assignment->papergrade); ! if ($hasaim) ! $aimgrade = min(max((int) $student->aimgrade, 0), $math_assignment->aimgrade); ! if ($student->mailformat) { ! // build html email ! $lang = current_language(); ! $messagehtml = "<!doctype html public \"-//w3c//dtd html 4.0 strict//$lang\">\n"; ! $messagehtml .= "<html><head>\n"; ! if ($lang == "en") ! $messagehtml .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"; ! else ! $messagehtml .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . get_string("thischarset") . "\" />\n"; ! $messagehtml .= "<style type=\"text/css\"><!--\n"; ! $messagehtml .= "BODY{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 12pt;\nfont-weight: normal;\n}\n"; ! $messagehtml .= "H2{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 18pt;\nfont-weight: bold;\ntext-align: left;\nmargin-top: 0px;\nmargin-bottom: 0px;\n}\n"; ! $messagehtml .= "H3{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 12pt;\nfont-weight: bold;\ntext-align: left;\nbackground-color: #FFE0A0;\npadding-top: 1px;\npadding-bottom: 1px;\npadding-left: 4px;\npadding-right: 4px;\n}\n"; ! $messagehtml .= "H4{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 12pt;\nfont-weight: normal;\nfont-style: italic;\ntext-align: left;\n}\n"; ! $messagehtml .= "P{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 12pt;\nfont-weight: normal;\ntext-align: left;\n}\n"; ! if ($hasaim) { ! $messagehtml .= "TABLE{\nclear: both;\nmargin-bottom: 16px;\n}\n"; ! $messagehtml .= "TH{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 12pt;\nfont-weight: bold;\ntext-align: left;\nbackground-color: #FFD080;\n}\n"; ! $messagehtml .= "TD{\nfont-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\nfont-size: 12pt;\nfont-weight: bold;\ntext-align: center;\nbackground-color: #FFF0D0;\n}\n"; ! $messagehtml .= "TD.unused{\nbackground-color: transparent;\n}\n"; ! $messagehtml .= "TD.total{\nbackground-color: #FFE8C8;\n}\n"; ! } ! $messagehtml .= "--></style>\n"; ! $messagehtml .= "</head>\n"; ! $messagehtml .= "<body bgcolor=\"#ffffff\" text=\"#000000\" link=\"#0000ff\" alink=\"#ff0000\" vlink=\"#800080\">\n"; ! $messagehtml .= "<h2>$course->fullname</h2>\n<h3>$math_assignment->name</h3>\n"; ! $messagehtml .= "<p>" . get_string("gradeemailmessage", "math_assignment") . "</p>\n"; ! $messagehtml .= "<p>" . get_string("gradeemailobtained", "math_assignment"); ! if ($hasaim) { ! $messagehtml .= ":</p>\n<table border=\"0\" align=\"left\" cellspacing=\"2\" cellpadding=\"4\">\n"; ! $messagehtml .= "<tr><td class=\"unused\"></td><th>" . get_string("maximumgrade") . "</th><th>" . get_string("grade") . "</th>"; ! if ($student->aimoverride > AIMOVR_RESET) ! $messagehtml .= "<th>" . get_string("extra") . "</th>"; ! $messagehtml .= "</tr>\n"; ! $messagehtml .= "<tr valign=\"top\"><th align=\"left\">" . get_string("paper", "math_assignment") . "</th>\n"; ! $messagehtml .= "<td align=\"center\">$math_assignment->papergrade</td>\n"; ! $messagehtml .= "<td align=\"center\">$papergrade</td>\n"; ! if ($student->aimoverride > AIMOVR_RESET) ! $messagehtml .= "<td></td>\n"; ! $messagehtml .= "</tr>\n"; ! $messagehtml .= "<tr valign=\"top\"><th align=\"left\">" . get_string("computer", "math_assignment") . "</th>\n"; ! $messagehtml .= "<td align=\"center\">$math_assignment->aimgrade</td>\n"; ! $messagehtml .= "<td align=\"center\">$aimgrade</td>\n"; ! if ($student->aimoverride > AIMOVR_RESET) ! $messagehtml .= "<td align=\"left\">" . get_string("gradeoverride", "math_assignment") . "</td>\n"; ! $messagehtml .= "</tr>\n"; ! $totalgrade = $papergrade + $aimgrade; ! $totalmax = $math_assignment->papergrade + $math_assignment->aimgrade; ! $messagehtml .= "<tr valign=\"top\"><th align=\"left\">" . get_string("total") . "</th>\n"; ! $messagehtml .= "<td align=\"center\">$totalmax</td>\n<td align=\"center\" class=\"total\">$totalgrade</td>\n"; ! if ($student->aimoverride > AIMOVR_RESET) ! $messagehtml .= "<td></td>"; ! $messagehtml .= "</tr>\n"; ! $messagehtml .= "</table>\n<br clear=\"all\" />\n"; ! } ! else ! $messagehtml .= " $papergrade / $math_assignment->papergrade.</p>\n"; ! $messagehtml .= "<h4>$teacher->firstname $teacher->lastname</h4><p><a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" . get_string("course") . " " . get_string("home") . "</a></p>\n"; ! $messagehtml .= "</body></html>"; ! } ! else ! $messagehtml = ""; ! // build plain text email ! $message = "$course->fullname\n$math_assignment->name\n\n"; ! $message .= get_string("gradeemailmessage", "math_assignment") . "\n"; ! $message .= get_string("gradeemailobtained", "math_assignment") . ":\n\n"; ! if ($hasaim) ! $message .= get_string("paper", "math_assignment") . ": "; ! $message .= "$papergrade / $math_assignment->papergrade\n"; ! if ($hasaim) { ! $message .= get_string("computer", "math_assignment") . ": "; ! $message .= "$aimgrade / $math_assignment->aimgrade"; ! if ($student->aimoverride > AIMOVR_RESET) ! $message .= " (" . get_string("gradeoverride", "math_assignment") . ")"; ! $message .= "\n"; ! $totalgrade = $papergrade + $aimgrade; ! $totalmax = $math_assignment->papergrade + $math_assignment->aimgrade; ! $message .= get_string("total") . ": $totalgrade / $totalmax\n"; ! } ! $message .= "\n$teacher->firstname $teacher->lastname\n\n" . get_string("course") . " " . get_string("home") . ": $CFG->wwwroot/course/view.php?id=$course->id"; ! return email_to_user($student, $teacher, $course->shortname . ": " . $math_assignment->name, $message, $messagehtml); } ! function math_assignment_email_all_grades($course, $math_assignment, $students) { /// Function which constructs an email listing all the grades found and emails it to the secretaries Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mod.html 25 Sep 2003 15:02:23 -0000 1.21 --- mod.html 26 Sep 2003 22:23:23 -0000 1.22 *************** *** 46,50 **** // Now we set the defaults if (!$form->name) ! $form->name = get_string("modulename", "math_assignment"); // get aimsubject from database --- 46,50 ---- // Now we set the defaults if (!$form->name) ! $form->name = get_string("modulename", "math_assignment") . ($form->section ? " $form->section" : ""); // get aimsubject from database Index: updatepapergrades.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/updatepapergrades.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** updatepapergrades.php 9 Sep 2003 18:31:07 -0000 1.1 --- updatepapergrades.php 26 Sep 2003 22:23:23 -0000 1.2 *************** *** 48,52 **** $gradeobj->aimgrade = -1; // not attempted $gradeobj->aimtimemodified = 0; ! $gradeobj->aimoverride = 0; $gradeobj->aimcomment = ""; insert_record("math_assignment_grades", $gradeobj, false); --- 48,52 ---- $gradeobj->aimgrade = -1; // not attempted $gradeobj->aimtimemodified = 0; ! $gradeobj->aimoverride = AIMOVR_OFF; $gradeobj->aimcomment = ""; insert_record("math_assignment_grades", $gradeobj, false); Index: version.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** version.php 25 Sep 2003 22:14:09 -0000 1.11 --- version.php 26 Sep 2003 22:23:23 -0000 1.12 *************** *** 7,11 **** $module->version = 2003092523; // The (date) version of this module ! $module->cron = 1200; // How often should cron check this module (seconds)? ?> --- 7,11 ---- $module->version = 2003092523; // The (date) version of this module ! $module->cron = 60; // How often should cron check this module (seconds)? ?> Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** view.php 25 Sep 2003 22:14:09 -0000 1.17 --- view.php 26 Sep 2003 22:23:23 -0000 1.18 *************** *** 107,111 **** $grade->papergrade = -1; $grade->aimgrade = -1; ! $grade->aimoverride = 0; $grade->aimcomment = ""; } --- 107,111 ---- $grade->papergrade = -1; $grade->aimgrade = -1; ! $grade->aimoverride = AIMOVR_OFF; $grade->aimcomment = ""; } *************** *** 290,294 **** else print_string("notattempted", "math_assignment"); ! if ($grade->aimoverride) { echo " ("; print_string("gradeoverride", "math_assignment"); --- 290,294 ---- else print_string("notattempted", "math_assignment"); ! if ($grade->aimoverride > AIMOVR_RESET) { echo " ("; print_string("gradeoverride", "math_assignment"); *************** *** 351,355 **** $aimgrade = ""; ! if ($student->aimoverride) { $edited = "$stredited ("; $editedclose = ")"; --- 351,355 ---- $aimgrade = ""; ! if ($student->aimoverride > AIMOVR_RESET) { $edited = "$stredited ("; $editedclose = ")"; *************** *** 437,441 **** echo math_assignment_get_file_links($math_assignment, "center"); if ($hasaim) { ! if ($grade->aimoverride) { echo "<p align=\"center\">"; print_string("gradeoverridemsg", "math_assignment"); --- 437,441 ---- 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"); |
From: <ma...@us...> - 2003-09-28 02:09:09
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv21659/lang/en Modified Files: math_assignment.php Log Message: More work on emails. Emails to students can now be sent from view.php. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** math_assignment.php 25 Sep 2003 22:14:09 -0000 1.19 --- math_assignment.php 26 Sep 2003 22:23:23 -0000 1.20 *************** *** 28,31 **** --- 28,32 ---- $string['coursesettings'] = "Course Settings"; $string['defaultemailhost'] = "Default Email Host"; + $string['delaymessage'] = "You have \$a to edit it if you want to make any changes."; $string['deleteall'] = "None (set courses to use no AiM subject)"; $string['deletequery'] = "Are you sure you want to delete this server?"; *************** *** 42,45 **** --- 43,48 ---- $string['externalurl'] = "link to URL"; $string['failed'] = "Error : Could not save the changes made."; + $string['gradeemailmessage'] = "Your script has been marked and placed in the pigeonholes for collection."; + $string['gradeemailobtained'] = "You obtained"; $string['grademultiplier'] = "Grade Multiplier"; $string['gradeoverride'] = "set by teacher"; |
From: <mo...@us...> - 2003-09-28 01:10:36
|
Update of /cvsroot/aimmath/AIM/doc In directory sc8-pr-cvs1:/tmp/cvs-serv27775 Modified Files: docmenu.html Log Message: changed the link from AuthoringGuide.pdf to AuthoringTtH.html Index: docmenu.html =================================================================== RCS file: /cvsroot/aimmath/AIM/doc/docmenu.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** docmenu.html 13 Sep 2003 07:30:38 -0000 1.1 --- docmenu.html 27 Sep 2003 21:21:23 -0000 1.2 *************** *** 21,25 **** <li><a href='format.html' target="main">AIM Question Syntax</a></li> <li><a href='AuthoringPackages.html' target="main">Question Authoring Packages</a></li> ! <li><a href='AuthoringGuide.pdf' target="main">Authoring tools tutorial</a></li> <li><a href='tasks.html' target="main">Tasks for the lecturer</a></li> </ul> --- 21,25 ---- <li><a href='format.html' target="main">AIM Question Syntax</a></li> <li><a href='AuthoringPackages.html' target="main">Question Authoring Packages</a></li> ! <li><a href='AuthoringTtH.html' target="main">Authoring tools tutorial</a></li> <li><a href='tasks.html' target="main">Tasks for the lecturer</a></li> </ul> |
From: <gus...@us...> - 2003-09-28 01:05:04
|
Update of /cvsroot/aimmath/moodle/lib/t2mml In directory sc8-pr-cvs1:/tmp/cvs-serv25804/lib/t2mml Modified Files: ctop.xsl edit.php pmathml.xsl pmathmlcss.xsl Log Message: edit.php now recognizes \[ and \(. Also updated stylesheets from w3c.org Index: ctop.xsl =================================================================== RCS file: /cvsroot/aimmath/moodle/lib/t2mml/ctop.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ctop.xsl 17 Sep 2003 19:22:19 -0000 1.1 --- ctop.xsl 27 Sep 2003 09:16:32 -0000 1.2 *************** *** 1176,1181 **** <xsl:apply-templates mode="c2p" select="*[1]"/> </xsl:template> ! <xsl:template mode="c2p" match="mml:semantics[annotation-xml/@encoding='MathML-Presentation']"> ! <xsl:apply-templates mode="c2p" select="annotation-xml[@encoding='MathML-Presentation']/node()"/> </xsl:template> --- 1176,1181 ---- <xsl:apply-templates mode="c2p" select="*[1]"/> </xsl:template> ! <xsl:template mode="c2p" match="mml:semantics[mml:annotation-xml/@encoding='MathML-Presentation']"> ! <xsl:apply-templates mode="c2p" select="mml:annotation-xml[@encoding='MathML-Presentation']/node()"/> </xsl:template> Index: edit.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lib/t2mml/edit.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** edit.php 25 Sep 2003 22:12:05 -0000 1.2 --- edit.php 27 Sep 2003 09:16:32 -0000 1.3 *************** *** 73,89 **** if ((ereg(">",$b)) || ($b=="}")){ if (substr($expr,$i,1)=="/"){ ! $numerateur=strrchr(substr($expr,0,$i+2),"<"); ! $i=$i-strlen($numerateur)+1; } else { ! if ($b==">") $b=strrchr(substr($expr,0,$i+2),"<"); ! $i=$i-strlen($b)+1; ! $balisefin=$b; ! if ($b!="}") $balisedebut=str_replace("/","",$b); else $balisedebut="{"; ! $c=chercherbo($balisedebut,$balisefin,substr($expr,0,$i+1)); ! $i=$i-strlen($c.$balisedebut); ! $c=indiceexposant($c); ! if ($balisedebut!="{") $balisedebutN=$balisedebut; else $balisedebutN="<mrow>"; ! if ($balisefin!="}") $balisefinN=$balisefin; else $balisefinN="</mrow>"; ! $numerateur=$c; } $ok=true; --- 73,89 ---- if ((ereg(">",$b)) || ($b=="}")){ if (substr($expr,$i,1)=="/"){ ! $numerateur=strrchr(substr($expr,0,$i+2),"<"); ! $i=$i-strlen($numerateur)+1; } else { ! if ($b==">") $b=strrchr(substr($expr,0,$i+2),"<"); ! $i=$i-strlen($b)+1; ! $balisefin=$b; ! if ($b!="}") $balisedebut=str_replace("/","",$b); else $balisedebut="{"; ! $c=chercherbo($balisedebut,$balisefin,substr($expr,0,$i+1)); ! $i=$i-strlen($c.$balisedebut); ! $c=indiceexposant($c); ! if ($balisedebut!="{") $balisedebutN=$balisedebut; else $balisedebutN="<mrow>"; ! if ($balisefin!="}") $balisefinN=$balisefin; else $balisefinN="</mrow>"; ! $numerateur=$c; } $ok=true; *************** *** 98,117 **** $exprr=substr($exprr,strlen($balisedebut.$c.$balisefin),strlen($exprr)); if (($balisedebut=="<msup>") && (ereg("\_",$a))){ ! $baliseO="<msubsup>"; ! $baliseF="</msubsup>"; ! $balisedebut=""; ! $balisefin=""; } else { ! if (ereg("\_",$a)) { ! $baliseO="<msub>"; ! $baliseF="</msub>"; ! } else { ! $baliseO="<msup>"; ! $baliseF="</msup>"; ! } } $denominateur=$balisedebut.$c.$balisefin; } else $ok=false; if ($ok) { ! $exprr=$baliseO.$balisedebutN.$numerateur.$balisefinN.$denominateur.$baliseF.$exprr; $a=""; } else $i=$j; --- 98,117 ---- $exprr=substr($exprr,strlen($balisedebut.$c.$balisefin),strlen($exprr)); if (($balisedebut=="<msup>") && (ereg("\_",$a))){ ! $baliseO="<msubsup>"; ! $baliseF="</msubsup>"; ! $balisedebut=""; ! $balisefin=""; } else { ! if (ereg("\_",$a)) { ! $baliseO="<msub>"; ! $baliseF="</msub>"; ! } else { ! $baliseO="<msup>"; ! $baliseF="</msup>"; ! } } $denominateur=$balisedebut.$c.$balisefin; } else $ok=false; if ($ok) { ! $exprr=$baliseO.$balisedebutN.$numerateur.$balisefinN.$denominateur.$baliseF.$exprr; $a=""; } else $i=$j; *************** *** 204,220 **** $c=strrchr(substr($expr,0,$i+2),"<"); if ((!(ereg("<mo",$c))) || (!($c))) { ! $i=$i-strlen($b)+1; ! if (($commande!="sqrt") && ($commande!="frac")) { ! $exprr="<mo>&#".$commande.";</mo>".$exprr; ! } else ! $exprr="\\".$commande."".$exprr; } else { ! $exprr=str_replace("\\".$commande,"&#".$commande.";",$c).$exprr; ! // echo "c=$c\n"; ! //echo "exprr=$exprr\n"; ! $i=$i-strlen($c)+1; ! //$a=substr($expr,$i,1); ! //echo "a=$a\n"; ! //$a=""; } $a=""; --- 204,220 ---- $c=strrchr(substr($expr,0,$i+2),"<"); if ((!(ereg("<mo",$c))) || (!($c))) { ! $i=$i-strlen($b)+1; ! if (($commande!="sqrt") && ($commande!="frac")) { ! $exprr="<mo>&#".$commande.";</mo>".$exprr; ! } else ! $exprr="\\".$commande."".$exprr; } else { ! $exprr=str_replace("\\".$commande,"&#".$commande.";",$c).$exprr; ! // echo "c=$c\n"; ! //echo "exprr=$exprr\n"; ! $i=$i-strlen($c)+1; ! //$a=substr($expr,$i,1); ! //echo "a=$a\n"; ! //$a=""; } $a=""; *************** *** 336,339 **** --- 336,342 ---- $message=preg_replace("/(\\$){2}([^$]+)(\\$){2}/e","'<div align=\"center\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mstyle displaystyle=\"true\">'.editermaths(\"$2\").'</mstyle></math></div>'",$message); $message=preg_replace("/(\\$){1}([^$]+)(\\$){1}/e","'<math xmlns=\"http://www.w3.org/1998/Math/MathML\">'.editermaths(\"$2\").'</math>'",$message); + $message=preg_replace("/(\\\\\[)([^$]+)(\\\\\])/e","'<div align=\"center\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><mstyle displaystyle=\"true\">'.editermaths(\"$2\").'</mstyle></math></div>'",$message); + $message=preg_replace("/(\\\\\()([^$]+)(\\\\\))/e","'<math xmlns=\"http://www.w3.org/1998/Math/MathML\">'.editermaths(\"$2\").'</math>'",$message); + $fflag++; } Index: pmathml.xsl =================================================================== RCS file: /cvsroot/aimmath/moodle/lib/t2mml/pmathml.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pmathml.xsl 17 Sep 2003 19:22:19 -0000 1.1 --- pmathml.xsl 27 Sep 2003 09:16:32 -0000 1.2 *************** *** 48,53 **** <fns:x name="css" o="Microsoft.FreeThreadedXMLDOM"> ! <script for="window" event="onload"> var xsl = new ActiveXObject("Microsoft.FreeThreadedXMLDOM"); xsl.async = false; --- 48,57 ---- + <!-- SCRIPT not script due to weird mozilla bug + http://bugzilla.mozilla.org/show_bug.cgi?id=158457 + --> + <fns:x name="css" o="Microsoft.FreeThreadedXMLDOM"> ! <SCRIPT for="window" event="onload"> var xsl = new ActiveXObject("Microsoft.FreeThreadedXMLDOM"); xsl.async = false; *************** *** 65,69 **** var newDoc = document.open("text/html", repl); newDoc.write(str); ! </script> </fns:x> --- 69,73 ---- var newDoc = document.open("text/html", repl); newDoc.write(str); ! </SCRIPT> </fns:x> *************** *** 194,203 **** <fns:x name="techexplorer-plugin" >techexplorer-plugin</fns:x> ! <xsl:variable name="docpref" select="document('')/*/fns:x[@name=current()/*/@fns:renderer][1]"/> <xsl:param name="activex"> <xsl:choose> ! <xsl:when test="$docpref='techexplorer-plugin'">techexplorer-plugin</xsl:when> <xsl:when test="system-property('xsl:vendor')!='Microsoft'"/> <xsl:when test="$docpref='mathplayer-dl'">mathplayer-dl</xsl:when> <xsl:when test="$docpref and fns:isinstalled(string($docpref/@o))='true'"> --- 198,212 ---- <fns:x name="techexplorer-plugin" >techexplorer-plugin</fns:x> ! <xsl:variable name="root" select="/"/> ! ! <xsl:param name="activex"> <xsl:choose> ! <xsl:when test="/*/@fns:renderer='techexplorer-plugin'">techexplorer-plugin</xsl:when> <xsl:when test="system-property('xsl:vendor')!='Microsoft'"/> + <xsl:otherwise> + <xsl:variable name="docpref" select="document('')/*/fns:x[@name=$root/*/@fns:renderer][1]"/> + <xsl:choose> <xsl:when test="$docpref='mathplayer-dl'">mathplayer-dl</xsl:when> <xsl:when test="$docpref and fns:isinstalled(string($docpref/@o))='true'"> *************** *** 208,211 **** --- 217,222 ---- </xsl:otherwise> </xsl:choose> + </xsl:otherwise> + </xsl:choose> </xsl:param> *************** *** 318,324 **** <xsl:when doc:id="mp" test="$activex='mathplayer-dl'"> <xsl:if test="fns:isinstalled('MathPlayer.Factory.1')='false'"> ! <script for="window" event="onload"> <xsl:value-of select="$mpdialog" disable-output-escaping="yes"/> ! </script> </xsl:if> <xsl:copy-of select="document('')/*/fns:x[@name='mathplayer']"/> --- 329,335 ---- <xsl:when doc:id="mp" test="$activex='mathplayer-dl'"> <xsl:if test="fns:isinstalled('MathPlayer.Factory.1')='false'"> ! <SCRIPT for="window" event="onload"> <xsl:value-of select="$mpdialog" disable-output-escaping="yes"/> ! </SCRIPT> </xsl:if> <xsl:copy-of select="document('')/*/fns:x[@name='mathplayer']"/> *************** *** 354,357 **** --- 365,372 ---- + <!-- squash annotation elements --> + + + <h:p>Somewhat bizarrely in an otherwise namespace aware system, Microsoft behaviours are defined to trigger off the *************** *** 367,370 **** --- 382,403 ---- </xsl:template> + <h:p>Copy semantics element through in IE (so mathplayer gets to see + mathplayer annotations, otherwise use first child or a presentation annotation.</h:p> + <xsl:template match="mml:semantics"> + <xsl:choose> + <xsl:when test="system-property('xsl:vendor')='Microsoft'"> + <xsl:element name="mml:{local-name(.)}"> + <xsl:copy-of select="@*"/> + <xsl:apply-templates/> + </xsl:element> + </xsl:when> + <xsl:when test="mml:annotation-xml[@encoding='MathML-Presentation']"> + <xsl:apply-templates select="mml:annotation-xml[@encoding='MathML-Presentation']/node()"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*[1]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <!-- a version of my old verb.xsl --> Index: pmathmlcss.xsl =================================================================== RCS file: /cvsroot/aimmath/moodle/lib/t2mml/pmathmlcss.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 |