[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 21 Nov 2005 22:28:13 -0000
albertel Mon Nov 21 17:28:13 2005 EDT
Modified files:
/loncom/homework bridgetask.pm
Log:
- generalizing the add_to_queu
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.81 loncom/homework/bridgetask.pm:1.82
--- loncom/homework/bridgetask.pm:1.81 Mon Nov 21 16:51:29 2005
+++ loncom/homework/bridgetask.pm Mon Nov 21 17:28:13 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.81 2005/11/21 21:51:29 albertel Exp $
+# $Id: bridgetask.pm,v 1.82 2005/11/21 22:28:13 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -478,7 +478,7 @@
if ($status eq 'NEEDS_CHECKIN') {
if(&proctor_check_auth($slot_name,$slot,'Task')) {
my $result=&add_to_queue('gradingqueue',
- $Apache::inputtags::slot_name);
+ [$Apache::inputtags::slot_name]);
&Apache::lonxml::debug("add_to_queue said $result");
}
}
@@ -788,7 +788,7 @@
&Apache::lonhomework::showhash(%Apache::lonhomework::results);
&Apache::structuretags::finalize_storage();
if ($award eq 'SUBMITTED') {
- &add_to_queue('gradingqueue',$Apache::inputtags::slot_name);
+ &add_to_queue('gradingqueue',[$Apache::inputtags::slot_name]);
}
} elsif ($Apache::lonhomework::results{'INTERNAL_store'}) {
&Apache::structuretags::finalize_storage();
@@ -925,7 +925,7 @@
} else {
$cur_data = ['none'];
}
- my $result=&add_to_queue($dest_queue,$cur_data->[0]);
+ my $result=&add_to_queue($dest_queue,[$cur_data->[0]]);
if ($result ne 'ok') {
return $result;
}
@@ -1010,13 +1010,16 @@
}
sub add_to_queue {
- my ($queue,$slot_name)=@_;
+ my ($queue,$user_data)=@_;
if ($queue eq 'none') { return 'ok'; }
my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser();
+ if (!$cid || $env{'request.state'} eq 'construct') {
+ return 'no_queue';
+ }
my $cnum=$env{'course.'.$cid.'.num'};
my $cdom=$env{'course.'.$cid.'.domain'};
my %data;
- $data{"$symb\0queue\0$uname\@$udom"}=[$slot_name];
+ $data{"$symb\0queue\0$uname\@$udom"}=$user_data;
return &Apache::lonnet::newput($queue,\%data,$cdom,$cnum);
}