--- loncom/interface/printout.pl 2003/09/01 03:30:57 1.37 +++ loncom/interface/printout.pl 2003/10/20 17:39:30 1.39 @@ -1,7 +1,7 @@ #!/usr/bin/perl # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc. # -# $Id: printout.pl,v 1.37 2003/09/01 03:30:57 albertel Exp $ +# $Id: printout.pl,v 1.39 2003/10/20 17:39:30 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,11 +26,36 @@ # http://www.lon-capa.org/ # +use lib '/home/httpd/lib/perl'; +use LONCAPA::loncgi(); +use File::Path; use IO::File; use Image::Magick; + +if (! &LONCAPA::loncgi::check_cookie_and_load_env()) { + print < +Bad Cookie + +Your cookie information is incorrect. What\'s up with that? + + +END + return; +} + print "Content-type: text/html\n\n"; print "\n"; - my ($texfile,$laystyle,$numberofcolumns,$selectionmade) = split(/&/,$ENV{'QUERY_STRING'}); +#### my ($texfile,$laystyle,$numberofcolumns,$selectionmade) = split(/&/,$ENV{'QUERY_STRING'}); + +my $identifier = $ENV{'QUERY_STRING'}; +my $texfile = $ENV{$identifier.'.file'}; +my $laystyle = $ENV{$identifier.'.layout'}; +my $numberofcolumns = $ENV{$identifier.'.numcol'}; +my $selectionmade = $ENV{$identifier.'.selection'}; + my $advans_role=0; if ($selectionmade>=10000) {$selectionmade=$selectionmade/10000; $advans_role=1;} my $figfile = $texfile; @@ -48,8 +73,11 @@ use Image::Magick; my $eps_f = $not_eps; $eps_f =~ s/\.[^.]*$/\.eps/i; $_ = $eps_f; - m/\/([^\/]+)$/; + m/\/home\/httpd\/html\/res\/(.+)/; $eps_f = '/home/httpd/prtspool/'.$1; + my $path=$eps_f; + $path=~s/\/([^\/]+)\.eps$//; + File::Path::mkpath($path,0,0777); my $image = Image::Magick->new; $not_eps =~ s/^\s+//; $not_eps =~ s/\s+$//; @@ -69,7 +97,6 @@ use Image::Magick; } } } - unlink $figfile; } #print "$texfile\n"; #name of the tex file for debugging only if (-e $texfile) {