Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

replaced js alert by popup

  • Loading branch information...
commit 30fc04e4e861e21a67880cd6ac296db018b65883 1 parent 9998c70
fiedorow authored
View
9 filter/algebra/filter.php
@@ -41,7 +41,7 @@
/// Edit these lines to correspond to your installation
// File path to the directory where mathml_filter.php resides
$CFG->algebrafilterdir = "filter/algebra";
-
+ $CFG->texfilterdir = "filter/tex";
/// These lines are important - the variable must match the name
/// of the actual function below
@@ -76,8 +76,11 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width=""
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 .= "<a target=\"popup\" title=\"TeX\" href=";
+ $output .= "\"$CFG->wwwroot/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "\" onClick=\"return openpopup('/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,";
+ $output .= "resizable,width=300,height=240', 0);\">";
}
$output .= "<img border=\"0\" $title $height $width src=\"";
if ($CFG->slasharguments) { // Use this method if possible for better caching
View
9 filter/tex/displaytex.php
@@ -0,0 +1,9 @@
+<html>
+<head><title>TeX Source</title></head>
+<body bgcolor="#FFFFFF">
+<?PHP
+ $texexp = urldecode($_SERVER['QUERY_STRING']);
+ echo "$texexp\n";
+?>
+</body>
+</html>
View
8 filter/tex/filter.php
@@ -71,8 +71,11 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="") {
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 .= "<a target=\"popup\" title=\"TeX\" href=";
+ $output .= "\"$CFG->wwwroot/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "\" onClick=\"return openpopup('/$CFG->texfilterdir/displaytex.php?";
+ $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,";
+ $output .= "resizable,width=300,height=240', 0);\">";
}
$output .= "<img border=\"0\" $title $height $width src=\"";
if ($CFG->slasharguments) { // Use this method if possible for better caching
@@ -125,7 +128,6 @@ function tex_filter ($courseid, $text) {
// <tex> TeX expression </tex>
// or $$ TeX expression $$
-
preg_match_all('/<tex>(.+?)<\/tex>|\$\$(.+?)\$\$/is', $text, $matches);
for ($i=0; $i<count($matches[0]); $i++) {
$texexp = $matches[1][$i] . $matches[2][$i];
Please sign in to comment.
Something went wrong with that request. Please try again.