[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm grades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 01 Oct 2005 03:27:45 -0000
albertel Fri Sep 30 23:27:45 2005 EDT
Modified files:
/loncom/homework grades.pm bridgetask.pm
Log:
- add the ability to limit the display of the queues and the regrade list to a specfic secion or sections
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.290 loncom/homework/grades.pm:1.291
--- loncom/homework/grades.pm:1.290 Fri Sep 23 15:45:24 2005
+++ loncom/homework/grades.pm Fri Sep 30 23:27:44 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.290 2005/09/23 19:45:24 albertel Exp $
+# $Id: grades.pm,v 1.291 2005/10/01 03:27:44 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -334,7 +334,16 @@
#--- 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 @@
}
$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 {
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.58 loncom/homework/bridgetask.pm:1.59
--- loncom/homework/bridgetask.pm:1.58 Fri Sep 30 22:06:06 2005
+++ loncom/homework/bridgetask.pm Fri Sep 30 23:27:44 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.58 2005/10/01 02:06:06 albertel Exp $
+# $Id: bridgetask.pm,v 1.59 2005/10/01 03:27:44 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -144,11 +144,28 @@
}
sub add_grading_button {
+ my (undef,$cid)=&Apache::lonxml::whichuser();
+ my $cnum=$env{'course.'.$cid.'.num'};
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my %sections;
+ my $numsections=&Apache::loncommon::get_sections($cdom,$cnum,\%sections);
+ my $size=5;
+ if (scalar(keys(%sections)) < 3) {
+ $size=scalar(keys(%sections))+2;
+ }
+ my $sec_select = '<select multiple name="chosensections" size="'.$size.'">'."\n";
+ $sec_select .= "<option value='all' selected='selected'>all</option>\n";
+ foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) {
+ $sec_select .= "<option name=\"$sec\">$sec</option>\n";
+ }
+ $sec_select .= "<option value='none'>none</option></select>\n";
+
my $result=' <input type="submit" name="gradeasubmission" value="'.
&mt("Get a submission to grade").'" />';
$result.='<input type="hidden" name="grade_target" value="webgrade" />';
if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
+ $result.='<p>Specify a section: '.$sec_select.'</p>';
$result.='<p>'.&mt("Grading Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks);
$result.=' <input type="submit" name="reviewagrading" value="'.
@@ -482,12 +499,12 @@
if ($env{'form.stop'}) {
return (undef,'stop');
} elsif ($env{'form.next'}) {
- return (undef,'show_list');
+ return (undef,'select_user');
}
}
return ($gradingkey,'selected');
} else {
- return (undef,'show_list');
+ return (undef,'select_user');
}
}
if (defined($env{'form.queue'}) && defined($env{'form.gradingkey'})
@@ -862,6 +879,13 @@
my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser();
my $cnum=$env{'course.'.$cid.'.num'};
my $cdom=$env{'course.'.$cid.'.domain'};
+
+ my @chosen_sections=
+ &Apache::loncommon::get_env_multiple('form.chosensections');
+ &Apache::grades::init_perm();
+ my ($classlist,$section,$fullname)=&Apache::grades::getclasslist(\@chosen_sections,);
+ &Apache::grades::reset_perm();
+
my $regexp="^$symb\0";
my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
my ($tmp)=%queue;
@@ -872,8 +896,9 @@
if ($with_selects) { $result.="<th></th>"; }
$result.="<th>resource</th><th>user</th><th>type</th><th>data</th></tr>";
foreach my $key (sort(keys(%queue))) {
+ my ($symb,$uname,$udom) = &decode_queue_key($key);
+ if (!defined($classlist->{$uname.':'.$udom})) { next; }
if ($key=~/locked$/ && !$with_selects) {
- my ($symb,$uname,$udom) = &decode_queue_key($key);
my $title=&Apache::lonnet::gettitle($symb);
$result.="<tr><td>$title</td><td>$uname</td>";
$result.='<td>lock</td><td>'.$queue{$key}.'</td></tr>';
@@ -884,7 +909,6 @@
$result.='<td>last queue modification time</td><td>'.
&Apache::lonlocal::locallocaltime($queue{$key})."</td></tr>";
} elsif ($key!~/(timestamp|locked)$/) {
- my ($symb,$uname,$udom) = &decode_queue_key($key);
my $title=&Apache::lonnet::gettitle($symb);
$result.="<tr>";
my $slot=$queue{$key}->[0];
@@ -1116,12 +1140,15 @@
my ($symb,$cid)=&Apache::lonxml::whichuser();
my $result.='<table border="1">';
+ my @chosen_sections=
+ &Apache::loncommon::get_env_multiple('form.chosensections');
&Apache::grades::init_perm();
- my ($classlist,$section,$fullname)=&Apache::grades::getclasslist('all',);
+ my ($classlist,$section,$fullname)=&Apache::grades::getclasslist(\@chosen_sections,);
&Apache::grades::reset_perm();
foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
my ($uname,$udom) = split(/:/,$student);
+
my %status = &get_student_status($symb,$cid,$udom,$uname);
my $queue = 'none';
my $cannot_grade;