]> git.mjollnir.org Git - moodle.git/commitdiff
Expression image now links to TeX source or debug script
authorfiedorow <fiedorow>
Sat, 27 Mar 2004 18:33:30 +0000 (18:33 +0000)
committerfiedorow <fiedorow>
Sat, 27 Mar 2004 18:33:30 +0000 (18:33 +0000)
filter/algebra/filter.php
filter/tex/filter.php

index 8e82deb706d2729dc1ab7c7c5b283a5011af345f..f8dbe85d1fa67afbcb0d01fb0a1f79835874996a 100644 (file)
@@ -73,6 +73,12 @@ 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";
@@ -80,6 +86,7 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width=""
       $output .= "$CFG->wwwroot/$CFG->algebrafilterdir/pix.php?file=$imagefile";
     }
     $output .= "\" />";
+    $output .= "</a>";
   } else {
     $output .= "Error: must pass URL or course";
   }
index 72574390fd9d56b288a44da37f4bd776eed18873..906e1068e500b18c3e2b617b69b8d0cf2ffeddf1 100644 (file)
@@ -68,6 +68,12 @@ 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";
@@ -75,6 +81,7 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="") {
             $output .= "$CFG->wwwroot/$CFG->texfilterdir/pix.php?file=$imagefile";
         }
         $output .= "\" />";
+        $output .= "</a>";
     } else {
         $output .= "Error: must pass URL or course";
     }