]> git.mjollnir.org Git - moodle.git/commitdiff
replaced js alert by popup
authorfiedorow <fiedorow>
Sun, 28 Mar 2004 22:35:49 +0000 (22:35 +0000)
committerfiedorow <fiedorow>
Sun, 28 Mar 2004 22:35:49 +0000 (22:35 +0000)
filter/algebra/filter.php
filter/tex/displaytex.php [new file with mode: 0644]
filter/tex/filter.php

index f8dbe85d1fa67afbcb0d01fb0a1f79835874996a..c38cda28a08df887f37b4c2ba176d9a2dd3dd902 100644 (file)
@@ -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
diff --git a/filter/tex/displaytex.php b/filter/tex/displaytex.php
new file mode 100644 (file)
index 0000000..1a13d1c
--- /dev/null
@@ -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>
index 906e1068e500b18c3e2b617b69b8d0cf2ffeddf1..67c67e7ba705f7abe1aafd94cc3d84e711e3ff0d 100644 (file)
@@ -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];