--- loncom/homework/structuretags.pm 2005/07/05 18:59:03 1.297 +++ loncom/homework/structuretags.pm 2005/09/23 20:16:50 1.302 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.297 2005/07/05 18:59:03 albertel Exp $ +# $Id: structuretags.pm,v 1.302 2005/09/23 20:16:50 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -118,7 +118,7 @@ sub page_start { my $body_tag_start; if (!defined($found{'body'}) && $env{'request.state'} eq 'construct' && $env{'environment.remote'} eq 'off') { - if ($target eq 'web') { + if ($target eq 'web' || $target eq 'edit') { $body_tag_start=&Apache::loncommon::bodytag(); $body_tag_start.=&Apache::lonxml::message_location(); } @@ -127,7 +127,7 @@ sub page_start { $safeeval); my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, $safeeval); - $body_tag_start=&body_tag_start($background,$bgcolor); + $body_tag_start=&body_tag_start($target,$background,$bgcolor); if ( ($target eq 'web' || $target eq 'webgrade') && $env{'request.state'} ne 'construct') { my ($symb,undef,undef,undef,$publicuser)= @@ -511,7 +511,6 @@ 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 '' ) { @@ -524,6 +523,7 @@ sub start_problem { &Apache::lonxml::debug("Using default type, problem, :$uri:"); } } + $Apache::lonhomework::default_type = $Apache::lonhomework::type; #added vars to the scripting enviroment my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; @@ -566,11 +566,12 @@ sub start_problem { value="'.$env{'form.username'}.'" />'; if ($env{'user.adv'}) { $form_tag_start.= - ' '; } $form_tag_start.='
'; } @@ -644,6 +645,10 @@ sub start_problem { } my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; } + if (lc($env{'course.'.$env{'request.course.id'}. + '.disableexampointprint'}) eq 'yes') { + $allow_print_points=0; + } my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); $duedate = POSIX::strftime("%c",localtime($duedate)); my $temp_file; @@ -1206,6 +1211,10 @@ sub start_part { if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; } + if (lc($env{'course.'.$env{'request.course.id'}. + '.disableexampointprint'}) eq 'yes') { + $allow_print_points=0; + } if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} } elsif ($target eq 'web') { $result.=''; @@ -1271,7 +1280,8 @@ sub start_preduedate { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { &Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']); - if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && + if (!$Apache::lonhomework::scantronmode && + $Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { &Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER')); &Apache::lonxml::get_all_text("/preduedate",$parser); @@ -1287,7 +1297,8 @@ sub end_preduedate { sub start_postanswerdate { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; if ($target eq 'web' || $target eq 'grade') { - if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { + if ($Apache::lonhomework::scantronmode || + $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { &Apache::lonxml::get_all_text("/postanswerdate",$parser); } } elsif ($target eq 'tex') {