Skip to content

Commit

Permalink
MDL-62640 filter_algebra: Adjust code for slashargument removal
Browse files Browse the repository at this point in the history
  • Loading branch information
meirzamoodle committed Sep 25, 2024
1 parent 83f6d35 commit 5da47d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
27 changes: 2 additions & 25 deletions filter/algebra/algebradebug.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@
$output = algebra2tex($algebra);
$output = refineTeX($output);
}
if ($action == 'ShowImage'|| $action == 'SlashArguments') {
if ($action == 'ShowImage') {
$output = algebra2tex($algebra);
$output = refineTeX($output);
if ($action == 'ShowImage') {
tex2image($output, $md5);
} else {
slasharguments($output, $md5);
}
tex2image($output, $md5);
} else {
outputText($output);
}
Expand Down Expand Up @@ -252,23 +248,6 @@ function tex2image($texexp, $md5, $return=false) {
}
}

function slasharguments($texexp, $md5) {
global $CFG;
$admin = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=http';
$image = tex2image($texexp,$md5,true);
echo "<p>If the following image displays correctly, set your ";
echo "<a href=\"$admin\" target=\"_blank\">Administration->Server->HTTP</a> ";
echo "setting for slasharguments to file.php/1/pic.jpg: ";
echo "<img src=\"pix.php/$image\" align=\"absmiddle\"></p>\n";
echo "<p>Otherwise set it to file.php?file=/1/pic.jpg ";
echo "It should display correctly as ";
echo "<img src=\"pix.php?file=$image\" align=\"absmiddle\"></p>\n";
echo "<p>If neither equation image displays correctly, please seek ";
echo "further help at moodle.org at the ";
echo "<a href=\"http://moodle.org/mod/forum/view.php?id=752&loginguest=true\" target=\"_blank\">";
echo "Mathematics Tools Forum</a></p>";
}

?>

<html>
Expand All @@ -294,8 +273,6 @@ function slasharguments($texexp, $md5) {
A more refined translation into TeX will appear in the box below.</li>
<li>Then click on this button <button type="submit" name="action" value="ShowImage">Show Image</button>
to show a graphic image of the algebraic expression.</li>
<li>Finally check your slash arguments setting
<button type="submit" name="action" value="SlashArguments">Check Slash Arguments</button></li>
</ol>
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
</form> <br /> <br />
Expand Down
7 changes: 1 addition & 6 deletions filter/algebra/classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,7 @@ protected function get_image_markup(
$anchorcontents = '';
if ($imagefile) {
$anchorcontents .= "<img $title alt=\"" . s($tex) . "\" src=\"";
if ($CFG->slasharguments) {
// Use this method if possible for better caching.
$anchorcontents .= "$CFG->wwwroot/filter/algebra/pix.php/$imagefile";
} else {
$anchorcontents .= "$CFG->wwwroot/filter/algebra/pix.php?file=$imagefile";
}
$anchorcontents .= "$CFG->wwwroot/filter/algebra/pix.php/$imagefile";
$anchorcontents .= "\" $style />";

$imagefound = file_exists("$CFG->dataroot/filter/algebra/$imagefile");
Expand Down

0 comments on commit 5da47d5

Please sign in to comment.