Diff for /loncom/interface/lonprintout.pm between versions 1.287 and 1.288

version 1.287, 2004/03/24 22:22:04 version 1.288, 2004/04/01 15:24:44
Line 1001  ENDPART Line 1001  ENDPART
  $result .= $print_array[0].'  \end{document}';   $result .= $print_array[0].'  \end{document}';
      } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon')     ||       } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon')     ||
       ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon')  ) {         ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon')  ) { 
  $selectionmade="Seems to be useless";   my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
    my $code_name=$helper->{'VARS'}->{'ANON_CODE_STORAGE_NAME'};
    if ($helper->{'VARS'}->{'REMEBER_ANON_CODES'} != 1) {
        $code_name=undef;
    }
  my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};   my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
      my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'});
     } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_from_directory') {         my $flag_latex_header_remove = 'NO'; 
    my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth));
    my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$num_todo,'inline');
    my $seed=time+($$<<16)+($$);
    my %allcodes;
    for (my $i=0;$i<$num_todo;$i++) {
        $moreenv{'CODE'}=&get_CODE(\%allcodes,$i,$seed,'6');
        my ($output,$fullname)=
    &print_resources($r,$helper,'anonymous',$type,\%moreenv,
     \@master_seq,$flag_latex_header_remove);
        $print_array[$i].=$output;
        &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
          &mt('last assignment').' '.$fullname);
        $flag_latex_header_remove = 'YES';
    }
    if ($code_name) {
        my $cdom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
        my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
        &Apache::lonnet::put('CODEs',
     { $code_name => join(',',keys(%allcodes)) },
     $cdom,$cnum);
    }
    &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
    $result .= $print_array[0].'  \end{document}';
        } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_from_directory') {      
     #prints selected problems from the subdirectory       #prints selected problems from the subdirectory 
  $selectionmade = 6;   $selectionmade = 6;
         my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'};          my @list_of_files=split /\|\|\|/, $helper->{'VARS'}->{'FILES'};
Line 1162  ENDPART Line 1190  ENDPART
                             'cgi.'.$identifier.'backref' => $URLback,);                              'cgi.'.$identifier.'backref' => $URLback,);
     
 $r->print(<<FINALEND);  $r->print(<<FINALEND);
 <meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier">  <meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" />
 </body>  </body>
 </html>  </html>
 FINALEND  FINALEND
 }  }
   
   sub num_to_letters {
       my ($num) = @_;
       my @nums= split('',$num);
       my @num_to_let=('A'..'Z');
       my $word;
       foreach my $digit (@nums) { $word.=$num_to_let[$digit]; }
       return $word;
   }
   
   sub get_CODE {
       my ($all_codes,$num,$seed,$size)=@_;
       my $max='1'.'0'x$size;
       srand($seed);
       my $newcode;
       while(1) {
    $newcode=int(rand($max));
    if (!exists($$all_codes{$newcode})) {
       $$all_codes{$newcode}=1;
       return &num_to_letters($newcode);
    }
       }
   }
   
 sub print_resources {  sub print_resources {
     my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header)=@_;      my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header)=@_;
     my $current_output = '';       my $current_output = ''; 
     my ($username,$userdomain,$usersection) = split /:/,$person;      my ($username,$userdomain,$usersection) = split /:/,$person;
     my $fullname = &get_name($username,$userdomain);      my $fullname = &get_name($username,$userdomain);
           if ($person =~ 'anon') {
    $fullname = "CODE - ".$moreenv->{'CODE'};
       }
     #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   
     &Apache::lonnet::delenv('form.counter');      &Apache::lonnet::delenv('form.counter');
Line 1485  ALL_PROBLEMS Line 1537  ALL_PROBLEMS
   
  if ($helper->{VARS}->{'assignment'}) {   if ($helper->{VARS}->{'assignment'}) {
     push @{$printChoices}, ["<b>Problems</b> from <b><i>$sequenceTitle</i></b> for <b>selected students</b>", 'problems_for_students', 'CHOOSE_STUDENTS'];      push @{$printChoices}, ["<b>Problems</b> from <b><i>$sequenceTitle</i></b> for <b>selected students</b>", 'problems_for_students', 'CHOOSE_STUDENTS'];
     push @{$printChoices}, ["<b>Problems</b> from <b><i>$sequenceTitle</i></b> for <b>anonymous students</b>", 'problems_for_anonymous', 'CHOOSE_ANON1'];      push @{$printChoices}, ["<b>Problems</b> from <b><i>$sequenceTitle</i></b> for <b>anonymous students</b>", 'problems_for_anon', 'CHOOSE_ANON1'];
  }   }
  my $resource_selector=<<RESOURCE_SELECTOR;   my $resource_selector=<<RESOURCE_SELECTOR;
    <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>     <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>
Line 1514  RESOURCE_SELECTOR Line 1566  RESOURCE_SELECTOR
 CHOOSE_STUDENTS  CHOOSE_STUDENTS
         &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1);          &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1);
   <state name="CHOOSE_ANON1" title="Select Students and Resources">    <state name="CHOOSE_ANON1" title="Select Students and Resources">
       <nextstate>PAGESIZE</nextstate>
     <message><hr width='33%' /><b>Number of anonymous assignments to print?</b></message>      <message><hr width='33%' /><b>Number of anonymous assignments to print?</b></message>
     <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5"></string>      <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5"></string>
           <choices variable="REMEBER_ANON_CODES" allowempty="1" multichoice="1">
         <choice computer="1">
           Should the CODEs used on this printing be remebered for later?
         </choice>
       </choices>
       <message><b>Names to store the CODEs under for later:</b></message>
       <string variable="ANON_CODE_STORAGE_NAME" maxlength="50" size="20" />
     <message><hr width='33%' /></message>      <message><hr width='33%' /></message>
     $resource_selector      $resource_selector
   </state>    </state>
Line 1525  CHOOSE_ANON1 Line 1584  CHOOSE_ANON1
   
  if ($helper->{VARS}->{'assignment'}) {   if ($helper->{VARS}->{'assignment'}) {
     push @{$printChoices}, ["<b>Resources</b> from <b><i>$sequenceTitle</i></b> for <b>selected students</b>", 'resources_for_students', 'CHOOSE_STUDENTS1'];      push @{$printChoices}, ["<b>Resources</b> from <b><i>$sequenceTitle</i></b> for <b>selected students</b>", 'resources_for_students', 'CHOOSE_STUDENTS1'];
     push @{$printChoices}, ["<b>Resources</b> from <b><i>$sequenceTitle</i></b> for <b>anonymous students</b>", 'resources_for_anonymous', 'CHOOSE_ANON2'];      push @{$printChoices}, ["<b>Resources</b> from <b><i>$sequenceTitle</i></b> for <b>anonymous students</b>", 'resources_for_anon', 'CHOOSE_ANON2'];
  }   }
           
   

Removed from v.1.287  
changed lines
  Added in v.1.288


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