+ '.$/;
+ }
+
+ my @lines = &Apache::lonnet::get_scantronformat_file();
+ my $codechoice='';
+ foreach my $line (@lines) {
+ next if (($line =~ /^\#/) || ($line eq ''));
+ my ($name,$description,$code_type,$code_length)=
+ (split(/:/,$line))[0,1,2,4];
+ if ($code_length > 0 &&
+ $code_type =~/^(letter|number|-1)/) {
+ $codechoice.=''.$description.'';
+ }
+ }
+ if ($codechoice eq '') {
+ $codechoice='Default';
+ }
+ my $anon1 = &generate_code_selector($helper,
+ 'CHOOSE_ANON1',
+ 'SELECT_PROBLEMS',
+ $codechoice,
+ $code_selection,
+ $namechoice) . $resource_selector;
+
+ &Apache::lonxml::xmlparse($r, 'helper',$anon1);
+
+ my $anon_page = &generate_code_selector($helper,
+ 'CHOOSE_ANON1_PAGE',
+ 'SELECT_PROBLEMS_PAGE',
+ $codechoice,
+ $code_selection,
+ $namechoice) .
+ &generate_resource_chooser('SELECT_PROBLEMS_PAGE',
+ 'Select Problem(s) to print',
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
+ 'RESOURCES',
+ 'PRINT_FORMATTING',
+ $url,
+ $isProblem, '', $symbFilter,
+ $start_new_option);
+ &Apache::lonxml::xmlparse($r, 'helper', $anon_page);
+ return ($randomly_ordered_warning,$codechoice,$code_selection,$namechoice);
+}
+
# Returns the XML for choosing how assignments are to be formatted
# that text must still be parsed by the helper xml parser.
# Parameters: 3 (required)
@@ -457,7 +588,9 @@ sub generate_format_selector {
my $secpdfoption;
unless (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon') ||
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon_page') ||
- ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon') ) {
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon') ||
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences_problems_for_anon') ||
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences_resources_for_anon')) {
$secpdfoption = 'Each PDF contains exactly one section';
}
return <{NAV_MAP}; # Slightly OO dirty.
- # Don't bother looping over undefined or empty parts arraY;
+ # Don't bother looping over undefined or empty parts array;
if (@parts) {
foreach my $part (@parts) {
@@ -662,7 +795,7 @@ sub map_print_dates {
my $navmap = $res->{NAV_MAP}; # slightly OO dirty.
- # Don't bother looping over undefined or empty parts arraY;
+ # Don't bother looping over undefined or empty parts array;
if (@parts) {
foreach my $part (@parts) {
@@ -763,8 +896,8 @@ sub master_seq_to_person_seq {
my $iterator = $navmap->getIterator($start,$finish,{},1);
# Iterate on the resource..select the items that are randomly selected
- # and that are in the seq_has. Presumably the iterator will take care
- # of the random ordering part of the deal.
+ # and that are in the seq_hash. Presumably the iterator will take care
+ # of the random ordering part of the deal.
#
my $curres;
while ($curres = $iterator->next()) {
@@ -840,14 +973,15 @@ sub set_font_size {
my ($text) = @_;
# There appear to be cases where the font directive is empty.. in which
- # case the first substituion would insert a spurious \ oh happy day.
+ # case the first substitution would insert a spurious \ oh happy day.
# as this has been the cause of much mystery and hair pulling _sigh_
if ($font_size ne '') {
$text =~ s/\\begin\{document}/\\begin{document}{\\$font_size/;
+ $text =~ s/\\end\{document}/}\\end{document}/;
+
}
- $text =~ s/\\end\{document}/}\\end{document}/;
return $text;
@@ -858,7 +992,7 @@ sub set_font_size {
# - The PDF, if necessary, is replicated.
# - The PDF is added to the list of files to convert to postscript (along with the images).
# - The LaTeX is added to include the final converted postscript in the file as an included
-# job. The assumption is that the includedpsheader.ps header will be included.
+# job. The assumption is that the includepsheader.ps header will be included.
#
# Parameters:
# pdf_uri - URI of the PDF file to include.
@@ -882,14 +1016,14 @@ sub include_pdf {
$file = &Apache::lonnet::filelocation('',$pdf_uri);
}
- # The file isn ow replicated locally.. or it did not exist in the first place
+ # The file is now replicated locally ... or it did not exist in the first place
# (unlikely). If it did exist, add the pdf to the set of files/images that
- # need tob e converted for this print job:
+ # need to be converted for this print job:
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
$file =~ s{(.*)/res/}{$londocroot/res/};
- open(FILE,">>$Apache::lonnet::perlvar{'lonPrtDir'}/$env{'user.name'}_$env{'user.domain'}_printout.dat");
+ open(FILE,">>","$Apache::lonnet::perlvar{'lonPrtDir'}/$env{'user.name'}_$env{'user.domain'}_printout.dat");
print FILE ("$file\n");
close (FILE);
@@ -1021,8 +1155,8 @@ sub printf_style_subst {
if ($size ne "") {
$subst = substr($subst, 0, $size);
- # Here's a nice edge case.. supose the end of the
- # substring is a \. In that case may have just
+ # Here's a nice edge case ... suppose the end of the
+ # substring is a \. In that case may have just
# chopped off a TeX escape... in that case, we append
# " " for the trailing character, and let the field
# spill over a bit (sigh).
@@ -1232,8 +1366,9 @@ sub is_valid_alpha_code {
sub is_code_valid {
my ($code_value, $code_option) = @_;
my ($code_type, $code_length) = ('letter', 6); # defaults.
- my @lines = &Apache::grades::get_scantronformat_file();
+ my @lines = &Apache::lonnet::get_scantronformat_file();
foreach my $line (@lines) {
+ next if (($line =~ /^\#/) || ($line eq ''));
my ($name, $type, $length) = (split(/:/, $line))[0,2,4];
if($name eq $code_option) {
$code_length = $length;
@@ -1305,7 +1440,7 @@ sub compare_names {
}
# Break the tie on the first name, but there are leading (possibly trailing
- # whitespaces to get rid of first
+ # whitespaces to get rid of first)
#
$f1 =~ s/^\s+//; # Remove leading...
$f1 =~ s/\s+$//; # Trailing spaces from first 1...
@@ -1337,8 +1472,8 @@ sub latex_header_footer_remove {
# necessity is determined by the problem_split param.
#
sub encapsulate_minipage {
- my ($text) = @_;
- if (!($env{'form.problem.split'} =~ /yes/i)) {
+ my ($text,$problem_split) = @_;
+ if (!($problem_split =~ /yes/i)) {
$text = '\begin{minipage}{\textwidth}'.$text.'\end{minipage}';
}
return $text;
@@ -1726,11 +1861,11 @@ my %page_formats=
('letter' => {
'book' => {
'1' => [ '7.1 in','9.8 in', '-0.57 in','-0.57 in','0.275 in'],
- '2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.275 in']
+ '2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','-0.4 in']
},
'album' => {
'1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.55 in','0.394 in'],
- '2' => [ '4.8 in', '6.8 in','-0.5 in', '-1.0 in','3.5 in']
+ '2' => [ '4.8 in', '6.8 in','-0.5 in', '-1.0 in','3.25 in']
},
},
'legal' => {
@@ -1956,7 +2091,7 @@ sub latex_corrections {
$result =~ s/(\\end\{document})/\\strut\\vspace\*{-4 mm}\\newline $copyright $end_of_student $1/;
}
$result =~ s/\$number_of_columns/$number_of_columns/g;
- $result =~ s/(\\end\{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill})/$2$1/g;
+ $result =~ s/(\\end\{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]\{\\hrulefill})/$2$1/g;
$result =~ s/(\\end\{longtable}\s*)\\strut\\newline/$1/g;
#-- LaTeX corrections
my $first_comment = index($result,' |