--- loncom/homework/structuretags.pm 2006/11/21 10:01:31 1.370 +++ loncom/homework/structuretags.pm 2007/04/06 21:22:24 1.375 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.370 2006/11/21 10:01:31 foxr Exp $ +# $Id: structuretags.pm,v 1.375 2007/04/06 21:22:24 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -88,6 +88,14 @@ sub page_start { $parstack,$parser,$safeeval); } + $extra_head.= ' + +'; + my %body_args; if (defined($found{'html'})) { $body_args{'skip_phases'}{'head'}=1; @@ -213,7 +221,8 @@ sub setup_rndseed { } $env{'form.rndseed'}=$rndseed; } - if ($env{'form.resetdata'} eq &mt('New Problem Variation') || + if ( ($env{'form.resetdata'} eq &mt('New Problem Variation') + && $env{'form.submitted'} eq 'yes') || $env{'form.newrandomization'} eq &mt('New Randomization')) { srand(time); $rndseed=int(rand(2100000000)); @@ -276,9 +285,7 @@ sub option { sub problem_web_to_edit_header { my ($rndseed)=@_; my $result.=''; - if (!$Apache::lonhomework::parsing_a_task) { - $result .= ''; - } + $result .= ''; $result .= ' @@ -293,9 +300,9 @@ sub problem_web_to_edit_header { : &mt(' Show All Foils'); if (defined($env{'form.showallfoils'})) { $result.='checked="on"'; } - $result.= ' />'.$show_all_foils_text. + $result.= ' />'.$show_all_foils_text.''. &Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems'). - '
'; + '
'; if (!$Apache::lonhomework::parsing_a_task) { $result.=" @@ -360,7 +367,8 @@ sub initialize_storage { my $namespace = $symb || $env{'request.uri'}; if ($env{'form.resetdata'} eq &mt('Reset Submissions') || - $env{'form.resetdata'} eq &mt('New Problem Variation') || + ($env{'form.resetdata'} eq &mt('New Problem Variation') + && $env{'form.submitted'} eq 'yes') || $env{'form.newrandomization'} eq &mt('New Randomization')) { &Apache::lonnet::tmpreset($namespace,'',$domain,$name); &Apache::lonxml::debug("Attempt reset"); @@ -731,7 +739,8 @@ sub start_problem { my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser, $style); if ($target eq 'web') { - $result .= &Apache::bridgetask::proctor_validation_screen(); + $result .= + &Apache::bridgetask::proctor_validation_screen($slot); } elsif ($target eq 'grade') { &Apache::bridgetask::proctor_check_auth($slot_name,$slot, 'problem'); @@ -787,7 +796,6 @@ sub end_problem { } if ($target eq 'tex') { - # Figure out the front matter and replace the # INSERTTEXFRONTMATTERHERE in result with it. note that we do # this in end_problem because whether or not we display due @@ -963,7 +971,7 @@ sub end_problem { sub start_library { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my ($result,$form_tag_start); - if ($$tagstack[0] eq 'library') { + if ($#$tagstack eq 0 && $$tagstack[0] eq 'library') { &init_problem_globals('library'); $Apache::lonhomework::type='problem'; } @@ -978,7 +986,7 @@ sub start_library { $result=$token->[4]; $result.=&Apache::edit::handle_insert(); } elsif (($target eq 'web' || $target eq 'webgrade') - && $$tagstack[0] eq 'library' + && ($#$tagstack eq 0 && $$tagstack[0] eq 'library') && $env{'request.state'} eq "construct" ) { my $name=&get_resource_name($parstack,$safeeval); ($result,$form_tag_start)= @@ -997,11 +1005,14 @@ sub end_library { my $result=''; if ($target eq 'edit') { $result=&problem_edit_footer(); - } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' && - $env{'request.state'} eq "construct") { + } elsif ($target eq 'web' + && ($#$tagstack eq 0 && $$tagstack[0] eq 'library') + && $env{'request.state'} eq "construct") { $result.=''.&Apache::loncommon::end_page({'discussion' => 1}); } - if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') }; + if ( $#$tagstack eq 0 && $$tagstack[0] eq 'library') { + &reset_problem_globals('library'); + } return $result; }