--- loncom/homework/structuretags.pm 2010/08/08 02:00:50 1.474 +++ loncom/homework/structuretags.pm 2010/11/03 17:06:28 1.478 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.474 2010/08/08 02:00:50 raeburn Exp $ +# $Id: structuretags.pm,v 1.478 2010/11/03 17:06:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -161,6 +161,45 @@ function setmode(form,probmode) { ENDSCRIPT } +sub file_delchk_js { + my $delfilewarn = &mt('You have indicated you wish to delete some files previously included for submission.').'\\n'. + &mt('Deleted files will not be graded.').' '. + &mt('Submit Answer?'); + return <<"ENDSCRIPT"; + +ENDSCRIPT +} + sub page_start { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, $extra_head)=@_; @@ -185,6 +224,10 @@ sub page_start { ); $extra_head .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args); } + my $is_task = ($env{'request.uri'} =~ /\.task$/); + if ($is_task) { + $extra_head .= &file_delchk_js(); + } my %body_args; if (defined($found{'html'})) { @@ -277,6 +320,9 @@ sub page_start { if ($target eq 'edit') { $form_tag_start.=&Apache::edit::form_change_detection(); } + if ($is_task) { + $form_tag_start .= ' onsubmit="return file_deletion_check(this);"'; + } $form_tag_start.='>'."\n"; my $symb=&Apache::lonnet::symbread(); @@ -783,6 +829,7 @@ sub init_problem_globals { &Apache::lonhomework::reset_show_problem_status(); $Apache::lonhomework::ignore_response_errors=1; } + @Apache::functionplotresponse::callscripts=(); @Apache::inputtags::responselist = (); @Apache::inputtags::importlist = (); @Apache::inputtags::previous=(); @@ -810,6 +857,7 @@ sub reset_problem_globals { undef($Apache::lonhomework::type); undef($Apache::lonhomework::scantronmode); undef($Apache::lonhomework::ignore_response_errors); + undef(@Apache::functionplotresponse::callscripts); &Apache::lonhomework::reset_show_problem_status(); } @@ -1202,6 +1250,9 @@ sub end_problem { } } } + if ($target eq 'web') { + $result.=&Apache::functionplotresponse::init_script(); + } if ($target eq 'grade') { &Apache::lonhomework::showhash(%Apache::lonhomework::results); &finalize_storage(); @@ -1835,7 +1886,7 @@ sub start_part { } } elsif ($target eq 'web') { - $result.=''; + $result.=''; } } }