[LON-CAPA-cvs] cvs: loncom /homework grades.pm

ng lon-capa-cvs@mail.lon-capa.org
Thu, 20 Jun 2002 21:21:16 -0000


This is a MIME encoded message

--ng1024608076
Content-Type: text/plain

ng		Thu Jun 20 17:21:16 2002 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  Organized the user interface for manual grading of subjective problem.
  
  
  
--ng1024608076
Content-Type: text/plain
Content-Disposition: attachment; filename="ng-20020620172116.txt"

Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.27 loncom/homework/grades.pm:1.28
--- loncom/homework/grades.pm:1.27	Fri May 24 17:45:22 2002
+++ loncom/homework/grades.pm	Thu Jun 20 17:21:16 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.27 2002/05/24 21:45:22 albertel Exp $
+# $Id: grades.pm,v 1.28 2002/06/20 21:21:16 ng Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -94,7 +94,7 @@
   my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"};
   my $hostver=unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'});
   $request->print(<<ENDHEADER);
-<h1>Verify a Submission Receipt Issued by this Server</h1>
+<h2><font color="#339933">Verify a Submission Receipt Issued by this Server</font></h2>
 <form action="/adm/grades" method="post">
 <tt>$hostver-<input type="text" name="receipt" size="4"></tt>
 <input type="submit" name="submit" value="Verify">
@@ -110,9 +110,11 @@
 	  }
   $request->print(<<ENDTABLEST);
 </form>
-<h1>Show Student Submissions on Assessment</h1>
-<table border="1">
-<tr><th>Username</th><th>Domain</th><th>Name</th><th>&nbsp;</th></tr>
+<h2><font color="#339933">Show Student Submissions on Assessment</font></h2>
+
+<table border=0><tr><td bgcolor=#990404>
+<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>
 ENDTABLEST
   my (%classlist) = &getclasslist($cdom,$cnum,'0');
   foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
@@ -125,11 +127,11 @@
       my ($tmp) = keys(%name);
       if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
 	$fullname=$name{'lastname'}.$name{'generation'};
-	if ($fullname =~ /[^\s]+/) { $fullname.=','; }
+	if ($fullname =~ /[^\s]+/) { $fullname.=', '; }
 	$fullname.=$name{'firstname'}.' '.$name{'middlename'};
       }
       if ( $Apache::grades::viewgrades eq 'F' ) {
-	  $request->print("\n".'<tr>'."<td>$sname</td><td>$sdom</td><td>$fullname</td><td>".
+	  $request->print("\n".'<tr bgcolor=#ffffe6>'."<td>$sname</td><td>$fullname</td><td>$sdom</td><td>".
 			  '<form action="/adm/grades" method="post">');
 	  if ($ENV{'form.url'}) {
 	    $request->print(
@@ -144,13 +146,16 @@
 	  $request->print(
              '<input type="hidden" name="student" value="'.$sname.'" />');
 	  $request->print(
+             '<input type="hidden" name="fullname" value="'.$fullname.'" />');
+	  $request->print(
              '<input type="hidden" name="domain" value="'.$sdom.'" />');
 	  $request->print(
                          '<input type="submit" name="submit" value="View" />');
-	  $request->print('</form></td></tr>');
+	  $request->print('</td></tr></form>');
+#	  $request->print('</form></td></tr>');
       }
   }
-  $request->print('</table>');
+  $request->print('</table></td></tr></table>');
 }
 
 
@@ -207,23 +212,28 @@
   my ($url,$symb,$courseid,$student,@parts) = @_;
   my $result ='';
   my $cellclr = '"#ffffdd"';
-  my ($stuname,$domain) = split(/:/,$student);
+  my ($username,$domain) = split(/:/,$student);
 
-  my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$stuname);
+  my (@requests) = ('lastname','firstname','middlename','generation');
+  my (%name) = &Apache::lonnet::get('environment',\@requests,$domain,$username);
+  my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$username);
+  my $fullname=$name{'lastname'}.$name{'generation'};
+  if ($fullname =~ /[^\s]+/) { $fullname.=', '; }
+  $fullname.=$name{'firstname'}.' '.$name{'middlename'};
 
