Diff for /loncom/homework/grades.pm between versions 1.28 and 1.29

version 1.28, 2002/06/20 21:21:16 version 1.29, 2002/06/20 22:04:21
Line 112  ENDHEADER Line 112  ENDHEADER
 </form>  </form>
 <h2><font color="#339933">Show Student Submissions on Assessment</font></h2>  <h2><font color="#339933">Show Student Submissions on Assessment</font></h2>
   
 <table border=0><tr><td bgcolor=#990404>  <table border="0"><tr><td bgcolor="#000000">
 <table border=0>  <table border="0">
 <tr bgcolor=#e6ffff><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td><td>&nbsp;</td></tr>  <tr bgcolor="#e6ffff"><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td><td>&nbsp;</td></tr>
 ENDTABLEST  ENDTABLEST
   my (%classlist) = &getclasslist($cdom,$cnum,'0');    my (%classlist) = &getclasslist($cdom,$cnum,'0');
   foreach my $student ( sort(@{ $classlist{'allids'} }) ) {    foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
Line 248  sub viewstudentgrade { Line 248  sub viewstudentgrade {
       $result.="</select></td>\n";        $result.="</select></td>\n";
     }      }
   }    }
   $result.='</tr>';    $result.='<td></td></tr>';
   return $result;    return $result;
 }  }
 #FIXME need to look at the meatdata <stores> spec on what type of data to accept and provide an  #FIXME need to look at the meatdata <stores> spec on what type of data to accept and provide an
