version 1.28, 2002/05/17 21:53:50
|
version 1.31, 2002/05/22 21:10:42
|
Line 75 sub menu_for_output {
|
Line 75 sub menu_for_output {
|
<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence"> All problems from the top level sequence<br /> |
<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence"> All problems from the top level sequence<br /> |
<br /> |
<br /> |
ENDMENUOUT1 |
ENDMENUOUT1 |
if ($ENV{'user.adv'} eq '1') { |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
|
$subdirtoprint =~ s/\/[^\/]+$//; |
|
if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') { |
$r->print(<<ENDMENUOUT2); |
$r->print(<<ENDMENUOUT2); |
<input type="radio" name="choice" value="Subdirectory print"> All problems from particular subdirectory <input type="text" name="subdirect" value="/res/"><br /> |
<input type="radio" name="choice" value="Subdirectory print"> All problems from current subdirectory (where this particular problem is)<br /> |
ENDMENUOUT2 |
ENDMENUOUT2 |
} |
} |
$r->print(<<ENDMENUOUT3); |
$r->print(<<ENDMENUOUT3); |
<br /><hr /><br /> |
<br /><hr /><br /> |
<h1>And what page format do you prefer?</h1> |
<h1>And what page format do you prefer?</h1> |
<input type="radio" name="layout" value="CBI"> Two columns landscape <br /> |
<input type="radio" name="layout" value="CBI"> Two columns landscape <br /> |
Line 126 ENDPART
|
Line 128 ENDPART
|
$moreenv{'request.filename'}=$currequest; |
$moreenv{'request.filename'}=$currequest; |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
$result .= $texversion; |
$result .= $texversion; |
|
$result = &additional_cleanup($result); |
} elsif ($choice eq 'Standard LaTeX output for the primary sequence' or $choice eq 'Standard LaTeX output for whole primary sequence') { |
} elsif ($choice eq 'Standard LaTeX output for the primary sequence' or $choice eq 'Standard LaTeX output for whole primary sequence') { |
#-- where is the primary sequence containing file? |
#-- where is the primary sequence containing file? |
my %moreenv; |
my %moreenv; |
Line 201 ENDPART
|
Line 203 ENDPART
|
} |
} |
} |
} |
$result = &additional_cleanup($result); |
$result = &additional_cleanup($result); |
} elsif ($choice eq 'Subdirectory print') { |
} elsif ($choice eq 'Subdirectory print') { |
if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') { |
my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); |
my $locald = &Apache::lonnet::filelocation("",$subdirtoprint); |
$subdirtoprint =~ s/\/[^\/]+$//; |
unless (-e $locald) { |
my @list_of_files = (); |
#do something in the case of the absence of this subdirectory on the local mashine |
my $localdirectory = $subdirtoprint; |
#replication process |
$localdirectory =~ s/.*(\/res\/)/$1/; |
} |
my @content_directory = &Apache::lonnet::dirlist($localdirectory); |
my @list_of_files = (); |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
my @content_directory = &Apache::lonnet::dirlist($subdirtoprint); |
my @tempo_array = split(/&/,$content_directory[$iy]); |
for (my $iy=0;$iy<=$#content_directory;$iy++) { |
$content_directory[$iy] = $tempo_array[0]; |
my @tempo_array = split(/&/,$content_directory[$iy]); |
if ($content_directory[$iy] =~ m/^[^\.]+\.problem$/) { |
$content_directory[$iy] = $tempo_array[0]; |
push @list_of_files,$content_directory[$iy]; |
if ($content_directory[$iy] =~ m/\.problem$/) { |
|
push @list_of_files,$content_directory[$iy]; |
|
} |
|
} |
|
for (my $i=0;$i<=$#list_of_files;$i++) { |
|
$subdirtoprint =~ s/\/$//; |
|
my $urlp = $subdirtoprint.'/'.$list_of_files[$i]; |
|
my %moreenv; |
|
$moreenv{'form.grade_target'}='tex'; |
|
&Apache::lonnet::appenv(%moreenv); |
|
my $texversion=&Apache::lonnet::ssi($urlp); |
|
&Apache::lonnet::delenv('form.grade_target'); |
|
$texversion =~ s/(\\begin{document})/$1 {\\tiny\\begin{verbatim}$urlp\\end{verbatim}}/; |
|
$result .= $texversion; |
|
} |
} |
$result = &additional_cleanup($result); |
|
|
|
} else { |
|
#message "you not allowed to do this" |
|
} |
} |
|
$localdirectory =~ s/\/$//; |
|
for (my $i=0;$i<=$#list_of_files;$i++) { |
|
my $urlp = $localdirectory.'/'.$list_of_files[$i]; |
|
my %moreenv; |
|
$moreenv{'form.grade_target'}='tex'; |
|
&Apache::lonnet::appenv(%moreenv); |
|
my $texversion=&Apache::lonnet::ssi($urlp); |
|
&Apache::lonnet::delenv('form.grade_target'); |
|
$texversion =~ s/(\\begin{document})/$1 {\\tiny\\begin{verbatim}$urlp\\end{verbatim}}/; |
|
$result .= $texversion; |
|
} |
|
$result = &additional_cleanup($result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
} |
#-- corrections for the different page formats |
#-- corrections for the different page formats |
if ($layout eq 'CBI') { |
if ($layout eq 'CBI') { |
Line 269 ENDPART
|
Line 266 ENDPART
|
$result =~ s/{\\par }\s*\\\\/\\\\/gm; |
$result =~ s/{\\par }\s*\\\\/\\\\/gm; |
$result =~ s/\\\\\s+\[/ \[/g; |
$result =~ s/\\\\\s+\[/ \[/g; |
$result =~ s/θ/\$\\theta\$/g; #converts theta from html into tex |
$result =~ s/θ/\$\\theta\$/g; #converts theta from html into tex |
|
$result =~ s/\b_+\b/\\makebox\[1 cm\]\[b\]{\\hrulefill}/g; |
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
$filename = "/home/httpd/prtspool/$ENV{'user.name'}$ENV{'user.domain'}temp$ENV{'user.login.time'}.tex"; |
$filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex"; |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
$r->log_error("Couldn't open $filename for output $!"); |
$r->log_error("Couldn't open $filename for output $!"); |
return SERVER_ERROR; |
return SERVER_ERROR; |