Diff for /loncom/homework/lonhomework.pm between versions 1.130 and 1.134

version 1.130, 2003/05/19 21:05:23 version 1.134, 2003/06/13 20:50:57
Line 225  sub check_access { Line 225  sub check_access {
     }      }
   }    }
   
   if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&    #if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&
       (!$Apache::lonhomework::history{"resource.0.outtoken"})) {    #    (!$Apache::lonhomework::history{"resource.0.outtoken"})) {
       return ('UNCHECKEDOUT','needs to be checked out');    #    return ('UNCHECKEDOUT','needs to be checked out');
   }    #}
   
   
   &Apache::lonxml::debug("sending back :$status:$datemsg:");    &Apache::lonxml::debug("sending back :$status:$datemsg:");
Line 399  sub analyze { Line 399  sub analyze {
  my $subresult=&Apache::lonnet::ssi($request->uri,   my $subresult=&Apache::lonnet::ssi($request->uri,
    ('grade_target' => 'analyze'),     ('grade_target' => 'analyze'),
    ('rndseed' => $i+$rndseed));     ('rndseed' => $i+$rndseed));
  &Apache::lonxml::debug(":$subresult:");  
  (my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);   (my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);
  my %analyze=&Apache::lonnet::str2hash($subresult);   my %analyze=&Apache::lonnet::str2hash($subresult);
  my @parts;   my @parts;
Line 418  sub analyze { Line 417  sub analyze {
     }      }
     &Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state,      &Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state,
   'Analyzing Results');    'Analyzing Results');
     foreach my $part (keys(%allparts)) {      foreach my $part (sort(keys(%allparts))) {
  if (defined(@{ $overall{$part.'.answer'} })) {   if (defined(@{ $overall{$part.'.answer'} })) {
     $request->print('<table><tr><td>Part '.$part.'</td></tr>');      my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] });
       $request->print('<table><tr><td colspan="'.($num_cols+1).'">Part '.$part.'</td></tr>');
     my %frequency;      my %frequency;
     foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) {      foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) {
  $frequency{join('\0',@{ $answer })}++;   $frequency{join("\0",@{ $answer })}++;
     }      }
     foreach my $answer (sort {(split('\0',$a))[0] <=> (split('\0',$b))[0]} (keys(%frequency))) {      $request->print('<tr><td colspan="'.($num_cols).'">Answer</td><td>Frequency</td></tr>');
  $request->print('<tr><td>'.      foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) {
  join('</td><td>',split('\0',$answer)).   $request->print('<tr><td align="right">'.
    join('</td><td align="right">',split("\0",$answer)).
  '</td><td>('.$frequency{$answer}.   '</td><td>('.$frequency{$answer}.
  ')</td></tr>');   ')</td></tr>');
     }      }
Line 572  sub newproblem { Line 573  sub newproblem {
     my $extension=$request->uri;      my $extension=$request->uri;
     $extension=~s:^.*\.([\w]+)$:$1:;      $extension=~s:^.*\.([\w]+)$:$1:;
     &Apache::lonxml::debug("Looking for :$extension:");      &Apache::lonxml::debug("Looking for :$extension:");
       my $templatelist=&get_template_list('',$extension);
     if ($ENV{'form.template'} &&      if ($ENV{'form.template'} &&
  $ENV{'form.template'} ne "Select a $extension template") {   $ENV{'form.template'} ne "Select a $extension template") {
  use File::Copy;   use File::Copy;
Line 579  sub newproblem { Line 581  sub newproblem {
  my $dest = &Apache::lonnet::filelocation("",$request->uri);   my $dest = &Apache::lonnet::filelocation("",$request->uri);
  copy($file,$dest);   copy($file,$dest);
  &renderpage($request,$dest);   &renderpage($request,$dest);
       } elsif($ENV{'form.newfile'} && !$templatelist) {
    # I don't like hard-coded filenames but for now, this will work.
    use File::Copy;
    my $templatefilename =
       $request->dir_config('lonIncludes').'/templates/blank.problem';
    &Apache::lonxml::debug("$templatefilename");
    my $dest = &Apache::lonnet::filelocation("",$request->uri);
    copy($templatefilename,$dest);
    &renderpage($request,$dest);
     } else {      } else {
  my $templatelist=&get_template_list('',$extension);  
  my $url=$request->uri;   my $url=$request->uri;
  my $dest = &Apache::lonnet::filelocation("",$request->uri);   my $dest = &Apache::lonnet::filelocation("",$request->uri);
  my $errormsg;   my $errormsg;

Removed from v.1.130  
changed lines
  Added in v.1.134


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>