Line 343  sub get_symb_and_url { Line 343  sub get_symb_and_url {
  return ($symb,$url);   return ($symb,$url);
 }  }
   
   sub view_edit_entire_class_form {
     my ($symb,$url)=@_;
     my $result.='<form action="/adm/grades" method="post">'."\n".
       '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
         '<input type="hidden" name="url" value="'.$url.'" />'."\n".
    '<input type="hidden" name="command" value="viewgrades" />'."\n".
     '<input type="submit" name="submit" value="View/Edit Entire Class" />'."\n".
       '</form>'."\n";
     return $result;
   }
   
   sub show_grading_menu_form {
     my ($symb,$url)=@_;
     my $result.='<form action="/adm/grades" method="post">'."\n".
       '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
         '<input type="hidden" name="url" value="'.$url.'" />'."\n".
    '<input type="hidden" name="command" value="gradingmenu" />'."\n".
     '<input type="submit" name="submit" value="Grading Menu" />'."\n".
       '</form>'."\n";
     return $result;
   }
   
 sub gradingmenu {  sub gradingmenu {
   my ($request) = @_;    my ($request) = @_;
   my ($symb,$url)=&get_symb_and_url($request);    my ($symb,$url)=&get_symb_and_url($request);
   if (!$symb) {return '';}    if (!$symb) {return '';}
   
   my $result='<h2>&nbsp;<font color="#339933">Select a Grading Method</font></h2><br />';    my $result='<h2>&nbsp;<font color="#339933">Select a Grading Method</font></h2><br />';
   $result.='<table width=100% border=0><tr><td bgcolor=#990404>'."\n";    $result.='<table width=100% border=0><tr><td bgcolor=#000000>'."\n";
   $result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n";    $result.='<table width=100% border=0><tr><td bgcolor=#e6ffff>'."\n";
   $result.='&nbsp;<b>Resource :</b> '.$url.'</td></tr>'."\n";    $result.='&nbsp;<b>Resource :</b> '.$url.'</td></tr>'."\n";
   $result.='<tr bgcolor=#ffffe6><td>'."\n";    $result.='<tr bgcolor=#ffffe6><td>'."\n";
   $result.='<form action="/adm/grades" method="post">'."\n".    $result.=&view_edit_entire_class_form($symb,$url);
      '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".  
       '<input type="hidden" name="url" value="'.$url.'" />'."\n".  
  '<input type="hidden" name="command" value="viewgrades" />'."\n".  
   '<input type="submit" name="submit" value="View/Edit Entire Class" />'."\n".  
     '</form>'."\n";  
   $result.='<form action="/adm/grades" method="post">'."\n".    $result.='<form action="/adm/grades" method="post">'."\n".
      '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".       '<input type="hidden" name="symb" value="'.$symb.'" />'."\n".
       '<input type="hidden" name="url" value="'.$url.'" />'."\n".        '<input type="hidden" name="url" value="'.$url.'" />'."\n".
Line 391  sub viewgrades { Line 408  sub viewgrades {
   my $cellclr = '"#ffffcc"';    my $cellclr = '"#ffffcc"';
   
   #get list of parts for this problem    #get list of parts for this problem
   my (@parts) = &getpartlist($url);    my (@parts) = sort(&getpartlist($url));
   
   $request->print ("<h2><font color=\"#339933\">Manual Grading</font></h2>");    $request->print ("<h2><font color=\"#339933\">Manual Grading</font></h2>");
   
Line 401  sub viewgrades { Line 418  sub viewgrades {
       '<input type="hidden" name="url" value="'.$url.'" />'."\n".        '<input type="hidden" name="url" value="'.$url.'" />'."\n".
  '<input type="hidden" name="command" value="editgrades" />'."\n".   '<input type="hidden" name="command" value="editgrades" />'."\n".
   '<input type="submit" name="submit" value="Submit Changes" />'."\n".    '<input type="submit" name="submit" value="Submit Changes" />'."\n".
     '<table border=0><tr><td bgcolor="#990404">'."\n".      '<table border=0><tr><td bgcolor="#000000">'."\n".
      '<table border=0>'."\n".       '<table border=0>'."\n".
       '<tr bgcolor='.$headerclr.'><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td>'."\n";        '<tr bgcolor='.$headerclr.'><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td>'."\n";
   foreach my $part (sort(@parts)) {    foreach my $part (@parts) {
      my $display=&Apache::lonnet::metadata($url,$part.'.display');       my $display=&Apache::lonnet::metadata($url,$part.'.display');
      if  (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }       if  (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
      $result.='<td><b>'.$display.'</b></td>'."\n";       $result.='<td><b>'.$display.'</b></td>'."\n";
Line 415  sub viewgrades { Line 432  sub viewgrades {
     $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts);      $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts);
   }    }
   $result.='</table></td></tr></table><input type="submit" name="submit" value="Submit Changes" /></form>';    $result.='</table></td></tr></table><input type="submit" name="submit" value="Submit Changes" /></form>';
     $result.=&show_grading_menu_form($symb,$url);
   return $result;    return $result;
 }  }
   
Line 658  sub csvuploadassign { Line 675  sub csvuploadassign {
     }      }
   }    }
   $request->print('<h3>Assigning Grades</h3>');    $request->print('<h3>Assigning Grades</h3>');
   &Apache::lonhomework::showhash(('1'=>\@keyfields));  
   &Apache::lonhomework::showhash(%fields);  
   my $courseid=$ENV{'request.course.id'};    my $courseid=$ENV{'request.course.id'};
   my $cdom=$ENV{"course.$courseid.domain"};    my $cdom=$ENV{"course.$courseid.domain"};
   my $cnum=$ENV{"course.$courseid.num"};    my $cnum=$ENV{"course.$courseid.num"};
   my (%classlist) = &getclasslist($cdom,$cnum,'1');    my (%classlist) = &getclasslist($cdom,$cnum,'1');
   foreach my $student ( sort(@{ $classlist{'allids'} }) ) {    my @skipped;
     my %newhash;    my $countdone=0;
     foreach my $grade (@gradedata) {    foreach my $grade (@gradedata) {
       my %entries=&Apache::loncommon::record_sep($grade);      my %entries=&Apache::loncommon::record_sep($grade);
       foreach my $dest (keys(%fields)) {      my $username=$entries{$fields{'username'}};
       my $domain=$entries{$fields{'domain'}};
       }      if (!exists($classlist{"$username:$domain"})) {
         push(@skipped,"$username:$domain");
         next;
     }      }
       my %grades;
       foreach my $dest (keys(%fields)) {
         if ($dest eq 'username' || $dest eq 'domain') { next; }
         if ($entries{$fields{$dest}} eq '') { next; }
         my $store_key=$dest;
         $store_key=~s/^stores/resource/;
         $store_key=~s/_/\./g;
         $grades{$store_key}=$entries{$fields{$dest}};
       }
       $grades{"resource.regrader"}="$ENV{'user.name'}:$ENV{'user.domain'}";
       &Apache::lonnet::cstore(\%grades,$symb,$ENV{'request.course.id'},
       $domain,$username);
       $request->print('.');
       $request->rflush();
       $countdone++;
     }
     $request->print("<br />Stored $countdone students\n");
     if (@skipped) {
       $request->print('<br /><font size="+1"><b>Skipped Students</b></font><br />');
       foreach my $student (@skipped) { $request->print("<br />$student"); }
   }    }
     $request->print(&view_edit_entire_class_form($symb,$url));
     $request->print(&show_grading_menu_form($symb,$url));
     return '';
 }  }
   
 sub send_header {  sub send_header {
Line 695  sub send_footer { Line 735  sub send_footer {
 sub handler {  sub handler {
   my $request=$_[0];    my $request=$_[0];
   
   if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;} else {$Apache::lonxml::debug=0;}  
     
   if ($ENV{'browser.mathml'}) {    if ($ENV{'browser.mathml'}) {
     $request->content_type('text/xml');      $request->content_type('text/xml');
   } else {    } else {
Line 742  sub handler { Line 780  sub handler {
          }           }
      }       }
   } else {    } else {
     &Apache::lonhomework::showhashsubset(\%ENV,'^form');      #&Apache::lonhomework::showhashsubset(\%ENV,'^form');
     $Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});      $Apache::grades::viewgrades=&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'});
     if ($command eq 'submission') {      if ($command eq 'submission') {
       &listStudents($request) if ($ENV{'form.student'} eq '');        &listStudents($request) if ($ENV{'form.student'} eq '');

Removed from v.1.28  
changed lines
  Added in v.1.29


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