--- loncom/homework/structuretags.pm 2003/02/14 21:22:04 1.148 +++ loncom/homework/structuretags.pm 2003/02/25 21:49:45 1.149 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.148 2003/02/14 21:22:04 www Exp $ +# $Id: structuretags.pm,v 1.149 2003/02/25 21:49:45 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -666,28 +666,35 @@ sub start_part { $Apache::inputtags::part=$id; @Apache::inputtags::responselist = (); @Apache::inputtags::previous=(); + my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); + if ($target eq 'meta') { return &Apache::response::mandatory_part_meta; - } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { - my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); - push (@Apache::inputtags::status,$status); - my $expression='$external::datestatus="'.$status.'";'; - $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";'; - &Apache::run::run($expression,$safeeval); - if ( $status eq 'CLOSED' ) { - my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); - if ( $target eq "web" ) { - $result="
Part is not open to be viewed. It $accessmsg
"; - } elsif ( $target eq 'tex' ) { - $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}"; - } - } else { - if ($target eq 'tex') { - if ($$tagstack[-2] ne 'problem') { - $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; - } + } elsif ($target eq 'web' || $target eq 'grade' || + $target eq 'answer' || $target eq 'tex') { + if ($hidden) { + my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); + } else { + my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); + push (@Apache::inputtags::status,$status); + my $expression='$external::datestatus="'.$status.'";'; + $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";'; + &Apache::run::run($expression,$safeeval); + if ( $status eq 'CLOSED' ) { + my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); + if ( $target eq "web" ) { + $result="
Part is not open to be viewed. It $accessmsg
"; + } elsif ( $target eq 'tex' ) { + $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}"; + } + } else { + if ($target eq 'tex') { + if ($$tagstack[-2] ne 'problem') { + $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; + } + } + } } - } } elsif ($target eq 'edit') { $result.=&Apache::edit::tag_start($target,$token); $result.=&Apache::edit::text_arg('Part ID:','id',$token). @@ -709,12 +716,13 @@ sub end_part { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; &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 $result=''; if ( $target eq 'meta' ) { $result=''; - } elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER') { + } elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER' && !$hidden) { $result=&Apache::inputtags::grade; - } elsif ($target eq 'web' || $target eq 'tex' ) { + } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, $target); if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';}