Diff for /loncom/interface/lonprintout.pm between versions 1.625 and 1.631

version 1.625, 2012/12/08 20:10:26 version 1.631, 2013/05/30 05:04:22
Line 149  sub printable_sequence { Line 149  sub printable_sequence {
 # Return:  # Return:
 #     XML that can be parsed by the helper to drive the state machine.  #     XML that can be parsed by the helper to drive the state machine.
 #  #
 sub create_incomplete_folder_selstud_helper($helper)  sub create_incomplete_folder_selstud_helper {
 {  
     my ($helper, $map)  = @_;      my ($helper, $map)  = @_;
   
   
Line 705  sub incomplete { Line 704  sub incomplete {
 #  to only those that are in the original set selcted to be printed.  #  to only those that are in the original set selcted to be printed.
 #  #
 # Parameters:  # Parameters:
 #   $helper - The helper we need $helper->{'VARS'}->{'symb'}  #   $map - The URL of the folder being printed.
 #            to construct the navmap and the iteration.  #          Used to determine which startResource and finishResource
 #   $seq   - The original set of resources to print   #          to use when using the navmap's getIterator method.
   #   $seq   - The original set of resources to print.
 #            (really an array of resource names (array of symb's).  #            (really an array of resource names (array of symb's).
 #   $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
   #            from folder for CODEd assignments
 #  #
 # Implicit inputs:  # Implicit inputs:
 #   $  #   $
Line 718  sub incomplete { Line 720  sub incomplete {
 #   print_resources.  #   print_resources.
 #   # 
 sub master_seq_to_person_seq {  sub master_seq_to_person_seq {
     my ($helper, $seq, $who, $code) = @_;      my ($map, $seq, $who, $code, $nohidemap) = @_;
   
   
     my ($username, $userdomain, $usersection) = split(/:/, $who);      my ($username, $userdomain, $usersection) = split(/:/, $who);
   
   
     # Toss the sequence up into a hash so that we have O(1) lookup time.      # Toss the sequence up into a hash so that we have O(1) lookup time.
     # on the items that come out of the user's list of resources.      # on the items that come out of the user's list of resources.
     #      #
       
     my %seq_hash = map {$_  => 1} @$seq;      my %seq_hash = map {$_  => 1} @$seq;
     my @output_seq;      my @output_seq;
   
       my $unhidden;
       if ($perm{'pav'} && $perm{'vgr'} && $nohidemap) {
           $unhidden = &Apache::lonnet::clutter($map);
       }
           
     my ($map, $id, $url) = &Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});  
     my $navmap           = Apache::lonnavmaps::navmap->new($username, $userdomain,      my $navmap           = Apache::lonnavmaps::navmap->new($username, $userdomain,
                                                            $code);                                                             $code, $unhidden);
     my $iterator         = $navmap->getIterator($navmap->firstResource(),      my ($start,$finish);
  $navmap->finishResource(),  
  {}, 1);      if ($map) {
     my %nonResourceItems = (          my $mapres = $navmap->getResourceByUrl($map);
  $iterator->BEGIN_MAP    => 1,          if ($mapres->is_map()) {
  $iterator->BEGIN_BRANCH => 1,              $start = $mapres->map_start();
  $iterator->END_BRANCH   => 1,              $finish = $mapres->map_finish();
  $iterator->END_MAP      => 1,          }
  $iterator->FORWARD      => 1,      }
  $iterator->BACKWARD     => 1      unless ($start && $finish) {
           $start = $navmap->firstResource();
           $finish = $navmap->finishResource();
       }
   
     ); # These items are not resources but appear in the midst of iteration.      my $iterator         = $navmap->getIterator($start,$finish,{},1);
   
     #  Iterate on the resource..select the items that are randomly selected      #  Iterate on the resource..select the items that are randomly selected
     #  and that are in the seq_has.  Presumably the iterator will take care      #  and that are in the seq_has.  Presumably the iterator will take care
Line 757  sub master_seq_to_person_seq { Line 765  sub master_seq_to_person_seq {
  #  Only process resources..that are not removed by randomout...   #  Only process resources..that are not removed by randomout...
  #  and are selected for printint as well.   #  and are selected for printint as well.
  #   #
                if (ref($curres) && ! $curres->randomout()) {
  if (! exists $nonResourceItems{$curres} && ! $curres->randomout()) {              my $currsymb = $curres->symb();
     my $symb = $curres->symb();              if (exists($seq_hash{$currsymb})) {
     if (exists $seq_hash{$symb}) {                  push(@output_seq, $currsymb);
  push(@output_seq, $symb);  
     }      }
  }   }
     }      }
      
   
     return \@output_seq; # for now.      return \@output_seq; # for now.
           
Line 3145  ENDPART Line 3151  ENDPART
  }   }
  my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};   my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
   
            my $map;
            if ($helper->{VARS}->{'symb'}) {
                ($map, my $id, my $resource) =
                    &Apache::lonnet::decode_symb($helper->{VARS}->{'symb'});
            }
   
  #loop over students   #loop over students
   
   my $flag_latex_header_remove = 'NO';    my $flag_latex_header_remove = 'NO';
Line 3179  ENDPART Line 3191  ENDPART
      } else {       } else {
  $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($helper, \@master_seq, $person);       my $actual_seq = master_seq_to_person_seq($map, \@master_seq,
                                                          $person, undef, 1);
      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 3221  ENDPART Line 3234  ENDPART
                  }                   }
      }       }
  }   }
          my ($randomorder,$randompick);           my ($randomorder,$randompick,$map);
          if ($helper->{VARS}{'symb'}) {           if ($helper->{VARS}{'symb'}) {
                ($map, my $id, my $resource) =
                    &Apache::lonnet::decode_symb($helper->{VARS}{'symb'});
              my $navmap = Apache::lonnavmaps::navmap->new();               my $navmap = Apache::lonnavmaps::navmap->new();
              if (defined($navmap)) {               if (defined($navmap)) {
                  my ($map,$id,$resource) =   
                      &Apache::lonnet::decode_symb($helper->{VARS}{'symb'});  
                  if ($map) {                   if ($map) {
                      my $res = $navmap->getResourceByUrl($map);                       my $mapres = $navmap->getResourceByUrl($map);
                      $randomorder = $res->randomorder();                       $randomorder = $mapres->randomorder();
                      $randompick = $res->randompick();                       $randompick = $mapres->randompick();
                  }                   }
              }               }
          }           }
