[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 22 Nov 2005 20:01:14 -0000
albertel Tue Nov 22 15:01:14 2005 EDT
Modified files:
/loncom/homework bridgetask.pm
Log:
- adding get_users_in_queue
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.84 loncom/homework/bridgetask.pm:1.85
--- loncom/homework/bridgetask.pm:1.84 Mon Nov 21 18:00:19 2005
+++ loncom/homework/bridgetask.pm Tue Nov 22 15:01:12 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.84 2005/11/21 23:00:19 albertel Exp $
+# $Id: bridgetask.pm,v 1.85 2005/11/22 20:01:12 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1236,6 +1236,27 @@
return 0;
}
+sub get_users_in_queue {
+ my ($queue,$symb,$cdom,$cnum) = @_;
+ if (!defined($cdom) || !defined($cnum)) {
+ my (undef,$cid)=&Apache::lonxml::whichuser();
+ $cnum=$env{'course.'.$cid.'.num'};
+ $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; }
+ my @users;
+ foreach my $key (sort(keys(%queue))) {
+ next if ($key=~/locked$/);
+ next if ($key=~/timestamp$/);
+ my ($symb,$uname,$udom) = &decode_queue_key($key);
+ push(@users,"$uname:$udom");
+ }
+ return @users;
+}
+
sub get_from_queue {
my ($queue)=@_;
my $result;