'."\n".
'';
#$result.='
Review'.&show_queue('reviewqueue');
#$result.='
Grade'.&show_queue('gradingqueue');
}
- # FIXME Blast! still need to reorg this, need to reshow the
- # queue being reviewed once done with the grade pass...
- # 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,$msg)=&get_key_todo($target);
if ($todo) {
@@ -532,7 +707,7 @@ DONESCREEN
&Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.'';
$form_tag_start.=
'
';
+ &escape($todo).'" />';
$Apache::bridgetask::queue_key=$todo;
&Apache::structuretags::initialize_storage();
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
@@ -547,6 +722,17 @@ DONESCREEN
&mt('Return to resource').'';
if ($status_code eq 'stop') {
$result.='
'.&mt("Stopped grading.").''.$back;
+ } elsif ($status_code eq 'cancel') {
+ $result.='
'.&mt("Cancelled grading.").''.$back;
+ } elsif ($status_code eq 'never_versioned') {
+ $result.='
'.
+ &mt("Requested user has never accessed the task.").
+ ''.$back;
+ } elsif ($status_code =~ /still_open:(.*)/) {
+ my $date = &Apache::lonlocal::locallocaltime($1);
+ $result.='
'.
+ &mt("Task is still open, will close at [_1].",$date).
+ ''.$back;
} elsif ($status_code eq 'lock_failed') {
$result.='
'.&mt("Failed to lock the requested record.")
.''.$back;
@@ -567,6 +753,8 @@ DONESCREEN
}
}
$webgrade='no';
+ }
+ if (!$todo || $env{'form.cancel'}) {
my $bodytext=&Apache::lonxml::get_all_text("/task",$parser,$style);
}
if ($target eq 'webgrade' && defined($env{'form.queue'})) {
@@ -594,9 +782,10 @@ DONESCREEN
}
if ($target eq 'webgrade') {
$result.="\n".'
';
+ &Apache::lonxml::startredirection();
}
} elsif ($target eq 'edit') {
- $result.=$head_tag_start."".$body_tag_start.$form_tag_start.
+ $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.")."
";
@@ -609,6 +798,20 @@ DONESCREEN
return $result;
}
+sub get_task_end_time {
+ my ($queue_entry,$symb,$udom,$uname) = @_;
+
+ my $end_time;
+ if (my $slot = &slotted_access($queue_entry)) {
+ my %slot_data=&Apache::lonnet::get_slot($slot);
+ $end_time = $slot_data{'endtime'};
+ } else {
+ $end_time = &Apache::lonhomework::due_date('0',$symb,
+ $udom,$uname);
+ }
+ return $end_time;
+}
+
sub get_key_todo {
my ($target)=@_;
my $todo;
@@ -632,13 +835,13 @@ sub get_key_todo {
}
- my $me=$env{'user.name'}.'@'.$env{'user.domain'};
+ 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 ($symb,$cid)=&Apache::lonnet::whichuser();
my $cnum = $env{'course.'.$cid.'.num'};
my $cdom = $env{'course.'.$cid.'.domain'};
my $uname = $env{'form.gradinguser'};
@@ -657,18 +860,34 @@ sub get_key_todo {
if (!$queue) {
$env{'form.queue'} = $queue = 'none';
#not queued so doing either a re or pre grade
+ my %status = &Apache::lonnet::restore($symb,$cid,$udom,$uname);
+ if ($status{'resource.0.version'} < 1) {
+ return (undef,'never_versioned');
+ }
return ($gradingkey);
}
+ if ($queue) {
+ my $queue_entry = &get_queue_data($queue,$udom,$uname);
+
+ my $end_time = &get_task_end_time($queue_entry,$symb,
+ $udom,$uname);
+ if ($end_time > time) {
+ return (undef,"still_open:$end_time");
+ }
+ }
+
my $who=&queue_key_locked($queue,$gradingkey);
if ($who eq $me) {
#already have the lock
- $env{'form.gradingkey'}=&Apache::lonnet::escape($gradingkey);
+ $env{'form.gradingkey'}=&escape($gradingkey);
+ &Apache::lonxml::debug("already locked");
return ($gradingkey);
}
if (!defined($who)) {
if (&lock_key($queue,$gradingkey)) {
+ &Apache::lonxml::debug("newly locked");
return ($gradingkey);
} else {
return (undef,'lock_failed');
@@ -678,7 +897,7 @@ sub get_key_todo {
#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'}));
+ $who,$env{'form.gradinguser'}.':'.$env{'form.gradingdomain'}));
}
@@ -688,13 +907,15 @@ sub get_key_todo {
$env{'form.queue'}=$queue='gradingqueue';
}
- my $gradingkey=&Apache::lonnet::unescape($env{'form.gradingkey'});
+ my $gradingkey=&unescape($env{'form.gradingkey'});
if ($env{'form.queue'} eq 'none') {
if (defined($env{'form.gradingkey'})) {
if ($target eq 'webgrade') {
if ($env{'form.stop'}) {
return (undef,'stop');
+ } elsif ($env{'form.cancel'}) {
+ return (undef,'cancel');
} elsif ($env{'form.next'}) {
return (undef,'select_user');
}
@@ -740,7 +961,8 @@ 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.stop'} && $target eq 'webgrade')
+ if (!(($env{'form.cancel'} || $env{'form.stop'})
+ && $target eq 'webgrade')
&& !$env{'form.gradingaction'}) {
&Apache::lonxml::debug("Getting anew $queue");
return (&get_from_queue($queue));
@@ -801,11 +1023,19 @@ DONEBUTTON
my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"};
my $title=&Apache::lonnet::gettitle();
+ my $start_time;
+
my $slot_name=
$Apache::lonhomework::history{"resource.$version.0.checkedin.slot"};
- my %slot=&Apache::lonnet::get_slot($slot_name);
- my $start_time=
- &Apache::lonlocal::locallocaltime($slot{'starttime'});
+ 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";
@@ -820,33 +1050,64 @@ DONEBUTTON
$status.=&add_request_another_attempt_button();
}
}
+ $status.='
';
my $man_count=0;
+ my $man_passed=0;
my $opt_count=0;
my $opt_passed=0;
- foreach my $dim_id (@Apache::bridgetask::dimensionlist) {
- if ($Apache::bridgetask::dimensionmandatory{$dim_id}
+ my $dim = $top;
+ foreach my $id (@{$dimension{$dim}{'criterias'}}) {
+ my $status = &get_criteria('status',$version,$dim,$id);
+ if ($dimension{$dim}{'criteria.'.$id.'.mandatory'}
eq 'N') {
$opt_count++;
- if ($Apache::lonhomework::history{"resource.$version.0.$dim_id.status"} eq 'pass') {
+ if ($status eq 'pass') {
$opt_passed++;
}
} else {
$man_count++;
+ if ($status eq 'pass') { $man_passed++; }
}
}
+ if ($man_passed eq $man_count) { $man_passed='all'; }
+
my $opt_req=&Apache::lonxml::get_param('OptionalRequired',
- $parstack,$safeeval);
+ $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 passed [_4].',$man_count,$opt_req,$opt_count,$opt_passed)."
\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";
+
+
+ foreach my $id (@{$dimension{$dim}{'criterias'}}) {
+ my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
+ if ($type eq 'dimension') {
+ $result.=$dimension{$id}{'result'};
+ next;
+ }
+ my $criteria =
+ &nested_parse(\$dimension{$dim}{'criteria.'.$id},
+ [@_]);
+ $status .= &layout_web_Criteria($dim,$id,$criteria);
+ }
my $internal_location=&internal_location();
$result=~s/\Q$internal_location\E/$status/;
}
- }
- if ($target eq 'web') {
- $result.="\n