Skip to content

Commit

Permalink
Expression image now links to TeX source or debug script
Browse files Browse the repository at this point in the history
  • Loading branch information
fiedorow committed Mar 27, 2004
1 parent 69e8e98 commit d633b4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions filter/algebra/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,20 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width=""
$width = "width=\"$width\"";
}
if ($imagefile) {
if (!file_exists("$CFG->dataroot/$CFG->algebrafilterdir/$imagefile") && isadmin()) {
$output .= "<a href=\"$CFG->wwwroot/$CFG->algebrafilterdir/algebradebug.php\">";
} else {
$output .= "<a href=\"javascript:prompt('The TeX code used to generate this formula is:','";
$output .= preg_replace('/(\\\)/',"\$1\$1",$tex) . "')\">";
}
$output .= "<img border=\"0\" $title $height $width src=\"";
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= "$CFG->wwwroot/$CFG->algebrafilterdir/pix.php/$imagefile";
} else {
$output .= "$CFG->wwwroot/$CFG->algebrafilterdir/pix.php?file=$imagefile";
}
$output .= "\" />";
$output .= "</a>";
} else {
$output .= "Error: must pass URL or course";
}
Expand Down
7 changes: 7 additions & 0 deletions filter/tex/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,20 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="") {
$width = "width=\"$width\"";
}
if ($imagefile) {
if (!file_exists("$CFG->dataroot/$CFG->texfilterdir/$imagefile") && isadmin()) {
$output .= "<a href=\"$CFG->wwwroot/$CFG->texfilterdir/texdebug.php\">";
} else {
$output .= "<a href=\"javascript:prompt('The TeX code used to generate this formula is:','";
$output .= preg_replace('/(\\\)/',"\$1\$1",$tex) . "')\">";
}
$output .= "<img border=\"0\" $title $height $width src=\"";
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= "$CFG->wwwroot/$CFG->texfilterdir/pix.php/$imagefile";
} else {
$output .= "$CFG->wwwroot/$CFG->texfilterdir/pix.php?file=$imagefile";
}
$output .= "\" />";
$output .= "</a>";
} else {
$output .= "Error: must pass URL or course";
}
Expand Down

0 comments on commit d633b4e

Please sign in to comment.