Diff for /loncom/interface/lonprintout.pm between versions 1.301 and 1.305

version 1.301, 2004/05/10 14:25:02 version 1.305, 2004/06/03 18:46:34
Line 421  sub page_format { Line 421  sub page_format {
     } elsif($papersize eq '6') {      } elsif($papersize eq '6') {
  if ($layout eq 'book') {   if ($layout eq 'book') {
     if ($numberofcolumns == 1) {      if ($numberofcolumns == 1) {
  $textwidth = '18 cm';   $textwidth = '176 mm';
  $textheight = '28 cm';   $textheight = '254 mm';
  $oddoffset = '-0.57 in';   $oddoffset = '-0.57 in';
  $evenoffset = '-0.57 in';   $evenoffset = '-0.57 in';
     } elsif ($numberofcolumns == 2) {      } elsif ($numberofcolumns == 2) {
  $textwidth = '96 mm';   $textwidth = '91 mm';
  $textheight = '2 cm';   $textheight = '254 mm';
  $oddoffset = '-0.57 in';   $oddoffset = '-0.57 in';
  $evenoffset = '-0.57 in';   $evenoffset = '-0.57 in';
     }      }
Line 1103  ENDPART Line 1103  ENDPART
  if ($urlp =~ m|/home/([^/]+)/public_html|) {   if ($urlp =~ m|/home/([^/]+)/public_html|) {
     $urlp =~ s|/home/([^/]*)/public_html|/~$1|;      $urlp =~ s|/home/([^/]*)/public_html|/~$1|;
  } else {   } else {
     $urlp =~ s|^/home/httpd/html||;      $urlp =~ s|^$Apache::lonnet::perlvar{'lonDocRoot'}||;
  }   }
  my $texversion=&Apache::lonnet::ssi($urlp,%form);   my $texversion=&Apache::lonnet::ssi($urlp,%form);
  if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||   if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
Line 1231  ENDPART Line 1231  ENDPART
     &Apache::lonnet::appenv('cgi.'.$identifier.'.file'   => $filename,      &Apache::lonnet::appenv('cgi.'.$identifier.'.file'   => $filename,
                             'cgi.'.$identifier.'.layout'  => $laystyle,                              'cgi.'.$identifier.'.layout'  => $laystyle,
                             'cgi.'.$identifier.'.numcol'  => $numberofcolumns,                              'cgi.'.$identifier.'.numcol'  => $numberofcolumns,
       'cgi.'.$identifier.'.paper'  => $papersize,
                             'cgi.'.$identifier.'.selection' => $selectionmade,                              'cgi.'.$identifier.'.selection' => $selectionmade,
     'cgi.'.$identifier.'tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'},      'cgi.'.$identifier.'tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'},
     'cgi.'.$identifier.'tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'},      'cgi.'.$identifier.'tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'},
Line 1285  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 1494  sub printHelper { Line 1519  sub printHelper {
     # "Delete everything after the last slash."      # "Delete everything after the last slash."
     $subdir =~ s|/[^/]+$||;      $subdir =~ s|/[^/]+$||;
     if (not $helper->{VARS}->{'construction'}) {      if (not $helper->{VARS}->{'construction'}) {
  $subdir='/home/httpd/html/res/'.$subdir;   $subdir=$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$subdir;
     }      }
     # "Remove all duplicate slashes."      # "Remove all duplicate slashes."
     $subdir =~ s|/+|/|g;      $subdir =~ s|/+|/|g;
Line 1693  CHOOSE_ANON2 Line 1718  CHOOSE_ANON2
     }      }
   
     # FIXME: That RE should come from a library somewhere.      # FIXME: That RE should come from a library somewhere.
     if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $ENV{'request.role.adv'} and $subdir ne '/home/httpd/html/res/') {          if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $ENV{'request.role.adv'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {    
         push @{$printChoices}, ["<b>".&mt('Problems')."</b> ".&mt('from current subdirectory')." <b><i>$subdir</i></b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];          push @{$printChoices}, ["<b>".&mt('Problems')."</b> ".&mt('from current subdirectory')." <b><i>$subdir</i></b>", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
   
         my $f = '$filename';          my $f = '$filename';
Line 1966  STATEHTML Line 1991  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.301  
changed lines
  Added in v.1.305


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