-
-Resource: $ENV{'form.url'} |
-Username | Name | Domain |
-View Problem | Submissions | Action |
+ View Submissions for a Student or a Group of Students
+ Resource: $ENV{'form.url'}
+
+ View Problem: no
+ yes
+ Submissions:
+ last sub only
+ last sub & parts info
+ all details
+
+
+
+
+
+
+ Select | Username |
+ Fullname | Domain |
+ Grade Status |
ENDTABLEST
- my (%classlist) = &getclasslist($cdom,$cnum,'0');
- foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
+ if ($ENV{'form.url'}) {
+ $request->print(''."\n");
+ }
+ if ($ENV{'form.symb'}) {
+ $request->print(''."\n");
+ }
+ $request->print(''."\n");
+
+ my ($classlist) = &getclasslist($getsec,'0');
+ foreach my $student ( sort(@{ $$classlist{$getsec} }) ) {
my ($sname,$sdom) = split(/:/,$student);
+ my ($type,$status) = &student_gradeStatus($ENV{'form.url'},$cdom,$sname);
+ next if ($status eq 'nothing' && $submitonly eq 'yes');
- my %name=&Apache::lonnet::get('environment', ['lastname','generation',
- 'firstname','middlename'],
- $sdom,$sname);
- my $fullname;
- my ($tmp) = keys(%name);
- if ($tmp !~ /^(con_lost|error|no_such_host)/i) {
- $fullname=$name{'lastname'}.$name{'generation'};
- if ($fullname =~ /[^\s]+/) { $fullname.=', '; }
- $fullname.=$name{'firstname'}.' '.$name{'middlename'};
- }
+ my $fullname = &get_fullname($sname,$sdom);
if ( $Apache::grades::viewgrades eq 'F' ) {
- $request->print("\n".''."$sname | $fullname | $sdom | ".
- ' ');
-# $request->print('');
+ $request->print("\n".''.
+ ' | '."\n".
+ ' '.$sname.' | '."\n".
+ ' '.$fullname.' | '."\n".
+ ' '.$sdom.' | '."\n");
+ $request->print(' '.$status.' | '."\n");
+
+ $request->print(' ');
}
}
$request->print('
| ');
+ $request->print('');
}
+sub processGroup {
+ my ($request) = shift;
+ my $ctr = 0;
+ my @stuchecked = (ref($ENV{'form.stuinfo'}) ? @{$ENV{'form.stuinfo'}}
+ : ($ENV{'form.stuinfo'}));
+ my $total = scalar(@stuchecked)-1;
+ if ($stuchecked[0] eq '') {
+ &userError($request,'No student was selected for viewing/grading.');
+ return;
+ }
+ foreach (@stuchecked) {
+ my ($sname,$sdom,$fullname) = split(/:/);
+ $ENV{'form.student'} = $sname;
+ $ENV{'form.fullname'} = $fullname;
+ &submission($request,$ctr,$total);
+ $ctr++;
+ }
+ return 'The End';
+}
+
+sub userError {
+ my ($request, $reason, $step) = @_;
+ $request->print('LON-CAPA User Error '."\n");
+ $request->print('Reason: '.$reason.'
'."\n");
+ $request->print('Step: '.($step ne '' ? $step : 'Use your browser back button to correct')
+ .'
'."\n");
+ return '';
+}
#FIXME - needs to handle multiple matches
sub finduser {
my ($name) = @_;
my $domain = '';
-
if ( $Apache::grades::viewgrades eq 'F' ) {
- #get classlist
- my ($cdom,$cnum) = split(/_/,$ENV{'request.course.id'});
- #print "Found $cdom:$cnum ";
- my (%classlist) = &getclasslist($cdom,$cnum,'0');
- foreach my $student ( sort(@{ $classlist{'allids'} }) ) {
- my ($posname,$posdomain) = split(/:/,$student);
+ my ($classlist) = &getclasslist('all','0');
+ foreach ( sort(@{ $$classlist{'all'} }) ) {
+ my ($posname,$posdomain) = split(/:/);
if ($posname =~ $name) { $name=$posname; $domain=$posdomain; last; }
}
return ($name,$domain);
@@ -200,20 +228,28 @@ sub finduser {
}
sub getclasslist {
- my ($coursedomain,$coursenum,$hideexpired) = @_;
+ my ($getsec,$hideexpired) = @_;
+ my ($coursedomain,$coursenum) = split(/_/,$ENV{'request.course.id'});
my %classlist=&Apache::lonnet::dump('classlist',$coursedomain,$coursenum);
my $now = time;
+ my (@holdsec,@sections);
foreach my $student (keys(%classlist)) {
my ($end,$start)=split(/:/,$classlist{$student});
# still a student?
if (($hideexpired) && ($end) && ($end < $now)) {
- #print "Skipping:$name:$end:$now \n";
next;
}
- #print "record=$record ";
- push( @{ $classlist{'allids'} }, $student);
+ my ($unam,$udom) = split(/:/,$student,2);
+ my $section = &Apache::lonnet::usection($udom,$unam,$ENV{'request.course.id'});
+ $section = ($section ne '-1' ? $section : 'no');
+ push @holdsec,$section;
+ push (@{ $classlist{$getsec} }, $student) if ($getsec eq 'all' || $getsec eq $section);
+ }
+ my %seen = ();
+ foreach my $item (@holdsec) {
+ push (@sections, $item) unless $seen{$item}++;
}
- return (%classlist);
+ return (\%classlist,\@sections);
}
sub getpartlist {
@@ -234,12 +270,8 @@ sub viewstudentgrade {
my $cellclr = '"#ffffdd"';
my ($username,$domain) = split(/:/,$student);
- my (@requests) = ('lastname','firstname','middlename','generation');
- my (%name) = &Apache::lonnet::get('environment',\@requests,$domain,$username);
+ my $fullname = &get_fullname($username,$domain);
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$username);
- my $fullname=$name{'lastname'}.$name{'generation'};
- if ($fullname =~ /[^\s]+/) { $fullname.=', '; }
- $fullname.=$name{'firstname'}.' '.$name{'middlename'};
$result.="$username | $fullname | $domain | \n";
foreach my $part (@parts) {
@@ -252,7 +284,7 @@ sub viewstudentgrade {
my ($status,$foo)=split(/_/,$score,2);
$result.=" | |