--- loncom/publisher/lonpublisher.pm 2008/05/12 23:47:49 1.234 +++ loncom/publisher/lonpublisher.pm 2008/05/28 22:22:35 1.237 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.234 2008/05/12 23:47:49 www Exp $ +# $Id: lonpublisher.pm,v 1.237 2008/05/28 22:22:35 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}; } @@ -775,7 +780,7 @@ sub fix_ids_and_indices { } if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; } $outstring.='<'.$tag.$newparmstring.$endtag.'>'; - if ($lctag eq 'm' || $lctag eq 'script' + if ($lctag eq 'm' || $lctag eq 'script' || $lctag eq 'answer' || $lctag eq 'display' || $lctag eq 'tex') { $outstring.=&get_all_text_unbalanced('/'.$lctag,\@parser); } @@ -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]; } @@ -840,8 +850,7 @@ sub store_metadata { return ($error,undef); } my $dbh = &Apache::lonmysql::get_dbh(); - if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv') || - ($metadata{'copyright'} eq 'custom')) { + if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv')) { # remove this entry my $delitem = 'url = '.$dbh->quote($metadata{'url'}); $status = &LONCAPA::lonmetadata::delete_metadata($dbh,undef,$delitem);