--- loncom/publisher/lonpublisher.pm 2005/03/03 21:14:10 1.186 +++ loncom/publisher/lonpublisher.pm 2005/03/10 02:34:58 1.187 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.186 2005/03/03 21:14:10 albertel Exp $ +# $Id: lonpublisher.pm,v 1.187 2005/03/10 02:34:58 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -850,29 +850,28 @@ sub store_metadata { sub checkonthis { my ($r,$source)=@_; - my $oldpath=$ENV{'request.filename'}; - $ENV{'request.filename'}=$source; - &Apache::lonxml::xmlparse($r,'web', - &Apache::lonnet::getfile($source)); - undef($Apache::lonhomework::parsing_a_problem); - $ENV{'request.filename'}=$oldpath; - if (($Apache::lonxml::errorcount) || - ($Apache::lonxml::warningcount)) { - if ($Apache::lonxml::errorcount) { + my $uri=&Apache::lonnet::hreflocation($source); + $uri=~s/\/$//; + my ($errorcount,$warningcount)=split(/:/, + &Apache::lonnet::ssi_body($uri, + ('return_only_error_and_warning_counts' => 1))); + if (($errorcount) || ($warningcount)) { + $r->print('
'.$uri.': '); + if ($errorcount) { $r->print(''. - $Apache::lonxml::errorcount.' '. + $errorcount.' '. &mt('error(s)').' '); } - if ($Apache::lonxml::warningcount) { + if ($warningcount) { $r->print(''. - $Apache::lonxml::warningcount.' '. + $warningcount.' '. &mt('warning(s)').''); } } else { $r->print(''.&mt('ok').''); } $r->rflush(); - return ($Apache::lonxml::warningcount,$Apache::lonxml::errorcount); + return ($warningcount,$errorcount); } # ============================================== Parse file itself for metadata @@ -2013,9 +2012,16 @@ ENDDIFF unless ($ENV{'form.phase'} eq 'two') { # ---------------------------------------------------------- Parse for problems - &checkonthis($r,$thisfn); - my ($outstring,$error)=&publish($thisfn,$thistarget,$thisembstyle); - $r->print('
'.$outstring); + my ($warningcount,$errorcount)=&checkonthis($r,$thisfn); + unless ($errorcount) { + my ($outstring,$error)= + &publish($thisfn,$thistarget,$thisembstyle); + $r->print('
'.$outstring); + } else { + $r->print('

'. + &mt('The document contains errors and cannot be published.'). + '

'); + } } else { $r->print('
'. &phasetwo($r,$thisfn,$thistarget,$thisembstyle,$thisdistarget));