'."\n".
''.
- 'Fullname | Username | Domain | '."\n";
+ 'Fullname (Username) | '."\n";
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
@@ -1835,7 +1994,8 @@ sub viewgrades {
my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1');
my $ctr = 0;
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
- my ($uname,$udom) = split(/:/);
+ my $uname = $_;
+ $uname=~s/:/_/;
$result.=''."\n";
$result.=&viewstudentgrade($url,$symb,$ENV{'request.course.id'},
$_,$$fullname{$_},\@parts,\%weight);
@@ -1845,6 +2005,10 @@ sub viewgrades {
$result.=''."\n";
$result.=''."\n";
+ if (scalar(%$fullname) eq 0) {
+ my $colspan=3+scalar(@parts);
+ $result='There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.Status'}.'" to modify or grade.';
+ }
$result.=&show_grading_menu_form($symb,$url);
return $result;
}
@@ -1853,30 +2017,31 @@ sub viewgrades {
sub viewstudentgrade {
my ($url,$symb,$courseid,$student,$fullname,$parts,$weight) = @_;
my ($uname,$udom) = split(/:/,$student);
+ $student=~s/:/_/;
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my $result=' '.
''.$fullname.''.
- ' | '.$uname.' | '.$udom.' | '."\n";
+ '\')"; TARGET=_self>'.$fullname.' '.
+ '('.$uname.($ENV{'user.domain'} eq $udom ? '' : ':'.$udom).')'."\n";
foreach my $apart (@$parts) {
my ($part,$type) = &split_part_type($apart);
my $score=$record{"resource.$part.$type"};
if ($type eq 'awarded') {
my $pts = $score eq '' ? '' : $score*$$weight{$part};
$result.=''."\n";
+ 'GD_'.$student.'_'.$part.'_awarded_s" value="'.$pts.'" />'."\n";
$result.=' | '."\n";
} elsif ($type eq 'solved') {
my ($status,$foo)=split(/_/,$score,2);
$status = 'nothing' if ($status eq '');
- $result.=''."\n";
$result.=' | \n";
} else {
$result.=''.
+ 'GD_'.$student.'_'.$part.'_'.$type.'_s" value="'.$score.'" />'.
"\n";
$result.=' | '."\n";
}
}
@@ -1907,7 +2072,7 @@ sub editgrades {
$title.='Section: '.$ENV{'form.section'}.''."\n";
my $result= ''."\n";
$result.= ''.
- 'Username | Fullname | '."\n";
+ 'Username | Domain | Fullname | '."\n";
my %scoreptr = (
'correct' =>'correct_by_override',
@@ -1955,16 +2120,24 @@ sub editgrades {
$result .= ' ';
$result .= $header;
$result .= ' '."\n";
-
+ my $noupdate;
for ($i=0; $i<$ENV{'form.total'}; $i++) {
+ my $line;
my $user = $ENV{'form.ctr'.$i};
+ my $usercolon = $user;
+ $usercolon =~s/_/:/;
+ my ($uname,$udom)=split(/_/,$user);
my %newrecord;
my $updateflag = 0;
- my @userdom = grep /^$user:/,keys %$classlist;
- my (undef,$udom) = split(/:/,$userdom[0]);
-
- $result .= ''.$user.' | '.
- $$fullname{$userdom[0]}.' | ';
+ $line .= ' '.$uname.' | '.
+ $udom.' | '.
+ $$fullname{$usercolon}.' | ';
+ my $usec=$classlist->{"$uname:$udom"}[5];
+ if (!&canmodify($usec)) {
+ my $numcols=scalar(@partid)*(scalar(@parts)-1)*2;
+ $noupdate.=$line."Not allowed to modify student | ";
+ next;
+ }
foreach (@partid) {
my $old_aw = $ENV{'form.GD_'.$user.'_'.$_.'_awarded_s'};
my $old_part_pcr = $old_aw/($weight{$_} ne '0' ? $weight{$_}:1);
@@ -1984,7 +2157,7 @@ sub editgrades {
}
$score = 'excused' if (($ENV{'form.GD_'.$user.'_'.$_.'_solved'} eq 'excused') &&
($score ne 'excused'));
- $result .= ''.$old_aw.' | '.
+ $line .= ''.$old_aw.' | '.
''.$awarded.
($score eq 'excused' ? $score : '').' | ';
@@ -2007,17 +2180,24 @@ sub editgrades {
$newrecord{'resource.'.$part.'regrader'}="$ENV{'user.name'}:$ENV{'user.domain'}";
$updateflag=1;
}
- $result .= ''.$old_aw.' | '.
+ $line .= ''.$old_aw.' | '.
''.$awarded.' | ';
}
}
- $result .= ''."\n";
+ $line.=''."\n";
if ($updateflag) {
$count++;
&Apache::lonnet::cstore(\%newrecord,$symb,$ENV{'request.course.id'},
- $udom,$user);
+ $udom,$uname);
+ $result.=$line;
+ } else {
+ $noupdate.=$line;
}
}
+ if ($noupdate) {
+ my $numcols=(scalar(@partid)*(scalar(@parts)-1)*2)+3;
+ $result .= 'No Changes Occured For the Students Below | '.$noupdate;
+ }
$result .= '
| '."\n".
&show_grading_menu_form ($symb,$url);
my $msg = 'Number of records updated = '.$rec_update.
@@ -2158,10 +2338,7 @@ to this page if the data selected is ins
value="$ENV{'form.upfile_associate'}" />
-
-
-
-
+
@@ -2199,6 +2376,48 @@ sub csvuploadmap_footer {
ENDPICK
}
+sub upcsvScores_form {
+ my ($request) = shift;
+ my ($symb,$url)=&get_symb_and_url($request);
+ if (!$symb) {return '';}
+ my $result =<
+ function checkUpload(formname) {
+ if (formname.upfile.value == "") {
+ alert("Please use the browse button to select a file from your local directory.");
+ return false;
+ }
+ formname.submit();
+ }
+
+CSVFORMJS
+ $ENV{'form.probTitle'} = &Apache::lonnet::gettitle($symb);
+ $result.='
'."\n";
+ $result.=''."\n";
+ $result.=' |
'."\n";
+ $result.=&show_grading_menu_form($symb,$url);
+
+ return $result;
+}
+
+
sub csvuploadmap {
my ($request)= @_;
my ($symb,$url)=&get_symb_and_url($request);
@@ -2258,7 +2477,8 @@ sub csvuploadassign {
}
$request->print('Assigning Grades');
my $courseid=$ENV{'request.course.id'};
- my ($classlist) = &getclasslist('all','1');
+ my ($classlist) = &getclasslist('all',0);
+ my @notallowed;
my @skipped;
my $countdone=0;
foreach my $grade (@gradedata) {
@@ -2269,6 +2489,11 @@ sub csvuploadassign {
push(@skipped,"$username:$domain");
next;
}
+ my $usec=$classlist->{"$username:$domain"}[5];
+ if (!&canmodify($usec)) {
+ push(@notallowed,"$username:$domain");
+ next;
+ }
my %grades;
foreach my $dest (keys(%fields)) {
if ($dest eq 'username' || $dest eq 'domain') { next; }
@@ -2287,10 +2512,14 @@ sub csvuploadassign {
}
$request->print(" Stored $countdone students\n");
if (@skipped) {
- $request->print(' Skipped Students ');
- foreach my $student (@skipped) { $request->print(" $student"); }
+ $request->print('Skipped Students ');
+ foreach my $student (@skipped) { $request->print("$student \n"); }
}
- $request->print(&view_edit_entire_class_form($symb,$url));
+ if (@notallowed) {
+ $request->print('Students Not Allowed to Modify ');
+ foreach my $student (@notallowed) { $request->print("$student \n"); }
+ }
+ $request->print(" \n");
$request->print(&show_grading_menu_form($symb,$url));
return '';
}
@@ -2355,7 +2584,7 @@ LISTJAVASCRIPT
my $result=' '.
'Manual Grading by Page or Sequence';
- $result.=' ';
- my ($depth,$ctr,$question) = (1,0,1);
+ my ($depth,$question) = (1,1);
$iterator->next(); # skip the first BEGIN_MAP
my $curRes = $iterator->next(); # for "current resource"
- while ($depth > 0 && $ctr < 100) { # ctr, just in case it never gets out of loop
+ while ($depth > 0) {
if($curRes == $iterator->BEGIN_MAP) { $depth++; }
- if($curRes == $iterator->END_MAP) { $depth++; }
+ if($curRes == $iterator->END_MAP) { $depth--; }
if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) {
my $parts = $curRes->parts();
- $parts = &temp_parts_fix($parts); # remove line when lonnavmap is fixed
my $title = $curRes->compTitle();
my $symbx = $curRes->symb();
$studentTable.=''.$question.
@@ -2560,8 +2785,8 @@ sub displayPage {
} else {
my $companswer = &Apache::loncommon::get_student_answers(
$symbx,$uname,$udom,$ENV{'request.course.id'});
- $companswer=~s|||g;
+ $companswer =~ s|||g;
# while ($companswer =~ /()/s) { #Part: '.$partid.' Submission: '
- .$record{$version.':'.$matchKey[0]}.' ' : '';
+ 'Part '.$partid.' '.
+ ($record{"$version:resource.$partid.tries"} eq '' ? 'Trial not counted' :
+ 'Trial '.$record{"$version:resource.$partid.tries"}).' '.
+ $record{$version.':'.$matchKey[0]}.' ' : '';
$displaySub[1].=(exists $record{"$version:resource.$partid.award"}) ?
- 'Part: '.$partid.' '.
+ 'Part '.$partid.' '.
$record{"$version:resource.$partid.award"}.'/'.
$record{"$version:resource.$partid.solved"}.' ' : '';
$displaySub[2].=(exists $record{"$version:resource.$partid.regrader"}) ?
@@ -2616,19 +2844,21 @@ sub displayPage {
'','.submission');
}
-
- foreach my $partid (@{$parts}) {
- $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
- $studentTable.=''."\n";
- $question++;
+ if (&canmodify($usec)) {
+ foreach my $partid (@{$parts}) {
+ $studentTable.=&gradeBox($request,$symbx,$uname,$udom,$question,$partid,\%record);
+ $studentTable.=''."\n";
+ $question++;
+ }
}
$studentTable.=' | ';
- }
+ }
$curRes = $iterator->next();
- $ctr++;
}
+ $navmap->untieHashes();
+
$studentTable.='
|