[LON-CAPA-cvs] cvs: loncom /homework grades.pm
ng
lon-capa-cvs@mail.lon-capa.org
Mon, 24 Jun 2002 21:05:12 -0000
This is a MIME encoded message
--ng1024952712
Content-Type: text/plain
ng Mon Jun 24 17:05:12 2002 EDT
Modified files:
/loncom/homework grades.pm
Log:
Put options to view problems/all attempts
--ng1024952712
Content-Type: text/plain
Content-Disposition: attachment; filename="ng-20020624170512.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.29 loncom/homework/grades.pm:1.30
--- loncom/homework/grades.pm:1.29 Thu Jun 20 18:04:21 2002
+++ loncom/homework/grades.pm Mon Jun 24 17:05:12 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.29 2002/06/20 22:04:21 albertel Exp $
+# $Id: grades.pm,v 1.30 2002/06/24 21:05:12 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,6 +29,9 @@
# 6/8 Gerd Kortemeyer
# 7/26 H.K. Ng
# 8/20 Gerd Kortemeyer
+# Year 2002
+# June 2002 H.K. Ng
+#
package Apache::grades;
use strict;
@@ -83,12 +86,12 @@
$matches++;
}
}
- $request->print('<p>'.$matches.' match(es)</p>');
+ $request->printf('<p>'.$matches." match%s</p>",$matches <= 1 ? '' : 'es');
}
return '';
}
-sub listStudents {
+sub receiptInput {
my ($request) = shift;
my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"};
my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"};
@@ -108,13 +111,24 @@
$request->print(
'<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />');
}
+# $request->print(<<ENDTABLEST);
+ $request->print('</form>');
+ return '';
+}
+
+sub listStudents {
+ my ($request) = shift;
+ my $cdom=$ENV{"course.$ENV{'request.course.id'}.domain"};
+ my $cnum=$ENV{"course.$ENV{'request.course.id'}.num"};
+
$request->print(<<ENDTABLEST);
-</form>
<h2><font color="#339933">Show Student Submissions on Assessment</font></h2>
<table border="0"><tr><td bgcolor="#000000">
<table border="0">
-<tr bgcolor="#e6ffff"><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td><td> </td></tr>
+<tr bgcolor="#e6ffff"><td colspan="6"><b>Resource: </b> $ENV{'form.url'}</td></tr>
+<tr bgcolor="#e6ffff"><td><b>Username</b></td><td><b>Name</b></td><td><b>Domain</b></td>
+<td><b>View Problem</b></td><td><b>Submissions</b></td><td><b>Action</b></td></tr>
ENDTABLEST
my (%classlist) = &getclasslist($cdom,$cnum,'0');
foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
@@ -131,26 +145,32 @@
$fullname.=$name{'firstname'}.' '.$name{'middlename'};
}
if ( $Apache::grades::viewgrades eq 'F' ) {
- $request->print("\n".'<tr bgcolor=#ffffe6>'."<td>$sname</td><td>$fullname</td><td>$sdom</td><td>".
+ $request->print("\n".'<tr bgcolor=#ffffe6>'."<td>$sname</td><td>$fullname</td><td>$sdom</td>".
'<form action="/adm/grades" method="post">');
if ($ENV{'form.url'}) {
$request->print(
- '<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />');
+ '<input type="hidden" name="url" value="'.$ENV{'form.url'}.'" />');
}
if ($ENV{'form.symb'}) {
$request->print(
- '<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />');
+ '<input type="hidden" name="symb" value="'.$ENV{'form.symb'}.'" />');
}
$request->print(
- '<input type="hidden" name="command" value="'.$ENV{'form.command'}.'" />');
+ '<input type="hidden" name="command" value="'.$ENV{'form.command'}.'" />');
$request->print(
- '<input type="hidden" name="student" value="'.$sname.'" />');
+ '<input type="hidden" name="student" value="'.$sname.'" />');
$request->print(
- '<input type="hidden" name="fullname" value="'.$fullname.'" />');
+ '<input type="hidden" name="fullname" value="'.$fullname.'" />');
$request->print(
- '<input type="hidden" name="domain" value="'.$sdom.'" />');
+ '<input type="hidden" name="domain" value="'.$sdom.'" />');
+ $request->print('<td>'.
+ '<input type="radio" name="vProb" value="no" checked> no '.
+ '<input type="radio" name="vProb" value="yes"> yes </td>');
+ $request->print('<td>'.
+ '<input type="radio" name="submission" value="last" checked> last '.
+ '<input type="radio" name="submission" value="all"> all </td>');
$request->print(
- '<input type="submit" name="submit" value="View" />');
+ '<td><input type="submit" name="submit" value="View/Grade" />');
$request->print('</td></tr></form>');
# $request->print('</form></td></tr>');
}
@@ -201,7 +221,7 @@
my @parts =();
my (@metakeys) = split(/,/,&Apache::lonnet::metadata($url,'keys'));
foreach my $key (@metakeys) {
- if ( $key =~ m/stores_([0-9]+)_.*/ ) {
+ if ( $key =~ m/stores_([0-9]+)_.*/) {
push(@parts,$key);
}
}
@@ -319,17 +339,44 @@
$symb=&Apache::lonnet::symbread($url);
}
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><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,
+ $result.='<table border="0"><tr><td><b>Username: </b>'.$uname.'</td><td><b>Fullname: </b>'.$ENV{'form.fullname'}.'</td><td><b>Domain: </b>'.$udom.'</td></tr>';
+ $result.='<tr><td colspan=3><b>Resource: </b>'.$url.'</td></tr></table>';
+ if ($ENV{'form.vProb'} eq 'yes') {
+ 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 />";
+ my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
+ $ENV{'request.course.id'});
+ $result.='<table border="0"><tr><td bgcolor="#000000">';
+ $result.='<table border="0"><tr><td bgcolor="#e6ffff">';
+ $result.='<b>Student\'s view of the problem:</b></td></tr><tr><td bgcolor="#ffffe6">'.$rendered.'<br />';
+ $result.='<b>Correct answer:</b><br />'.$companswer;
+ $result.='</td></tr></table>';
+ $result.='</td></tr></table><br />';
+ }
+ my $last = '';
+ $last = 'last' if ($ENV{'form.submission'} eq 'last');
+ my $answer=&Apache::loncommon::get_previous_attempt($symb,$uname,$udom,
+ $ENV{'request.course.id'},$last);
+ $result.=$answer.'<br />Needs an interface for inputting scores';
- $answer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
- $ENV{'request.course.id'});
- $result.=$answer;
+ my (@parts) = sort(&getpartlist($url));
+
+ #start the form
+ $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="editgrades" />'."\n".
+ '<table border=0><tr><td bgcolor="#000000">'."\n".
+ '<table border=0>'."\n".
+ '<tr bgcolor="#e6ffff"><td>'."\n";
+
+ $result.='</tr>';
+ #get info for each student
+ $result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$uname,@parts);
+
+ $result.='</table></td></tr></table><input type="submit" name="submit" value="Submit Changes" /></form>';
return $result;
}
@@ -349,7 +396,7 @@
'<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".
+ '<input type="submit" name="submit" value="View/Grade Entire Class" />'."\n".
'</form>'."\n";
return $result;
}
@@ -386,7 +433,13 @@
'<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".
+ '<input type="submit" name="submit" value="View/Grade A Student" />'."\n".
+ '</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="receiptInput" />'."\n".
+ '<input type="submit" name="submit" value="Verify Receipt" />'."\n".
'</form>'."\n";
$result.='</td></tr></table>'."\n";
$result.='</td></tr></table>'."\n";
@@ -425,7 +478,7 @@
my $display=&Apache::lonnet::metadata($url,$part.'.display');
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
$result.='<td><b>'.$display.'</b></td>'."\n";
- }
+ }
$result.='</tr>';
#get info for each student
foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
@@ -797,6 +850,8 @@
$request->print(&csvupload($request));
} elsif ($command eq 'csvuploadmap') {
$request->print(&csvuploadmap($request));
+ } elsif ($command eq 'receiptInput') {
+ &receiptInput($request);
} elsif ($command eq 'csvuploadassign') {
if ($ENV{'form.associate'} ne 'Reverse Association') {
$request->print(&csvuploadassign($request));
--ng1024952712--