--- loncom/homework/outputtags.pm 2003/05/03 21:09:03 1.29 +++ loncom/homework/outputtags.pm 2003/07/01 21:10:43 1.30 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # tags that create controlled output # -# $Id: outputtags.pm,v 1.29 2003/05/03 21:09:03 albertel Exp $ +# $Id: outputtags.pm,v 1.30 2003/07/01 21:10:43 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -144,10 +144,15 @@ sub start_displayweight { } else { my @parts=&multipart($ENV{'request.uri'}); my $weight; - foreach my $part (@parts) { - my $pweight=&Apache::lonnet::EXT("resource.$part.weight"); - if (!defined($pweight) || ($pweight eq '')) { $pweight=1; } - $weight+=$pweight; + if (@parts) { + foreach my $part (@parts) { + my $pweight=&Apache::lonnet::EXT("resource.$part.weight"); + if (!defined($pweight) || ($pweight eq '')) { $pweight=1; } + $weight+=$pweight; + } + } else { + $weight = &Apache::lonnet::EXT("resource.$id.weight"); + if (!defined($weight) || ($weight eq '')) { $weight=1; } } $result=$weight; }