--- loncom/interface/lonprintout.pm 2014/04/24 15:36:58 1.627.2.12 +++ loncom/interface/lonprintout.pm 2015/06/04 13:03:36 1.627.2.15 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.627.2.12 2014/04/24 15:36:58 raeburn Exp $ +# $Id: lonprintout.pm,v 1.627.2.15 2015/06/04 13:03:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -701,12 +701,12 @@ sub incomplete { } } # -# When printing for students, the resoures and order of the +# When printing for students, the resources and order of the # resources may need to be altered if there are folders with # random selectiopn or random ordering (or both) enabled. # This sub computes the set of resources to print for a student # modified both by random ordering and selection and filtered -# to only those that are in the original set selcted to be printed. +# to only those that are in the original set selected to be printed. # # Parameters: # $map - The URL of the folder being printed. @@ -717,6 +717,9 @@ sub incomplete { # $who - Student/domain for whome the sequence will be generated. # $code - CODE being printed when printing Problems/Resources # from folder for CODEd assignments +# $nohidemap - If true, parameter in map for hiddenresource will be +# ignored. The user calling the routine should have +# both the pav and vgr privileges if this is set to true). # # Implicit inputs: # $ @@ -738,7 +741,7 @@ sub master_seq_to_person_seq { my @output_seq; my $unhidden; - if ($perm{'pav'} && $perm{'vgr'} && $nohidemap) { + if ($nohidemap) { $unhidden = &Apache::lonnet::clutter($map); } @@ -2933,7 +2936,6 @@ ENDPART &Apache::lonxml::clear_problem_counter(); - my $pbreakresources = keys %page_breaks; for (my $i=0;$i<=$#master_seq;$i++) { &Apache::lonenc::reset_enc(); @@ -3185,6 +3187,10 @@ ENDPART my $student_counter=-1; my $i = 0; my $last_section = (split(/:/,$students[0]))[2]; + my $nohidemap; + if ($perm{'pav'} && $perm{'vgr'}) { + $nohidemap = 1; + } foreach my $person (@students) { my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; if (-e $duefile) { @@ -3202,7 +3208,7 @@ ENDPART $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'}); } my $actual_seq = master_seq_to_person_seq($map, \@master_seq, - $person, undef, 1); + $person, undef, $nohidemap); my ($output,$fullname, $printed)=&print_resources($r,$helper, $person,$type, \%moreenv, $actual_seq, @@ -3290,6 +3296,8 @@ ENDPART $moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,$code_length, $code_type); } + $code_name =~ s/^\s+//; + $code_name =~ s/\s+$//; if ($code_name) { &Apache::lonnet::put('CODEs', { @@ -3311,6 +3319,10 @@ ENDPART my $flag_latex_header_remove = 'NO'; my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$num_todo); my $count=0; + my $nohidemap; + if ($perm{'pav'} && $perm{'vgr'}) { + $nohidemap = 1; + } foreach my $code (sort(@allcodes)) { my $file_num=int($count/$number_per_page); if ($code_type eq 'number') { @@ -3323,7 +3335,7 @@ ENDPART $env{'form.CODE'} = $moreenv{'CODE'}; $actual_seq = master_seq_to_person_seq($map, \@master_seq, undef, - $moreenv{'CODE'}, 1); + $moreenv{'CODE'}, $nohidemap); delete($env{'form.CODE'}); } my ($output,$fullname, $printed)= @@ -3621,6 +3633,7 @@ sub print_resources { my $current_assignment = ""; my $assignment; my $courseidinfo = &get_course(); + my $possprint = scalar(@{$master_seq}); if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} @@ -3764,7 +3777,24 @@ sub print_resources { # if ($actually_printed == 0) { - $current_output = &encapsulate_minipage("\\vskip -10mm \nNo incomplete resources\n \\vskip 100 mm { }\n"); + my $message = &mt('No resources to print'); + if (!$possprint) { + if ($perm{'pav'} || $perm{'pfo'}) { + $message = &mt('There are no unhidden resources to print.')."\n\n". + &mt('The most likely reason is one of the following: ')."\n". + '\begin{itemize}'."\n". + '\item '.&mt("The 'Resource hidden from students' parameter is set for the folder being printed.")."\n". + '\item '.&mt("'Hidden' is checked in the Course Editor individually for each resource in the folder being printed.")."\n". + '\end{itemize}'."\n\n". + &mt("Note: to print a bubblesheet exam which you want to hide from students, ". + "use the Course Editor to check the 'Hidden' checkbox for the exam folder itself.")."\n"; + } + } elsif ($print_incomplete) { + $message = &mt('No incomplete resources'); + } + if ($message) { + $current_output = &encapsulate_minipage("\\vskip -10mm \n$message\n \\vskip 100 mm { }\n"); + } if ($remove_latex_header eq "NO") { $current_output = &print_latex_header() . $current_output; } else {