Diff for /loncom/interface/lonprintout.pm between versions 1.590 and 1.591

version 1.590, 2011/06/06 10:53:09 version 1.591, 2011/06/14 10:22:39
Line 432  RESOURCE_SELECTOR Line 432  RESOURCE_SELECTOR
   
 #-----------------------------------------------------------------------  #-----------------------------------------------------------------------
   
   # Determine if a resource is incomplete given the map:
   # Parameters:
   #   $username - Name of user for whom we are checking.
   #   $domain   - Domain of user we are checking.
   #   $map - map name.
   # Returns:
   #     0 - map is not incomplete.
   #     1 - map is incomplete.
   #
   sub incomplete {
       my ($username, $domain, $map) = @_;
   
       # Manipulate the env so the navmap is made
       # in the context of the appropriate user:
   
       my $me         = $env{'user.name'};
       my $my_domain  = $env{'user.domain'};
   
       $env{'user.name'} = $username;
       $env{'user.domain'} = $domain;
   
       my $navmap = Apache::lonnavmaps::navmap->new();
       
       $env{'user.name'}   = $me; # Restore user/domain context.
       $env{'user.domain'} = $my_domain;
   
       if (defined($navmap)) {
    my $res = $navmap->getResourceByUrl($map);
    my $result = $res->is_incomplete();
    return $result;
       } else {
    return 1;
       }
   }
   
 # Fetch the contents of a resource, uninterpreted.  # Fetch the contents of a resource, uninterpreted.
 # This is used here to fetch a latex file to be included  # This is used here to fetch a latex file to be included
