--- loncom/homework/inputtags.pm 2008/12/11 14:52:30 1.253
+++ loncom/homework/inputtags.pm 2010/06/06 21:42:04 1.263
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.253 2008/12/11 14:52:30 bisitz Exp $
+# $Id: inputtags.pm,v 1.263 2010/06/06 21:42:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -388,12 +388,13 @@ sub start_textline {
&& $Apache::lonhomework::type ne 'exam') {
my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
if ($size != 0) {$size=$size*2; $size.=' mm';} else {$size='40 mm';}
- if ($env{'form.pdfFormFields'} eq 'yes') {
+ if ($env{'form.pdfFormFields'} eq 'yes'
+ && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
my $fieldname = $env{'request.symb'}.
'&part_'. $Apache::inputtags::part.
'&textresponse'.
'&HWVAL_' . $Apache::inputtags::response['-1'];
- $result="\n\\\\\n".'\textField{'.$fieldname.'}{'.$size.'}{12 bp}';
+ $result='\textField{'.$fieldname.'}{'.$size.'}{12 bp}';
} else {
$result='\framebox['.$size.'][s]{\tiny\strut}';
}
@@ -572,8 +573,10 @@ sub valid_award {
'BAD_FORMULA', 'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT',
'MISORDERED_RANK', 'INVALID_FILETYPE',
'EXCESS_FILESIZE', 'DRAFT',
- 'SUBMITTED', 'ASSIGNED_SCORE',
- 'APPROX_ANS', 'EXACT_ANS','COMMA_FAIL') {
+ 'SUBMITTED', 'SUBMITTED_CREDIT',
+ 'ANONYMOUS', 'ANONYMOUS_CREDIT',
+ 'ASSIGNED_SCORE', 'APPROX_ANS',
+ 'EXACT_ANS','COMMA_FAIL') {
if ($award eq $possibleaward) { return 1; }
}
return 0;
@@ -587,6 +590,7 @@ sub valid_award {
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'INTERNAL_ERROR',
'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK',
'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'DRAFT', 'SUBMITTED',
+ 'SUBMITTED_CREDIT', 'ANONYMOUS', 'ANONYMOUS_CREDIT',
'ASSIGNED_SCORE', 'APPROX_ANS', 'EXACT_ANS');
my $i=0;
my %fwd_awards = map { ($_,$i++) } @awards;
@@ -610,7 +614,7 @@ sub hide_award {
return 1;
}
if ($award =~
- /^(?:EXACT_ANS|APPROX_ANS|SUBMITTED|ASSIGNED_SCORE|INCORRECT)/) {
+ /^(?:EXACT_ANS|APPROX_ANS|SUBMITTED|SUBMITTED_CREDIT|ANONYMOUS|ANONYMOUS_CREDIT|ASSIGNED_SCORE|INCORRECT)/) {
return 1;
}
return 0;
@@ -735,7 +739,7 @@ sub decideoutput {
'.disable_receipt_display'} ne 'yes') &&
($Apache::lonhomework::type ne 'practice')) {
$message.=(($target eq 'web')?'
':' ').
- &mt('Your receipt is [_1]',
+ &mt('Your receipt no. is [_1]',
(&Apache::lonnet::receipt($Apache::inputtags::part).
(($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'')));
}
@@ -817,7 +821,7 @@ sub decideoutput {
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'INVALID_FILETYPE') {
- $message = &mt('Submission won\'t be graded. The type of file submitted is not allowed.');
+ $message = &mt("Submission won't be graded. The type of file submitted is not allowed.");
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'SIG_FAIL') {
@@ -871,8 +875,19 @@ sub decideoutput {
$message = &mt("Your submission has been recorded.");
$css_class=$possible_class{'no_grade'};
$button=1;
+ } elsif ($award eq 'SUBMITTED_CREDIT') {
+ $message = &mt("Your submission has been recorded, and credit awarded.");
+ $css_class=$possible_class{'correct'};
+ $button=1;
+ } elsif ($award eq 'ANONYMOUS') {
+ $message = &mt("Your anonymous submission has been recorded.");
+ $css_class=$possible_class{'no_grade'};
+ $button=1;
+ } elsif ($award eq 'ANONYMOUS_CREDIT') {
+ $message = &mt("Your anonymous submission has been recorded, and credit awarded.");
+ $css_class=$possible_class{'correct'};
} elsif ($award eq 'DRAFT') {
- $message = &mt("A draft copy has been saved.");
+ $message = &mt("Copy saved but not submitted.");
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'ASSIGNED_SCORE') {
@@ -894,14 +909,27 @@ sub decideoutput {
my (undef,undef,$domain,$user)=&Apache::lonnet::whichuser();
foreach my $resid(@Apache::inputtags::response){
if ($Apache::lonhomework::history{"resource.$part.$resid.handback"}) {
- $message.='
';
+ if ($target eq 'tex') {
+ $message.= "\\\\\n";
+ } else {
+ $message.='
';
+ }
my @files = split(/\s*,\s*/,
$Apache::lonhomework::history{"resource.$part.$resid.handback"});
my $file_msg;
foreach my $file (@files) {
- $file_msg.= '
'.$file.'';
+ if ($target eq 'tex') {
+ $file_msg.= "\\\\\n".$file;
+ } else {
+ $file_msg.= '
'.$file.'';
+ }
}
$message .= &mt('Returned file(s): [_1]',$file_msg);
+ if ($target eq 'tex') {
+ $message.= "\\\\\n";
+ } else {
+ $message.='
';
+ }
}
}
@@ -1021,6 +1049,18 @@ sub setgradedata {
$Apache::lonhomework::results{"resource.$id.solved"} =
$solvemsg;
$Apache::lonhomework::results{"resource.$id.awarded"} = '1';
+ } elsif ( $award eq 'SUBMITTED_CREDIT' ) {
+ $Apache::lonhomework::results{"resource.$id.tries"} =
+ $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+ $Apache::lonhomework::results{"resource.$id.solved"} =
+ 'credit_attempted';
+ $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
+ } elsif ( $award eq 'ANONYMOUS_CREDIT' ) {
+ $Apache::lonhomework::results{"resource.$id.tries"} =
+ $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+ $Apache::lonhomework::results{"resource.$id.solved"} =
+ 'credit_attempted';
+ $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
} elsif ( $award eq 'INCORRECT' ) {
$Apache::lonhomework::results{"resource.$id.tries"} =
$Apache::lonhomework::history{"resource.$id.tries"} + 1;
@@ -1035,6 +1075,11 @@ sub setgradedata {
$Apache::lonhomework::history{"resource.$id.tries"} + 1;
$Apache::lonhomework::results{"resource.$id.solved"} =
'ungraded_attempted';
+ } elsif ( $award eq 'ANONYMOUS' ) {
+ $Apache::lonhomework::results{"resource.$id.tries"} =
+ $Apache::lonhomework::history{"resource.$id.tries"} + 1;
+ $Apache::lonhomework::results{"resource.$id.solved"} =
+ 'ungraded_attempted';
} elsif ( $award eq 'DRAFT' ) {
$Apache::lonhomework::results{"resource.$id.solved"} = '';
} elsif ( $award eq 'NO_RESPONSE' ) {
@@ -1094,6 +1139,10 @@ sub setgradedata {
if ($award eq 'SUBMITTED') {
&Apache::response::add_to_gradingqueue();
}
+ if (($Apache::lonhomework::type eq 'anonsurvey') ||
+ ($Apache::lonhomework::type eq 'anonsurveycred')) {
+ $Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type;
+ }
}
sub find_which_previous {
@@ -1206,12 +1255,7 @@ sub get_grade_messages {
if ( $tries eq '' ) { $tries = '0'; }
if ( $maxtries eq '' ) { $maxtries = '2'; }
if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; }
- my $tries_text=&mt('Tries');
- if ( $Apache::lonhomework::type eq 'survey' ||
- $Apache::lonhomework::parsing_a_task) {
- $tries_text=&mt('Submissions');
- }
-
+ my $tries_text= &get_tries_text();;
if ($showbutton) {
if ($target eq 'tex') {
if ($env{'request.state'} ne "construct"
@@ -1223,7 +1267,7 @@ sub get_grade_messages {
$trystr = '\vskip 0 mm ';
}
} else {
- $trystr = '