--- loncom/interface/lonprintout.pm	2001/11/29 18:18:38	1.8
+++ loncom/interface/lonprintout.pm	2001/12/07 23:35:54	1.10
@@ -16,7 +16,7 @@
 package Apache::lonprintout;
 
 use strict;
-use Apache::Constants qw(:common);
+use Apache::Constants qw(:common :http);
 use Apache::lonxml;
 use Apache::lonnet;
 use Apache::File();
@@ -41,9 +41,10 @@ sub menu_for_output {
     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 primary sequence">  Standard LaTeX output for the primary sequence<br></br>
-<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence">  Standard LaTeX output for the top level sequence<br></br>
+<input type="hidden" name="url" value="$ENV{'form.postdata'}">
+<input type="radio" name="choice" value="Standard LaTeX output for current document">  Standard LaTeX output for current document<br />
+<input type="radio" name="choice" value="Standard LaTeX output for the primary sequence">  Standard LaTeX output for the primary sequence<br />
+<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence">  Standard LaTeX output for the top level sequence<br />
 <input type="submit" value="Please make a choice">
 </form>
 </body>
@@ -69,7 +70,12 @@ ENDPART
     my $filename;
 
     if ($choice eq 'Standard LaTeX output for current document') {
-	my $file=&Apache::lonnet::filelocation("",'/res/'.$ENV{'request.ambiguous'});
+        my $access=&Apache::lonnet::allowed('bre',$ENV{'form.url'});
+	if (($access ne '2') && ($access ne 'F')) {
+	  $ENV{'user.error.msg'}="$ENV{'form.url'}:bre:1:1:Access Denied";
+	  return HTTP_NOT_ACCEPTABLE;
+	}
+	my $file=&Apache::lonnet::filelocation("",$ENV{'form.url'});
 	my $filecontents=&Apache::lonnet::getfile($file);
 	$result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle);
     } elsif ($choice eq 'Standard LaTeX output for the primary sequence') {
@@ -139,7 +145,7 @@ ENDPART
 		print $temp_file $result;
 	}
 $r->print(<<FINALEND);
-<meta http-equiv="Refresh" content="0; url=http://bistromath.lite.msu.edu/cgi-bin/printout.pl?$filename">
+<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$filename">
 </body>
 </html>
 FINALEND