--- loncom/homework/grades.pm 2003/07/18 20:14:35 1.119
+++ loncom/homework/grades.pm 2003/07/29 14:24:24 1.127
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.119 2003/07/18 20:14:35 ng Exp $
+# $Id: grades.pm,v 1.127 2003/07/29 14:24:24 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,7 @@
# June-August H.K. Ng
# Year 2003
# February, March H.K. Ng
+# July, H. K. Ng
#
package Apache::grades;
@@ -98,7 +99,8 @@ sub get_fullname {
#--- Get the partlist and the response type for a given problem. ---
#--- Indicate if a response type is coded handgraded or not. ---
sub response_type {
- my ($url) = shift;
+ my ($url,$symb) = shift;
+ $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))) if ($symb eq '');
my $allkeys = &Apache::lonnet::metadata($url,'keys');
my %seen = ();
my (@partlist,%handgrade);
@@ -107,7 +109,8 @@ sub response_type {
my ($responsetype,$part) = split(/_/,$_,2);
my ($partid,$respid) = split(/_/,$part);
$responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!!
- $handgrade{$part} = $responsetype.':'.($allkeys =~ /parameter_$part\_handgrade/ ? 'yes' : 'no');
+ my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb);
+ $handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no');
next if ($seen{$partid} > 0);
$seen{$partid}++;
push @partlist,$partid;
@@ -123,23 +126,25 @@ sub showResourceInfo {
my $result ='
'.
'
Current Resource: '.$probTitle.'
'."\n";
my ($partlist,$handgrade) = &response_type($url);
- my ($resptype,$hdgrade)=('','no');
+ my %resptype = ();
+ my $hdgrade='no';
for (sort keys(%$handgrade)) {
my ($responsetype,$handgrade)=split(/:/,$$handgrade{$_});
- $resptype = $responsetype;
+ my $partID = (split(/_/))[0];
+ $resptype{$partID} = $responsetype;
$hdgrade = $handgrade if ($handgrade eq 'yes');
- $result.='
Part '.(split(/_/))[0].'
'.
+ $result.='
Part '.$partID.'
'.
'
Type: '.$responsetype.'
';
# '
Handgrade: '.$handgrade.'
';
}
$result.='
'."\n";
- return $result,$resptype,$hdgrade,$partlist,$handgrade;
+ return $result,\%resptype,$hdgrade,$partlist,$handgrade;
}
#--- Clean response type for display
#--- Currently filters option response type only.
sub cleanRecord {
- my ($answer,$response) = @_;
+ my ($answer,$response,$symb) = @_;
if ($response eq 'option') {
my (@IDs,@ans);
foreach (split(/\&/,&Apache::lonnet::unescape($answer))) {
@@ -148,12 +153,27 @@ sub cleanRecord {
push @ans,$ans;
}
my $grayFont = '';
- return '
'.
+ return '
'.
'
Answer
'.
(join '
',@ans).'
'.
'
'.$grayFont.'Option ID
'.$grayFont.
(join '
'.$grayFont,@IDs).'
'.
- '
';
+ '
';
+ }
+ if ($response eq 'essay') {
+ if (! exists ($ENV{'form.'.$symb})) {
+ my (%keyhash) = &Apache::lonnet::dump('nohist_handgrade',
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+
+ my $loginuser = $ENV{'user.name'}.':'.$ENV{'user.domain'};
+ $ENV{'form.keywords'} = $keyhash{$symb.'_keywords'} ne '' ? $keyhash{$symb.'_keywords'} : '';
+ $ENV{'form.kwclr'} = $keyhash{$loginuser.'_kwclr'} ne '' ? $keyhash{$loginuser.'_kwclr'} : 'red';
+ $ENV{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0';
+ $ENV{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : '';
+ $ENV{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob.
+ }
+ return '
'.&keywords_highlight($answer).'
';
}
return $answer;
}
@@ -197,6 +217,7 @@ COMMONJSFUNCTIONS
#--- section, ids and fullnames for each user.
sub getclasslist {
my ($getsec,$filterlist) = @_;
+ $getsec = $getsec eq '' ? 'all' : $getsec;
my $classlist=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
return if (! defined($classlist));
@@ -303,6 +324,7 @@ sub jscriptNform {
''."\n".
''."\n".
''."\n".
+ ''."\n".
''."\n".
''."\n".
''."\n".
@@ -430,7 +452,7 @@ sub listStudents {
my $result='
'.$viewgrade.
' Submissions for a Student or a Group of Students
';
- my ($table,$resptype,$hdgrade,$partlist,$handgrade) = &showResourceInfo($url,$ENV{'form.probTitle'});
+ my ($table,undef,$hdgrade,$partlist,$handgrade) = &showResourceInfo($url,$ENV{'form.probTitle'});
$result.=$table;
$request->print(< last sub only'."\n".
' last sub & parts info'."\n".
+ ' by dates and submissions'."\n".
' all details'."\n".
''."\n".
''."\n".
- ''."\n".
' '."\n".
' '."\n".
''."\n".
@@ -497,23 +519,27 @@ LISTJAVASCRIPT
''."\n".
''."\n";
- $gradeTable.='Student Status: '.
- &Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,'javascript:reLoadList(this.form);').' ';
+ if (exists($ENV{'form.gradingMenu'}) && exists($ENV{'form.Status'})) {
+ $gradeTable.=''."\n";
+ } else {
+ $gradeTable.='Student Status: '.
+ &Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,'javascript:reLoadList(this.form);').' ';
+ }
- $gradeTable.='To '.lc($viewgrade).' a submission, click on the check box next to the student\'s name. Then '."\n".
- 'click on the '.$viewgrade.' button. To view the submissions for a group of students, click'."\n".
- ' on the check boxes for the group of students. '."\n".
+ $gradeTable.='To '.lc($viewgrade).' a submission or a group of submissions, click on the check box(es) '.
+ 'next to the student\'s name(s). Then click on the Next button. '."\n".
''."\n";
$gradeTable.=''."\n";
+ 'value="Next->" />'."\n";
my (undef, undef, $fullname) = &getclasslist($getsec,'1');
$gradeTable.='
'.
'
';
my $loop = 0;
while ($loop < 2) {
- $gradeTable.='