version 1.152.6.1, 2014/07/09 15:17:32
|
version 1.154, 2012/02/13 11:24:16
|
Line 176 my %gnuplot_defaults =
|
Line 176 my %gnuplot_defaults =
|
test => $color_test, |
test => $color_test, |
description => 'Background color of image (xffffff)', |
description => 'Background color of image (xffffff)', |
edit_type => 'entry', |
edit_type => 'entry', |
size => '10' |
size => '10', |
|
class => 'colorchooser' |
}, |
}, |
fgcolor => { |
fgcolor => { |
default => 'x000000', |
default => 'x000000', |
test => $color_test, |
test => $color_test, |
description => 'Foreground color of image (x000000)', |
description => 'Foreground color of image (x000000)', |
edit_type => 'entry', |
edit_type => 'entry', |
size => '10' |
size => '10', |
|
class => 'colorchooser' |
}, |
}, |
transparent => { |
transparent => { |
default => 'off', |
default => 'off', |
Line 463 my %axis_defaults =
|
Line 465 my %axis_defaults =
|
test => $color_test, |
test => $color_test, |
description => 'Color of grid lines (x000000)', |
description => 'Color of grid lines (x000000)', |
edit_type => 'entry', |
edit_type => 'entry', |
size => '10' |
size => '10', |
|
class => 'colorchooser' |
}, |
}, |
xmin => { |
xmin => { |
default => '-10.0', |
default => '-10.0', |
Line 534 my %curve_defaults =
|
Line 537 my %curve_defaults =
|
test => $color_test, |
test => $color_test, |
description => 'Color of curve (x000000)', |
description => 'Color of curve (x000000)', |
edit_type => 'entry', |
edit_type => 'entry', |
size => '10' |
size => '10', |
|
class => 'colorchooser' |
}, |
}, |
name => { |
name => { |
default => '', |
default => '', |
Line 634 sub end_gnuplot {
|
Line 638 sub end_gnuplot {
|
('title','xlabel','ylabel','key','axis','label','curve')); |
('title','xlabel','ylabel','key','axis','label','curve')); |
my $result = ''; |
my $result = ''; |
my $randnumber; |
my $randnumber; |
|
my $tmpdir =LONCAPA::tempdir(); # Where temporary files live: |
|
|
# need to call rand everytime start_script would evaluate, as the |
# need to call rand everytime start_script would evaluate, as the |
# safe space rand number generator and the global rand generator |
# safe space rand number generator and the global rand generator |
# are not separate |
# are not separate |
Line 645 sub end_gnuplot {
|
Line 651 sub end_gnuplot {
|
&check_inputs(); # Make sure we have all the data we need |
&check_inputs(); # Make sure we have all the data we need |
## |
## |
## Determine filename |
## Determine filename |
my $tmpdir = '/home/httpd/perl/tmp/'; |
|
my $filename = $env{'user.name'}.'_'.$env{'user.domain'}. |
my $filename = $env{'user.name'}.'_'.$env{'user.domain'}. |
'_'.time.'_'.$$.$randnumber.'_plot'; |
'_'.time.'_'.$$.$randnumber.'_plot'; |
## Write the plot description to the file |
## Write the plot description to the file |
Line 666 ENDIMAGE
|
Line 671 ENDIMAGE
|
#might be inside the safe space, register the URL for later |
#might be inside the safe space, register the URL for later |
&Apache::lonxml::register_ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps"); |
&Apache::lonxml::register_ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps"); |
$result = "%DYNAMICIMAGE:$Apache::lonplot::plot{'width'}:$Apache::lonplot::plot{'height'}:$Apache::lonplot::plot{'texwidth'}\n"; |
$result = "%DYNAMICIMAGE:$Apache::lonplot::plot{'width'}:$Apache::lonplot::plot{'height'}:$Apache::lonplot::plot{'texwidth'}\n"; |
$result .= '\graphicspath{{/home/httpd/perl/tmp/}}'."\n"; |
$result .= '\graphicspath{{'.$tmpdir.'}}'."\n"; |
$result .= '\includegraphics[width='.$Apache::lonplot::plot{'texwidth'}.' mm]{'.&unescape($filename).'.eps}'; |
$result .= '\includegraphics[width='.$Apache::lonplot::plot{'texwidth'}.' mm]{'.&unescape($filename).'.eps}'; |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
Line 1609 sub write_gnuplot_file {
|
Line 1614 sub write_gnuplot_file {
|
} |
} |
$gnuplot_input .= ' "'.$font_properties->{'printname'}.'" '; |
$gnuplot_input .= ' "'.$font_properties->{'printname'}.'" '; |
$gnuplot_input .= $fontsize; |
$gnuplot_input .= $fontsize; |
$gnuplot_input .= "\nset output \"/home/httpd/perl/tmp/". |
$gnuplot_input .= "\nset output \"".$tmpdir. |
&unescape($filename).".eps\"\n"; |
&unescape($filename).".eps\"\n"; |
$gnuplot_input .= "set encoding iso_8859_1\n"; # Get access to extended font. |
$gnuplot_input .= "set encoding iso_8859_1\n"; # Get access to extended font. |
|
|
Line 1681 sub write_gnuplot_file {
|
Line 1686 sub write_gnuplot_file {
|
$gnuplot_input .= "set samples $Apache::lonplot::plot{'samples'}\n"; |
$gnuplot_input .= "set samples $Apache::lonplot::plot{'samples'}\n"; |
# title, xlabel, ylabel |
# title, xlabel, ylabel |
# titles |
# titles |
my $offset; |
my $extra_space_x = ($xtics{'location'} eq 'axis') ? ' 0, -0.5 ' : ''; |
if ($version >= 4.4) { |
my $extra_space_y = ($ytics{'location'} eq 'axis') ? ' -0.5, 0 ' : ''; |
$offset = 'offset '; |
|
} |
|
my $extra_space_x = ($xtics{'location'} eq 'axis') ? ' '.$offset.'0, -0.5 ' : ''; |
|
my $extra_space_y = ($ytics{'location'} eq 'axis') ? ' '.$offset.'-0.5, 0 ' : ''; |
|
|
|
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$gnuplot_input .= "set title \"$title\" font \"".$font_properties->{'printname'}.",".$fontsize."pt\"\n" if (defined($title)) ; |
$gnuplot_input .= "set title \"$title\" font \"".$font_properties->{'printname'}.",".$fontsize."pt\"\n" if (defined($title)) ; |
Line 1933 sub edit_attributes {
|
Line 1934 sub edit_attributes {
|
if ($defaults->{$attr}->{'edit_type'} eq 'entry') { |
if ($defaults->{$attr}->{'edit_type'} eq 'entry') { |
$result .= &Apache::edit::text_arg |
$result .= &Apache::edit::text_arg |
($description,$attr,$token, |
($description,$attr,$token, |
$defaults->{$attr}->{'size'}); |
$defaults->{$attr}->{'size'}, |
|
$defaults->{$attr}->{'class'}); |
} elsif ($defaults->{$attr}->{'edit_type'} eq 'choice') { |
} elsif ($defaults->{$attr}->{'edit_type'} eq 'choice') { |
$result .= &Apache::edit::select_or_text_arg |
$result .= &Apache::edit::select_or_text_arg |
($description,$attr,$defaults->{$attr}->{'choices'},$token); |
($description,$attr,$defaults->{$attr}->{'choices'},$token); |