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

foxr foxr at source.lon-capa.org
Wed Feb 22 05:16:39 EST 2012


foxr		Wed Feb 22 10:16:39 2012 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  BZ874 Add fixups to colors for jpicker not inserting x's in color choosers
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.154 loncom/xml/lonplot.pm:1.155
--- loncom/xml/lonplot.pm:1.154	Mon Feb 13 11:24:16 2012
+++ loncom/xml/lonplot.pm	Wed Feb 22 10:16:39 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.154 2012/02/13 11:24:16 foxr Exp $
+# $Id: lonplot.pm,v 1.155 2012/02/22 10:16:39 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -624,7 +624,18 @@
     } elsif ($target eq 'modified') {
 	my $constructtag=&Apache::edit::get_new_args
 	    ($token,$parstack,$safeeval,keys(%gnuplot_defaults));
+
 	if ($constructtag) {
+	    #
+	    # The color chooser does not prepent x to the color values
+	    # Do that here:
+	    #
+	    foreach my $attribute ('bgcolor', 'fgcolor') {
+		my $value = $token->[2]{$attribute};
+		if (defined $value && !($value =~ /^x/)) {
+		    $token->[2]{$attribute} = 'x' . $value;
+		}
+	    }
 	    $result = &Apache::edit::rebuild_tag($token);
 	}
     }
@@ -1355,6 +1366,13 @@
 	my $constructtag=&Apache::edit::get_new_args
 	    ($token,$parstack,$safeeval,keys(%curve_defaults));
 	if ($constructtag) {
+	    #
+	    # Fix up the color attribute as jcolor does not prepend an x
+	    #
+	    my $value = $token->[2]{'color'};
+	    if (defined $value && !($value =~ /^x/)) {
+		$token->[2]{'color'} = 'x' . $value;
+	    }
 	    $result = &Apache::edit::rebuild_tag($token);
 	}
     }
@@ -1501,7 +1519,17 @@
     } elsif ($target eq 'modified') {
 	my $constructtag=&Apache::edit::get_new_args
 	    ($token,$parstack,$safeeval,keys(%axis_defaults));
+
 	if ($constructtag) {
+	    #
+	    #  Fix up the color attribute since jchooser does not
+	    #  prepend an x to the color:
+	    #
+	    my $value = $token->[2]{'color'};
+	    if (defined $value && !($value =~ /^x/)) {
+		$token->[2]{'color'} = 'x' . $value;
+	    }
+
 	    $result = &Apache::edit::rebuild_tag($token);
 	}
     }
@@ -1594,6 +1622,7 @@
 		       $curve->{'color'}       : 
 		       $Apache::lonplot::plot{'fgcolor'}        );
     }
+    
     # set term
     if ($target eq 'web') {
 	$gnuplot_input .= 'set terminal png enhanced nocrop ';




More information about the LON-CAPA-cvs mailing list