--- loncom/interface/lonprintout.pm 2010/09/02 00:17:36 1.583.2.3
+++ loncom/interface/lonprintout.pm 2013/08/27 02:39:24 1.583.2.6
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.583.2.3 2010/09/02 00:17:36 raeburn Exp $
+# $Id: lonprintout.pm,v 1.583.2.6 2013/08/27 02:39:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -256,6 +256,46 @@ CHOOSE_ANON1
return $result;
}
+# 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)
+
+# helper - The helper; $helper->{'VARS'}->{'PRINT_TYPE'} used
+# to check if splitting PDFs by section can be offered.
+# title - Title for the current state.
+# this_state - State name of the chooser.
+
+sub generate_format_selector {
+ my ($helper,$title,$this_state) = @_;
+ 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 = 'Each PDF contains exactly one section';
+ }
+ return <
+
How should the results be printed?
+
+ Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)
+ Add one empty page/column after each student\'s assignment
+ Add two empty pages/column after each student\'s assignment
+ Add three empty pages/column after each student\'s assignment
+
+ PAGESIZE
+
How do you want assignments split into PDF files?
+
+ All assignments in a single PDF file
+ $secpdfoption
+ Each PDF contains exactly one assignment
+
+ Specify the number of assignments per PDF:
+
+
+RESOURCE_SELECTOR
+}
+
+
#-----------------------------------------------------------------------
@@ -1489,6 +1529,7 @@ sub unsupported {
my $result.= &print_latex_header($mode);
if ($currentURL=~m|^(/adm/wrapper/)?ext/|) {
$currentURL=~s|^(/adm/wrapper/)?ext/|http://|;
+ $currentURL=~s|http://https://|https://|;
my $title=&Apache::lonnet::gettitle($symb);
$title = &Apache::lonxml::latex_special_symbols($title);
$result.=' \strut \\\\ '.$title.' \strut \\\\ '.$currentURL.' ';
@@ -2653,7 +2694,8 @@ ENDPART
my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'});
&adjust_number_to_print($helper);
my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'};
- if ($number_per_page eq '0' || $number_per_page eq 'all') {
+ if ($number_per_page eq '0' || $number_per_page eq 'all'
+ || $number_per_page eq 'section') {
$number_per_page=$num_todo;
}
my $flag_latex_header_remove = 'NO';
@@ -3142,6 +3184,11 @@ sub init_perm {
$perm{'pfo'}=&Apache::lonnet::allowed('pfo',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
}
+ $perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
+ if (!$perm{'vgr'}) {
+ $perm{'vgr'}=&Apache::lonnet::allowed('vgr',
+ $env{'request.course.id'}.'/'.$env{'request.course.sec'});
+ }
}
sub get_randomly_ordered_warning {
@@ -3554,27 +3601,10 @@ ALL_PROBLEMS
$map,
$isProblem, '', $symbFilter,
$start_new_option);
- $resource_selector .= <
-
How should the results be printed?
-
- Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)
- Add one empty page/column after each student\'s assignment
- Add two empty pages/column after each student\'s assignment
- Add three empty pages/column after each student\'s assignment
-
- PAGESIZE
-
How do you want assignments split into PDF files?
-
- All assignments in a single PDF file
- Each PDF contains exactly one section
- Each PDF contains exactly one assignment
-
- Specify the number of assignments per PDF:
-
-
-RESOURCE_SELECTOR
- $resource_selector .= &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
+ $resource_selector .= &generate_format_selector($helper,
+ 'How should results be printed?',
+ 'PRINT_FORMATTING').
+ &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
'Select Problem(s) to print',
"multichoice='1' addstatus='1' closeallpages ='1'",
'RESOURCES',
@@ -3702,28 +3732,11 @@ RESOURCE_SELECTOR
$start_new_option
-
-
- NUMBER_PER_PDF
-
How should the results be printed?
-
- Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)
- Add one empty page/column after each student\'s assignment
- Add two empty pages/column after each student\'s assignment
- Add three empty pages/column after each student\'s assignment
-
- PAGESIZE
-
How do you want assignments split into PDF files?
-
- All assignments in a single PDF file
- Each PDF contains exactly one section
- Each PDF contains exactly one assignment
-
- Specify the number of assignments per PDF:
-
-
RESOURCE_SELECTOR
+ $resource_selector .= &generate_format_selector($helper,
+ 'Format of the print job',
+ 'PRINT_FORMATTING');
&Apache::lonxml::xmlparse($r, 'helper', <
@@ -3881,7 +3894,7 @@ CHOOSE_FROM_ANY_SEQUENCE
my $startedTable = 0; # have we started an HTML table yet? (need
# to close it later)
- if (($perm{'pav'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or
+ if (($perm{'pav'} and $perm{'vgr'}) or
($helper->{VARS}->{'construction'} eq '1')) {
&addMessage('
'
.''.&mt('Print Options').'
'