--- loncom/homework/lonhomework.pm 2006/06/20 05:10:00 1.252 +++ loncom/homework/lonhomework.pm 2006/06/30 05:10:29 1.255 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.252 2006/06/20 05:10:00 albertel Exp $ +# $Id: lonhomework.pm,v 1.255 2006/06/30 05:10:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -344,9 +344,14 @@ sub check_slot_access { } } + if ( $is_correct) { + if ($type eq 'problem') { + return ($status); + } return ('SHOW_ANSWER'); } + if ( $status eq 'CANNOT_ANSWER' && ($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) { return ($status,$datemsg); @@ -621,6 +626,13 @@ sub setuppermissions { return ''; } +sub unset_permissions { + undef($Apache::lonhomework::queuegrade); + undef($Apache::lonhomework::modifygrades); + undef($Apache::lonhomework::viewgrades); + undef($Apache::lonhomework::browse); +} + sub setupheader { my $request=$_[0]; &Apache::loncommon::content_type($request,'text/html'); @@ -807,7 +819,7 @@ sub editxmlmode { &Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index", "Problem Editing Help"). ''. - &Apache::loncommon::help_open_menu('',undef,undef,undef,5,'Authoring'). + &Apache::loncommon::help_open_menu(undef,undef,5,'Authoring'). ''; if ($cols > 80) { $cols = 80; } if ($cols < 70) { $cols = 70; } @@ -1020,10 +1032,15 @@ sub handler { if ($Apache::lonhomework::browse ne 'F' && $env{'request.state'} ne "construct") { #should know where we are, so ask - $request->internal_redirect('/adm/ambiguous'); return OK; + &unset_permissions(); + $request->internal_redirect('/adm/ambiguous'); + return OK; } } - if (&setupheader($request)) { return OK; } + if (&setupheader($request)) { + &unset_permissions(); + return OK; + } &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:$Apache::lonhomework::modifygrades:$Apache::lonhomework::queuegrade"); &Apache::lonxml::debug("Problem Mode ".$env{'form.problemmode'}); my ($symb) = &Apache::lonxml::whichuser(); @@ -1057,6 +1074,7 @@ sub handler { #&Apache::lonxml::debug("Spent $td seconds processing"); # always turn off debug messages $Apache::lonxml::debug=0; + &unset_permissions(); return OK; }