'."\n";
+
+ if ($target eq 'web' || $target eq 'webgrade') {
+ $head_tag_start.='
'.
+ &Apache::structuretags::get_resource_name($parstack,$safeeval).
+ '';
+ }
+
if ($target eq 'web' && $env{'request.state'} ne 'construct') {
if ($Apache::lonhomework::modifygrades) {
- $body_tag_start.='
";
my $symb=&Apache::lonnet::symbread();
if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
- $body_tag_start.='
';
+ my $target_id =
+ &Apache::lonstathelpers::make_target_id({symb => $symb,
+ part => '0'});
+ $body_tag_start.='
';
}
}
}
@@ -451,7 +453,37 @@ sub start_Task {
} elsif ($env{'form.donescreen'}) {
my $title=&Apache::lonnet::gettitle();
my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'});
- my $files='
';
+ my (undef,undef,$domain,$user)=
+ &Apache::lonxml::whichuser();
+ my $files = '
';
+ my $msg;
+ foreach my $file (@files) {
+ my $url="/uploaded/$domain/$user/portfolio$file";
+ $file = ''.$file.'';
+ $files .= '- '.$file.'
';
+ $msg .= "Submitted file $file
\n";
+ }
+ $files.='
';
+ my $subject = "Submission message for $title";
+ my ($message_status,$comment_status);
+ my $setting = $env{'course.'.$env{'request.course.id'}.'.task_messages'};
+ $setting =~ s/^\s*(\S*)\s*$/$1/;
+ $setting = lc($setting);
+ if ($setting eq 'only_student'
+ || $setting eq 'student_and_user_notes_screen') {
+ $message_status =
+ &Apache::lonmsg::user_normal_msg($user,$domain,$subject,$msg);
+ $message_status = '
'.&mt('Message sent to user: [_1]',
+ $message_status).'
';
+ }
+ if ($setting eq 'student_and_user_notes_screen') {
+ $comment_status =
+ &Apache::lonmsg::store_instructor_comment($subject.'
'.
+ $msg,$user,$domain);
+ $comment_status = '
'.&mt('Message sent to instructor: [_1]',
+ $comment_status).'
';
+ }
+
$result.=<
$title
Files submitted: $files
@@ -459,6 +491,8 @@ sub start_Task {
Logout
Change to a different course
+$message_status
+$comment_status
DONESCREEN
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.=''.&mt('Not open to be viewed').'
';
@@ -485,9 +519,8 @@ DONESCREEN
}
}
} elsif ($target eq 'web') {
- my $name= &Apache::structuretags::get_resource_name($parstack,$safeeval);
- $result.="$head_tag_start$name
- $body_tag_start \n".&style();
+ $result.="$head_tag_start
+ $body_tag_start \n";
$result.=&preserve_grade_info();
$result.=&internal_location();
@@ -499,7 +532,11 @@ DONESCREEN
$target eq 'webgrade') {
my $webgrade='yes';
if ($target eq 'webgrade') {
- $result.=$head_tag_start.$body_tag_start;
+ $result.=$head_tag_start.
+ ''.$body_tag_start.
+ "\n".''."\n".
+ '';
#$result.='
Review'.&show_queue('reviewqueue');
#$result.='
Grade'.&show_queue('gradingqueue');
}
@@ -508,7 +545,7 @@ DONESCREEN
# 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);
@@ -521,13 +558,9 @@ DONESCREEN
$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') {
@@ -537,7 +570,7 @@ DONESCREEN
if ($status_code eq 'stop') {
$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.")
@@ -547,6 +580,10 @@ DONESCREEN
$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.").''.$back;
}
@@ -577,6 +614,9 @@ DONESCREEN
}
if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
}
+ if ($target eq 'webgrade') {
+ $result.="\n".'';
+ }
} elsif ($target eq 'edit') {
$result.=$head_tag_start."".$body_tag_start.$form_tag_start.
&Apache::structuretags::problem_edit_header();
@@ -613,6 +653,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)) {
@@ -640,7 +731,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');
@@ -682,6 +772,17 @@ 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='';
@@ -709,8 +810,9 @@ sub end_Task {
&show_task($status,$previous)) {
$result.=&Apache::inputtags::gradestatus('0');
$result.='';
+ my $action = &Apache::lonenc::check_encrypt($env{'request.uri'});
$result.=<
+
@@ -727,7 +829,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 '.
@@ -757,14 +859,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 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().'