--- loncom/homework/bridgetask.pm 2005/05/31 21:11:56 1.36
+++ loncom/homework/bridgetask.pm 2005/08/15 19:41:16 1.41
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.36 2005/05/31 21:11:56 albertel Exp $
+# $Id: bridgetask.pm,v 1.41 2005/08/15 19:41:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,6 +36,7 @@ use Apache::File();
use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
+use Apache::slotrequest();
use Time::HiRes qw( gettimeofday tv_interval );
BEGIN {
@@ -146,8 +147,8 @@ sub add_grading_button {
my $result=' ';
$result.='';
- if ( 1) {
- #need a permissions for limitng this to 'powerful users'
+ if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ # FIXME need a permission for limiting this to 'powerful users'
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);
@@ -164,14 +165,29 @@ sub add_grading_button {
}
sub add_request_another_attempt_button {
+ my ($text)=@_;
+ if (!$text) { $text="Request another attempt"; }
my $result;
my $symb=&Apache::lonnet::symbread();
+ my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb);
+ my $action='get_reservation';
+ if ($slot_name) {
+ $text="Change reservation.";
+ $action='change_reservation';
+ my $description=&Apache::slotrequest::get_description($slot_name,
+ $slot);
+ $result.=(< Will be next available: $description
+STUFF
+ }
+
if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); }
$symb=&Apache::lonnet::escape($symb);
$result.='';
return $result;
}
@@ -208,6 +224,15 @@ sub start_Task {
my $uri=$env{'request.uri'};
if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
$body_tag_start.=$uri.'">'.&add_grading_button()."";
+ my $symb=&Apache::lonnet::symbread();
+ if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
+ $body_tag_start.='';
+ }
}
}
if ($target eq 'web' || ($target eq 'grade' && !$env{'form.webgrade'}) || $target eq 'answer' ||
@@ -238,6 +263,7 @@ sub start_Task {
$msg.='
'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'
';
} elsif ($status eq 'NOT_IN_A_SLOT') {
$msg.='
'.&mt('You are not currently signed up to work at this time and/or place.').'
';
+ $msg.=&add_request_another_attempt_button("Sign up for time to work.");
} elsif ($status eq 'NEEDS_CHECKIN') {
$msg.='
'.&mt('You need the Proctor to validate you.').
'
'.&proctor_validation_screen($slot);
@@ -259,14 +285,7 @@ sub start_Task {
}
} elsif ($target eq 'grade' && !$env{'form.webgrade'}) {
if ($status eq 'NEEDS_CHECKIN') {
- if (&proctor_check_auth($slot_name,$slot)) {
- #FIXME immeadiatly add this to the grading queue
- # with slot->{'endtime'} for when grading can
- # begin on this resource
- # FIXME I think the above is done by default,
- # need to check that
- # failure doesn't do this.
- }
+ &proctor_check_auth($slot_name,$slot);
}
}
} elsif ($target eq 'web') {
@@ -514,7 +533,6 @@ sub end_Task {
}
} elsif ($ungraded) {
$Apache::lonhomework::results{"resource.$version.status"}='ungraded';
- # FIXME if in review queue need to move back to grading queue
if ($env{'form.queue'} eq 'reviewqueue') {
&Apache::lonxml::debug("moving back.");
&move_between_queues('reviewqueue','gradingqueue');
@@ -526,13 +544,31 @@ sub end_Task {
$Apache::lonhomework::results{"resource.$version.0.solved"}='incorrect_by_override';
$Apache::lonhomework::results{"resource.$version.0.award"}='INCORRECT';
$Apache::lonhomework::results{"resource.$version.0.awarded"}='0';
- &remove_from_queue($env{'form.queue'});
+ &remove_from_queue($env{'form.queue'});
+
+ my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
+ $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
+ $Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"};
+ &Apache::grades::version_portfiles(
+ \%Apache::lonhomework::results,
+ ["$version.0.bridgetask"],$courseid,
+ $symb,$udom,$uname,
+ ["$version.0.bridgetask"]);
} else {
$Apache::lonhomework::results{"resource.$version.status"}='pass';
$Apache::lonhomework::results{"resource.$version.0.solved"}='correct_by_override';
$Apache::lonhomework::results{"resource.$version.0.award"}='EXACT_ANS';
$Apache::lonhomework::results{"resource.$version.0.awarded"}='1';
&remove_from_queue($env{'form.queue'});
+
+ my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
+ $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}=
+ $Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"};
+ &Apache::grades::version_portfiles(
+ \%Apache::lonhomework::results,
+ ["$version.0.bridgetask"],$courseid,
+ $symb,$udom,$uname,
+ ["$version.0.bridgetask"]);
}
$Apache::lonhomework::results{"resource.status"}=
$Apache::lonhomework::results{"resource.$version.status"};