--- loncom/homework/lonhomework.pm 2004/09/27 18:36:53 1.180 +++ loncom/homework/lonhomework.pm 2004/11/29 22:13:34 1.184 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.180 2004/09/27 18:36:53 albertel Exp $ +# $Id: lonhomework.pm,v 1.184 2004/11/29 22:13:34 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)); @@ -514,12 +519,12 @@ sub analyze { foreach my $part (sort(keys(%allparts))) { if (defined(@{ $overall{$part.'.answer'} })) { my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] }); - $request->print(''); + $request->print('
'.&mt('Part').' '.$part.'
'); my %frequency; foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) { $frequency{join("\0",@{ $answer })}++; } - $request->print(''); + $request->print(''); foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) { $request->print('
'.&mt('Part').' '.$part.'
'.&mt('Answer').''.&mt('Frequency').'
'.&mt('Answer').''.&mt('Frequency').'
'. join('',split("\0",$answer)). @@ -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,7 +769,6 @@ sub handler { $Apache::lonxml::debug=$ENV{'user.debug'}; if (&setupheader($request)) { return OK; } $ENV{'request.uri'}=$request->uri; - &setuppermissions(); &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:"); # some times multiple problemmodes are submitted, need to select