Line 3298  ENDPART Line 3311  ENDPART
              my $actual_seq = \@master_seq;               my $actual_seq = \@master_seq;
              if ($randomorder) {               if ($randomorder) {
                  $env{'form.CODE'} = $moreenv{'CODE'};                   $env{'form.CODE'} = $moreenv{'CODE'};
                  $actual_seq = master_seq_to_person_seq($helper,\@master_seq,undef,                   $actual_seq = master_seq_to_person_seq($map, \@master_seq,
                                                         $moreenv{'CODE'});                                                          undef,
                                                           $moreenv{'CODE'}, 1);
                  delete($env{'form.CODE'});                   delete($env{'form.CODE'});
              }               }
      my ($output,$fullname, $printed)=       my ($output,$fullname, $printed)=
Line 4648  CHOOSE_FROM_ANY_SEQUENCE Line 4662  CHOOSE_FROM_ANY_SEQUENCE
     if (!$res_printable) {      if (!$res_printable) {
  $paramHash = Apache::lonhelper::getParamHash();   $paramHash = Apache::lonhelper::getParamHash();
  $paramHash->{MESSAGE_TEXT} =    $paramHash->{MESSAGE_TEXT} = 
     &mt('<p><b>Printing for current resource is only possible between [_1] and [_1]</b></p>',              '<p class="LC_info">'
     $res_printstartdate, $res_printenddate);             .&mt('Printing for current resource is only possible between [_1] and [_2]',
                   $res_printstartdate, $res_printenddate).'</p>';
  Apache::lonhelper::message->new();   Apache::lonhelper::message->new();
     }      }
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
Line 4874  FONT_SELECTION Line 4889  FONT_SELECTION
       return "$helper->{VARS}->{'probstatus'}";        return "$helper->{VARS}->{'probstatus'}";
                    </defaultvalue>                     </defaultvalue>
    <choice computer="problem">Homework Problem</choice>     <choice computer="problem">Homework Problem</choice>
    <choice computer="exam">Exam Problem</choice>     <choice computer="exam">Bubblesheet Exam Problem</choice>
    <choice computer="survey">Survey question</choice>     <choice computer="survey">Survey question</choice>
                    ,choice computer="anonsurvey"Anonymous survey question</choice>                     ,choice computer="anonsurvey"Anonymous survey question</choice>
  </dropdown>   </dropdown>

Removed from v.1.625  
changed lines
  Added in v.1.631


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