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);
|