--- loncom/interface/lonprintout.pm 2022/06/11 14:51:49 1.679
+++ loncom/interface/lonprintout.pm 2023/04/15 21:50:34 1.690
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.679 2022/06/11 14:51:49 raeburn Exp $
+# $Id: lonprintout.pm,v 1.690 2023/04/15 21:50:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -453,7 +453,7 @@ sub generate_common_choosers {
&get_randomly_ordered_warning($helper, $map);
# code for a few states used for printout launched from both
- # /adm/navmpas and from a resource by a privileged user:
+ # /adm/navmaps and from a resource by a privileged user:
# - To allow resources to be selected for printing.
# - To determine pagination between assignments.
# - To determine how many assignments should be bundled into a single PDF.
@@ -755,7 +755,7 @@ sub get_print_dates {
# get_print_dates but namvaps::course_print_dates are gotten...and not converted
# to times either.
#
-# @param $res - Reference to a resource has from lonnvampas::resource.
+# @param $res - Reference to a resource hash from lonnavmaps::resource.
#
# @return (opendate, closedate)
#
@@ -769,7 +769,7 @@ sub course_print_dates {
my @close_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) {
@@ -795,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) {
@@ -896,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()) {
@@ -973,7 +973,7 @@ 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 '') {
@@ -992,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.
@@ -1016,9 +1016,9 @@ 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/};
@@ -1155,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).
@@ -1440,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...
@@ -2532,7 +2532,7 @@ sub load_skips {
my ($helper) = @_;
- # If this is the first time, unrap the resources and extra spaces:
+ # If this is the first time, unwrap the resources and extra spaces:
if (!$skips_loaded) {
@extraspace = (split(/\|\|\|/, $helper->{'VARS'}->{'EXTRASPACE'}));
@@ -2839,8 +2839,8 @@ ENDPART
my @student_names=();
- # Common settings for the %form has:
- # In some cases these settings get overriddent by specific cases, but the
+ # Common settings for the %form hash:
+ # In some cases these settings get overridden by specific cases, but the
# settings are common enough to make it worthwhile factoring them out
# here.
#
@@ -3304,8 +3304,12 @@ ENDPART
my $map;
if ($helper->{VARS}->{'symb'}) {
- ($map, my $id, my $resource) =
- &Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});
+ unless ((($print_type eq 'all_problems_students') ||
+ ($print_type eq 'incomplete_problems_selpeople_course')) &&
+ $perm{'pfo'}) {
+ ($map, my $id, my $resource) =
+ &Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});
+ }
}
#loop over students
@@ -3793,7 +3797,7 @@ sub print_resources {
# nice to put the special in as a postscript comment
# e.g. \special{ps:\ENDOFSTUDENTSTAMP} unfortunately,
# The special gets passed the \ and dvips puts it in the output file
- # so we will just rely on prntout.pl to strip ENDOFSTUDENTSTAMP from the
+ # so we will just rely on printout.pl to strip ENDOFSTUDENTSTAMP from the
# postscript. Each ENDOFSTUDENTSTAMP will go on a line by itself.
#
@@ -3902,7 +3906,7 @@ sub print_resources {
$rendered =~ s/\\end\{document}//;
}
$current_output .= $rendered.'\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\strut \vskip 0 mm \strut ';
- } elsif($res_url = ~/\.pdf$/) {
+ } elsif($res_url =~ /\.pdf$/) {
my $url = &Apache::lonnet::clutter($res_url);
my $rendered = &include_pdf($url);
if ($remove_latex_header ne 'NO') {
@@ -4212,19 +4216,12 @@ sub printHelper {
$helper->{VARS}->{'symb'} = $env{'form.symb'};
}
if ($env{'form.url'}) {
- $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
+ unless ($env{'form.url'} eq '/adm/navmaps') {
+ $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
+ }
}
-
}
- if ($env{'form.symb'}) {
- $helper->{VARS}->{'symb'} = $env{'form.symb'};
- }
- if ($env{'form.url'}) {
- unless ($env{'form.url'} eq '/adm/navmaps') {
- $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
- }
- }
if ($helper->{VARS}->{'symb'} ne '') {
$helper->{VARS}->{'symb'}=
&Apache::lonenc::check_encrypt($helper->{VARS}->{'symb'});
@@ -4500,7 +4497,7 @@ sub printHelper {
$optionText = &mt('Selected [_1]Incomplete Problems[_2] [_3]not in a folder[_4]' . $textSuffix,
'','','','');
} else {
- $optionText = &mt('Selected [_1]Incomplete Problems[_2] from folder [_3]' . $textSuffix,
+ $optionText = &mt('Selected [_1]Incomplete Problems[_2] from folder [_3]' . $textSuffix,
'','',''.$sequenceTitle.'');
}
push(@{$printChoices},
@@ -4562,7 +4559,8 @@ sub printHelper {
# BZ 5209 - incomplete problems from entire course:
push(@{$printChoices},
- [&mtn('Selected Incomplete Problems from entire course for selected people'),
+ [&mt('Selected [_1]Incomplete Problems[_2] from [_3]entire course[_4] for [_5]selected people[_6]',
+ '','','','','',''),
'incomplete_problems_selpeople_course', 'INCOMPLETE_PROBLEMS_COURSE_RESOURCES']);
my $helperFragment = &create_incomplete_course_helper($helper); # Create needed states.
@@ -4570,9 +4568,9 @@ sub printHelper {
# Selected problems/resources from entire course:
- push @{$printChoices}, [&mtn('Selected Problems from entire course'), 'all_problems', 'ALL_PROBLEMS'];
- push @{$printChoices}, [&mtn('Selected Resources from entire course'), 'all_resources', 'ALL_RESOURCES'];
- push @{$printChoices}, [&mtn('Selected Problems from entire course for selected people'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS'];
+ push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from [_3]entire course[_4]','','','',''), 'all_problems', 'ALL_PROBLEMS'];
+ push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from [_3]entire course[_4]','','','',''), 'all_resources', 'ALL_RESOURCES'];
+ push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from [_3]entire course[_4] for [_5]selected people[_6]','','','','','',''), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS'];
my $suffixXml = <
Select sorting order of printout
@@ -4788,8 +4786,9 @@ CHOOSE_FROM_SUBDIR
# another resource selector for that sequence
if ((!$helper->{VARS}->{'construction'}) &&
(!$is_published || (($subdir eq '') && ($url eq '/adm/navmaps')))) {
- push @$printChoices, [&mtn("Selected Resources from selected folder in course"),
- 'select_sequences', 'CHOOSE_SEQUENCE'];
+ push(@$printChoices,[&mt('Selected [_1]Resources[_2] from [_3]selected folder[_4] in course',
+ '','','',''),
+ 'select_sequences','CHOOSE_SEQUENCE']);
my $escapedSequenceName;
if ($helper->{VARS}->{'SEQUENCE'} ne '') {
$escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};
@@ -4804,8 +4803,10 @@ CHOOSE_FROM_SUBDIR
#Escape apostrophes and backslashes for Perl
$escapedSequenceName =~ s/\\/\\\\/g;
$escapedSequenceName =~ s/'/\\'/g;
+ my $nocurrloc;
if (($subdir eq '') && ($url eq '/adm/navmaps')) {
- if ($perm{'pfo'})) {
+ $nocurrloc = 'nocurrloc="1"';
+ if ($perm{'pfo'}) {
push(@{$printChoices},
[&mt('Selected [_1]Problems[_2] from [_3]selected folder[_4] in course for [_5]selected people[_6]',
'','','','','',''),
@@ -4818,18 +4819,10 @@ CHOOSE_FROM_SUBDIR
'select_sequences_resources_for_students','CHOOSE_SEQUENCE_STUDENTS1'],
[&mt('Selected [_1]Resources[_2] from [_3]selected folder[_4] in course for [_5]CODEd assignments[_6]',
'','','','','',''),
- 'select_sequences_resources_for_anon','CHOOSE_SEQUENCE_ANON2'],
- [&mt('Selected [_1]Resources[_2] from [_3]selected folder[_4] in course',
- '','','',''),
- 'select_sequences','CHOOSE_SEQUENCE']);
+ 'select_sequences_resources_for_anon','CHOOSE_SEQUENCE_ANON2']);
if ($escapedSequenceName) {
&generate_common_choosers($r,$helper,$escapedSequenceName,$escapedSequenceName,$isProblem,$symbFilter,$start_new_option);
}
- } else {
- push(@{$printChoices},
- [&mt('Selected [_1]Resources[_2] from [_3]selected folder[_4] in course',
- '','','',''),
- 'select_sequences','CHOOSE_SEQUENCE']);
}
}
if (($subdir eq '') && ($url eq '/adm/navmaps') && ($perm{'pfo'})) {
@@ -4887,7 +4880,7 @@ CHOOSE_FROM_SUBDIR
(mark desired resources then click "next" button)
+ closeallpages="1" modallink="1" suppressNavmap="1" $nocurrloc>
PAGESIZE
return $isNotMap
return '$escapedSequenceName';
@@ -4911,7 +4904,7 @@ CHOOSE_FROM_ANY_SEQUENCE
(mark desired resources then click "next" button)
+ closeallpages="1" modallink="1" suppressNavmap="1" $nocurrloc>
PAGESIZE
return $isNotMap
return '$escapedSequenceName';