Line 2222  sub print_construction_sequence { Line 2256  sub print_construction_sequence {
 #BZ 5209  #BZ 5209
 #   2        map_incomplete_problems_seq Print incomplete problems from the current  #   2        map_incomplete_problems_seq Print incomplete problems from the current
 #            folder in student context.  #            folder in student context.
 #   101      map_incomplete_problems_people_seq Print incomplete problems from the  #   5      map_incomplete_problems_people_seq Print incomplete problems from the
 #            current folder in privileged context.  #            current folder in privileged context.
 #   102      incomplete_problems_selpeople_course Print incomplete problems for  #    5      incomplete_problems_selpeople_course Print incomplete problems for
 #            selected people from the entire course.  #            selected people from the entire course.
 #  #
 #   Item 101 has much the same processing as 8,  #   Item 101 has much the same processing as 8,
 #   Item 102 has much the same processing as 8.  
 #  #
 #  Differences:  Item 101, 102 require per-student filtering of the resource  #  Differences:  Item 101, 102 require per-student filtering of the resource
 #  set so that only the incomplete resources are printed.  #  set so that only the incomplete resources are printed.
Line 2724  ENDPART Line 2757  ENDPART
      } elsif (($print_type eq 'problems_for_students')           ||       } elsif (($print_type eq 'problems_for_students')           ||
       ($print_type eq 'problems_for_students_from_page') ||        ($print_type eq 'problems_for_students_from_page') ||
       ($print_type eq 'all_problems_students')           ||        ($print_type eq 'all_problems_students')           ||
       ($print_type eq 'resources_for_students')){        ($print_type eq 'resources_for_students')          ||
         ($print_type eq 'incomplete_problems_selpeople_course') ||
         ($print_type eq 'map_incomplete_problems_people_seq')){
   
   
      #-- prints assignments for whole class or for selected students         #-- prints assignments for whole class or for selected students  
  my $type;   my $type;
  if (($print_type eq 'problems_for_students')           ||   if (($print_type eq 'problems_for_students')           ||
      ($print_type eq 'problems_for_students_from_page') ||       ($print_type eq 'problems_for_students_from_page') ||
      ($print_type eq 'all_problems_students') ) {       ($print_type eq 'all_problems_students')           ||
        ($print_type eq 'incomplete_problems_selpeople_course') ||
        ($print_type eq 'map_incomplete_problems_people_seq')) {
      $selectionmade=5;       $selectionmade=5;
      $type='problems';       $type='problems';
  } elsif ($print_type eq 'resources_for_students') {   } elsif ($print_type eq 'resources_for_students') {
Line 2788  ENDPART Line 2825  ENDPART
  my $i = 0;   my $i = 0;
  my $last_section = (split(/:/,$students[0]))[2];   my $last_section = (split(/:/,$students[0]))[2];
  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) {
  my $temp_file = Apache::File->new('>>'.$duefile);   my $temp_file = Apache::File->new('>>'.$duefile);
Line 3159  sub print_resources { Line 3195  sub print_resources {
     my ($username,$userdomain,$usersection) = split /:/,$person;      my ($username,$userdomain,$usersection) = split /:/,$person;
     my $fullname = &get_name($username,$userdomain);      my $fullname = &get_name($username,$userdomain);
     my $namepostfix = "\\\\"; # Both anon and not anon should get the same vspace.      my $namepostfix = "\\\\"; # Both anon and not anon should get the same vspace.
       #
       # Figure out if we need to filter the output by
       # the incomplete problems for that person
       #
       my $print_type = $helper->{'VARS'}->{'PRINT_TYPE'};
       my $print_incomplete = 0;
       if (($print_type eq 'map_incomplete_problems_people_seq')   ||
    ($print_type eq 'incomplete_problems_selpeople_course')) {
    $print_incomplete = 1;
       }
     if ($person =~ 'anon') {      if ($person =~ 'anon') {
  $namepostfix .="Name: ";   $namepostfix .="Name: ";
  $fullname = "CODE - ".$moreenv->{'CODE'};   $fullname = "CODE - ".$moreenv->{'CODE'};
Line 3168  sub print_resources { Line 3214  sub print_resources {
     #      #
   
     my $i           = 0;      my $i           = 0;
       my $actually_printed = 0; # Count of resources printed.
     #goes through all resources, checks if they are available for       #goes through all resources, checks if they are available for 
     #current student, and produces output         #current student, and produces output   
   
Line 3184  sub print_resources { Line 3231  sub print_resources {
     #   so we will just rely on prntout.pl to strip  ENDOFSTUDENTSTAMP from the      #   so we will just rely on prntout.pl to strip  ENDOFSTUDENTSTAMP from the
     #   postscript.  Each ENDOFSTUDENTSTAMP will go on a line by itself.      #   postscript.  Each ENDOFSTUDENTSTAMP will go on a line by itself.
     #      #
   
     my $syllabus_first = 0;      my $syllabus_first = 0;
     foreach my $curresline (@{$master_seq})  {      foreach my $curresline (@{$master_seq})  {
  if (defined $page_breaks{$curresline}) {   if (defined $page_breaks{$curresline}) {
Line 3196  sub print_resources { Line 3244  sub print_resources {
  if ( !($type eq 'problems' &&    if ( !($type eq 'problems' && 
        ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) ) {         ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) ) {
     my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);      my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
       if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {
    next;
       }
       $actually_printed++; # we're going to print one.
     if (&Apache::lonnet::allowed('bre',$res_url)) {      if (&Apache::lonnet::allowed('bre',$res_url)) {
  if ($res_url!~m|^ext/|   if ($res_url!~m|^ext/|
     && $res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {      && $res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
Line 3209  sub print_resources { Line 3261  sub print_resources {
                                 $rendered = &print_latex_header().$rendered;                                  $rendered = &print_latex_header().$rendered;
                             }                              }
                         }                          }
   ;
                         if ($remove_latex_header eq 'YES') {                          if ($remove_latex_header eq 'YES') {
                             $rendered = &latex_header_footer_remove($rendered);                              $rendered = &latex_header_footer_remove($rendered);
                         } else {                          } else {
Line 3220  sub print_resources { Line 3273  sub print_resources {
  #   Use a copy of the hash so we don't pervert it on future loop passes.   #   Use a copy of the hash so we don't pervert it on future loop passes.
  my %answerenv = %{$moreenv};   my %answerenv = %{$moreenv};
  $answerenv{'answer_output_mode'}='tex';   $answerenv{'answer_output_mode'}='tex';
   
   
  $answerenv{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};   $answerenv{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
   
  &Apache::lonxml::restore_problem_counter();   &Apache::lonxml::restore_problem_counter();
Line 3294  sub print_resources { Line 3349  sub print_resources {
  }   }
  if (&Apache::loncommon::connection_aborted($r)) { last; }   if (&Apache::loncommon::connection_aborted($r)) { last; }
     }      }
       # If we are printing incomplete it's possible we don't have
       # anything to print.  The print subsystem is not so good at handling
       # that so we're going to generate a stub that says there are no
       # incomplete resources for the person.
       #
       if ($actually_printed == 0) {
   
    $current_output  = 'No incomplete resources';
    $current_output .= '\end{document}';
    $current_output = &print_latex_header() . $current_output;
       }
   
     if ($syllabus_first) {      if ($syllabus_first) {
         $current_output =~ s/\\\\ Last updated:/Last updated:/          $current_output =~ s/\\\\ Last updated:/Last updated:/
Line 3838  ALL_PROBLEMS Line 3904  ALL_PROBLEMS
  }   }
   
  my $randomly_ordered_warning =    my $randomly_ordered_warning = 
     &get_randomly_ordered_warning($helper,$map);              &get_randomly_ordered_warning($helper, $map);
   
  # resource_selector will hold a few states that:   # resource_selector will hold a few states that:
  #   - Allow resources to be selected for printing.   #   - Allow resources to be selected for printing.

Removed from v.1.590  
changed lines
  Added in v.1.591


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