Diff for /loncom/homework/lonhomework.pm between versions 1.1 and 1.9

version 1.1, 2000/07/25 17:45:40 version 1.9, 2000/09/14 20:55:42
Line 5  package Apache::lonhomework; Line 5  package Apache::lonhomework;
 use strict;  use strict;
 use Apache::style;  use Apache::style;
 use Apache::lonxml;  use Apache::lonxml;
   use Apache::lonnet;
   use Apache::inputtags;
   use Apache::structuretags;
   use Apache::response;
   
 sub handler {  sub handler {
   my $request=shift;    my $request=shift;
   
   my @parsecontents;    my $target=&get_target();
   {  
     my $fh=Apache::File->new($request->filename);  
     @parsecontents=<$fh>;  
   }  
     
   my $parsestring=join('',@parsecontents);  
     
   $request->content_type('text/html');    $request->content_type('text/html');
   $request->send_http_header;    $request->send_http_header;
   $request->print('<html>    &Apache::lonhomework::send_header($request);
 <form method="post" action="'.$request->uri.'"<input type="hidden" name="TARGET" value="edit"><input type="submit" value="Submit">');    my $file = "/home/httpd/html".$request->uri;
     my %mystyle;
     my $result = '';
     &Apache::inputtags::initialize_inputtags;
     $result = Apache::lonxml::xmlparse($target, &getfile($file),
    &getfile('/home/httpd/html/res/103/albertel/default_homework').&setup_vars($target),%mystyle);
     #$request->print("Result follows:");
     $request->print($result);
     #$request->print(":Result ends");
     &Apache::lonhomework::send_footer($request);
   }
   
   sub get_target {
     return "web";
   }
   
   sub setup_vars {
     my ($target) = @_;
     return ';$external::target='.$target.';';
   }
   
   sub send_header {
     my ($request)= @_;
     $request->print('<html>');
     $request->print('<form method="POST" action="'.$request->uri.'">');
   }
   
   sub send_footer {
     my ($request)= @_;
     $request->print('</form>');
     $request->print('</html>');
   }
   
   sub getfile {
     my ($filename) = @_;
     my $a="";
     if (! -e $filename ) {
       &Apache::lonnet::subscribe($filename);
       &Apache::lonnet::repcopy($filename);
     }
     {
       my $fh=Apache::File->new($filename);
   
       while (<$fh>) {
         $a .=$_;
       }
     }
     return $a
 }  }
   
 1;  1;

Removed from v.1.1  
changed lines
  Added in v.1.9


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