--- loncom/homework/lonhomework.pm 2000/10/11 21:02:13 1.14 +++ loncom/homework/lonhomework.pm 2000/11/07 17:21:18 1.15 @@ -12,7 +12,7 @@ use Apache::response; sub handler { my $request=shift; - + my $target=&get_target(); $Apache::lonxml::debug=1; if ($ENV{'browser.mathml'}) { @@ -24,7 +24,7 @@ sub handler { return 'OK' if $request->header_only; &Apache::lonhomework::send_header($request); - my $file = "/home/httpd/html".$request->uri; + my $file = &Apache::lonnet::filelocation("",$request->uri); my %mystyle; my $result = ''; &Apache::inputtags::initialize_inputtags; @@ -50,7 +50,15 @@ sub handler { } sub get_target { - return "web"; + if ( $ENV{'request.state'} eq "published") { + return 'web'; + } elsif ($ENV{'request.state'} eq "construct") { + if ( defined $ENV{'form.'.$ENV{'form.request.prefix'}.'preview'}) { + return 'web'; + } else { + return 'edit'; + } + } } sub setup_vars { @@ -71,7 +79,7 @@ sub send_footer { $request->print(&Apache::lontexconvert::footer()); } -sub getfile { +sub getfilenothere { my ($filename) = @_; my $a=""; if (! -e $filename ) {