');
+ $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;
+ foreach my $student (@stuchecked) {
+ my ($sname,$sdom,$fullname) = split(/:/,$student);
+ $ENV{'form.student'} = $sname;
+ $ENV{'form.fullname'} = $fullname;
+ &submission($request,$ctr,$total);
+ $ctr++;
+ }
+
+ return 'The End';
+}
#FIXME - needs to handle multiple matches
sub finduser {
@@ -206,10 +201,10 @@ sub finduser {
if ( $Apache::grades::viewgrades eq 'F' ) {
#get classlist
- my ($cdom,$cnum) = split(/_/,$ENV{'request.course.id'});
+# 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 ($classlist) = &getclasslist('all','0');
+ foreach my $student ( sort(@{ $$classlist{'all'} }) ) {
my ($posname,$posdomain) = split(/:/,$student);
if ($posname =~ $name) { $name=$posname; $domain=$posdomain; last; }
}
@@ -220,20 +215,27 @@ 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'});
+ push @holdsec,$section;
+ push (@{ $classlist{$getsec} }, $student) if ($getsec eq 'all' or $getsec == $section);
+ }
+ my %seen = ();
+ foreach my $item (@holdsec) {
+ push (@sections, $item) unless $seen{$item}++;
}
- return (%classlist);
+ return (\%classlist,\@sections);
}
sub getpartlist {
@@ -254,14 +256,9 @@ 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) {
my ($temp,$part,$type)=split(/_/,$part);
@@ -288,7 +285,7 @@ sub viewstudentgrade {
#interface based on that, also do that to above function.
sub setstudentgrade {
my ($url,$symb,$courseid,$student,@parts) = @_;
-
+ print "set student grade parts=@parts ";
my $result ='';
my ($stuname,$domain) = split(/:/,$student);
my %record=&Apache::lonnet::restore($symb,$courseid,$domain,$stuname);
@@ -309,10 +306,11 @@ sub setstudentgrade {
} elsif ($oldscore !~ m/^$newscore/) {
$update=1;
$result.="Updating $stuname to $newscore \n";
- if ($newscore eq 'correct') { $newscore = 'correct_by_override'; }
+ if ($newscore eq 'correct') { $newscore = 'correct_by_override'; }
if ($newscore eq 'incorrect') { $newscore = 'incorrect_by_override'; }
- if ($newscore eq 'excused') { $newscore = 'excused'; }
- if ($newscore eq 'ungraded') { $newscore = 'ungraded_attempted'; }
+ if ($newscore eq 'excused') { $newscore = 'excused'; }
+ if ($newscore eq 'ungraded') { $newscore = 'ungraded_attempted'; }
+ if ($newscore eq 'partial') { $newscore = 'correct_partially_by_override'; }
} else {
#$result.="$stuname:$part:$type:unchanged $oldscore to $newscore: \n";
}
@@ -332,7 +330,7 @@ sub setstudentgrade {
while (my ($k,$v) = each %newrecord) {
print "k=$k:v=$v: \n";
}
- &Apache::lonnet::cstore(\%newrecord,$symb,$courseid,$domain,$stuname);
+# &Apache::lonnet::cstore(\%newrecord,$symb,$courseid,$domain,$stuname);
$result.="Stored away ".scalar(keys(%newrecord))." elements. \n";
}
@@ -342,9 +340,10 @@ sub setstudentgrade {
#
# --------------------------- show submissions of a student, option to grade --------
sub submission {
- my ($request) = @_;
+ my ($request,$counter,$total) = @_;
- $request->print(<print(<
function updateRadio(radioButton,formtextbox,formsel,wgt) {
var pts = formtextbox.value;
@@ -393,125 +392,158 @@ sub submission {
JAVASCRIPT
+}
(my $url=$ENV{'form.url'})=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
if ($ENV{'form.student'} eq '') { &moreinfo($request,"Need student login id"); return ''; }
- print "formstu=$ENV{'form.student'}: ";
my ($uname,$udom) = &finduser($ENV{'form.student'});
if ($uname eq '') { &moreinfo($request,"Unable to find student"); return ''; }
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
+ my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
#
# header info
- my $result='
Submission Record
';
- $result.='
Username: '.$uname.
- '
Fullname: '.$ENV{'form.fullname'}.'
Domain: '.$udom.'
';
- $result.='
Resource: '.$url.'
';
+ if ($counter == 0) {
+ $request->print('
Submission Record
');
+ }
+
#
-# option to display problem
- if ($ENV{'form.vProb'} eq 'yes') {
+# option to display problem, only once else it cause problems with the form later since the problem has a form.
+ if ($ENV{'form.vProb'} eq 'yes' && $counter == 0) {
my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
$ENV{'request.course.id'});
my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
$ENV{'request.course.id'});
- $result.='