--- loncom/homework/chemresponse.pm 2007/04/18 00:19:37 1.72 +++ loncom/homework/chemresponse.pm 2007/10/08 09:22:50 1.74 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # chemical equation style response # -# $Id: chemresponse.pm,v 1.72 2007/04/18 00:19:37 albertel Exp $ +# $Id: chemresponse.pm,v 1.74 2007/10/08 09:22:50 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -327,15 +327,30 @@ sub end_organicresponse { } $result.=&Apache::response::answer_footer('organicresponse'); } + if ($target eq 'web') { + &Apache::response::setup_prior_tries_hash(\&format_prior_answer_organic, + ['molecule']) + } if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { - &Apache::lonxml::increment_counter(&Apache::response::repetition()); + &Apache::lonxml::increment_counter(&Apache::response::repetition(), $partid); + if ($target eq 'analyze') { + &Apache::lonhomework::set_bubble_lines(); + } } &Apache::response::end_response(); return $result; } +sub format_prior_answer_organic { + my ($mode,$answer,$other_data) = @_; + my $result=&mt('Smile representation: "[_1]"',''.$answer.''); + my $jme=$other_data->[0]; + $result.=&jme_img($jme,$answer,400); + return $result; +} + sub start_organicstructure { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result; @@ -548,7 +563,7 @@ sub end_reactionresponse { if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { - &Apache::lonxml::increment_counter(&Apache::response::repetition()); + &Apache::lonxml::increment_counter(&Apache::response::repetition(), $partid); } &Apache::response::end_response(); return $result;