--- loncom/homework/structuretags.pm 2003/05/09 22:24:05 1.169 +++ loncom/homework/structuretags.pm 2003/05/13 20:38:55 1.171 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.169 2003/05/09 22:24:05 albertel Exp $ +# $Id: structuretags.pm,v 1.171 2003/05/13 20:38:55 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,7 +38,7 @@ use Apache::File(); use Apache::lonmenu; BEGIN { - &Apache::lonxml::register('Apache::structuretags',('block','languageblock','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext')); + &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext')); } sub start_web { @@ -481,7 +481,7 @@ sub end_problem { ) { if ($status eq 'CAN_ANSWER') { if ($target ne 'tex') { - $result.="\n"; + if ($ENV{'form.print_answer'} ne 'yes') {$result.="\n";} } } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || $status eq 'UNCHECKEDOUT' ) { @@ -505,8 +505,10 @@ sub end_problem { &finalize_storage(); } if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') ) { - $result.=''; #normally we get it from xmlend, but in CSTR - # we always show answer mode too. + if ($ENV{'form.print_answer'} ne 'yes') { + $result.=''; #normally we get it from xmlend, but in CSTR + # we always show answer mode too. + } } } elsif ($target eq 'meta') { if ($Apache::inputtags::part eq '0') { @@ -657,6 +659,35 @@ sub end_languageblock { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result; if ($target eq "edit") { + $result.= &Apache::edit::tag_end($target,$token,''); + } + return $result; +} + +sub start_instructorcomment { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + + my $result; + + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || + $target eq 'tex' || $target eq 'analyze') { + $result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/); + if ( ! $result ) { + my $skip=&Apache::lonxml::get_all_text("/instructorcomment",$parser); + &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]"); + } + $result=''; + } elsif ($target eq 'edit') { + $result .=&Apache::edit::tag_start($target,$token); + $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); + } + return $result; +} + +sub end_instructorcomment { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + my $result; + if ($target eq "edit") { $result.= &Apache::edit::tag_end($target,$token,''); } return $result;