'."\n".
+ '';
#$result.=' Review'.&show_queue('reviewqueue');
#$result.=' Grade'.&show_queue('gradingqueue');
}
@@ -386,7 +565,7 @@ sub start_Task {
# Hrrm, vaildation pass should perhaps say 'not_locked'
# perhaps do a search if there is a key that is mine and if
# there isn't reshow the queue....
- my ($todo,$status_code)=&get_key_todo($target);
+ my ($todo,$status_code,$msg)=&get_key_todo($target);
if ($todo) {
&setup_env_for_other_user($todo,$safeeval);
@@ -399,36 +578,43 @@ sub start_Task {
$Apache::bridgetask::queue_key=$todo;
&Apache::structuretags::initialize_storage();
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
- if ($target eq 'webgrade') {
- #$result.=' After -'.&show_queue($env{'form.queue'});
- $result.="\n".'
';
- if ($status_code eq 'selected') {
- $form_tag_start.=
- '';
- }
+ if ($target eq 'webgrade' && $status_code eq 'selected') {
+ $form_tag_start.=
+ '';
}
} else {
if ($target eq 'webgrade') {
$result.="\n";
+ my $back='
';
if ($status_code eq 'stop') {
- $result.=''.&mt("Stopped grading.").'';
+ $result.=''.&mt("Stopped grading.").''.$back;
} elsif ($status_code eq 'lock_failed') {
- $result.=''.&mt("Failed to lock the request record.").'';
+ $result.=''.&mt("Failed to lock the requested record.")
+ .''.$back;
} elsif ($status_code eq 'unlock') {
- $result.=''.&mt("Unlocked the requested record.").'';
+ $result.=''.&mt("Unlocked the requested record.")
+ .''.$back;
$result.=&show_queue($env{'form.queue'},1);
} elsif ($status_code eq 'show_list') {
$result.=&show_queue($env{'form.queue'},1);
} elsif ($status_code eq 'select_user') {
$result.=&select_user();
+ } elsif ($status_code eq 'unable') {
+ $result.=''.&mt("Unable to aqcuire a user to grade.").''.$back;
+ } elsif ($status_code eq 'not_allowed') {
+ $result.=''.&mt('Not allowed to grade the requested user.').' '.$msg.''.$back;
} else {
- $result.=''.&mt("No user to be graded.").'';
+ $result.=''.&mt("No user to be graded.").''.$back;
}
}
$webgrade='no';
- my $bodytext=&Apache::lonxml::get_all_text("/task",$parser);
+ my $bodytext=&Apache::lonxml::get_all_text("/task",$parser,$style);
}
if ($target eq 'webgrade' && defined($env{'form.queue'})) {
+ if ($webgrade eq 'yes') {
+ $result.=&submission_time_stamp();
+ }
$result.=$form_tag_start;
$result.='';
@@ -438,7 +624,26 @@ sub start_Task {
$result.='';
}
+ if ($env{'form.chosensections'}) {
+ my @chosen_sections=
+ &Apache::loncommon::get_env_multiple('form.chosensections');
+ foreach my $sec (@chosen_sections) {
+ $result.='';
+ }
+ }
+ if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
+ }
+ if ($target eq 'webgrade') {
+ $result.="\n".'
';
}
+ } elsif ($target eq 'edit') {
+ $result.=$form_tag_start.
+ &Apache::structuretags::problem_edit_header();
+ $Apache::lonxml::warnings_error_header=
+ &mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")." ";
+ my $temp=&Apache::edit::insertlist($target,$token);
+ $result.=$temp;
} else {
# page_start returned a starting result, delete it if we don't need it
$result = '';
@@ -468,6 +673,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)) {
@@ -482,12 +738,12 @@ sub get_key_todo {
if ($env{'form.stop'}) {
return (undef,'stop');
} elsif ($env{'form.next'}) {
- return (undef,'show_list');
+ return (undef,'select_user');
}
}
return ($gradingkey,'selected');
} else {
- return (undef,'show_list');
+ return (undef,'select_user');
}
}
if (defined($env{'form.queue'}) && defined($env{'form.gradingkey'})
@@ -495,7 +751,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');
@@ -538,6 +793,16 @@ sub get_key_todo {
return (undef,undef)
}
+sub minimize_storage {
+ foreach my $key (keys(%Apache::lonhomework::results)) {
+ if ($key =~ /regrader$/) { next; }
+ if ($Apache::lonhomework::results{$key} eq
+ $Apache::lonhomework::history{$key}) {
+ delete($Apache::lonhomework::results{$key});
+ }
+ }
+}
+
sub end_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my $result='';
@@ -545,15 +810,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","*",
@@ -562,25 +825,47 @@ sub end_Task {
'.&mt('Submit Portfolio Files for Grading').'
'.&mt('Indicate the files from your portfolio to be evaluated in grading this task.').'
').
"
";
- $result.=&Apache::inputtags::gradestatus('0');
}
- if (&show_task($status,$previous)) {
- my $bt_status=$Apache::lonhomework::history{"resource.$version.status"};
+ if (!$previous && $status ne 'SHOW_ANSWER' &&
+ &show_task($status,$previous)) {
+ $result.=&Apache::inputtags::gradestatus('0');
+ $result.='';
+ my $action = &Apache::lonenc::check_encrypt($env{'request.uri'});
+ $result.=<
+
+
+
+DONEBUTTON
+ }
+ if (&show_task($status,$previous) &&
+ $Apache::lonhomework::history{"resource.$version.0.status"} =~ /^(pass|fail)$/) {
+ my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"};
my $title=&Apache::lonnet::gettitle();
- my %slot=&Apache::lonnet::get_slot($Apache::inputtags::slot_name);
- my $start_time=
- &Apache::lonlocal::locallocaltime($slot{'starttime'});
- my $status;
- $status.="\n
\n";
+ my $start_time;
+
+ my $slot_name=
+ $Apache::lonhomework::history{"resource.$version.0.checkedin.slot"};
+ if ($slot_name) {
+ my %slot=&Apache::lonnet::get_slot($slot_name);
+
+ $start_time=$slot{'starttime'}
+ } else {
+ $start_time=
+ &Apache::lonnet::EXT('resource.0.opendate');
+ }
+ $start_time=&Apache::lonlocal::locallocaltime($start_time);
+
+ my $status = "\n
\n";
if ($bt_status eq 'pass') {
$status.='
You passed the '.$title.' given on '.
- $start_time.'.
';
+ $start_time.'';
}
if ($bt_status eq 'fail') {
$status.='
You did not pass the '.$title.' given on '.
- $start_time.'.
';
+ $start_time.'';
if (!$previous) {
$status.=&add_request_another_attempt_button();
}
@@ -592,24 +877,24 @@ sub end_Task {
if ($Apache::bridgetask::dimensionmandatory{$dim_id}
eq 'N') {
$opt_count++;
- if ($Apache::lonhomework::history{"resource.$version.$dim_id.status"} eq 'pass') {
+ if ($Apache::lonhomework::history{"resource.$version.0.$dim_id.status"} eq 'pass') {
$opt_passed++;
}
} else {
$man_count++;
}
}
+
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 on the bridge task.',$man_count,$opt_req,$opt_count)."
\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().'