version 1.276, 2004/02/13 21:13:21
|
version 1.278, 2004/02/17 16:24:24
|
Line 982 ENDPART
|
Line 982 ENDPART
|
$selectionmade=8; |
$selectionmade=8; |
} |
} |
my @students=split /\|\|\|/, $helper->{'VARS'}->{'STUDENTS'}; |
my @students=split /\|\|\|/, $helper->{'VARS'}->{'STUDENTS'}; |
if ($helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq '0') {$helper->{'VARS'}->{'NUMBER_TO_PRINT'}=$#students+1;} |
if ($helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq '0' || |
|
$helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq 'all' ) { |
|
$helper->{'VARS'}->{'NUMBER_TO_PRINT'}=$#students+1; |
|
} |
my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; |
my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; |
#loop over students |
#loop over students |
my $flag_latex_header_remove = 'NO'; |
my $flag_latex_header_remove = 'NO'; |
Line 1155 ENDPART
|
Line 1158 ENDPART
|
} |
} |
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex"; |
my $identifier = &Apache::loncommon::get_cgi_id(); |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".$identifier.".tex"; |
$r->log_error("Couldn't open $filename for output $!"); |
if (!($#print_array>0)) { |
return SERVER_ERROR; |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
} |
$r->log_error("Couldn't open $filename for output $!"); |
print $temp_file $result; |
return SERVER_ERROR; |
my $begin=index($result,'\begin{document}',0); |
} |
my $inc=substr($result,0,$begin+16); |
print $temp_file $result; |
if ($#print_array>0) { |
my $begin=index($result,'\begin{document}',0); |
for (my $i=1;$i<=$#print_array;$i++) { |
my $inc=substr($result,0,$begin+16); |
my $anobegin=index($print_array[$i],'\setcounter{page}',0); |
} else { |
substr($print_array[$i],0,$anobegin)=''; |
my $begin=index($result,'\begin{document}',0); |
$print_array[$i]=$inc.$print_array[$i].'\end{document}'; |
my $inc=substr($result,0,$begin+16); |
|
for (my $i=0;$i<=$#print_array;$i++) { |
|
if ($i==0) { |
|
$print_array[$i]=$result; |
|
} else { |
|
my $anobegin=index($print_array[$i],'\setcounter{page}',0); |
|
substr($print_array[$i],0,$anobegin)=''; |
|
$print_array[$i]=$inc.$print_array[$i].'\end{document}'; |
|
} |
my $temp_file; |
my $temp_file; |
my $newfilename=$filename; |
my $newfilename=$filename; |
$newfilename =~s/\.tex$/_add$i\.tex/; |
my $num=$i+1; |
|
$newfilename =~s/\.tex$/_$num\.tex/; |
unless ($temp_file = Apache::File->new('>'.$newfilename)) { |
unless ($temp_file = Apache::File->new('>'.$newfilename)) { |
$r->log_error("Couldn't open $newfilename for output $!"); |
$r->log_error("Couldn't open $newfilename for output $!"); |
return SERVER_ERROR; |
return SERVER_ERROR; |
} |
} |
print $temp_file $print_array[$i]; |
print $temp_file $print_array[$i]; |
} |
} |
|
|
} |
} |
my $student_names=''; |
my $student_names=''; |
if ($#print_array>0) { |
if ($#print_array>0) { |
for (my $i=0;$i<=$#print_array;$i++) { |
for (my $i=0;$i<=$#print_array;$i++) { |
$student_names.=$student_names[$i].'_ENDPERSON_'; |
$student_names.=$student_names[$i].'_ENDPERSON_'; |
} |
} |
|
} else { |
|
if ($#student_names>-1) { |
|
$student_names=$student_names[0].'_ENDPERSON_'; |
|
} else { |
|
my $fullname = &get_name($ENV{'user.name'},$ENV{'user.domain'}); |
|
$student_names=join(':',$ENV{'user.name'},$ENV{'user.domain'}, |
|
$ENV{'request.course.sec'},$fullname). |
|
'_ENDPERSON_'.'_END_'; |
|
} |
} |
} |
|
|
my $URLback=''; #link to original document |
my $URLback=''; #link to original document |
Line 1196 ENDPART
|
Line 1216 ENDPART
|
if ($URLback=~/([^?]+)/) {$URLback=$1;} |
if ($URLback=~/([^?]+)/) {$URLback=$1;} |
} |
} |
|
|
my $identifier = time.'_'.int(rand(1000)); |
|
&Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename, |
&Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename, |
'cgi.'.$identifier.'.layout' => $laystyle, |
'cgi.'.$identifier.'.layout' => $laystyle, |
'cgi.'.$identifier.'.numcol' => $numberofcolumns, |
'cgi.'.$identifier.'.numcol' => $numberofcolumns, |
Line 1490 CHOOSE_STUDENTS
|
Line 1509 CHOOSE_STUDENTS
|
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash->{'variable'} = 'NUMBER_TO_PRINT'; |
$paramHash->{'variable'} = 'NUMBER_TO_PRINT'; |
$helper->declareVar('NUMBER_TO_PRINT'); |
$helper->declareVar('NUMBER_TO_PRINT'); |
addMessage("<input type='text' name='NUMBER_TO_PRINT.forminput' size='3' value='0' /><hr width='33%' />"); |
addMessage("<input type='text' name='NUMBER_TO_PRINT.forminput' size='3' value='all' /><hr width='33%' />"); |
|
|
if ($helper->{VARS}->{'assignment'}) { |
if ($helper->{VARS}->{'assignment'}) { |
push @{$printChoices}, ["<b>Resources</b> from <b><i>$sequenceTitle</i></b> for <b>selected students</b>", 'resources_for_students', 'CHOOSE_STUDENTS1']; |
push @{$printChoices}, ["<b>Resources</b> from <b><i>$sequenceTitle</i></b> for <b>selected students</b>", 'resources_for_students', 'CHOOSE_STUDENTS1']; |
Line 1518 CHOOSE_STUDENTS1
|
Line 1537 CHOOSE_STUDENTS1
|
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash->{'variable'} = 'NUMBER_TO_PRINT'; |
$paramHash->{'variable'} = 'NUMBER_TO_PRINT'; |
$helper->declareVar('NUMBER_TO_PRINT'); |
$helper->declareVar('NUMBER_TO_PRINT'); |
addMessage("<input type='text' name='NUMBER_TO_PRINT.forminput' size='3' value='0' /><hr width='33%' />"); |
addMessage("<input type='text' name='NUMBER_TO_PRINT.forminput' size='3' value='all' /><hr width='33%' />"); |
} |
} |
|
|
# FIXME: That RE should come from a library somewhere. |
# FIXME: That RE should come from a library somewhere. |