--- loncom/interface/lonprintout.pm 2023/04/15 17:53:07 1.688
+++ loncom/interface/lonprintout.pm 2024/11/01 00:08:03 1.698
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.688 2023/04/15 17:53:07 raeburn Exp $
+# $Id: lonprintout.pm,v 1.698 2024/11/01 00:08:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -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)
#
@@ -897,7 +897,7 @@ sub master_seq_to_person_seq {
# Iterate on the resource..select the items that are randomly selected
# and that are in the seq_hash. Presumably the iterator will take care
- # of the random ordering part of the deal.
+ # of the random ordering part of the deal.
#
my $curres;
while ($curres = $iterator->next()) {
@@ -1155,7 +1155,7 @@ sub printf_style_subst {
if ($size ne "") {
$subst = substr($subst, 0, $size);
- # Here's a nice edge case.. suppose the end of the
+ # 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
@@ -1865,7 +1865,7 @@ my %page_formats=
},
'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.0 in']
},
},
'legal' => {
@@ -1925,7 +1925,7 @@ my %page_formats=
},
'album' => {
'1' => ['21.59 cm','19.558 cm','-1.397cm','-2.11 cm','0 cm'],
- '2' => ['9.91 cm','19.558 cm','-1.397 cm','-2.11 cm','0 cm']
+ '2' => ['9.91 cm','19.558 cm','-1.397 cm','-2.11 cm','-1 cm']
},
},
'a5' => {
@@ -2012,23 +2012,46 @@ sub page_format_transformation {
} else {
$fancypagestatement="\\rhead{}\\chead{}\\lhead{$header_text}";
}
+ my ($paperwidth,$paperheight);
if ($layout eq 'album') {
$text =~ s/\\begin\{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\n\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\n\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\n\\pagestyle{fancy}$fancypagestatement\\usepackage{booktabs}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}\n /;
+ if ($papersize eq 'a4') {
+ $paperwidth = '29.7cm';
+ $paperheight = '21cm';
+ } elsif ($numberofcolumns eq '1') {
+ if ($papersize eq 'letter') {
+ $paperwidth = '11in';
+ $paperheight = '8.5in';
+ } elsif ($papersize eq 'legal') {
+ $paperwidth = '14in';
+ $paperheight = '8.5in';
+ }
+ }
} elsif ($layout eq 'book') {
if ($choice ne 'All class print') {
$text =~ s/\\begin\{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset $topmargintoinsert\n\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\n\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\\pagestyle{fancy}$fancypagestatement\\usepackage{booktabs}\\begin{document}\n\\voffset=-0\.8 cm\\setcounter{page}{1}\n/;
} else {
$text =~ s/\\pagestyle\{fancy}\\rhead\{}\\chead\{}\s*\\begin\{document}/\\textheight = $textheight\\oddsidemargin = $evenoffset\n\\evensidemargin = $evenoffset $topmargintoinsert\\textwidth= $textwidth\\newlength{\\minipagewidth}\n\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\usepackage{booktabs}\\begin{document}\\voffset=-0\.8cm\n\\setcounter{page}{1} \\vskip 5 mm\n /;
}
- if ($papersize eq 'a4') {
- my $papersize_text;
- if ($perm{'pav'}) {
- $papersize_text = '\\special{papersize=210mm,297mm}';
- } else {
- $papersize_text = '\special{papersize=210mm,297mm}';
- }
- $text =~ s/(\\begin\{document})/$1$papersize_text/;
- }
+ if ($papersize eq 'a4') {
+ $paperwidth = '21cm';
+ $paperheight = '29.7cm';
+ } elsif ($papersize eq 'letter') {
+ $paperwidth = '8.5in';
+ $paperheight = '11.5in';
+ } elsif ($papersize eq 'legal') {
+ $paperwidth = '8.5in';
+ $paperheight = '14.0in';
+ }
+ }
+ if ($paperwidth ne '' && $paperheight ne '') {
+ my $papersize_text;
+ if ($perm{'pav'}) {
+ $papersize_text = '\\special{papersize='.$paperwidth.','.$paperheight.'}';
+ } else {
+ $papersize_text = '\special{papersize='.$paperwidth.','.$paperheight.'}';
+ }
+ $text =~ s/(\\begin\{document})/$1$papersize_text/;
}
if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;}
if ($indexlist eq 'yes') {
@@ -2532,7 +2555,7 @@ sub load_skips {
my ($helper) = @_;
- # If this is the first time, unwrap 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'}));
@@ -3310,6 +3333,8 @@ ENDPART
($map, my $id, my $resource) =
&Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});
}
+ } elsif (($helper->{'VARS'}->{'postdata'} eq '/adm/navmaps') && ($perm{'pfo'})) {
+ $map = $helper->{'VARS'}->{'SEQUENCE'};
}
#loop over students
@@ -3399,9 +3424,12 @@ ENDPART
if ($helper->{VARS}{'symb'}) {
($map, my $id, my $resource) =
&Apache::lonnet::decode_symb($helper->{VARS}{'symb'});
+ } elsif (($helper->{'VARS'}->{'postdata'} eq '/adm/navmaps') && ($perm{'pfo'})) {
+ $map = $helper->{'VARS'}->{'SEQUENCE'};
}
my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth));
$moreenv{'problem_split'} = $parmhash{'problem_stream_switch'};
+ $moreenv{'suppress_tries'} = $parmhash{'suppress_tries'};
$moreenv{'instructor_comments'}='hide';
$moreenv{'bubbles_per_row'} = $bubbles_per_row;
my $seed=time+($$<<16)+($$);
@@ -3797,7 +3825,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 printout.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.
#
@@ -3906,7 +3934,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') {
@@ -4821,12 +4849,47 @@ CHOOSE_FROM_SUBDIR
'','','','','',''),
'select_sequences_resources_for_anon','CHOOSE_SEQUENCE_ANON2']);
if ($escapedSequenceName) {
- &generate_common_choosers($r,$helper,$escapedSequenceName,$escapedSequenceName,$isProblem,$symbFilter,$start_new_option);
+ my ($randomly_ordered_warning,$codechoice,$code_selection,$namechoice) =
+ &generate_common_choosers($r,$helper,$escapedSequenceName,$escapedSequenceName,
+ $isProblem,$symbFilter,$start_new_option);
+
+ my $resource_selector = <
+
+ Sort by section then student
+ Sort by students across sections.
+
+
+
+
+
+
+ $randomly_ordered_warning
+ PRINT_FORMATTING
+ (mark desired resources then click "next" button)
+
+ return $isNotMap;
+ $escapedSequenceName
+ return $symbFilter;
+ $start_new_option
+
+
+RESOURCE_SELECTOR
+
+ my $anon3 = &generate_code_selector($helper,
+ 'CHOOSE_ANON3',
+ 'SELECT_RESOURCES',
+ $codechoice,
+ $code_selection,
+ $namechoice) . $resource_selector;
+
+ &Apache::lonxml::xmlparse($r, 'helper',$anon3);
}
}
}
if (($subdir eq '') && ($url eq '/adm/navmaps') && ($perm{'pfo'})) {
- &Apache::lonxml::xmlparse($r, 'helper', <
Select the sequence to print resources from:
@@ -4860,7 +4923,7 @@ CHOOSE_FROM_SUBDIR
Select the sequence to print resources from:
- CHOOSE_STUDENTS
+ CHOOSE_STUDENTS2
return &Apache::lonprintout::printable_sequence(\$res);
return $urlValue;
return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0);
@@ -4870,7 +4933,7 @@ CHOOSE_FROM_SUBDIR
Select the sequence to print resources from:
- CHOOSE_ANON1
+ CHOOSE_ANON3
return &Apache::lonprintout::printable_sequence(\$res);
return $urlValue;
return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0);