version 1.428, 2006/03/08 22:32:11
|
version 1.432, 2006/03/21 18:43:49
|
Line 41 use Apache::lonnavmaps;
|
Line 41 use Apache::lonnavmaps;
|
use Apache::lonratedt; |
use Apache::lonratedt; |
use POSIX qw(strftime); |
use POSIX qw(strftime); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Carp; |
|
|
my %perm; |
my %perm; |
|
|
Line 238 sub encapsulate_minipage {
|
Line 239 sub encapsulate_minipage {
|
} |
} |
return $text; |
return $text; |
} |
} |
|
# |
|
# The NUMBER_TO_PRINT and SPLIT_PDFS |
|
# variables interact, this sub looks at these two parameters |
|
# and comes up with a final value for NUMBER_TO_PRINT which can be: |
|
# all - if SPLIT_PDFS eq 'all'. |
|
# 1 - if SPLIT_PDFS eq 'oneper' |
|
# section - if SPLIT_PDFS eq 'sections' |
|
# <unchanged> - if SPLIT_PDFS eq 'usenumber' |
|
# |
|
sub adjust_number_to_print { |
|
my $helper = shift; |
|
|
|
my $split_pdf = $helper->{'VARS'}->{'SPLIT_PDFS'}; |
|
|
|
if ($split_pdf eq 'all') { |
|
$helper->{'VARS'}->{'NUMBER_TO_PRINT'} = 'all'; |
|
} elsif ($split_pdf eq 'oneper') { |
|
$helper->{'VARS'}->{'NUMBER_TO_PRINT'} = 1; |
|
} elsif ($split_pdf eq 'sections') { |
|
$helper->{'VARS'}->{'NUMBER_TO_PRINT'} = 'section'; |
|
} elsif ($split_pdf eq 'usenumber') { |
|
# Unmodified. |
|
} else { |
|
# Error!!!! |
|
|
|
croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print"; |
|
} |
|
} |
|
|
sub character_chart { |
sub character_chart { |
my $result = shift; |
my $result = shift; |
Line 995 sub output_data {
|
Line 1023 sub output_data {
|
my %parmhash = %$rparmhash; |
my %parmhash = %$rparmhash; |
my $resources_printed = ''; |
my $resources_printed = ''; |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
my $bodytag=&Apache::loncommon::bodytag('Preparing Printout'); |
my $headtag = &Apache::loncommon::headtag('Preparing Printout'); |
|
my $end_headtag = &Apache::loncommon::endheadtag(); |
|
my $bodytag = &Apache::loncommon::bodytag('Preparing Printout'); |
$r->print(<<ENDPART); |
$r->print(<<ENDPART); |
$html |
$html |
<head> |
$headtag |
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
var editbrowser; |
var editbrowser; |
function openbrowser(formname,elementname,only,omit) { |
function openbrowser(formname,elementname,only,omit) { |
Line 1023 $html
|
Line 1053 $html
|
editbrowser.focus(); |
editbrowser.focus(); |
} |
} |
</script> |
</script> |
<title>LON-CAPA output for printing</title> |
$end_headtag |
</head> |
|
$bodytag |
$bodytag |
<p> |
<p> |
Please stand by while processing your print request, this may take some time ... |
Please stand by while processing your print request, this may take some time ... |
Line 1407 ENDPART
|
Line 1436 ENDPART
|
# Each element of the students array is of the form: |
# Each element of the students array is of the form: |
# username:domain:section:last, first:status |
# username:domain:section:last, first:status |
# |
# |
|
# Note that student sort is not compatible with printing |
|
# 1 section per pdf...so that setting overrides. |
# |
# |
if ($helper->{'VARS'}->{'student_sort'} eq 1) { |
if (($helper->{'VARS'}->{'student_sort'} eq 1) && |
|
($helper->{'VARS'}->{'SPLIT_PDFS'} ne "sections")) { |
@students = sort compare_names @students; |
@students = sort compare_names @students; |
} |
} |
|
&adjust_number_to_print($helper); |
|
|
if ($helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq '0' || |
if ($helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq '0' || |
$helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq 'all' ) { |
$helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq 'all' ) { |
$helper->{'VARS'}->{'NUMBER_TO_PRINT'}=$#students+1; |
$helper->{'VARS'}->{'NUMBER_TO_PRINT'}=$#students+1; |
} |
} |
|
# If we are splitting on section boundaries, we need |
|
# to remember that in split_on_sections and |
|
# print all of the students in the list. |
|
# |
|
my $split_on_sections = 0; |
|
if ($helper->{'VARS'}->{'NUMBER_TO_PRINT'} eq 'section') { |
|
$split_on_sections = 1; |
|
$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 |
Line 1428 ENDPART
|
Line 1471 ENDPART
|
if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$moreenv{'problem_split'}='yes';} |
if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$moreenv{'problem_split'}='yes';} |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75'); |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75'); |
my $student_counter=-1; |
my $student_counter=-1; |
|
my $i = 0; |
|
my $last_section = (split(/:/,$students[0]))[2]; |
foreach my $person (@students) { |
foreach my $person (@students) { |
|
|
my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; |
my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; |
Line 1436 ENDPART
|
Line 1481 ENDPART
|
print $temp_file "1969\n"; |
print $temp_file "1969\n"; |
} |
} |
$student_counter++; |
$student_counter++; |
my $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'}); |
if ($split_on_sections) { |
|
my $this_section = (split(/:/,$person))[2]; |
|
if ($this_section ne $last_section) { |
|
$i++; |
|
$last_section = $this_section; |
|
} |
|
} else { |
|
$i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'}); |
|
} |
my ($output,$fullname, $printed)=&print_resources($r,$helper, |
my ($output,$fullname, $printed)=&print_resources($r,$helper, |
$person,$type, |
$person,$type, |
\%moreenv,\@master_seq, |
\%moreenv,\@master_seq, |
Line 1718 ENDPART
|
Line 1771 ENDPART
|
"cgi.$identifier.coursedom" => $cdom, |
"cgi.$identifier.coursedom" => $cdom, |
"cgi.$identifier.resources" => $resources_printed); |
"cgi.$identifier.resources" => $resources_printed); |
|
|
$r->print(<<FINALEND); |
my $end_page = &Apache::loncommon::end_page(); |
|
$r->print(<<FINALEND); |
<br /> |
<br /> |
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" /> |
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" /> |
<a href="/cgi-bin/printout.pl?$identifier">Continue</a> |
<a href="/cgi-bin/printout.pl?$identifier">Continue</a> |
</body> |
$end_page |
</html> |
|
FINALEND |
FINALEND |
} |
} |
|
|
Line 2200 ALL_PROBLEMS
|
Line 2253 ALL_PROBLEMS
|
</state> |
</state> |
<state name="NUMBER_PER_PDF" title="Number printed at once"> |
<state name="NUMBER_PER_PDF" title="Number printed at once"> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<message><hr width='33%' /><b>Number of assignments printed at the same time: </b></message> |
<message><hr width='33%' /><b>How do you want assignments split into PDF files? </b></message> |
|
<choices variable="SPLIT_PDFS"> |
|
<choice computer="all">All assignments in a single PDF file</choice> |
|
<choice computer="sections">Each PDF contains exactly one section</choice> |
|
<choice computer="oneper">Each PDF contains exactly one assignment</choice> |
|
<choice computer="usenumber">Specify Number:</choice> |
|
</choices> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
</state> |
</state> |
RESOURCE_SELECTOR |
RESOURCE_SELECTOR |
Line 2243 CHOOSE_STUDENTS
|
Line 2302 CHOOSE_STUDENTS
|
if ($code =~ /^[A-Z]+$/) { # Alpha code |
if ($code =~ /^[A-Z]+$/) { # Alpha code |
$choice = &letters_to_num($code); |
$choice = &letters_to_num($code); |
} |
} |
$code_selection .= ' <choice computer="'.$choice.'">'.$code."</choice>\n"; |
push(@{$helper->{DATA}{ALL_CODE_CHOICES}},[$code,$choice]); |
} |
} |
|
$code_selection .= |
|
' |
|
<exec> |
|
push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); |
|
</exec> |
|
'.$/; |
|
|
|
|
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); |
my $codechoice=''; |
my $codechoice=''; |
foreach my $line (<FH>) { |
foreach my $line (<FH>) { |
Line 2299 CHOOSE_STUDENTS
|
Line 2366 CHOOSE_STUDENTS
|
</validator> |
</validator> |
</string> |
</string> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
|
<message><b>Choose single code from list</b></message> |
|
<message></td><td></message> |
|
<choices variable="CODE_SELECTED_FROM_LIST" multichoice="0" allowempty="0"> |
|
$code_selection |
|
</choices> |
|
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message></td><td></message> |
<message></td><td></message> |
<dropdown variable="REUSE_OLD_CODES"> |
<dropdown variable="REUSE_OLD_CODES"> |
Line 2339 CHOOSE_ANON1
|
Line 2412 CHOOSE_ANON1
|
<choice computer='3'>Add three empty pages/column after each student\'s assignment</choice> |
<choice computer='3'>Add three empty pages/column after each student\'s assignment</choice> |
</choices> |
</choices> |
</state> |
</state> |
<state name="NUMBER_PER_PDF title="Number assingnments per pdf"> |
<state name="NUMBER_PER_PDF" title="Number assignments per pdf"> |
<nextstate>PAGESIZE</nextstate> |
<nextstate>PAGESIZE</nextstate> |
<message><hr width='33%' /><b>Number of assignments printed at the same time: </b></message> |
<message><hr width='33%' /><b>How do you want assignments split into PDF files? </b></message> |
|
<choices variable="SPLIT_PDFS"> |
|
<choice computer="all">All assignments in a single PDF file</choice> |
|
<choice computer="sections">Each PDF contains exactly one section</choice> |
|
<choice computer="oneper">Each PDF contains exactly one assignment</choice> |
|
<choice computer="usenumber">Specify Number:</choice> |
|
</choices> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
<string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string> |
</state> |
</state> |
RESOURCE_SELECTOR |
RESOURCE_SELECTOR |
Line 2399 CHOOSE_STUDENTS1
|
Line 2478 CHOOSE_STUDENTS1
|
</validator> |
</validator> |
</string> |
</string> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
|
<message><b>Choose single code from list</b></message> |
|
<message></td><td></message> |
|
<dropdown variable="CODE_SELECTED_FROM_LIST" multichoice="0" allowempty="0"> |
|
$code_selection |
|
</dropdown> |
|
<message></td></tr><tr><td colspan="2"><hr width='33%' /></td></tr><tr><td></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message><b>Reprint a set of saved CODEs:</b></message> |
<message></td><td></message> |
<message></td><td></message> |
<dropdown variable="REUSE_OLD_CODES"> |
<dropdown variable="REUSE_OLD_CODES"> |