Diff for /loncom/interface/lonprintout.pm between versions 1.2 and 1.3

version 1.2, 2001/08/21 15:59:08 version 1.3, 2001/09/18 14:30:55
Line 11 Line 11
 #  #
 # 3/1 Gerd Kortemeyer  # 3/1 Gerd Kortemeyer
 #  #
   # 9/17 Alex Sakharuk
   #
 package Apache::lonprintout;  package Apache::lonprintout;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::lonxml;  use Apache::lonxml;
 use Apache::lonnet;  use Apache::lonnet;
   use Apache::File;
   
 sub handler {  
   
   sub headerform {
     my $r = shift;      my $r = shift;
     $r->content_type('text/html');      $r->print(<<ENDHEADER);
     $r->send_http_header;  <html>
     return OK if $r->header_only;  <head>
   <title>LON-CAPA output for printing</title>
   </head>
   <body bgcolor="FFFFFF">
   <form method="post" enctype="multipart/form-data" action="/adm/printout" name="printform">
   <h1>Printout:</h1><br></br>
   ENDHEADER
   }
   
   
 #--- my developmental space begin (Alex)  sub menu_for_output {
 #-- local menu      my $r = shift;
           $r->print(<<ENDMENUOUT);
   <input type="hidden" name="phase" value="two">
   <input type="radio" name="choice" value="Standard LaTeX output for current document">  Standard LaTeX output for current document<br></br>
   <input type="radio" name="choice" value="Standard LaTeX output for the whole sequence">  Standard LaTeX output for the whole sequence<br></br>
   <input type="submit" value="Please make a choice">
   </form>
   </body>
   </html>
   ENDMENUOUT
   }
   
   
   sub output_data {
       my $r = shift;
       $r->print(<<ENDPART);
   <html>
   <head>
   <title>LON-CAPA output for printing</title>
   </head>
   <body bgcolor="FFFFFF">
   <hr>
   ENDPART
   
 #-- core      my $choice = $ENV{'form.choice'};
     my $result = '';      my $result = '';
     my %mystyle;      my %mystyle;
   
     my $file=&Apache::lonnet::filelocation("",$ENV{'form.postdata'});      if ($choice eq 'Standard LaTeX output for current document') {
   
     my $filecontents=&Apache::lonnet::getfile($file);   my $file=&Apache::lonnet::filelocation("",'/res/'.$ENV{'request.ambiguous'});
    my $filecontents=&Apache::lonnet::getfile($file);
    $result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle);
   
    my $tempo_file;
           my $file = 'temp.tex';
    unless ($tempo_file = Apache::File->new($file)) {
       $r->log_error("Couldn't open $file for output");
               return SERVER_ERROR; 
    }
   
    $r->print($result);
   
       } elsif ($choice eq 'Standard LaTeX output for the whole sequence') {
    my $current_file = '/res/'.$ENV{'request.ambiguous'};
           $current_file =~ s/(\/res\/physnet\/physnet)(\/m\d+)\/(.*)/$1$2$2\.sequence/;
    my $file=&Apache::lonnet::filelocation("",$current_file);
    my $filecontents=&Apache::lonnet::getfile($file);
    $result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle);
   
    $result = &content_map($result);
    $r->print($result);
   
     $result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle);  
       
     $r->print($result);  
   
     return OK;  
   
 #--- my developmental space end (Alex)      }
   $r->print(<<FINALEND);
   </body>
   </html>
   FINALEND
   }
   
   
   sub content_map {
   #-- find a list of files to publish
       my $map_string = shift;
     
   
   
   
       return $map_string;
   }
   
   
   sub handler {
   
       my $r = shift;
       $r->content_type('text/html');
       $r->send_http_header;
   
   #-- start form
       &headerform($r);
   #-- menu for output
       unless ($ENV{'form.phase'}) {
    &menu_for_output($r);
       }
   #-- core part 
       if ($ENV{'form.phase'} eq 'two') {
    &output_data($r);
       }
       return OK;
   
 # --------------------------------------------------- Print login screen header  
 #    $r->print(<<ENDDOCUMENT);  
 #<html>  
 #<head>  
 #<title>The LearningOnline Network with CAPA</title>  
 #</head>  
 #<body bgcolor="#FFFFFF">  
 #<h1>Printout</h1>  
 #<img src="/adm/lonKaputt/lonconstruct.gif">  
   
 #</body>  
 #</html>  
 #ENDDOCUMENT  
 #    return OK;  
 }   } 
   
 1;  1;

Removed from v.1.2  
changed lines
  Added in v.1.3


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