--- loncom/homework/grades.pm 2004/05/06 06:49:48 1.195
+++ loncom/homework/grades.pm 2004/07/27 15:16:10 1.204.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.195 2004/05/06 06:49:48 albertel Exp $
+# $Id: grades.pm,v 1.204.2.1 2004/07/27 15:16:10 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1084,7 +1084,7 @@ sub sub_page_kw_js {
var ypos = (screen.height-height)/2-30;
ypos = (ypos < 0) ? '0' : ypos;
- pWin = window.open('', 'MessageCenter', 'toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height);
+ pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=600,height='+height);
pWin.focus();
pDoc = pWin.document;
pDoc.open('text/html','replace');
@@ -1215,7 +1215,7 @@ sub sub_page_kw_js {
var ypos = (screen.height-330)/2-30;
ypos = (ypos < 0) ? '0' : ypos;
- hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos);
+ hwdWin = window.open('', 'KeywordHighlightCentral', 'resizeable=yes,toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos);
hwdWin.focus();
var hDoc = hwdWin.document;
hDoc.open('text/html','replace');
@@ -1669,7 +1669,9 @@ KEYWORDS
$partid.' ( ID '.$respid.
' ) ';
if ($record{"resource.$partid.$respid.uploadedurl"}) {
- $lastsubonly.=' File uploaded by student Like all files provided by users, this file may contain virusses ';
+ &Apache::lonnet::allowuploaded('/adm/grades',
+ $record{"resource.$partid.$respid.uploadedurl"});
+ $lastsubonly.=' File uploaded by student Like all files provided by users, this file may contain virusses ';
}
$lastsubonly.='Submitted Answer: '.
&cleanRecord($subval,$responsetype,$symb,$partid,
@@ -2049,11 +2051,11 @@ sub saveHandGrade {
}
} elsif ($dropMenu eq 'reset status'
&& exists($record{'resource.'.$_.'.solved'})) { #don't bother if no old records -> no attempts
- $newrecord{'resource.'.$_.'.tries'} = 0;
- $newrecord{'resource.'.$_.'.solved'} = '';
- $newrecord{'resource.'.$_.'.award'} = '';
- $newrecord{'resource.'.$_.'.awarded'} = 0;
- $newrecord{'resource.'.$_.'.regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
+ foreach my $key (keys (%record)) {
+ if ($key=~/^resource\.\Q$_\E\./) { $newrecord{$key} = ''; }
+ }
+ $newrecord{'resource.'.$_.'.regrader'}=
+ "$ENV{'user.name'}:$ENV{'user.domain'}";
} elsif ($dropMenu eq '') {
$pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
$ENV{'form.GD_BOX'.$newflg.'_'.$_} :
@@ -2596,7 +2598,7 @@ sub editgrades {
if ($noupdate) {
# my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
my $numcols=scalar(@partid)*4+2;
- $result .= '
No Changes Occurred For the Students Below '.$noupdate;
+ $result .= 'No Changes Occurred For the Students Below '.$noupdate;
}
$result .= ' '."\n".
&show_grading_menu_form ($symb,$url);
@@ -3108,7 +3110,7 @@ sub displayPage {
' Prob. '.
' '.($ENV{'form.vProb'} eq 'no' ? 'Title' : 'Problem Text').'/Grade ';
- my ($depth,$question) = (1,1);
+ my ($depth,$question,$prob) = (1,1,1);
$iterator->next(); # skip the first BEGIN_MAP
my $curRes = $iterator->next(); # for "current resource"
while ($depth > 0) {
@@ -3119,7 +3121,7 @@ sub displayPage {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- $studentTable.=''.$question.
+ $studentTable.=' '.$prob.
(scalar(@{$parts}) == 1 ? '' : ' ('.scalar(@{$parts}).' parts)').' ';
$studentTable.='';
if ($ENV{'form.vProb'} eq 'yes' ) {
@@ -3169,6 +3171,7 @@ sub displayPage {
$studentTable.=' '."\n";
$question++;
}
+ $prob++;
}
$studentTable.=' ';
@@ -3211,7 +3214,8 @@ sub displaySubByDates {
my @matchKey = sort(grep /^resource\.\Q$partid\E\..*?\.submission$/,@versionKeys);
# next if ($$record{"$version:resource.$partid.solved"} eq '');
foreach my $matchKey (@matchKey) {
- if (exists $$record{$version.':'.$matchKey}) {
+ if (exists($$record{$version.':'.$matchKey}) &&
+ $$record{$version.':'.$matchKey} ne '') {
my ($responseId)=($matchKey=~ /^resource\.\Q$partid\E\.(.*?)\.submission$/);
$displaySub[0].='Part '.$partid.' ';
$displaySub[0].='(ID '.
@@ -3295,7 +3299,7 @@ sub updateGradeByPage {
$iterator->next(); # skip the first BEGIN_MAP
my $curRes = $iterator->next(); # for "current resource"
- my ($depth,$question,$changeflag)= (1,1,0);
+ my ($depth,$question,$prob,$changeflag)= (1,1,1,0);
while ($depth > 0) {
if($curRes == $iterator->BEGIN_MAP) { $depth++; }
if($curRes == $iterator->END_MAP) { $depth--; }
@@ -3304,7 +3308,7 @@ sub updateGradeByPage {
my $parts = $curRes->parts();
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
- $studentTable.=''.$question.
+ $studentTable.=' '.$prob.
(scalar(@{$parts}) == 1 ? '' : ' ('.scalar(@{$parts}).' parts)').' ';
$studentTable.=' '.$title.' ';
@@ -3365,6 +3369,7 @@ sub updateGradeByPage {
''.$displayPts[1].' '.
' ';
+ $prob++;
}
$curRes = $iterator->next();
}
@@ -3415,18 +3420,25 @@ sub getSequenceDropDown {
return $result;
}
-sub scantron_uploads {
- if (!-e $Apache::lonnet::perlvar{'lonScansDir'}) { return ''};
- my $result= '';
+sub scantron_filenames {
my $cdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
my $cname=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname,
&Apache::loncommon::propath($cdom,$cname));
- $result.=" ";
- foreach my $filename (@files) {
+ my @possiblenames;
+ foreach my $filename (sort(@files)) {
($filename)=split(/&/,$filename);
if ($filename!~/^scantron_orig_/) { next ; }
$filename=~s/^scantron_orig_//;
+ push(@possiblenames,$filename);
+ }
+ return @possiblenames;
+}
+
+sub scantron_uploads {
+ my $result= '';
+ $result.=" ";
+ foreach my $filename (sort(&scantron_filenames())) {
$result.="$filename \n";
}
$result.=" ";
@@ -3452,7 +3464,7 @@ sub scantron_CODElist {
my $cnum = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
my @names=&Apache::lonnet::getkeys('CODEs',$cdom,$cnum);
my $namechoice=' ';
- foreach my $name (@names) {
+ foreach my $name (sort(@names)) {
if ($name =~ /^error: 2 /) { next; }
$namechoice.=''.$name.' ';
}
@@ -3491,7 +3503,7 @@ sub scantron_selectphase {
+STUFF
+ $r->print(" ".&show_grading_menu_form($symb,$url)."