';
+ }
} elsif ($target eq 'edit') {
$result.=$head_tag_start."".$body_tag_start.$form_tag_start.
&Apache::structuretags::problem_edit_header();
@@ -622,6 +631,57 @@ sub get_key_todo {
return (undef,'select_user');
}
+
+ my $me=$env{'user.name'}.'@'.$env{'user.domain'};
+
+ #need to try both queues..
+ if (defined($env{'form.regradeaspecificsubmission'}) &&
+ defined($env{'form.gradinguser'}) &&
+ defined($env{'form.gradingdomain'}) ) {
+ my ($symb,$cid)=&Apache::lonxml::whichuser();
+ my $cnum = $env{'course.'.$cid.'.num'};
+ my $cdom = $env{'course.'.$cid.'.domain'};
+ my $uname = $env{'form.gradinguser'};
+ my $udom = $env{'form.gradingdomain'};
+
+ my $gradingkey=&encode_queue_key($symb,$udom,$uname);
+
+ my $queue;
+
+ if (&in_queue('gradingqueue',$symb,$cdom,$cnum,$udom,$uname)) {
+ $env{'form.queue'} = $queue = 'gradingqueue';
+ } elsif (&in_queue('reviewqueue' ,$symb,$cdom,$cnum,$udom,$uname)) {
+ $env{'form.queue'} = $queue = 'reviewqueue';
+ }
+
+ if (!$queue) {
+ $env{'form.queue'} = $queue = 'none';
+ #not queued so doing either a re or pre grade
+ return ($gradingkey);
+ }
+
+ my $who=&queue_key_locked($queue,$gradingkey);
+ if ($who eq $me) {
+ #already have the lock
+ $env{'form.gradingkey'}=&Apache::lonnet::escape($gradingkey);
+ return ($gradingkey);
+ }
+
+ if (!defined($who)) {
+ if (&lock_key($queue,$gradingkey)) {
+ return ($gradingkey);
+ } else {
+ return (undef,'lock_failed');
+ }
+ }
+
+ #otherwise (defined($who) && $who ne $me) some else has it...
+ return (undef,'not_allowed',
+ &mt('Another user ([_1]) currently has the record for [_2] locked.',
+ $who,$env{'form.gradinguser'}.'@'.$env{'form.gradingdomain'}));
+ }
+
+
my $queue=$env{'form.queue'};
if (!defined($queue)) {
@@ -649,7 +709,6 @@ sub get_key_todo {
&& $env{'form.queuemode'} eq 'selected') {
my $who=&queue_key_locked($queue,$gradingkey);
- my $me=$env{'user.name'}.'@'.$env{'user.domain'};
if ($who eq $me) {
&Apache::lonxml::debug("Found a key was given to me");
return ($gradingkey,'selected');
@@ -729,8 +788,9 @@ sub end_Task {
&show_task($status,$previous)) {
$result.=&Apache::inputtags::gradestatus('0');
$result.='';
+ my $action = &Apache::lonenc::check_encrypt($env{'request.uri'});
$result.=<
+
@@ -747,7 +807,7 @@ DONEBUTTON
my $start_time=
&Apache::lonlocal::locallocaltime($slot{'starttime'});
- my $status = "\n\n";
+ my $status = "\n
\n";
if ($bt_status eq 'pass') {
$status.='
You passed the '.$title.' given on '.
@@ -777,14 +837,14 @@ DONEBUTTON
my $opt_req=&Apache::lonxml::get_param('OptionalRequired',
$parstack,$safeeval);
if ($opt_req !~ /\S/) { $opt_req='0'; }
- $status.="\n
".&mt('You needed to pass all of the [_1] mandatory components and [_2] of the [_3] optional components, of which you were required to pass [_4] on the bridge task.',$man_count,$opt_passed,$opt_count,$opt_req)."
\n";
+ $status.="\n
".&mt('You needed to pass all of the [_1] mandatory components and [_2] of the [_3] optional components, of which you passed [_4].',$man_count,$opt_req,$opt_count,$opt_passed)."
\n";
my $internal_location=&internal_location();
$result=~s/\Q$internal_location\E/$status/;
}
}
- if ($target eq 'web' || $target eq 'webgrade') {
- $result.=&Apache::lonxml::xmlend().'