--- loncom/publisher/lonpublisher.pm 2008/05/17 12:08:45 1.235 +++ loncom/publisher/lonpublisher.pm 2008/05/19 18:43:16 1.236 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.235 2008/05/17 12:08:45 www Exp $ +# $Id: lonpublisher.pm,v 1.236 2008/05/19 18:43:16 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -665,6 +665,7 @@ sub fix_ids_and_indices { "Max Index: $maxindex (min 10)\n"; } my $outstring=''; + my $responsecounter=1; my @parser; $parser[0]=HTML::LCParser->new(\$content); $parser[-1]->xml_mode(1); @@ -680,6 +681,10 @@ sub fix_ids_and_indices { next; } if ($lctag eq 'base') { next; } + if (($lctag eq 'part') || ($lctag eq 'problem')) { + $responsecounter=0; + } + if ($lctag=~/response$/) { $responsecounter++; } my %parms=%{$token->[2]}; $counter=$addid{$tag}; if (!$counter) { $counter=$addid{$lctag}; } @@ -784,7 +789,12 @@ sub fix_ids_and_indices { unless ($token->[1] eq 'allow') { $outstring.='[1].'>'; } - } + } + if ((($token->[1] eq 'part') || ($token->[1] eq 'problem')) + && (!$responsecounter)) { + my $outstring=''.&mt('Found [_1] without responses',$token->[1]).''; + return ($outstring,1); + } } else { $outstring.=$token->[1]; }