Diff for /loncom/interface/lonprintout.pm between versions 1.640 and 1.648

version 1.640, 2014/02/19 02:12:57 version 1.648, 2016/01/28 19:37:42
Line 700  sub incomplete { Line 700  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  #  resources may need to be altered if there are folders with
 #  random selectiopn or random ordering (or both) enabled.  #  random selectiopn or random ordering (or both) enabled.
 #  This sub computes the set of resources to print for a student  #  This sub computes the set of resources to print for a student
 #  modified both by random ordering and selection and filtered  #  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:  # Parameters:
 #   $map - The URL of the folder being printed.  #   $map - The URL of the folder being printed.
Line 716  sub incomplete { Line 716  sub incomplete {
 #   $who   - Student/domain for whome the sequence will be generated.  #   $who   - Student/domain for whome the sequence will be generated.
 #   $code  - CODE being printed when printing Problems/Resources  #   $code  - CODE being printed when printing Problems/Resources
 #            from folder for CODEd assignments  #            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:  # Implicit inputs:
 #   $  #   $
Line 737  sub master_seq_to_person_seq { Line 740  sub master_seq_to_person_seq {
     my @output_seq;      my @output_seq;
   
     my $unhidden;      my $unhidden;
     if ($perm{'pav'} && $perm{'vgr'} && $nohidemap) {      if ($nohidemap) {
         $unhidden = &Apache::lonnet::clutter($map);          $unhidden = &Apache::lonnet::clutter($map);
     }      }
           
Line 2928  ENDPART Line 2931  ENDPART
   
  &Apache::lonxml::clear_problem_counter();   &Apache::lonxml::clear_problem_counter();
   
  my $pbreakresources = keys %page_breaks;  
  for (my $i=0;$i<=$#master_seq;$i++) {   for (my $i=0;$i<=$#master_seq;$i++) {
   
     &Apache::lonenc::reset_enc();      &Apache::lonenc::reset_enc();
Line 3179  ENDPART Line 3181  ENDPART
  my $student_counter=-1;   my $student_counter=-1;
  my $i = 0;   my $i = 0;
  my $last_section = (split(/:/,$students[0]))[2];   my $last_section = (split(/:/,$students[0]))[2];
            my $nohidemap;
            if ($perm{'pav'} && $perm{'vgr'}) {
                $nohidemap = 1;
            }
  foreach my $person (@students) {   foreach my $person (@students) {
              my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";               my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
      if (-e $duefile) {       if (-e $duefile) {
Line 3196  ENDPART Line 3202  ENDPART
  $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});   $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});
      }       }
      my $actual_seq = master_seq_to_person_seq($map, \@master_seq,       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,       my ($output,$fullname, $printed)=&print_resources($r,$helper,
      $person,$type,       $person,$type,
      \%moreenv,  $actual_seq,       \%moreenv,  $actual_seq,
Line 3284  ENDPART Line 3290  ENDPART
  $moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,$code_length,   $moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,$code_length,
     $code_type);      $code_type);
      }       }
                $code_name =~ s/^\s+//;
                $code_name =~ s/\s+$//;
      if ($code_name) {       if ($code_name) {
  &Apache::lonnet::put('CODEs',   &Apache::lonnet::put('CODEs',
       {        {
Line 3305  ENDPART Line 3313  ENDPART
  my $flag_latex_header_remove = 'NO';    my $flag_latex_header_remove = 'NO'; 
  my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$num_todo);   my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,$num_todo);
  my $count=0;   my $count=0;
            my $nohidemap;
            if ($perm{'pav'} && $perm{'vgr'}) {
                $nohidemap = 1;
            }
  foreach my $code (sort(@allcodes)) {   foreach my $code (sort(@allcodes)) {
      my $file_num=int($count/$number_per_page);       my $file_num=int($count/$number_per_page);
      if ($code_type eq 'number') {        if ($code_type eq 'number') { 
Line 3317  ENDPART Line 3329  ENDPART
                  $env{'form.CODE'} = $moreenv{'CODE'};                   $env{'form.CODE'} = $moreenv{'CODE'};
                  $actual_seq = master_seq_to_person_seq($map, \@master_seq,                   $actual_seq = master_seq_to_person_seq($map, \@master_seq,
                                                         undef,                                                          undef,
                                                         $moreenv{'CODE'}, 1);                                                          $moreenv{'CODE'}, $nohidemap);
                  delete($env{'form.CODE'});                   delete($env{'form.CODE'});
              }               }
      my ($output,$fullname, $printed)=       my ($output,$fullname, $printed)=
Line 3426  ENDPART Line 3438  ENDPART
  #}   #}
     }      }
   
     # Set URLback if this is a construction space print so we can provide      # Set URLback so we can provide a link back to the resource and to change options.
     # a link to the resource being edited.      # (Since the browser back button does not currently work with https,
     #      # the back link is useful even when there is an easy-to-miss LON-CAPA back button.)
   
     my $URLback=''; #link to original document      my $URLback=''; #link to original document
     if ($helper->{'VARS'}->{'construction'} eq '1') {      if ($helper->{'VARS'}->{'construction'} eq '1') {
  $URLback=$helper->{'VARS'}->{'filename'};   $URLback=$helper->{'VARS'}->{'filename'};
       } elsif ($helper->{VARS}{'symb'}) {
           my ($map, $id, $url) = &Apache::lonnet::decode_symb($helper->{VARS}{'symb'});
           $URLback = &Apache::lonnet::clutter($url);
     }      }
     #      #
     # Final adjustment of the font size:      # Final adjustment of the font size:
Line 3612  sub print_resources { Line 3627  sub print_resources {
     #      #
   
     my $syllabus_first = 0;      my $syllabus_first = 0;
     my $assessment_first = 0;  
     my $current_assignment = "";      my $current_assignment = "";
     my $assignment;      my $assignment;
     my $courseidinfo = &get_course();      my $courseidinfo = &get_course();
       my $possprint = scalar(@{$master_seq});
   
     foreach my $curresline (@{$master_seq})  {      foreach my $curresline (@{$master_seq})  {
  if (defined $page_breaks{$curresline}) {   if (defined $page_breaks{$curresline}) {
Line 3634  sub print_resources { Line 3649  sub print_resources {
     if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {      if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {
  next;   next;
     }      }
             if ((!$actually_printed) && ($curresline =~ m/$LONCAPA::assess_re/)) {  
                 $assessment_first = 1;  
             }  
     $actually_printed++; # we're going to print one.      $actually_printed++; # we're going to print one.
   
     if (&Apache::lonnet::allowed('bre',$res_url)) {      if (&Apache::lonnet::allowed('bre',$res_url)) {
Line 3760  sub print_resources { Line 3772  sub print_resources {
     #      #
   
     if ($actually_printed == 0) {      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") {   if ($remove_latex_header eq "NO") {
     $current_output = &print_latex_header() . $current_output;      $current_output = &print_latex_header() . $current_output;
  } else {   } else {
Line 3771  sub print_resources { Line 3800  sub print_resources {
     if ($syllabus_first) {      if ($syllabus_first) {
         $current_output =~ s/\\\\ Last updated:/Last updated:/          $current_output =~ s/\\\\ Last updated:/Last updated:/
     }      }
     my $newheader;      my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
     unless (($assessment_first) && ($actually_printed > 1)) {      my $header_line =
  my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');      &format_page_header($LaTeXwidth, $parmhash{'print_header_format'},
  my $header_line =                          $currentassignment, $courseidinfo, $fullname, $usersection);
     &format_page_header($LaTeXwidth, $parmhash{'print_header_format'},      my $header_start = ($columns_in_format == 1) ? '\lhead' : '\fancyhead[LO]';
  $currentassignment, $courseidinfo, $fullname, $usersection);      my $newheader = $header_start.'{'.$header_line.'}';
  my $header_start = ($columns_in_format == 1) ? '\lhead'  
     : '\fancyhead[LO]';  
  $newheader = $header_start.'{'.$header_line.'}';  
     }  
     if ($current_output=~/\\documentclass/) {      if ($current_output=~/\\documentclass/) {
  $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$newheader$namepostfix}\\vskip 5 mm /;   $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$newheader$namepostfix}\\vskip 5 mm /;
   
Line 5034  sub render { Line 5059  sub render {
     my $PaperType=&mt('Paper type');      my $PaperType=&mt('Paper type');
     my $landscape=&mt('Landscape');      my $landscape=&mt('Landscape');
     my $portrait=&mt('Portrait');      my $portrait=&mt('Portrait');
     my $pdfFormLabel=&mt('PDF-Formfields');      my $pdfFormLabel=&mt('PDF Form Fields');
     my $with=&mt('with Formfields');      my $with=&mt('with Form Fields');
     my $without=&mt('without Formfields');      my $without=&mt('without Form Fields');
           
   
     $result.='<h3>'.&mt('Layout Options').'</h3>'      $result.='<h3>'.&mt('Layout Options').'</h3>'

Removed from v.1.640  
changed lines
  Added in v.1.648


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>