--- loncom/homework/bridgetask.pm 2005/05/27 21:13:46 1.33
+++ loncom/homework/bridgetask.pm 2005/05/31 16:31:01 1.35
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.33 2005/05/27 21:13:46 albertel Exp $
+# $Id: bridgetask.pm,v 1.35 2005/05/31 16:31:01 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -146,11 +146,17 @@ sub add_grading_button {
$result.='';
if ( 1) {
#need a permissions for limitng this to 'powerful users'
- #check if review queue has items
- $result.=' '."\n";
+
+ my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue');
+ $result.='
'.&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.=' '."\n";
+ &mt("Select an entry from the grading queue").'" />
'.&mt("Review Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks);
+ $result.='
'."\n";
}
return $result;
}
@@ -655,6 +661,8 @@ sub show_queue {
my ($symb,$uname,$udom) = &decode_queue_key($key);
my $title=&Apache::lonnet::gettitle($symb);
$result.="
";
+ my $slot=$queue{$key}->[0];
+ my %slot_data=&Apache::lonnet::get_slot($slot);
if ($with_selects) {
my $ekey=&Apache::lonnet::escape($key);
my ($action,$description)=('select',&mt('Select'));
@@ -666,7 +674,8 @@ sub show_queue {
($action,$description)=('unlock',&mt('Unlock'));
}
}
- $result.=(<
FORM
+
+ } else {
+ $result.='
'.&mt("In Progress").'
'
+ }
}
$result.="
$title
$uname
";
- my $slot=$queue{$key}->[0];
- my %slot_data=&Apache::lonnet::get_slot($slot);
$result.='
queue entry
Slot: '.$slot.' End time: '.
&Apache::lonlocal::locallocaltime($slot_data{'endtime'}).
"
";
@@ -691,6 +702,37 @@ FORM
return $result;
}
+sub get_queue_counts {
+ my ($queue)=@_;
+ my $result;
+ my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser();
+ my $cnum=$env{'course.'.$cid.'.num'};
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my $regexp="^$symb\0";
+ my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
+ my ($tmp)=%queue;
+ if ($tmp=~/^error: 2 /) {
+ return (0,0,0);
+ }
+ my ($entries,$ready_to_grade,$locks)=(0,0,0);
+ foreach my $key (sort(keys(%queue))) {
+ if ($key=~/locked$/) {
+ $locks++;
+ } elsif ($key=~/timestamp$/) {
+ #ignore
+ } elsif ($key!~/(timestamp|locked)$/) {
+ my ($symb,$uname,$udom) = &decode_queue_key($key);
+ $entries++;
+ my $slot=$queue{$key}->[0];
+ my %slot_data=&Apache::lonnet::get_slot($slot);
+ if (time > $slot_data{'endtime'}) {
+ $ready_to_grade++;
+ }
+ }
+ }
+ return ($entries,$ready_to_grade,$locks);
+}
+
sub decode_queue_key {
my ($key)=@_;
my ($symb,undef,$user) = split("\0",$key);