--- loncom/xml/lonplot.pm	2002/03/22 16:56:37	1.62
+++ loncom/xml/lonplot.pm	2002/04/24 16:38:40	1.66
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.62 2002/03/22 16:56:37 matthew Exp $
+# $Id: lonplot.pm,v 1.66 2002/04/24 16:38:40 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,7 +112,7 @@ my $words_test     = sub {$_[0]=~s/\s+/
 ##                                                               ##
 ###################################################################
 my @gnuplot_edit_order = 
-    qw/bgcolor fgcolor height width font transparent grid border align/;
+    qw/alttag bgcolor fgcolor height width font transparent grid border align/;
 
 my $gnuplot_help_text = <<"ENDPLOTHELP";
 <p>
@@ -148,15 +148,22 @@ ENDPLOTHELP
 
 my %gnuplot_defaults = 
     (
+     alttag       => {
+	 default     => 'dynamically generated plot',
+	 test        => $words_test,
+	 description => 'brief description of the plot',
+      	 edit_type   => 'entry',
+	 size        => '40'
+	 },
      height       => {
-	 default     => 200,
+	 default     => 300,
 	 test        => $int_test,
 	 description => 'height of image (pixels)',
       	 edit_type   => 'entry',
 	 size        => '10'
 	 },
      width        => {
-	 default     => 200,
+	 default     => 400,
 	 test        => $int_test,
 	 description => 'width of image (pixels)',
 	 edit_type   => 'entry',
@@ -183,7 +190,7 @@ my %gnuplot_defaults =
 	 edit_type   => 'onoff'
 	 },
      grid         => {
-	 default     => 'off',
+	 default     => 'on',
 	 test        => $onoff_test, 
 	 description => 'Display grid',
 	 edit_type   => 'onoff'
@@ -202,7 +209,7 @@ my %gnuplot_defaults =
 	 choices     => ['small','medium','large']
 	 },
      align        => {
-	 default     => 'left',
+	 default     => 'center',
 	 test        => sub {$_[0]=~/^(left|right|center)$/},
 	 description => 'alignment for image in html',
 	 edit_type   => 'choice',
@@ -299,6 +306,7 @@ my %tic_defaults =
 	 },
      );
 
+my @axis_edit_order = ('color','xmin','xmax','ymin','ymax');
 my %axis_defaults = 
     (
      color   => {
@@ -484,10 +492,10 @@ sub end_gnuplot {
 	if ($target eq 'web') {
 	    $result .= <<"ENDIMAGE";
 <img src    = "/cgi-bin/plot.gif?file=$filename&output=gif" 
-     width  = "$plot{'width'}" 
+     width  = "$plot{'width'}"
      height = "$plot{'height'}"
      align  = "$plot{'align'}"
-     alt    = "image should be /cgi-bin/plot.gif?$filename" />
+     alt    = "$plot{'alttag'}" />
 ENDIMAGE
         } elsif ($target eq 'tex') {
 	    &Apache::lonnet::ssi('cgi-bin/plot.gif?file=$filename'.
@@ -610,7 +618,7 @@ sub start_title {
 	my $text=&Apache::lonxml::get_all_text("/title",$$parser[-1]);
 	$result.=&Apache::edit::end_row().
 	    &Apache::edit::start_spanning_row().
-	    &Apache::edit::textfield('',$text,'',60);
+	    &Apache::edit::editline('',$text,'',60);
     } elsif ($target eq 'modified') {
 	my $text=$$parser[-1]->get_text("/title");
 	$result.=&Apache::edit::rebuild_tag($token);
@@ -644,7 +652,7 @@ sub start_xlabel {
 	my $text=&Apache::lonxml::get_all_text("/xlabel",$$parser[-1]);
 	$result.=&Apache::edit::end_row().
 	    &Apache::edit::start_spanning_row().
-	    &Apache::edit::textfield('',$text,'',60);
+	    &Apache::edit::editline('',$text,'',60);
     } elsif ($target eq 'modified') {
 	my $text=$$parser[-1]->get_text("/xlabel");
 	$result.=&Apache::edit::rebuild_tag($token);	
@@ -679,7 +687,7 @@ sub start_ylabel {
 	my $text = &Apache::lonxml::get_all_text("/ylabel",$$parser[-1]);
 	$result .= &Apache::edit::end_row().
 	    &Apache::edit::start_spanning_row().
-	    &Apache::edit::textfield('',$text,'',60);
+	    &Apache::edit::editline('',$text,'',60);
     } elsif ($target eq 'modified') {
 	my $text=$$parser[-1]->get_text("/ylabel");
 	$result.=&Apache::edit::rebuild_tag($token);
@@ -718,7 +726,7 @@ sub start_label {
 	my $text = &Apache::lonxml::get_all_text("/label",$$parser[-1]);
 	$result .= &Apache::edit::end_row().
 	    &Apache::edit::start_spanning_row().
-	    &Apache::edit::textfield('',$text,'',60);
+	    &Apache::edit::editline('',$text,'',60);
     } elsif ($target eq 'modified') {
 	&Apache::edit::get_new_args
 	    ($token,$parstack,$safeeval,keys(%label_defaults));
@@ -795,7 +803,7 @@ sub start_function {
 	my $text = &Apache::lonxml::get_all_text("/function",$$parser[-1]);
 	$result .= &Apache::edit::end_row().
 	    &Apache::edit::start_spanning_row().
-	    &Apache::edit::textfield('',$text,'',60);
+	    &Apache::edit::editline('',$text,'',60);
     } elsif ($target eq 'modified') {
 	$result.=&Apache::edit::rebuild_tag($token);
 	my $text=$$parser[-1]->get_text("/function");
@@ -871,7 +879,7 @@ sub start_data {
 	my $text = &Apache::lonxml::get_all_text("/data",$$parser[-1]);
 	$result .= &Apache::edit::end_row().
 	    &Apache::edit::start_spanning_row().
-	    &Apache::edit::textfield('',$text,'',60);
+	    &Apache::edit::editline('',$text,'',60);
     } elsif ($target eq 'modified') {
 	$result.=&Apache::edit::rebuild_tag($token);
 	my $text=$$parser[-1]->get_text("/data");
@@ -899,7 +907,8 @@ sub start_axis {
 			$tagstack->[-1]);
     } elsif ($target eq 'edit') {
 	$result .= &Apache::edit::tag_start($target,$token,'Plot Axes');
-	$result .= &edit_attributes($target,$token,\%axis_defaults);
+	$result .= &edit_attributes($target,$token,\%axis_defaults,
+				    \@axis_edit_order);
     } elsif ($target eq 'modified') {
 	my $constructtag=&Apache::edit::get_new_args
 	    ($token,$parstack,$safeeval,keys(%axis_defaults));
@@ -983,7 +992,7 @@ sub write_gnuplot_file {
 	$gnuplot_input .= "set output\n";
     } elsif ($target eq 'tex') {
 	$gnuplot_input .= "set term postscript eps monochrome\n";
-	$gnuplot_input .= "set output \"$filename.eps\"\n";
+	$gnuplot_input .= "set output \"/home/httpd/perl/tmp/$filename.eps\"\n";
     }
     # grid
     $gnuplot_input .= 'set grid'.$/ if ($plot{'grid'} eq 'on');