Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv11051/mod/math_assignment
Modified Files:
aimpage.php
Log Message:
Implemented links to change between html and xml + mathml
Index: aimpage.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** aimpage.php 16 Sep 2003 11:44:44 -0000 1.5
--- aimpage.php 16 Sep 2003 17:05:37 -0000 1.6
***************
*** 14,23 ****
optional_variable($q); // quiz ID
optional_variable($aimaction); // action to get AiM to perform
- optional_variable($output, "html"); // output type (html, xml)
-
- if (strcasecmp($output, "xml") == 0)
- $usexml = function_exists('editer');
- else
- $usexml = false;
if (! $site = get_site()) {
--- 14,17 ----
***************
*** 108,112 ****
--- 102,127 ----
}
}
+ // 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'];
+ }
+ }
+ }
+ }
+
+ // get output option from cookie
+ if (function_exists('editer')) {
+ if (array_key_exists("output", $_COOKIE))
+ $usexml = (strcasecmp($_COOKIE['output'], "xml") == 0);
+ else
+ $usexml = $CFG->math_assignment_default_latex_output ? true : false;
}
+ else
+ $usexml = false;
// Print the page header
***************
*** 162,165 ****
--- 177,201 ----
$data = math_assignment_get_aim_output($server->address, $postdata, $usexml ? "latex" : "html");
}
+ }
+
+ // print output problems box
+ if (function_exists('editer')) {
+ echo "<center>";
+ print_simple_box_start();
+ echo "<p align=\"center\">";
+ print_string("outputprobs", "math_assignment");
+ echo " ";
+ print_string($usexml ? "mathml" : "html", "math_assignment");
+ echo ".<br />\n";
+ echo "<form name=\"output_change\" action=\"aimpage.php?id=$cm->id\" method=\"post\">\n";
+ echo "<input type=\"hidden\" name=\"outputchange\" value=\"" . ($usexml ? "html" : "xml") . "\" />\n";
+ echo "<input type=\"hidden\" name=\"postdata\" value=\"" . htmlspecialchars($postdata) . "\" />\n";
+ echo "<a href=\"javascript:document.output_change.submit();\">";
+ print_string("outputchange", "math_assignment");
+ echo " ";
+ print_string($usexml ? "html" : "mathml", "math_assignment");
+ echo "</a>.\n</form></p>\n";
+ print_simple_box_end();
+ echo "</center>\n";
}
|