[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
raeburn
raeburn@source.lon-capa.org
Fri, 11 Mar 2011 05:01:36 -0000
raeburn Fri Mar 11 05:01:36 2011 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
- Bug 6167.
- Don't offer "Each PDF contains exactly one section" option when creating
printout for CODEs to avoid ISE.
- New routine: &generate_format_selector() used to create print options
for EMPTY_PAGES and SPLIT_PDFS selectors, and eliminate duplicate XML.
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.585 loncom/interface/lonprintout.pm:1.586
--- loncom/interface/lonprintout.pm:1.585 Wed Sep 15 16:37:36 2010
+++ loncom/interface/lonprintout.pm Fri Mar 11 05:01:36 2011
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.585 2010/09/15 16:37:36 raeburn Exp $
+# $Id: lonprintout.pm,v 1.586 2011/03/11 05:01:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -256,6 +256,37 @@
return $result;
}
+sub generate_format_selector {
+ my ($helper,$title,$nextstate) = @_;
+ 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') ) {
+ $secpdfoption = '<choice computer="sections">Each PDF contains exactly one section</choice>';
+ }
+ return <<RESOURCE_SELECTOR;
+ <state name="PRINT_FORMATTING" title="$title">
+ $nextstate
+ <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
+ <choices variable="EMPTY_PAGES">
+ <choice computer='0'>Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)</choice>
+ <choice computer='1'>Add one empty page/column after each student\'s assignment</choice>
+ <choice computer='2'>Add two empty pages/column after each student\'s assignment</choice>
+ <choice computer='3'>Add three empty pages/column after each student\'s assignment</choice>
+ </choices>
+ <nextstate>PAGESIZE</nextstate>
+ <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>
+ $secpdfoption
+ <choice computer="oneper">Each PDF contains exactly one assignment</choice>
+ <choice computer="usenumber" relatedvalue="NUMBER_TO_PRINT">
+ Specify the number of assignments per PDF:</choice>
+ </choices>
+ </state>
+RESOURCE_SELECTOR
+}
+
#-----------------------------------------------------------------------
@@ -3578,27 +3609,15 @@
$map,
$isProblem, '', $symbFilter,
$start_new_option);
- $resource_selector .= <<RESOURCE_SELECTOR;
- <state name="PRINT_FORMATTING" title="How should results be printed?">
- <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
- <choices variable="EMPTY_PAGES">
- <choice computer='0'>Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)</choice>
- <choice computer='1'>Add one empty page/column after each student\'s assignment</choice>
- <choice computer='2'>Add two empty pages/column after each student\'s assignment</choice>
- <choice computer='3'>Add three empty pages/column after each student\'s assignment</choice>
- </choices>
- <nextstate>PAGESIZE</nextstate>
- <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" relatedvalue="NUMBER_TO_PRINT">
- Specify the number of assignments per PDF:</choice>
- </choices>
- </state>
-RESOURCE_SELECTOR
- $resource_selector .= &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
+ 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') ) {
+ $secpdfoption = '<choice computer="sections">Each PDF contains exactly one section</choice>';
+ }
+ $resource_selector .= &generate_format_selector($helper,
+ 'How should results be printed?').
+ &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
'Select Problem(s) to print',
"multichoice='1' addstatus='1' closeallpages ='1'",
'RESOURCES',
@@ -3726,28 +3745,12 @@
$start_new_option
</resource>
</state>
-
- <state name="PRINT_FORMATTING" title="Format of the print job">
- <nextstate>NUMBER_PER_PDF</nextstate>
- <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
- <choices variable="EMPTY_PAGES">
- <choice computer='0'>Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)</choice>
- <choice computer='1'>Add one empty page/column after each student\'s assignment</choice>
- <choice computer='2'>Add two empty pages/column after each student\'s assignment</choice>
- <choice computer='3'>Add three empty pages/column after each student\'s assignment</choice>
- </choices>
- <nextstate>PAGESIZE</nextstate>
- <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" relatedvalue="NUMBER_TO_PRINT">
- Specify the number of assignments per PDF:</choice>
- </choices>
- </state>
RESOURCE_SELECTOR
+ my $nextstate = '<nextstate>NUMBER_PER_PDF</nextstate>';
+ $resource_selector .= &generate_format_selector($helper,
+ 'Format of the print job',
+ $nextstate);
&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS1);
<state name="CHOOSE_STUDENTS1" title="Select Students and Resources">
<choices variable='student_sort'>