Diff for /loncom/homework/grades.pm between versions 1.394 and 1.396

version 1.394, 2007/04/15 18:25:56 version 1.396, 2007/04/25 00:16:51
Line 953  sub processGroup { Line 953  sub processGroup {
     my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo');      my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo');
     my $total      = scalar(@stuchecked)-1;      my $total      = scalar(@stuchecked)-1;
   
     foreach (@stuchecked) {      foreach my $student (@stuchecked) {
  my ($uname,$udom,$fullname) = split(/:/);   my ($uname,$udom,$fullname) = split(/:/,$student);
  $env{'form.student'}        = $uname;   $env{'form.student'}        = $uname;
  $env{'form.userdom'}        = $udom;   $env{'form.userdom'}        = $udom;
  $env{'form.fullname'}       = $fullname;   $env{'form.fullname'}       = $fullname;
Line 1626  sub show_problem { Line 1626  sub show_problem {
     $result.='</td></tr></table><br />';      $result.='</td></tr></table><br />';
     return $result;      return $result;
 }  }
   sub files_exist {
       my ($r, $symb) = @_;
       my $files_exist = 0;
       my @students = &Apache::loncommon::get_env_multiple('form.stuinfo');
       foreach my $student (@students) {
           my ($uname,$udom,$fullname) = split(/:/,$student);
           my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname);
           my ($string,$timestamp)= &get_last_submission(\%record);
           foreach (@$string) {
               my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/;
               my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
               if (@$files) {
                   $files_exist = 1;
                   return $files_exist;
               }
           }
       }
       return $files_exist;
   }
 sub download_all_link {  sub download_all_link {
     my ($r,$symb) = @_;      my ($r,$symb) = @_;
     my $courseid=$env{'request.course.id'};      my $all_students = 
     my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo');   join("\n", &Apache::loncommon::get_env_multiple('form.stuinfo'));
     my $parts;  
     my $total      = scalar(@stuchecked)-1;      my $parts =
     my $all_students;   join("\n",&Apache::loncommon::get_env_multiple('form.vPart'));
     foreach my $stu_info (@stuchecked) {  
         $all_students .= $stu_info."\n";  
     }  
     foreach my $part (&Apache::loncommon::get_env_multiple('form.vPart')) {  
         $parts .= $part."\n";  
     }  
     my $identifier = &Apache::loncommon::get_cgi_id();      my $identifier = &Apache::loncommon::get_cgi_id();
     &Apache::lonnet::appenv('cgi.'.$identifier.'.students' => $all_students,      &Apache::lonnet::appenv('cgi.'.$identifier.'.students' => $all_students,
                             'cgi.'.$identifier.'.symb' => $symb,                              'cgi.'.$identifier.'.symb' => $symb,
                             'cgi.'.$identifier.'.parts' => $parts,                              'cgi.'.$identifier.'.parts' => $parts,);
                             'cgi.'.$identifier.'.courseid' => $courseid);      $r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">'.
     $r->print('<a href="/cgi-bin/multidownload.pl?'.$identifier.'">Download All Submitted Documents</a>');        &mt('Download All Submitted Documents').'</a>');
     return      return
 }  }
   
 # --------------------------- show submissions of a student, option to grade   # --------------------------- show submissions of a student, option to grade 
 sub submission {  sub submission {
     my ($request,$counter,$total) = @_;      my ($request,$counter,$total) = @_;
Line 1681  sub submission { Line 1696  sub submission {
  &sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes');   &sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes');
  $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ?    $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? 
     &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};      &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};
  &download_all_link($request,$symb);   if (&files_exist($request, $symb)) {
       &download_all_link($request, $symb);
    }
  $request->print('<h3>&nbsp;<font color="#339933">Submission Record</font></h3>'."\n".   $request->print('<h3>&nbsp;<font color="#339933">Submission Record</font></h3>'."\n".
  '<font size=+1>&nbsp;<b>Resource: </b>'.$env{'form.probTitle'}.'</font>'."\n");   '<font size=+1>&nbsp;<b>Resource: </b>'.$env{'form.probTitle'}.'</font>'."\n");
   
Line 6150  sub handler { Line 6167  sub handler {
  }   }
     } else {      } else {
  &init_perm();   &init_perm();
  &Apache::lonnet::logthis("command is $command");  
  foreach my $key (keys %perm) {  
     &Apache::lonnet::logthis("key is $key");  
  }  
  if ($command eq 'submission' && $perm{'vgr'}) {   if ($command eq 'submission' && $perm{'vgr'}) {
     ($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));      ($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0));
  } elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {   } elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) {

Removed from v.1.394  
changed lines
  Added in v.1.396


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