--- loncom/homework/response.pm 2008/09/04 22:06:23 1.198 +++ loncom/homework/response.pm 2008/12/11 04:11:09 1.206.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.198 2008/09/04 22:06:23 riegler Exp $ +# $Id: response.pm,v 1.206.2.1 2008/12/11 04:11:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -288,6 +288,7 @@ sub check_for_previous { $previous{'last'}='1'; } if (! $previous{'award'} ) { $previous{'award'} = 'UNKNOWN'; } + if ($previous{'award'} eq 'INTERNAL_ERROR') { $previous{'used'}=0; } &Apache::lonxml::debug("got a match :$previous{'award'}:$previous{'used'}:"); } } @@ -486,9 +487,6 @@ sub start_mathresponse { $safeeval); $Apache::inputtags::answertxt{$id}=[$answer]; } - if ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER') { - $result.=&edit_mathresponse_button($id,"HWVAL_$id"); - } } elsif ($target eq 'edit') { $result.=&Apache::edit::tag_start($target,$token); @@ -523,7 +521,7 @@ sub start_mathresponse { sub edit_mathresponse_button { my ($id,$field)=@_; my $button=&mt('Edit Answer'); - my $helplink=&Apache::loncommon::help_open_topic('Formula_Editor'); +# my $helplink=&Apache::loncommon::help_open_topic('Formula_Editor'); my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'}; return(< @@ -533,7 +531,7 @@ function edit_${id}_${field} (textarea) newwin = window.open("/adm/dragmath/applet/MaximaPopup.html","","width=565,height=400,resizable"); } -$button +$button ENDFORMULABUTTON } @@ -575,6 +573,12 @@ sub end_mathresponse { } if ($target eq 'web') { &setup_prior_tries_hash(\&format_prior_response_math); + my $partid = $Apache::inputtags::part; + my $id = $Apache::inputtags::response[-1]; + if (($Apache::inputtags::status['-1'] eq 'CAN_ANSWER') + && (&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffeditor') ne 'yes')) { + $result.=&edit_mathresponse_button($id,"HWVAL_$id"); + } } pop(@Apache::lonxml::namespace); @@ -677,7 +681,7 @@ sub start_responseparam { } } if (defined($optionlist)) { - $result.='Use template:
'; } @@ -1189,7 +1193,7 @@ sub submitted { } # Submit All button on a .page was pressed if (defined($env{'form.all_submit'})) { return 1; } - # otherwise no submission occured + # otherwise no submission occurred return 0; }