--- loncom/homework/bridgetask.pm 2005/05/31 21:11:56 1.36
+++ loncom/homework/bridgetask.pm 2005/08/09 16:48:15 1.39
@@ -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.39 2005/08/09 16:48:15 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 {
@@ -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,14 @@ 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();
+ $body_tag_start.='';
+
}
}
if ($target eq 'web' || ($target eq 'grade' && !$env{'form.webgrade'}) || $target eq 'answer' ||
@@ -238,6 +262,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);
@@ -526,13 +551,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"};