version 1.11, 2001/12/20 20:24:36
|
version 1.12, 2001/12/20 22:36:35
|
Line 34 use Apache::File;
|
Line 34 use Apache::File;
|
use Apache::response; |
use Apache::response; |
use Apache::lonxml; |
use Apache::lonxml; |
|
|
use Digest::MD5 qw(md5 md5_hex md5_base64); |
use Digest::MD5 qw(md5_base64); |
|
|
sub BEGIN { |
sub BEGIN { |
&Apache::lonxml::register('Apache::lonplot',('plot')); |
&Apache::lonxml::register('Apache::lonplot',('plot')); |
Line 158 sub end_plot {
|
Line 158 sub end_plot {
|
## Determine filename -- Need to use the 'id' thingy that Gerd |
## Determine filename -- Need to use the 'id' thingy that Gerd |
## mentioned. |
## mentioned. |
my $tmpdir = '/home/httpd/perl/tmp/'; |
my $tmpdir = '/home/httpd/perl/tmp/'; |
my $filename = $tmpdir.$ENV{'user.name'}.'_'.$ENV{'user.domain'}. |
my $filename = $ENV{'user.name'}.'_'.$ENV{'user.domain'}. |
'_plot.data'; |
'_plot.data'; |
my $usersees=md5_base64($filename.'_'.$ENV{'REMOTE_ADDR'}); |
|
|
|
## Write the plot description to the file |
## Write the plot description to the file |
my $fh=Apache::File->new('/home/httpd/perl/tmp/'.$filename); |
my $fh=Apache::File->new(">$tmpdir$filename"); |
$result .= '<pre>'; |
$result .= '<pre>'; |
$result .= &write_gnuplot_file($fh); |
$result .= $filename.$/; |
|
print $fh &write_gnuplot_file(); |
$result .= '</pre>'.$/; |
$result .= '</pre>'.$/; |
## return image tag for the plot |
## return image tag for the plot |
$result .= '<img src="/cgi-bin/plot.cgi?'.$usersees.'"/>'; |
$result .= <<"ENDIMAGE"; |
|
<img src = "/cgi-bin/plot.gif?$filename" |
|
alt = "/cgi-bin/plot.gif?$filename" /> |
|
ENDIMAGE |
} |
} |
return $result; |
return $result; |
} |
} |
Line 419 sub get_attributes{
|
Line 421 sub get_attributes{
|
} |
} |
|
|
sub write_gnuplot_file { |
sub write_gnuplot_file { |
my $fh = shift; |
|
my $gnuplot_input = ''; |
my $gnuplot_input = ''; |
my $curve; |
my $curve; |
# Collect all the colors |
# Collect all the colors |
Line 500 ENDLABELS
|
Line 501 ENDLABELS
|
} |
} |
$gnuplot_input .= $/.$datatext; |
$gnuplot_input .= $/.$datatext; |
return $gnuplot_input; |
return $gnuplot_input; |
# print $fh $gnuplot_input; |
|
} |
} |
|
|
1; |
1; |