[LON-CAPA-cvs] cvs: loncom /xml lonplot.pm

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 07 Jun 2005 22:30:46 -0000


foxr		Tue Jun  7 18:30:46 2005 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  In 'tex' target prefix the plot with a tex comment that tells 
  outer tags that this is a dynamic image and what the size is.
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.108 loncom/xml/lonplot.pm:1.109
--- loncom/xml/lonplot.pm:1.108	Tue May 31 18:15:32 2005
+++ loncom/xml/lonplot.pm	Tue Jun  7 18:30:42 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.108 2005/05/31 22:15:32 foxr Exp $
+# $Id: lonplot.pm,v 1.109 2005/06/07 22:30:42 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,11 +39,7 @@
 
 use vars qw/$weboutputformat $versionstring/;
 
-#
-#   This variable allows a callback to be registered
-#   if a gnuplot tag block is performed.
-#
-my $notify_callback;
+
 
 BEGIN {
     &Apache::lonxml::register('Apache::lonplot',('gnuplot'));
@@ -54,31 +50,9 @@
     if ($versionstring =~ /^gnuplot 4/) {
         $weboutputformat = 'png';
     }
-    $notify_callback = undef;
     
 }
 
-# register_callback(\&callback)
-#    Arranges for callback to be invoked on the </gnuplot>
-#    tag.
-# 
-sub register_callback {
-    $notify_callback = shift;
-}
-# clear_callback();
-#     Undefs the callback.
-#
-sub clear_callback {
-    $notify_callback = undef;
-}
-# invoke_callback()
-#     Invokes the callback if defined
-#
-sub invoke_callback {
-    if (defined $notify_callback) {
-	&$notify_callback();
-    }
-}
 
 ## 
 ## Description of data structures:
@@ -565,12 +539,13 @@
 	    &Apache::lonxml::debug(" gnuplot ht  = $Apache::lonplot::plot{'height'}");
 	    #might be inside the safe space, register the URL for later
 	    &Apache::lonxml::register_ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps");
-	    $result = '\graphicspath{{/home/httpd/perl/tmp/}}\includegraphics[width='.$Apache::lonplot::plot{'texwidth'}.' mm]{'.&Apache::lonnet::unescape($filename).'.eps}';
+	    $result  = "%DYNAMICIMAGE:$Apache::lonplot::plot{'width'}:$Apache::lonplot::plot{'height'}:$Apache::lonplot::plot{'texwidth'} \n";
+	    $result .= '\graphicspath{{/home/httpd/perl/tmp/}}'."\n";
+	    $result .= '\includegraphics[width='.$Apache::lonplot::plot{'texwidth'}.' mm]{'.&Apache::lonnet::unescape($filename).'.eps}';
 	}
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::tag_end($target,$token);
     }
-    &invoke_callback();
     return $result;
 }