Skip to content

Commit

Permalink
replaced js alert by popup
Browse files Browse the repository at this point in the history
  • Loading branch information
fiedorow committed Mar 28, 2004
1 parent 9998c70 commit 30fc04e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 6 additions & 3 deletions filter/algebra/filter.php
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions 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>
8 changes: 5 additions & 3 deletions filter/tex/filter.php
Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 30fc04e

Please sign in to comment.