--- loncom/homework/bridgetask.pm 2010/09/27 18:45:14 1.253
+++ loncom/homework/bridgetask.pm 2010/10/12 16:07:43 1.255
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.253 2010/09/27 18:45:14 raeburn Exp $
+# $Id: bridgetask.pm,v 1.255 2010/10/12 16:07:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -545,23 +545,35 @@ sub done_screen {
my $title=&Apache::lonnet::gettitle($env{'request.uri'});
my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
my (undef,undef,$domain,$user)= &Apache::lonnet::whichuser();
- my $files = '
';
- my $msg;
- foreach my $file (@files) {
- my $url="/uploaded/$domain/$user/portfolio$file";
- if (! &Apache::lonnet::stat_file($url)) {
- $file = ''
- .&mt('[_1]Nonexistent file:[_2]'
- ,' '
- ,' '.$file.'');
- $msg .= "".&mt('Submitted non-existent file [_1]',$file)."
\n";
- } else {
- $file = ''.$file.'';
- $msg .= "".&mt('Submitted file [_1]',$file)."
\n";
- }
- $files .= '- '.$file.'
';
+ my ($msg,$files,$shown);
+ if (@files > 0) {
+ $files = '';
+ foreach my $file (@files) {
+ my $url="/uploaded/$domain/$user/portfolio$file";
+ if (! &Apache::lonnet::stat_file($url)) {
+ $file = ''
+ .&mt('[_1]Nonexistent file:[_2]'
+ ,' '
+ ,' '.$file.'');
+ $msg .= "".&mt('Submitted non-existent file [_1]',$file)."
\n";
+ } else {
+ $file = ''.$file.'';
+ $msg .= "".&mt('Submitted file [_1]',$file)."
\n";
+ }
+ $files .= '- '.$file.'
';
+ }
+ $files.='
';
+ $shown = ''.&mt('Files submitted: [_1]',$files).'
'
+ .''.&mt('You are now done with this Bridge Task').'
'
+ .'
'
+ .''.&mt('Logout').'
'
+ .''.&mt('Change to a different course').'
';
+ } else {
+ $msg = &mt("Submission status: no files currently submitted, when 'Done' was indicated.");
+ $shown = ''.
+ &mt('You did not submit any files. Please try again.').'
'.
+ ''.&mt('Back to Bridge Task').'
';
}
- $files.='
';
my $subject = &mt('Submission message for [_1]',$title);
my ($message_status,$comment_status);
my $setting = $env{'course.'.$env{'request.course.id'}.'.task_messages'};
@@ -581,15 +593,11 @@ sub done_screen {
$comment_status = ''.&mt('Message sent to instructor: [_1]',
$comment_status).'
';
}
+
return "$title
"
- .''.&mt('Files submitted: [_1]',$files).'
'
- .''.&mt('You are now done with this Bridge Task').'
'
- .'
'
- .''.&mt('Logout').'
'
-.''.&mt('Change to a different course').'
'
-.$message_status
-.$comment_status;
-
+ .$shown
+ .$message_status
+ .$comment_status;
}
sub start_Task {
@@ -784,6 +792,11 @@ sub start_Task {
$result.=''.&mt("Stopped grading.").''.$back;
} elsif ($status_code eq 'cancel') {
$result.=''.&mt("Cancelled grading.").''.$back;
+ } elsif ($status_code eq 'terminated') {
+ $result.= ''.&mt('Terminated grading').'
'.
+ ''.
+ &mt('Grading for [_1] has not been saved because of a grading key mismatch.',
+ ''.$env{'form.terminated'}.'').'
'.$back;
} elsif ($status_code eq 'never_versioned') {
$result.=''.
&mt("Requested user has never accessed the task.").
@@ -1004,6 +1017,8 @@ sub get_key_todo {
return (undef,'stop');
} elsif ($env{'form.cancel'}) {
return (undef,'cancel');
+ } elsif ($env{'form.terminated'}) {
+ return (undef, 'terminated');
} elsif ($env{'form.next'}) {
return (undef,'select_user');
}
@@ -1049,13 +1064,17 @@ sub get_key_todo {
if ($env{'form.queuemode'} ne 'selected') {
# don't get something new from the queue if they hit the stop button
- if (!(($env{'form.cancel'} || $env{'form.stop'})
+ if (!(($env{'form.cancel'} || $env{'form.stop'} || $env{'form.terminated'})
&& $target eq 'webgrade')
&& !$env{'form.gradingaction'}) {
&Apache::lonxml::debug("Getting anew $queue");
return (&get_from_queue($queue));
} else {
- return (undef,'stop');
+ if ($env{'form.terminated'}) {
+ return (undef,'terminated');
+ } else {
+ return (undef,'stop');
+ }
}
}
return (undef,undef)
@@ -1320,9 +1339,9 @@ DONEBUTTON
$Apache::lonhomework::results{"resource.$version.0.solved"};
}
&minimize_storage();
- my $canstore;
+ my ($canstore,$domain,$name);
if ($env{'form.gradingkey'}) {
- my ($symb,$courseid,$domain,$name) =
+ (my $symb,my $courseid,$domain,$name) =
&Apache::lonnet::whichuser();
my $todo=&unescape($env{'form.gradingkey'});
my ($keysymb,$uname,$udom)=&decode_queue_key($todo);
@@ -1363,8 +1382,7 @@ DONEBUTTON
}
} else {
&check_queue_unlock($env{'form.queue'});
- $result .= '
'.
- &mt('Information extracted from the current gradingkey was for a different BT or user from those for which grading data are to be stored.').' '.&mt('No grading changes stored.').'
';
+ $env{'form.terminated'} = $name.':'.$domain;
}
}
if (exists($Apache::lonhomework::results{'INTERNAL_store'})) {