-  $result.="<tr><td bgcolor=$cellclr>$stuname</td><td bgcolor=$cellclr align=\"middle\">$domain</td>\n";
+  $result.="<tr bgcolor=$cellclr><td>$username</td><td>$fullname</td><td align=\"middle\">$domain</td>\n";
   foreach my $part (@parts) {
     my ($temp,$part,$type)=split(/_/,$part);
     #print "resource.$part.$type = ".$record{"resource.$part.$type"}." <br />\n";
     if ($type eq 'awarded') {
       my $score=$record{"resource.$part.$type"};
-      $result.="<td bgcolor=$cellclr align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n";
+      $result.="<td align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n";
     } elsif ($type eq 'tries') {
       my $score=$record{"resource.$part.$type"};
-      $result.="<td bgcolor=$cellclr align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n"
+      $result.="<td align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n"
     } elsif ($type eq 'solved') {
       my $score=$record{"resource.$part.$type"};
-      $result.="<td bgcolor=$cellclr align=\"middle\"><select name=\"GRADE.$student.$part.$type\">\n";
+      $result.="<td align=\"middle\"><select name=\"GRADE.$student.$part.$type\">\n";
       if ($score =~ /^correct/) {
 	$result.="<option selected=\"on\">correct</option>\n<option>incorrect</option>\n<option>excused</option>\n<option>ungraded</option>\n<option>nothing</option>\n";
       } elsif ($score =~ /^incorrect/) {
@@ -311,7 +321,8 @@
   if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
   my $answer=&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
 						      $ENV{'request.course.id'});
-  my $result="<h2> Submission Record </h2>  $uname:$udom for $url <br />".$answer;
+  my $result='<h2><font color="#339933">Submission Record</font></h2>';
+  $result.='<b>Username : </b>'.$uname.'<br><b>Fullname : </b>'.$ENV{'form.fullname'}.'<br><b>Domain : </b>'.$udom.'<br><b>Resource : </b>'.$url.' <br />'.$answer;
   my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
 						   $ENV{'request.course.id'});
   $result.="Student's view of the problem:<br /> $rendered <br /> Correct answer:<br />";
@@ -336,25 +347,32 @@
   my ($request) = @_;
   my ($symb,$url)=&get_symb_and_url($request);
   if (!$symb) {return '';}
-  my $result='<h2>Select a grading method</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=#e6ffff>'."\n";
+  $result.='&nbsp;<b>Resource :</b> '.$url.'</td></tr>'."\n";
+  $result.='<tr bgcolor=#ffffe6><td>'."\n";
   $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>';
+	    '</form>'."\n";
   $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="csvupload" />'."\n".
 	  '<input type="submit" name="submit" value="Upload Scores" />'."\n".
-	    '</form>';
+	    '</form>'."\n";
   $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="submission" />'."\n".
 	  '<input type="submit" name="submit" value="View/Edit Student" />'."\n".
-	    '</form>';
+	    '</form>'."\n";
+  $result.='</td></tr></table>'."\n";
+  $result.='</td></tr></table>'."\n";
   return $result;
 }
 
@@ -375,7 +393,7 @@
   #get list of parts for this problem
   my (@parts) = &getpartlist($url);
 
-  $request->print ("<h2><font color=\"#339966\">Manual Grading</font></h2>");
+  $request->print ("<h2><font color=\"#339933\">Manual Grading</font></h2>");
 
   #start the form
   $result = '<form action="/adm/grades" method="post">'."\n".
@@ -383,15 +401,15 @@
       '<input type="hidden" name="url" value="'.$url.'" />'."\n".
 	'<input type="hidden" name="command" value="editgrades" />'."\n".
 	  '<input type="submit" name="submit" value="Submit Changes" />'."\n".
-	    '<table border=0><tr><td bgcolor="#999999">'."\n".
+	    '<table border=0><tr><td bgcolor="#990404">'."\n".
 	     '<table border=0>'."\n".
-	      '<tr><td bgcolor='.$headerclr.'>UserId</td><td bgcolor='.$headerclr.'>Domain</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)) {
      my $display=&Apache::lonnet::metadata($url,$part.'.display');
      if  (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
-     $result.='<td bgcolor='.$headerclr.'>'.$display.'</td>'."\n";
+     $result.='<td><b>'.$display.'</b></td>'."\n";
    }
-  $result.="</tr>";
+  $result.='</tr>';
   #get info for each student
   foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
     $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts);

--ng1024608076--