Diff for /loncom/interface/lonprintout.pm between versions 1.112 and 1.115

version 1.112, 2003/02/07 19:47:48 version 1.115, 2003/02/14 02:21:35
Line 1200  sub page_format_transformation { Line 1200  sub page_format_transformation {
  } else {   } else {
   ($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'});    ($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'});
  }   }
     my $firstname = &special_character_corrections(&Apache::lonnet::unescape($ENV{'environment.firstname'}));      my $firstname = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'environment.firstname'}),'','','header');
     my $lastname = &special_character_corrections(&Apache::lonnet::unescape($ENV{'environment.lastname'}));      my $lastname = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'environment.lastname'}),'','','header');
     my $courseidinfo = &special_character_corrections(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}));      my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'','','header');
     if ($layout eq 'CBI') {      if ($layout eq 'CBI') {
     $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$firstname $lastname}} \\hfill  $courseidinfo} \\vskip 5 mm /;      $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$firstname $lastname}} \\hfill  $courseidinfo} \\vskip 5 mm /;
     } elsif ($layout eq 'CAPA') {      } elsif ($layout eq 'CAPA') {
Line 1255  sub details_for_menu { Line 1255  sub details_for_menu {
 }  }
   
   
 sub special_character_corrections {  
     my $argument = shift;  
     $argument =~ s/_/ /g;  
     $argument =~ s/\^/ /g;  
     $argument =~ s/&/\\&/g;  
     return $argument;  
 }  
   
   
 sub latex_corrections {  sub latex_corrections {
   
     my ($number_of_columns,$result) = @_;      my ($number_of_columns,$result) = @_;
Line 1302  sub handler { Line 1293  sub handler {
   
     my $r = shift;      my $r = shift;
   
       # not sure where the form.* was getting processed.
       Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
   
       # A hook for me to work without disturbing Alex.
       if ($ENV{'form.jeremy'}) {
           printWizard($r);
           return OK;
       }
   
     my $loaderror=&Apache::lonnet::overloaderror($r);      my $loaderror=&Apache::lonnet::overloaderror($r);
     if ($loaderror) { return $loaderror; }      if ($loaderror) { return $loaderror; }
     $loaderror=      $loaderror=
Line 1355  sub handler { Line 1355  sub handler {
         
 }   } 
   
   use Apache::lonwizard;
   
   sub printWizard {
       my $r = shift;
   
       if ($ENV{'request.course.id'}) {
    my $fn=$ENV{'request.course.fn'};
    tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640);
       }
   
       if ($r->header_only) {
           if ($ENV{'browser.mathml'}) {
               $r->content_type('text/xml');
           } else {
               $r->content_type('text/html');
           }
           $r->send_http_header;
           return OK;
       }
   
       # Send header, nocache
       if ($ENV{'browser.mathml'}) {
           $r->content_type('text/xml');
       } else {
           $r->content_type('text/html');
       }
       &Apache::loncommon::no_cache($r);
       $r->send_http_header;
       $r->rflush();
   
       my ($resourceTitle,$sequenceTitle,$mapTitle) = &details_for_menu;
   
       my $wizard = Apache::lonwizard->new("Printing Wizard");
       # PRINT_TYPE: What the user wants to print (current docs,
       #  whole sequence, etc.
       $wizard->declareVars(['PRINT_TYPE']);
   
       my $subdir = $ENV{'form.postdata'};
       $subdir =~ s|http://[^/]+||;
       $subdir =~ m/\/([^\/]+)$/;
       $subdir =~ s/\Q$1\E//;
   
       # This code also shows up above... which is prefered? Is one
       # right for this context?
       #my $subdir = &Apache::lonnet::filelocation("",$ENV{'form.url'});
       #$subdir =~ s/\/[^\/]+$//;
       
       Apache::lonwizard::switch_state->new($wizard, "START", "Selecting Resources to Print", "PRINT_TYPE", [
              ['current_document', "<b>$resourceTitle</b> (exactly what was on the screen)", 'CHOOSE_FORMAT'],
              ['map_problems', "Problems from <b>$sequenceTitle</b>", 'CHOOSE_FORMAT'],
              ['map_problems_pages', "All of <b>$sequenceTitle</b>", 'CHOOSE_FORMAT'],
              ['problems_for_students', "Problems from <b>$sequenceTitle</b> for selected students", 'CHOOSE_FORMAT'],
              ['problems_from_directory', "Problems from <b>$subdir</b>", 'CHOOSE_FORMAT'] ],
              "What do you want to print?");
       
       $r->print($wizard->display());
   
       untie %hash;
   
       return OK;
   
   }
   
   
 1;  1;
 __END__  __END__

Removed from v.1.112  
changed lines
  Added in v.1.115


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