Diff for /loncom/interface/lonprintout.pm between versions 1.160 and 1.161

version 1.160, 2003/05/08 19:16:42 version 1.161, 2003/05/12 18:14:01
Line 1363  ENDPART Line 1363  ENDPART
     if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {      if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
       #-- single document - problem, page, html, xml, ...        #-- single document - problem, page, html, xml, ...
  my $currentURL;   my $currentURL;
  if ($helper->{'VARS'}->{'construction'} ne '1') {   if (not defined $helper->{'VARS'}->{'construction'}) {
             #prins published resource  
     $currentURL=$helper->{'VARS'}->{'postdata'};      $currentURL=$helper->{'VARS'}->{'postdata'};
  } else {   } else {
             #prins resource from the construction space      $currentURL=$helper->{'VARS'}->{'construction'};
     $currentURL=$helper->{'VARS'}->{'filename'};  
     $currentURL=~s/\/home\//\/~/;  
     $currentURL=~s/public_html\///;  
  }   }
  $selectionmade = 1;   $selectionmade = 1;
  if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {   if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
     my %moreenv;          my %moreenv;
     $moreenv{'form.grade_target'}='tex';          $moreenv{'form.grade_target'}='tex';
     $moreenv{'request.filename'}=$currentURL;   if (&Apache::lonnet::allowed('bre',$currentURL)) {
     $moreenv{'form.textwidth'}=$LaTeXwidth;      $currentURL=~s/http:\/\/[^\/]+//;
     &Apache::lonnet::appenv(%moreenv);   }
     my $texversion=&Apache::lonnet::ssi($currentURL);          $moreenv{'request.filename'}=$currentURL;
     &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');          $moreenv{'form.textwidth'}=$LaTeXwidth;
     $result .= $texversion;          &Apache::lonnet::appenv(%moreenv);
     if ($currentURL=~m/\.page\s*$/) {          my $texversion=&Apache::lonnet::ssi($currentURL);
  ($result,$number_of_columns) = &page_cleanup($result);          &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
     }          $result .= $texversion;
  } else {          if ($currentURL=~m/\.page\s*$/) {
     ($result,$number_of_columns) = &page_cleanup($result);
           }
         } else {
 #  $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';  #  $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
 #  if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {  #  if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {
 #      $result.=$1;  #      $result.=$1;
Line 1393  ENDPART Line 1392  ENDPART
 #      $result.=$ENV{'form.url'};  #      $result.=$ENV{'form.url'};
 #  }  #  }
 #  $result.=' \end{document}'  #  $result.=' \end{document}'
  }        }
   
   
     } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or      } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or
              ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or               ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or
              ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')) {                ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')) { 
Line 1584  sub handler { Line 1585  sub handler {
   
 # my $key;   # my $key; 
 # foreach $key (keys %{$helper->{'VARS'}}) {  # foreach $key (keys %{$helper->{'VARS'}}) {
 #    $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-<br />');  #    $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<br />');
 # }  # }
 # return OK;  # return OK;
   
Line 1749  sub printHelper { Line 1750  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 defined $helper->{VARS}->{'construction'}) {
  $subdir='/home/httpd/html/res/'.$subdir;   $subdir =  '/home/httpd/html/res'.$subdir;   
       } else {
    $helper->{VARS}->{'construction'}=~/^([^\/]+)\/\/([^\/]+)(.*)\/[^\/]*$/;
    $subdir = $3;
    $subdir=~/\/~([^\/]+)\/(.*)$/;
    $subdir = '/home/'.$1.'/public_html/'.$2;
     }      }
   ####    $r->print('Dir:  '.$subdir.'  ');
   ####    return OK;
   
   
     # What can be printed is a very dynamic decision based on      # What can be printed is a very dynamic decision based on
Line 1775  sub printHelper { Line 1783  sub printHelper {
     $r->print($helper->{VARS}->{'postdata'});      $r->print($helper->{VARS}->{'postdata'});
   
     # If we're in a sequence...      # If we're in a sequence...
     if ($helper->{'VARS'}->{'construction'} ne '1') {      if (!defined($helper->{'VARS'}->{'construction'})) {
         # Allow problems from sequence          # Allow problems from sequence
         push @{$printChoices}, ["Problem(s) from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS'];          push @{$printChoices}, ["Problem(s) from <b>$sequenceTitle</b>", 'map_problems', 'CHOOSE_PROBLEMS'];
         # Allow all resources from sequence          # Allow all resources from sequence
Line 1878  CHOOSE_FROM_SUBDIR Line 1886  CHOOSE_FROM_SUBDIR
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
     $paramHash->{MESSAGE_TEXT} = "";      $paramHash->{MESSAGE_TEXT} = "";
     Apache::lonhelper::message->new();      Apache::lonhelper::message->new();
   
     $paramHash = Apache::lonhelper::getParamHash();      $paramHash = Apache::lonhelper::getParamHash();
     $paramHash->{'variable'} = 'PRINT_TYPE';      $paramHash->{'variable'} = 'PRINT_TYPE';
     $helper->declareVar('PRINT_TYPE');      $helper->declareVar('PRINT_TYPE');
     $paramHash->{CHOICES} = $printChoices;      $paramHash->{CHOICES} = $printChoices;
     Apache::lonhelper::choices->new();      Apache::lonhelper::choices->new();
   
       if (1) {
           $paramHash = Apache::lonhelper::getParamHash();
           $paramHash->{MESSAGE_TEXT} = "<hr>";
           Apache::lonhelper::message->new();
   
           $paramHash = Apache::lonhelper::getParamHash();
           $paramHash->{CHOICES} = [
                                      ['Print with answer', '1'],
                                      ['Print without answers', '0'] ];
           $paramHash->{'variable'} = 'PRINT_WITH_ANSWERS';
           Apache::lonhelper::choices->new();
       }
   
     Apache::lonprintout::page_format_state->new("FORMAT");      Apache::lonprintout::page_format_state->new("FORMAT");
   
     # Generate the PAGESIZE state which will offer the user the margin      # Generate the PAGESIZE state which will offer the user the margin

Removed from v.1.160  
changed lines
  Added in v.1.161


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