--- loncom/xml/lonxml.pm 2001/05/26 15:31:33 1.78 +++ loncom/xml/lonxml.pm 2001/05/26 17:27:28 1.79 @@ -35,6 +35,9 @@ use Apache::run; use Apache::londefdef; use Apache::scripttag; use Apache::edit; +use Apache::lonnet; +use Apache::File; + #================================================== Main subroutine: xmlparse #debugging control, to turn on debugging modify the correct handler $Apache::lonxml::debug=0; @@ -571,6 +574,14 @@ ENDSCRIPT return $result; } +sub storefile { + my ($file,$contents)=@_; + if (my $fh=Apache::File->new('>'.$file)) { + print $fh $contents; + $fh->close(); + } +} + sub inserteditinfo { my ($result,$filecontents)=@_; unless ($filecontents) { @@ -621,16 +632,16 @@ sub handler { return OK if $request->header_only; + + my $file=&Apache::lonnet::filelocation("",$request->uri); # # Edit action? Save file. # unless ($ENV{'request.state'} eq 'published') { if ($ENV{'form.savethisfile'}) { - + &storefile($file,$ENV{'form.filecont'}); } } - - my $file=&Apache::lonnet::filelocation("",$request->uri); my %mystyle; my $result = ''; my $filecontents=&Apache::lonnet::getfile($file);