--- loncom/homework/bridgetask.pm 2005/05/10 20:29:26 1.22
+++ loncom/homework/bridgetask.pm 2005/05/13 15:34:50 1.24
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.22 2005/05/10 20:29:26 albertel Exp $
+# $Id: bridgetask.pm,v 1.24 2005/05/13 15:34:50 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -69,9 +69,12 @@ sub proctor_check_auth {
if ($puser eq $user && $pdom eq $domain) {
my $authhost=&Apache::lonnet::authenticate($puser,$env{'form.proctorpassword'},$pdom);
if ($authhost ne 'no_host') {
- $Apache::lonhomework::results{'resource.checkedin'}=
+ my $version=
+ $Apache::lonhomework::results{'resource.version'}=
+ $Apache::lonhomework::history{'resource.version'}++;
+ $Apache::lonhomework::results{"resource.$version.checkedin"}=
$user.'@'.$domain;
- $Apache::lonhomework::results{'resource.checkedin.slot'}=
+ $Apache::lonhomework::results{"resource.$version.checkedin.slot"}=
$slot_name;
return 1;
}
@@ -125,12 +128,13 @@ sub start_Task {
}
if ($target eq 'web' || ($target eq 'grade' && !$env{'form.webgrade'}) || $target eq 'answer' ||
$target eq 'tex') {
+ my $version=$Apache::lonhomework::history{'resource.version'};
($status,$accessmsg,my $slot_name,$slot) =
&Apache::lonhomework::check_task_access('0');
push(@Apache::inputtags::status,$status);
$Apache::inputtags::slot_name=$slot_name;
my $expression='$external::datestatus="'.$status.'";';
- $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
+ $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$version.solved"}.'";';
&Apache::run::run($expression,$safeeval);
&Apache::lonxml::debug("Got $status");
if (( $status eq 'CLOSED' ) ||
@@ -236,6 +240,7 @@ sub end_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my $result='';
my $status=$Apache::inputtags::status['-1'];
+ my $version=$Apache::lonhomework::history{'resource.version'};
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex') {
if (
@@ -245,7 +250,8 @@ sub end_Task {
if ($target eq 'web') {
if ($status eq 'CAN_ANSWER') {
$result.="\n".'
'.
- &Apache::inputtags::file_selector('0',"bridgetask","*",
+ &Apache::inputtags::file_selector($version,
+ "bridgetask","*",
'portfolioonly').
"
";
$result.=&Apache::inputtags::gradestatus('0');
@@ -260,11 +266,11 @@ sub end_Task {
&Apache::essayresponse::file_submission('0','bridgetask',
'portfiles',\$award);
if ($award eq 'SUBMITTED' &&
- $Apache::lonhomework::results{"resource.0.bridgetask.portfiles"}) {
- $Apache::lonhomework::results{"resource.0.tries"}=
- 1+$Apache::lonhomework::history{"resource.0.tries"};
+ $Apache::lonhomework::results{"resource.$version.bridgetask.portfiles"}) {
+ $Apache::lonhomework::results{"resource.$version.tries"}=
+ 1+$Apache::lonhomework::history{"resource.$version.tries"};
}
- $Apache::lonhomework::results{"resource.0.award"}=$award;
+ $Apache::lonhomework::results{"resource.$version.award"}=$award;
&Apache::lonhomework::showhash(%Apache::lonhomework::results);
&Apache::structuretags::finalize_storage();
if ($award eq 'SUBMITTED') {
@@ -309,11 +315,11 @@ sub end_Task {
&check_queue_unlock();
} elsif ($mandatory_failed) {
$Apache::lonhomework::results{'resource.status'}='fail';
- $Apache::lonhomework::results{"resource.0.award"}='EXACT_ANS';
+ $Apache::lonhomework::results{"resource.$version.award"}='EXACT_ANS';
&remove_from_queue();
} else {
$Apache::lonhomework::results{'resource.status'}='pass';
- $Apache::lonhomework::results{"resource.0.award"}='INCORRECT';
+ $Apache::lonhomework::results{"resource.$version.award"}='INCORRECT';
&remove_from_queue();
}
&Apache::structuretags::finalize_storage();
@@ -618,6 +624,7 @@ sub get_instance {
}
}
} elsif ($target eq 'webgrade') {
+ my $version=$Apache::lonhomework::history{'resource.version'};
foreach my $id (@{$dimension{$instance.'.criterias'}}) {
my $link='criteria_'.$instance.'_'.$id;
my $status=$Apache::lonhomework::history{"resource.$dim_id.$instance.$id.status"};
@@ -645,7 +652,7 @@ sub get_instance {
$result.='';
my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio';
- foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.0.bridgetask.portfiles"})) {
+ foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.bridgetask.portfiles"})) {
my $file=$file_url.$partial_file;
&Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
$result.='![]('.
) |