--- loncom/homework/structuretags.pm 2005/04/22 17:15:33 1.289 +++ loncom/homework/structuretags.pm 2005/07/05 18:59:03 1.297 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.289 2005/04/22 17:15:33 albertel Exp $ +# $Id: structuretags.pm,v 1.297 2005/07/05 18:59:03 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,6 +68,34 @@ sub end_tex { return ''; } +sub body_tag_start { + my ($target,$background,$bgcolor)=@_; + my $body_tag_start=''."\n"; - } - if ($target eq 'web' && $env{'request.state'} ne 'construct') { + my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, + $safeeval); + $body_tag_start=&body_tag_start($background,$bgcolor); + if ( ($target eq 'web' || $target eq 'webgrade') + && $env{'request.state'} ne 'construct') { my ($symb,undef,undef,undef,$publicuser)= &Apache::lonxml::whichuser(); if ($symb eq '' && !$publicuser) { @@ -365,13 +373,19 @@ sub store_aggregates { } if ($Apache::lonhomework::results{'resource.'.$part.'.tries'} == 1) { $aggregate{$symb."\0".$part."\0users"} = 1; + } else { + my (undef,$last_reset) = &Apache::grades::get_last_resets($symb,$env{'request.course.id'},[$part]); + if ($last_reset) { + if (&Apache::grades::get_num_tries(\%Apache::lonhomework::history,$last_reset,$part) == 0) { + $aggregate{$symb."\0".$part."\0users"} = 1; + } + } } $aggregate{$symb."\0".$part."\0attempts"} = 1; } - if (%aggregate) { + if (keys (%aggregate) > 0) { &Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate, - $cdomain,$cname); - + $cdomain,$cname); } } @@ -497,6 +511,7 @@ sub start_problem { defined($env{'form.problemtype'})) { $Apache::lonhomework::type=$env{'form.problemtype'}; } + $Apache::lonhomework::default_type = $Apache::lonhomework::type; &Apache::lonxml::debug("Found this to be of type :$Apache::ltonhomework::type:"); } if ($Apache::lonhomework::type eq '' ) { @@ -738,7 +753,8 @@ sub end_problem { } if ($target eq 'answer' && ($env{'request.state'} eq 'construct') && $env{'form.answer_output_mode'} ne 'tex') { - $result.=''; # normally we get it from xmlend, but in CSTR + $result.=&Apache::lonxml::xmlend().''; + # normally we get it from above, but in CSTR # we always show answer mode too. } } elsif ($target eq 'meta') { @@ -1120,7 +1136,7 @@ sub start_part { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result=''; my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); - if ($id eq '') { $id = $Apache::lonxml::curdepth; } + if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; } $Apache::inputtags::part=$id; push(@Apache::inputtags::partlist,$id); @Apache::inputtags::response=(); @@ -1247,6 +1263,7 @@ sub end_part { } pop @Apache::inputtags::status; $Apache::inputtags::part=''; + $Apache::lonhomework::type = $Apache::lonhomework::default_type; return $result; }