[LON-CAPA-cvs] cvs: loncom /homework grades.pm
ng
lon-capa-cvs@mail.lon-capa.org
Tue, 25 Jun 2002 21:07:57 -0000
This is a MIME encoded message
--ng1025039277
Content-Type: text/plain
ng Tue Jun 25 17:07:57 2002 EDT
Modified files:
/loncom/homework grades.pm
Log:
Put radio button options and text entry for handgrading.
--ng1025039277
Content-Type: text/plain
Content-Disposition: attachment; filename="ng-20020625170757.txt"
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.30 loncom/homework/grades.pm:1.31
--- loncom/homework/grades.pm:1.30 Mon Jun 24 17:05:12 2002
+++ loncom/homework/grades.pm Tue Jun 25 17:07:56 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.30 2002/06/24 21:05:12 ng Exp $
+# $Id: grades.pm,v 1.31 2002/06/25 21:07:56 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -244,44 +244,33 @@
$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 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 align=\"middle\"><input type=\"text\" name=\"GRADE.$student.$part.$type\" value=\"$score\" size=\"4\" /></td>\n"
+ my $score=$record{"resource.$part.$type"};
+ if ($type eq 'awarded' || $type eq 'tries') {
+ $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"};
+ my ($status,$foo)=split(/_/,$score,2);
$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/) {
- $result.="<option>correct</option>\n<option selected=\"on\">incorrect</option>\n<option>excused</option>\n<option>ungraded</option>\n<option>nothing</option>\n";
- } elsif ($score eq '') {
- $result.="<option>correct</option>\n<option>incorrect</option>\n<option>excused</option>\n<option>ungraded</option>\n<option selected=\"on\">nothing</option>\n";
- } elsif ($score =~ /^excused/) {
- $result.="<option>correct</option>\n<option>incorrect</option>\n<option selected=\"on\">excused</option>\n<option>ungraded</option>\n<option>nothing</option>\n";
- } elsif ($score =~ /^ungraded/) {
- $result.="<option>correct</option>\n<option>incorrect</option>\n<option>excused</option>\n<option selected=\"on\">ungraded</option>\n<option>nothing</option>\n";
- }
+ my $optsel = '<option>correct</option><option>incorrect</option><option>excused</option>'.
+ '<option>ungraded</option><option>handgraded</option><option>nothing</option>'."\n";
+ $status = 'nothing' if ($status eq '');
+ $optsel =~ s/<option>$status/<option selected="on">$status/;
+ $result.=$optsel;
$result.="</select></td>\n";
}
}
$result.='<td></td></tr>';
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 metadata <stores> spec on what type of data to accept and provide an
#interface based on that, also do that to above function.
sub setstudentgrade {
my ($url,$symb,$courseid,$student,@parts) = @_;
my $result ='';
-
my ($stuname,$domain) = split(/:/,$student);
-
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$stuname);
-
my %newrecord;
foreach my $part (@parts) {
@@ -324,12 +313,19 @@
return $result;
}
+# -- show submissions of a student, option to grade
+#
sub submission {
my ($request) = @_;
+ $request->print(<<JAVASCRIPT);
+<script type="text/javascript">
+ function changeRadio(title,url) {
+ }
+</script>
+JAVASCRIPT
my $url=$ENV{'form.url'};
$url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; }
-# if ($ENV{'form.student'} eq '') { &listStudents($request); return ''; }
my ($uname,$udom) = &finduser($ENV{'form.student'});
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; }
my $symb;
@@ -339,10 +335,13 @@
$symb=&Apache::lonnet::symbread($url);
}
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
-
+#
+# header info
my $result='<h2><font color="#339933">Submission Record</font></h2>';
$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>';
+#
+# option to display problem
if ($ENV{'form.vProb'} eq 'yes') {
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
$ENV{'request.course.id'});
@@ -350,7 +349,7 @@
$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>Student\'s view of the problem</b></td></tr><tr><td bgcolor="#ffffff">'.$rendered.'<br />';
$result.='<b>Correct answer:</b><br />'.$companswer;
$result.='</td></tr></table>';
$result.='</td></tr></table><br />';
@@ -359,24 +358,47 @@
$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';
+ $result.=$answer;
- my (@parts) = sort(&getpartlist($url));
+ my $maxpt = &Apache::lonnet::EXT('resource.partid.weight',$symb,$udom,$uname);
+ my %record= &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
+ my $score = $record{'resource.0.awarded'}*$maxpt;
- #start the form
- $result.= '<form action="/adm/grades" method="post">'."\n".
+ $result.= '<form action="/adm/grades" method="post" name="SCORE">'."\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);
+ '<table border="0"><tr><td><b>Points</b></td><td>';
+ my $ctr = 0;
+ while ($ctr<=$maxpt) {
+ $result.= '<input type="radio" name="radval" '.
+ 'onclick="javascript:SCORE.GRADE_'.$ENV{'form.student'}.'.value='.$ctr.'" value="'.$ctr.'" '.
+ ($score == $ctr? 'checked':'').' /> '.$ctr."\n";
+ $ctr++;
+ }
+ $result.='</td><td> <b>or</b> </td>';
+ $result.='<td><input type="text" name="GRADE_'.$ENV{'form.student'}.'"'.
+ ($score ne ''? ' value = "'.$score.'"':'').' size="4" /></td>'."\n";
+ $result.='<td>/'.$maxpt.' (max pts)</td><td>';
- $result.='</table></td></tr></table><input type="submit" name="submit" value="Submit Changes" /></form>';
+ foreach my $part (&getpartlist($url)) {
+ my ($temp,$part,$type)=split(/_/,$part);
+ if ($type eq 'solved') {
+ my ($status,$foo)=split(/_/,$record{"resource.$part.$type"},2);
+ $result.="<select name=\"GRADE.$uname:$udom.$part.$type\">\n";
+ my $optsel = '<option>correct</option><option>incorrect</option>'.
+ '<option>excused</option><option>ungraded</option>'.
+ '<option>handgraded</option><option>nothing</option>'."\n";
+ $status = 'nothing' if ($status eq '');
+ $optsel =~ s/<option>$status/<option selected="on">$status/;
+ $result.=$optsel;
+ $result.="</select></td></tr>\n";
+ }
+ }
+ $result.='<tr><td colspan="5">The buttons do not work yet.<input type="submit" name="gradeOpt" value="Save N Next" /> ';
+ $result.='<input type="submit" name="gradeOpt" value="Next" /> ';
+ $result.='<input type="submit" name="gradeOpt" value="Previous" /> ';
+ $result.='</td><tr></table></form>';
return $result;
}
@@ -477,14 +499,18 @@
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
+ print "Manual grading:$url:$part:$display:<br>";
$result.='<td><b>'.$display.'</b></td>'."\n";
}
$result.='</tr>';
#get info for each student
foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
+ my $display=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},$student,@parts);
+# print "ID=$ENV{'request.course.id'}:STU=$student:DIS=$display:<br>\n";
$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>';
+ $result.='<input type="submit" name="submit" value="Submit Changes" /></form>';
$result.=&show_grading_menu_form($symb,$url);
return $result;
}
--ng1025039277--