--- loncom/xml/lonxml.pm 2002/01/03 16:18:00 1.145 +++ loncom/xml/lonxml.pm 2002/01/08 21:11:13 1.147 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.145 2002/01/03 16:18:00 www Exp $ +# $Id: lonxml.pm,v 1.147 2002/01/08 21:11:13 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1011,6 +1011,8 @@ sub storefile { if (my $fh=Apache::File->new('>'.$file)) { print $fh $contents; $fh->close(); + } else { + &warning("Unable to save file $file"); } } @@ -1032,23 +1034,38 @@ sub inserteditinfo { SIMPLECONTENT } - my $editheader='Edit below
'; + + $filecontents =~ s::</textarea>:g; +# my $editheader='Edit below
'; my $editfooter=(<

+ +
ENDFOOTER - $result=~s/(\]*\>)/$1$editheader/is; +# $result=~s/(\]*\>)/$1$editheader/is; $result=~s/(\<\/body\>)/$editfooter/is; return $result; } +sub editbutton { + my ($result) = @_; + my $button=(< + + +EDITBUTTON + $result=~s/(\<\/body\>)/$button/is; + return $result; +} + sub handler { my $request=shift; @@ -1077,7 +1094,7 @@ sub handler { } } my %mystyle; - my $result = ''; + my $result = ''; my $filecontents=&Apache::lonnet::getfile($file); if ($filecontents == -1) { $result=(<uri); $request->print($result); return OK; } - + sub debug { if ($Apache::lonxml::debug eq 1) { - print("DEBUG:".$_[0]."
\n"); + $|=1; + print("DEBUG:".join('
',@_)."
\n"); } } sub error { if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) { - print "ERROR:".$_[0]."
\n"; + print "ERROR:".join('
',@_)."
\n"; } else { print "An Error occured while processing this resource. The instructor has been notified.
"; #notify author - &Apache::lonmsg::author_res_msg($ENV{'request.filename'},$_[0]); + &Apache::lonmsg::author_res_msg($ENV{'request.filename'},join('
',@_)); #notify course if ( $ENV{'request.course.id'} ) { my $users=$ENV{'course.'.$ENV{'request.course.id'}.'.comment.email'}; @@ -1134,19 +1159,19 @@ sub error { foreach my $user (split /\,/, $users) { ($user,my $domain) = split /:/, $user; &Apache::lonmsg::user_normal_msg($user,$domain, - "Error [$declutter]",$_[0]); + "Error [$declutter]",join('
',@_)); } } #FIXME probably shouldn't have me get everything forever. - &Apache::lonmsg::user_normal_msg('albertel','msu',"Error in $ENV{'request.filename'}",$_[0]); + &Apache::lonmsg::user_normal_msg('albertel','msu',"Error in $ENV{'request.filename'}",join('
',@_)); #&Apache::lonmsg::user_normal_msg('albertel','103',"Error in $ENV{'request.filename'}",$_[0]); } } sub warning { if ($ENV{'request.state'} eq 'construct') { - print "WARNING:".$_[0]."
\n"; + print "WARNING:".join('
',@_)."
\n"; } }