--- loncom/homework/lonhomework.pm 2004/09/18 17:29:29 1.179 +++ loncom/homework/lonhomework.pm 2004/11/13 20:40:32 1.183 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.179 2004/09/18 17:29:29 albertel Exp $ +# $Id: lonhomework.pm,v 1.183 2004/11/13 20:40:32 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -292,7 +292,7 @@ sub check_access { $status = 'CANNOT_ANSWER'; } } - if ($status eq 'CAN_ANSWER') { + if ($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER') { my $interval=&Apache::lonnet::EXT("resource.$id.interval"); &Apache::lonxml::debug("looking for interval $interval"); if ($interval) { @@ -449,9 +449,13 @@ sub handle_save_or_undo { sub analyze_header { my ($request) = @_; + my $bodytag=''; + if ($ENV{'environment.remote'} eq 'off') { + $bodytag=&Apache::loncommon::bodytag(); + } my $result.=' '.&mt("Analyzing a problem").' - '.&Apache::lonxml::message_location().' + '.$bodytag.&Apache::lonxml::message_location().'
'. &Apache::structuretags::remember_problem_state().' @@ -489,6 +493,7 @@ sub analyze { for(my $i=1;$i<$ENV{'form.numtoanalyze'}+1;$i++) { &Apache::lonhtmlcommon::Increment_PrgWin($request,\%prog_state, &mt('last problem')); + if (&Apache::loncommon::connection_aborted($request)) { return; } my $subresult=&Apache::lonnet::ssi($request->uri, ('grade_target' => 'analyze'), ('rndseed' => $i+$rndseed)); @@ -571,8 +576,11 @@ sub editxmlmode { if ($cols > 80) { $cols = 80; } if ($cols < 70) { $cols = 70; } if ($rows < 20) { $rows = 20; } - $result.=''. - &Apache::lonxml::message_location().' + my $bodytag=''; + if ($ENV{'environment.remote'} eq 'off') { + $bodytag=&Apache::loncommon::bodytag(); + } + $result.=''.$bodytag.&Apache::lonxml::message_location().' '. &Apache::structuretags::remember_problem_state().' @@ -602,6 +610,13 @@ sub renderpage { &Apache::lonxml::debug("Running targets ".join(':',@targets)); my $overall_result; foreach my $target (@targets) { + # FIXME need to do something intelligent when a problem goes + # from viewable to not viewable due to map conditions + #&setuppermissions(); + #if ( $Apache::lonhomework::browse ne '2' + # && $Apache::lonhomework::browse ne 'F' ) { + # $request->print(" You most likely shouldn't see me."); + #} #my $t0 = [&gettimeofday()]; my $problem=&Apache::lonnet::getfile($file); if ($problem eq -1) { @@ -754,10 +769,7 @@ sub handler { $Apache::lonxml::debug=$ENV{'user.debug'}; if (&setupheader($request)) { return OK; } $ENV{'request.uri'}=$request->uri; - - #setup permissions - $Apache::lonhomework::browse= &Apache::lonnet::allowed('bre',$ENV{'request.filename'}); - $Apache::lonhomework::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'}); + &setuppermissions(); &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:"); # some times multiple problemmodes are submitted, need to select # the last one