--- loncom/homework/lonhomework.pm 2002/11/12 05:05:26 1.101 +++ loncom/homework/lonhomework.pm 2002/12/11 14:44:24 1.104 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.101 2002/11/12 05:05:26 albertel Exp $ +# $Id: lonhomework.pm,v 1.104 2002/12/11 14:44:24 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -144,7 +144,7 @@ $Apache::lonxml::browse=''; sub check_access { my ($id) = @_; my $date =''; - my $status = ''; + my $status; my $datemsg = ''; my $lastdate = ''; my $temp; @@ -156,6 +156,12 @@ sub check_access { $lastdate = $date; $date = &Apache::lonnet::EXT("resource.$id.$temp"); my $thistype = &Apache::lonnet::EXT("resource.$id.$temp.type"); + if ($thistype =~ /^(con_lost|no_such_host)/ || + $date =~ /^(con_lost|no_such_host)/) { + $status='UNAVAILABLE'; + $date="may open later."; + return($status,$date); + } if ($thistype eq 'date_interval') { if ($temp eq 'opendate') { $date=&Apache::lonnet::EXT("resource.$id.duedate")-$date; @@ -332,13 +338,12 @@ sub analyze { my %overall; my %allparts; my $rndseed=$ENV{'form.rndseed'}; - srand($rndseed); &analyze_header($request); - for(my $i;$i<$ENV{'form.numtoanalyze'};$i++) { + for(my $i=1;$i<$ENV{'form.numtoanalyze'}+1;$i++) { my $subresult=&Apache::lonnet::ssi($request->uri, ('grade_target' => 'analyze'), - ('rndseed' => rand)); - #&Apache::lonxml::debug(":$subresult:"); + ('rndseed' => $i)); + &Apache::lonxml::debug(":$subresult:"); (my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2); my %analyze=&Apache::lonnet::str2hash($subresult); &Apache::lonhomework::showhash(%analyze); @@ -465,7 +470,7 @@ sub get_template_list { $result=$file; last; } else { - push (@allnames, $name); + if ($name) { push (@allnames, $name); } } } if (@allnames && !$result) {