--- loncom/homework/bridgetask.pm 2005/10/01 04:06:29 1.62
+++ loncom/homework/bridgetask.pm 2005/10/14 16:23:39 1.70
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.62 2005/10/01 04:06:29 albertel Exp $
+# $Id: bridgetask.pm,v 1.70 2005/10/14 16:23:39 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -294,6 +294,7 @@ sub show_task {
( $status eq 'INVALID_ACCESS') )) {
return 0;
}
+ if ($env{'form.donescreen'}) { return 0; }
return 1;
}
@@ -334,11 +335,41 @@ sub submission_time_stamp {
return $result;
}
+sub webgrade_standard_info {
+ my ($version)=&get_version();
+ my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+ my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
+ my $file_list="
\n";
+ foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
+ my $file=$file_url.$partial_file;
+ $file=~s|/+|/|g;
+ &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
+ $file_list.=' '.$file.
+ ' '."\n";
+ }
+ $file_list.=" \n";
+
+ my %lt=&Apache::lonlocal::texthash('done' => 'Done',
+ 'stop' => 'Stop',
+ );
+
+ my $result=<
+
+
+ $file_list
+
+INFO
+ return $result;
+}
+
sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my ($status,$accessmsg,$slot);
if ($target ne 'webgrade') {
+ &Apache::structuretags::init_problem_globals('Task');
&Apache::structuretags::initialize_storage();
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
}
@@ -392,6 +423,18 @@ sub start_Task {
''.&proctor_validation_screen($slot);
} elsif ($status eq 'WAITING_FOR_GRADE') {
$msg.=''.&mt('Your submission is in the grading queue.').' ';
+ } elsif ($env{'form.donescreen'}) {
+ my $title=&Apache::lonnet::gettitle();
+ my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
+ my $files='';
+ $result.=<$title
+ Files submitted: $files
+ You are now done with this Bridge Task
+
+ Logout
+ Change to a different course
+DONESCREEN
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.=''.&mt('Not open to be viewed').' ';
}
@@ -498,6 +541,7 @@ sub start_Task {
value="'.$sec.'" />';
}
}
+ if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
}
} else {
# page_start returned a starting result, delete it if we don't need it
@@ -605,15 +649,13 @@ sub end_Task {
my ($version,$previous)=&get_version();
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex') {
- if (
- (($target eq 'web') && ($env{'request.state'} ne 'construct')) ||
- ($target eq 'answer') || ($target eq 'tex')
- ) {
+ if ($target eq 'web' || $target eq 'answer' || $target eq 'tex') {
if ($target eq 'web') {
if (&show_task($status,$previous)) {
$result.=&Apache::lonxml::endredirection();
}
- if ($status eq 'CAN_ANSWER' && !$previous) {
+ if ($status eq 'CAN_ANSWER' && !$previous &&
+ !$env{'form.donescreen'}) {
$result.="\n".''.
&Apache::inputtags::file_selector("$version.0",
"bridgetask","*",
@@ -623,6 +665,13 @@ sub end_Task {
'.&mt('Indicate the files from your portfolio to be evaluated in grading this task.').'
').
"
";
$result.=&Apache::inputtags::gradestatus('0');
+ $result.='';
+ $result.=<
+
+
+
+DONEBUTTON
}
if (&show_task($status,$previous) &&
$Apache::lonhomework::history{"resource.$version.status"} =~ /^(pass|fail)$/) {
@@ -688,6 +737,8 @@ sub end_Task {
$award;
$Apache::lonhomework::results{"resource.0.submission"}=
$Apache::lonhomework::results{"resource.$version.0.submission"}='';
+ } else {
+ delete($Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"});
}
&Apache::lonhomework::showhash(%Apache::lonhomework::results);
&Apache::structuretags::finalize_storage();
@@ -804,9 +855,14 @@ sub end_Task {
# &mt('Save Partial Grade and Continue Grading').'" /> ';
$result.=''.&Apache::loncommon::endbodytag().'