--- loncom/homework/structuretags.pm 2005/03/17 13:56:32 1.282 +++ loncom/homework/structuretags.pm 2005/04/01 18:08:14 1.283 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.282 2005/03/17 13:56:32 albertel Exp $ +# $Id: structuretags.pm,v 1.283 2005/04/01 18:08:14 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1066,6 +1066,17 @@ sub end_randomlist { return $result; } +sub ordered_show_check { + my $last_part=$Apache::inputtags::partlist[-2]; + my $in_order= + &Apache::lonnet::EXT('resource.'.$Apache::inputtags::part.'.ordered'); + my $in_order_show=1; + if ($last_part ne '0' && lc($in_order) eq 'yes') { + $in_order_show=&Apache::response::check_status($last_part); + } + return $in_order_show; +} + sub start_part { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result=''; @@ -1080,7 +1091,7 @@ sub start_part { my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); my $newtype=&Apache::lonnet::EXT("resource.$id.type"); if ($newtype) { $Apache::lonhomework::type=$newtype; } - + my $in_order_show=&ordered_show_check(); my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; $expression.='$external::type=\''.$Apache::lonhomework::type.'\';'; &Apache::run::run($expression,$safeeval); @@ -1091,7 +1102,7 @@ sub start_part { &Apache::response::meta_parameter_write('display','string',$display,'Part Description'); } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { - if ($hidden) { + if ($hidden || !$in_order_show) { my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); } else { my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); @@ -1171,18 +1182,20 @@ sub end_part { &Apache::lonxml::debug("in end_part $target "); my $status=$Apache::inputtags::status['-1']; my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); + my $in_order_show=&ordered_show_check(); my $result=''; if ( $target eq 'meta' ) { $result=''; } elsif ($target eq 'grade') { if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) && - !$hidden) { + !$hidden && $in_order_show) { $result=&Apache::inputtags::grade; } else { # move any submission data to .hidden &Apache::inputtags::hidealldata($Apache::inputtags::part); } - } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { + } elsif (($target eq 'web' || $target eq 'tex') && + !$hidden && $in_order_show) { my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, $target); if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {