Diff for /loncom/interface/lonprintout.pm between versions 1.303 and 1.306

version 1.303, 2004/05/27 14:08:58 version 1.306, 2004/06/07 19:08:36
Line 1286  sub print_resources { Line 1286  sub print_resources {
        ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) {         ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) {
     my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);      my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
     if (&Apache::lonnet::allowed('bre',$res_url)) {      if (&Apache::lonnet::allowed('bre',$res_url)) {
  my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);   if ($res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
  my $lonidsdir=$r->dir_config('lonIDsDir');      my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
  my $envfile=$ENV{'user.environment'};      my $lonidsdir=$r->dir_config('lonIDsDir');
  $envfile=~/\/([^\/]+)\.id$/;      my $envfile=$ENV{'user.environment'};
  $envfile=$1;      $envfile=~/\/([^\/]+)\.id$/;
  &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);      $envfile=$1;
  my $current_counter=$ENV{'form.counter'};      &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
  if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||      my $current_counter=$ENV{'form.counter'};
    ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {      if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
     my %form;         ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
     $form{'answer_output_mode'}='tex';   my %form;
     $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};   $form{'answer_output_mode'}='tex';
     my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%form);   $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
     &Apache::lonnet::appenv(('form.counter' => $current_counter));   my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%form);
     if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {   &Apache::lonnet::appenv(('form.counter' => $current_counter));
  $rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;   if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
       $rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
    } else {
       $rendered=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
       $rendered.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($curresline).'}\vskip 0 mm ';
       $rendered.=&path_to_problem ($curresline,$LaTeXwidth);
       $rendered.='\vskip 1 mm '.$ansrendered;
    }
       }
       if ($remove_latex_header eq 'YES') {
    $rendered = &latex_header_footer_remove($rendered);
     } else {      } else {
  $rendered=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});   $rendered =~ s/\\end{document}//;
  $rendered.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($curresline).'}\vskip 0 mm ';  
  $rendered.=&path_to_problem ($curresline,$LaTeXwidth);  
  $rendered.='\vskip 1 mm '.$ansrendered;  
     }      }
  }      $current_output .= $rendered;    
  if ($remove_latex_header eq 'YES') {   } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
     $rendered = &latex_header_footer_remove($rendered);      my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
       my $lonidsdir=$r->dir_config('lonIDsDir');
       my $envfile=$ENV{'user.environment'};
       $envfile=~/\/([^\/]+)\.id$/;
       $envfile=$1;
       &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
       my $current_counter=$ENV{'form.counter'};
       if ($remove_latex_header eq 'YES') {
    $rendered = &latex_header_footer_remove($rendered);
       } else {
    $rendered =~ s/\\end{document}//;
       }
       $current_output .= $rendered.'\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\strut \vskip 0 mm \strut ';
  } else {   } else {
     $rendered =~ s/\\end{document}//;      my $rendered = &unsupported($res_url);
       if ($remove_latex_header ne 'NO') {
    $rendered = &latex_header_footer_remove($rendered);
       } else {
    $rendered =~ s/\\end{document}//;
       }
       $current_output .= $rendered;
  }   }
  $current_output .= $rendered;  
     }      }
     $remove_latex_header = 'YES';      $remove_latex_header = 'YES';
  }   }
Line 1572  HELPERFRAGMENT Line 1596  HELPERFRAGMENT
   
     # If the user is priviledged, allow them to print all       # If the user is priviledged, allow them to print all 
     # problems in the course, optionally for selected students      # problems in the course, optionally for selected students
     if ($userPriviledged && ($helper->{VARS}->{'postdata'}=~/\/res\//)) {       if ($userPriviledged && 
           ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { 
         push @{$printChoices}, ['<b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS'];          push @{$printChoices}, ['<b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS'];
          &Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS);           &Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS);
   <state name="ALL_PROBLEMS" title="Select Problem(s) to print">    <state name="ALL_PROBLEMS" title="Select Problem(s) to print">
Line 1967  STATEHTML Line 1992  STATEHTML
     $result .= "</select></td><td>\n";      $result .= "</select></td><td>\n";
     $result .= "<select name='${var}.paper'>\n";      $result .= "<select name='${var}.paper'>\n";
   
       my %parmhash=&Apache::lonnet::coursedescription($ENV{'request.course.id'});
       my $DefaultPaperSize=$parmhash{'default_paper_size'};
       if ($DefaultPaperSize eq '') {$DefaultPaperSize='letter';}
     $i = 0;      $i = 0;
     foreach (@paperSize) {      foreach (@paperSize) {
         if ($i == 0) {          if ($paperSize[$i]=~/$DefaultPaperSize/) {
             $result .= "<option selected value='$i'>" . $paperSize[$i] . "</option>\n";              $result .= "<option selected value='$i'>" . $paperSize[$i] . "</option>\n";
         } else {          } else {
             $result .= "<option value='$i'>" . $paperSize[$i] . "</option>\n";              $result .= "<option value='$i'>" . $paperSize[$i] . "</option>\n";

Removed from v.1.303  
changed lines
  Added in v.1.306


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