[LON-CAPA-cvs] cvs: loncom /cgi plot.gif

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 24 Sep 2003 21:15:55 -0000


matthew		Wed Sep 24 17:15:55 2003 EDT

  Modified files:              
    /loncom/cgi	plot.gif 
  Log:
  Emit proper html headers for eps output.
  
  
Index: loncom/cgi/plot.gif
diff -u loncom/cgi/plot.gif:1.9 loncom/cgi/plot.gif:1.10
--- loncom/cgi/plot.gif:1.9	Fri Mar  1 09:03:50 2002
+++ loncom/cgi/plot.gif	Wed Sep 24 17:15:55 2003
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: plot.gif,v 1.9 2002/03/01 14:03:50 matthew Exp $
+# $Id: plot.gif,v 1.10 2003/09/24 21:15:55 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,22 @@
 	print;
     }
 } elsif ($output eq 'eps') {
-    system ("gnuplot $filename");
+    print <<"END";
+Content-type: text/html
+
+<html><head><title>eps plot creation</title></head>
+<body>
+<h2>Creating eps plot</h2>
+
+END
+    if (! system ("gnuplot $filename")) {
+        print "<h2>An error occured.</h2>\n".
+            "I am not going to tell you about it as I have not bothered ".
+            "to figure out how to get you the error text.\n";
+    } else {
+        print "<h2>EPS file generated successfully.</h2>\n";
+    }
+    print "</body></html>\n";
 } else {
     die "output $output is not a recognized value or has no value\n";
 }