'."\n".
'';
@@ -862,8 +868,8 @@ sub get_key_todo {
my ($symb,$cid)=&Apache::lonnet::whichuser();
my $cnum = $env{'course.'.$cid.'.num'};
my $cdom = $env{'course.'.$cid.'.domain'};
- my $uname = $env{'form.gradinguser'};
- my $udom = $env{'form.gradingdomain'};
+ my $uname = &LONCAPA::clean_username($env{'form.gradinguser'});
+ my $udom = &LONCAPA::clean_domain($env{'form.gradingdomain'});
my $gradingkey=&encode_queue_key($symb,$udom,$uname);
@@ -1061,27 +1067,30 @@ DONEBUTTON
$start_time=&Apache::lonlocal::locallocaltime($start_time);
my $status =
- "\n
\n\t";
+ "\n
\n\t";
+ my $dim = $top;
+ my %counts = &get_counts($dim,undef,$parstack,
+ $safeeval);
+ my $question_status ="\n\t
".
+ &question_status_message(\%counts,-1).
+ "
\n";
+
if ($bt_status eq 'pass') {
$status.='
You passed the '.$title.' given on '.
$start_time.'
';
+ $status.=$question_status;
}
if ($bt_status eq 'fail') {
$status.='
You did not pass the '.$title.' given on '.
$start_time.'
';
+ $status.=$question_status;
if (!$previous) {
$status.=&add_request_another_attempt_button();
}
}
- $status.="\n".'
'."\n";
- my $dim = $top;
- my %counts = &get_counts($dim,undef,$parstack,
- $safeeval);
- $status.="\n
\n\t
".
- &question_status_message(\%counts,-1).
- "
\n
\n";
+ $status.="\n".'
'."\n";
foreach my $id (@{$dimension{$dim}{'criterias'}}) {
my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
@@ -1113,7 +1122,8 @@ DONEBUTTON
}
- if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous) {
+ if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous
+ && $status eq 'CAN_ANSWER') {
my $award='SUBMITTED';
&Apache::essayresponse::file_submission("$version.0",'bridgetask',
'portfiles',\$award);
@@ -1574,9 +1584,16 @@ sub show_queue {
my $ekey=&escape($key);
my ($action,$description,$status)=('select',&mt('Select'));
if (exists($queue{"$key\0locked"})) {
+ my ($locker,$time) =
+ &get_lock_info($queue{"$key\0locked"});
+ if ($time) {
+ $time =
+ &Apache::lonnavmaps::timeToHumanString($time,
+ 'start');
+ }
my $me=$env{'user.name'}.':'.$env{'user.domain'};
- $status=&mt('Locked by
[_1]',$queue{"$key\0locked"});
- if ($me eq $queue{"$key\0locked"}) {
+ $status=&mt('Locked by
[_1] [_2]',$locker,$time);
+ if ($me eq $locker) {
($action,$description)=('resume',&mt('Resume'));
} else {
($action,$description)=('unlock',&mt('Unlock'));
@@ -1686,7 +1703,7 @@ sub queue_key_locked {
my ($key_locked,$value)=
&Apache::lonnet::get($queue,["$key\0locked"],$cdom,$cnum);
if ($key_locked eq "$key\0locked") {
- return $value;
+ return &get_lock_info($value);
}
return undef;
}
@@ -1767,6 +1784,24 @@ sub pick_from_queue_data {
return undef;
}
+sub get_lock_info {
+ my ($lock_info) = @_;
+ if (wantarray) {
+ if (ref($lock_info) eq 'ARRAY') {
+ return @{$lock_info};
+ } else {
+ return ($lock_info);
+ }
+ } else {
+ if (ref($lock_info) eq 'ARRAY') {
+ return $lock_info->[0];
+ } else {
+ return $lock_info;
+ }
+ }
+ return;
+}
+
sub find_mid_grade {
my ($queue,$symb,$cdom,$cnum)=@_;
my $todo=&unescape($env{'form.gradingkey'});
@@ -1778,7 +1813,7 @@ sub find_mid_grade {
my $regexp="^$symb\0.*\0locked\$";
my %locks=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
foreach my $key (keys(%locks)) {
- my $who=$locks{$key};
+ my $who= &get_lock_info($locks{$key});
if ($who eq $me) {
$todo=$key;
$todo=~s/\0locked$//;
@@ -1794,7 +1829,7 @@ sub lock_key {
my (undef,$cid)=&Apache::lonnet::whichuser();
my $cnum=$env{'course.'.$cid.'.num'};
my $cdom=$env{'course.'.$cid.'.domain'};
- my $success=&Apache::lonnet::newput($queue,{"$todo\0locked"=> $me},
+ my $success=&Apache::lonnet::newput($queue,{"$todo\0locked"=> [$me,time]},
$cdom,$cnum);
&Apache::lonxml::debug("success $success $todo");
if ($success eq 'ok') {
@@ -2210,7 +2245,6 @@ sub end_Dimension {
my $result=&Apache::lonxml::endredirection();
my $dim=&get_id($parstack,$safeeval);
if (&skip_dimension_parsing($dim)) {
- &disable_dimension_parsing($dim);
pop(@Apache::bridgetask::dimension);
return;
}
@@ -2250,13 +2284,15 @@ sub end_Dimension {
}
my $dim_info=
"\n
\n\t";
- my $question = ('sub' x $dimension{$dim}{'depth'}).'question';
- $question =~ s/^(.)/uc($1)/e;
+ my $ucquestion =
+ my $question =
+ ('sub' x $dimension{$dim}{'depth'}).'question';
+ $ucquestion =~ s/^(.)/uc($1)/e;
if ($dim_status eq 'pass') {
- $dim_info.='
'.$question.' : you passed the above '.$mandatory.' question
';
+ $dim_info.='
'.$ucquestion.' : you passed this '.$mandatory.' '.$question.'
';
}
if ($dim_status eq 'fail') {
- $dim_info.='
'.$question.' : you did not pass the above '.$mandatory.' question
';
+ $dim_info.='
'.$ucquestion.' : you did not pass this '.$mandatory.' '.$question.'
';
}
my %counts = &get_counts($dim,$instance,$parstack,
$safeeval);
@@ -2286,8 +2322,11 @@ sub end_Dimension {
}
}
# puts the results at the end of the dimension
- $result .= $dim_info;
-
+ if ($result =~m{
}) {
+ $result=~s{
}{$dim_info};
+ } else {
+ $result .= $dim_info;
+ }
# puts the results at the beginning of the dimension
# my $internal_location=&internal_location($dim);
# $result=~s/\Q$internal_location\E/$dim_info/;
@@ -2429,7 +2468,7 @@ sub question_status_message {
foreach my $type ('cri','dim') {
if ($counts->{$req.'_'.$type}) {
push(@sections,
- $counts->{$req.'_'.$type.'_passed'}.' of '.
+ $counts->{$req.'_'.$type.'_passed'}.' of the '.
$counts->{$req.'_'.$type}.' '.
$req{$req}.' '.$type{$type});
}
@@ -2449,7 +2488,15 @@ sub question_status_message {
$status .= '.';
if ($counts->{'opt'}) {
$status .= ' You were required to pass '.$counts->{'opt_req'}.
- ' optional component'.($counts->{'opt_req'} == 1?'':'s');
+ ' optional ';
+ if ($counts->{'opt_dim'} + $counts->{'man_dim'} < 1) {
+ $status .=
+ ($counts->{'opt_req'} == 1?'criterion':'criteria');
+ } else {
+ $status .=
+ 'component'.($counts->{'opt_req'} == 1?'':'s');
+ }
+ $status .= '.';
}
return $status;
}
@@ -2789,11 +2836,13 @@ sub proctor_validation_screen {
.'';
}
if (!$env{'form.proctordomain'}) { $env{'form.proctordomain'}=$domain; }
+ my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
+ $uri = &HTML::Entities::encode($uri,'<>&"');
my $result= (<
Proctor Validation
Your room's proctor needs to validate your access to this resource.
$msg
-