--- loncom/homework/grades.pm 2005/09/20 06:45:02 1.285
+++ loncom/homework/grades.pm 2005/11/22 19:31:43 1.297
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.285 2005/09/20 06:45:02 albertel Exp $
+# $Id: grades.pm,v 1.297 2005/11/22 19:31:43 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -334,7 +334,16 @@ COMMONJSFUNCTIONS
#--- section, ids and fullnames for each user.
sub getclasslist {
my ($getsec,$filterlist) = @_;
- $getsec = $getsec eq '' ? 'all' : $getsec;
+ my @getsec;
+ if (!ref($getsec)) {
+ if ($getsec ne '' && $getsec ne 'all') {
+ @getsec=($getsec);
+ }
+ } else {
+ @getsec=@{$getsec};
+ }
+ if (grep(/^all$/,@getsec)) { undef(@getsec); }
+
my $classlist=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
return if (! defined($classlist));
@@ -363,7 +372,7 @@ sub getclasslist {
}
$section = ($section ne '' ? $section : 'none');
if (&canview($section)) {
- if ($getsec eq 'all' || $getsec eq $section) {
+ if (!@getsec || grep(/^\Q$section\E$/,@getsec)) {
$sections{$section}++;
$fullnames{$student}=$fullname;
} else {
@@ -536,7 +545,13 @@ sub verifyreceipt {
if ($env{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; }
my $parts=['0'];
if ($receiptparts) { ($parts)=&response_type($url,$symb); }
- foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+ foreach (sort
+ {
+ if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+ return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+ }
+ return $a cmp $b;
+ } (keys(%$fullname))) {
my ($uname,$udom)=split(/\:/);
foreach my $part (@$parts) {
if ($receipt eq &Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb,$part)) {
@@ -702,7 +717,14 @@ LISTJAVASCRIPT
$gradeTable.=''."\n";
my $ctr = 0;
- foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+ foreach my $student (sort
+ {
+ if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+ return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+ }
+ return $a cmp $b;
+ }
+ (keys(%$fullname))) {
my ($uname,$udom) = split(/:/,$student);
my %status = ();
if ($env{'form.showgrading'} eq 'yes' && $submitonly ne 'all') {
@@ -1370,10 +1392,10 @@ sub gradeBox {
my $ctr = 0;
$result.='
'."\n"; # display radio buttons in a nice table 10 across
while ($ctr<=$wgt) {
- $result.= ' | \n";
+ ($score eq $ctr ? 'checked':'').' /> '.$ctr."\n";
$result.=(($ctr+1)%10 == 0 ? '
' : '');
$ctr++;
}
@@ -1829,6 +1851,14 @@ KEYWORDS
if ($env{'form.handgrade'} eq 'yes');
$request->print($result);
}
+ if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
+ $request->print('
'.
+ &Apache::loncommon::track_student_link(&mt('View recent activity'),$uname,$udom,'check'));
+ }
+ if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
+ $request->print('
'.
+ &Apache::loncommon::pprmlink(&mt('Set/Change parameters'),$uname,$udom,$symb,'check'));
+ }
my %seen = ();
my @partlist;
@@ -1945,6 +1975,7 @@ sub processHandGrade {
my ($subject,$message,$msgstatus) = ('','','');
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
$subject = $env{'form.msgsub'} if ($includemsg =~ /^msgsub/);
+ unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); }
my (@msgnum) = split(/,/,$includemsg);
foreach (@msgnum) {
$message.=$env{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne '');
@@ -1955,7 +1986,10 @@ sub processHandGrade {
&Apache::lonnet::clutter($url).
"?symb=$symb\">$env{'form.probTitle'}";
$msgstatus = &Apache::lonmsg::user_normal_msg ($uname,$udom,
- $env{'form.msgsub'},$message);
+ $env{'form.msgsub'}.' ['.
+ &Apache::lonnet::declutter($url).']',$message);
+ $request->print('
'.&mt('Sending message to [_1]@[_2]',$uname,$udom).': '.
+ $msgstatus);
}
if ($env{'form.collaborator'.$ctr}) {
my @collabstrs=&Apache::loncommon::get_env_multiple("form.collaborator$ctr");
@@ -2064,7 +2098,13 @@ sub processHandGrade {
my (@parsedlist,@nextlist);
my ($nextflg) = 0;
- foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+ foreach (sort
+ {
+ if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+ return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+ }
+ return $a cmp $b;
+ } (keys(%$fullname))) {
if ($nextflg == 1 && $button =~ /Next$/) {
push @parsedlist,$_;
}
@@ -2332,7 +2372,7 @@ sub version_portfiles {
} else {
my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,'copy',
'/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
- push(@v_portfiles, $answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
+ push(@v_portfiles, $directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]);
&Apache::lonnet::mark_as_readonly($domain,$stuname,
['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]],
[$symb,$env{'request.course.id'},'graded']);
@@ -2394,6 +2434,7 @@ sub viewgrades_js {
}
for (i=0;i';
my $ctr = 0;
while ($ctr<=$weight{$partid}) { # display radio buttons in a nice table 10 across
- $result.= ' | \n";
+ ','.$ctr.')" />'.$ctr."\n";
$result.=(($ctr+1)%10 == 0 ? '
' : '');
$ctr++;
}
@@ -2638,7 +2682,13 @@ sub viewgrades {
#list all the students - with points and grade status
my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1');
my $ctr = 0;
- foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+ foreach (sort
+ {
+ if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+ return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+ }
+ return $a cmp $b;
+ } (keys(%$fullname))) {
$ctr++;
$result.=&viewstudentgrade($url,$symb,$env{'request.course.id'},
$_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets);
@@ -2822,13 +2872,14 @@ sub editgrades {
my $dropMenu = $env{'form.GD_'.$user.'_'.$_.'_solved'};
$score = 'excused' if (($dropMenu eq 'excused') && ($score ne 'excused'));
+ $newrecord{'resource.'.$_.'.regrader'}=
+ "$env{'user.name'}:$env{'user.domain'}";
if ($dropMenu eq 'reset status' &&
$old_score ne '') { # ignore if no previous attempts => nothing to reset
$newrecord{'resource.'.$_.'.tries'} = 0;
$newrecord{'resource.'.$_.'.solved'} = '';
$newrecord{'resource.'.$_.'.award'} = '';
$newrecord{'resource.'.$_.'.awarded'} = 0;
- $newrecord{'resource.'.$_.'.regrader'}="$env{'user.name'}:$env{'user.domain'}";
$updateflag = 1;
if ($env{'form.GD_'.$user.'_'.$_.'_aggtries'} > 0) {
my $aggtries = $env{'form.GD_'.$user.'_'.$_.'_aggtries'};
@@ -3162,7 +3213,6 @@ sub csvuploadoptions {
\n");
+ $request->print('
+
'."\n");
$request->print(&show_grading_menu_form($symb,$url));
return '';
}
@@ -3365,13 +3416,13 @@ LISTJAVASCRIPT
$result.=''."\n".
''."\n";
- $result.=' View Problems Text: no '."\n".
- ' yes '."
\n";
+ $result.=' View Problems Text: '."\n".
+ ''."
\n";
$result.=' Submission Details: '.
- ' none'."\n".
- ' by dates and submissions'."\n".
- ' all details'."\n";
+ ''."\n".
+ ''."\n".
+ ''."\n";
$result.=''."\n".
''."\n".
@@ -3395,12 +3446,18 @@ LISTJAVASCRIPT
my (undef,undef,$fullname) = &getclasslist($getsec,'1');
my $ptr = 1;
- foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
+ foreach my $student (sort
+ {
+ if (lc($$fullname{$a}) ne lc($$fullname{$b})) {
+ return (lc($$fullname{$a}) cmp lc($$fullname{$b}));
+ }
+ return $a cmp $b;
+ } (keys(%$fullname))) {
my ($uname,$udom) = split(/:/,$student);
$studentTable.=($ptr%2 == 1 ? '
' : '');
$studentTable.=''.$ptr.' | ';
- $studentTable.=' '
- .&nameUserString(undef,$$fullname{$student},$uname,$udom)."\n";
+ $studentTable.=' | \n";
$studentTable.=($ptr%2 == 0 ? ' |
' : '');
$ptr++;
}
@@ -3472,7 +3529,11 @@ sub displayPage {
my $navmap = Apache::lonnavmaps::navmap->new();
my ($mapUrl, $id, $resUrl)=&Apache::lonnet::decode_symb($env{'form.page'});
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
-
+ if (!$map) {
+ $request->print('Unable to view requested sequence. ('.$resUrl.')');
+ $request->print(&show_grading_menu_form($symb,$url));
+ return;
+ }
my $iterator = $navmap->getIterator($map->map_start(),
$map->map_finish());
@@ -3678,7 +3739,12 @@ sub updateGradeByPage {
my $navmap = Apache::lonnavmaps::navmap->new();
my ($mapUrl, $id, $resUrl) = &Apache::lonnet::decode_symb( $env{'form.page'});
my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps
-
+ if (!$map) {
+ $request->print('Unable to grade requested sequence. ('.$resUrl.')');
+ my ($symb,$url)=&get_symb_and_url($request);
+ $request->print(&show_grading_menu_form($symb,$url));
+ return;
+ }
my $iterator = $navmap->getIterator($map->map_start(),
$map->map_finish());
@@ -4018,7 +4084,7 @@ SCANTRONFORM
-
+
|
@@ -4324,7 +4390,7 @@ sub scantron_process_corrections {
}
}
if ($err) {
- $r->print("Unable to accept last correction, an error occurred :$errmsg:");
+ $r->print("Unable to accept last correction, an error occurred :$errmsg:");
} else {
&scantron_put_line($scanlines,$scan_data,$which,$line,$skip);
&scantron_putfile($scanlines,$scan_data);
@@ -5390,10 +5456,10 @@ GRADINGMENUJS
$result.='';
- $result.=''.
+ $result.=' |
|
'."\n";
$result.=''.
- ' '.
- 'Current Resource: For all students in selected section or course |
'."\n";
+ 'Current Resource: For all students in selected section or course'."\n";
$result.=''.
- ' '.
- 'The complete set/page/sequence: For one student |
'."\n";
+ 'The complete set/page/sequence: For one student'."\n";
$result.=' '.
''.
|