--- loncom/homework/inputtags.pm 2010/06/05 01:38:43 1.262 +++ loncom/homework/inputtags.pm 2010/06/17 00:13:20 1.264 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.262 2010/06/05 01:38:43 www Exp $ +# $Id: inputtags.pm,v 1.264 2010/06/17 00:13:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -572,8 +572,8 @@ sub valid_award { 'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'INTERNAL_ERROR', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK', 'INVALID_FILETYPE', - 'EXCESS_FILESIZE', 'DRAFT', - 'SUBMITTED', 'SUBMITTED_CREDIT', + 'EXCESS_FILESIZE', 'FILENAME_INUSE', + 'DRAFT', 'SUBMITTED', 'SUBMITTED_CREDIT', 'ANONYMOUS', 'ANONYMOUS_CREDIT', 'ASSIGNED_SCORE', 'APPROX_ANS', 'EXACT_ANS','COMMA_FAIL') { @@ -589,7 +589,8 @@ sub valid_award { 'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT', 'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', 'INTERNAL_ERROR', 'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK', - 'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'DRAFT', 'SUBMITTED', + 'INVALID_FILETYPE', 'EXCESS_FILESIZE', 'FILENAME_INUSE', + 'DRAFT', 'SUBMITTED', 'SUBMITTED_CREDIT', 'ANONYMOUS', 'ANONYMOUS_CREDIT', 'ASSIGNED_SCORE', 'APPROX_ANS', 'EXACT_ANS'); my $i=0; @@ -820,6 +821,16 @@ sub decideoutput { $message = &mt('Submission won\'t be graded. The combined size of submitted files exceeded the amount allowed.'); $css_class=$possible_class{'not_charged_try'}; $button=1; + } elsif ($award eq 'FILENAME_INUSE') { + $message = &mt('You have already uploaded a file with that filename.'); + if ($target eq 'tex') { + $message.= "\\\\\n"; + } else { + $message .= '
'; + } + $message .= &mt('Please use a different file name.'); + $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."); $css_class=$possible_class{'not_charged_try'}; @@ -1255,15 +1266,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::type eq 'surveycred' || - $Apache::lonhomework::type eq 'anonsurvey' || - $Apache::lonhomework::type eq 'anonsurveycred' || - $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" @@ -1275,7 +1278,7 @@ sub get_grade_messages { $trystr = '\vskip 0 mm '; } } else { - $trystr = ''.$tries_text." $tries"; + $trystr = ''.&mt($tries_text)." $tries"; if ($Apache::lonhomework::parsing_a_task) { } elsif($env{'request.state'} ne 'construct') { $trystr.="/$maxtries"; @@ -1362,7 +1365,13 @@ sub previous_tries { foreach my $i (1..$Apache::lonhomework::history{'version'}) { my $prefix = $i.":resource.$id"; - + my $is_anon; + if (defined($env{'form.grade_symb'})) { + if (($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurvey') || + ($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurveycred')) { + $is_anon = 1; + } + } next if (!exists($Apache::lonhomework::history{"$prefix.award"})); $count++; $count_lookup{$i} = $count; @@ -1407,7 +1416,11 @@ sub previous_tries { $submission = $Apache::lonhomework::history{"$prefix.submission"}; } - $output.=''.$submission.''; + if ($is_anon) { + $output.=''.&mt('(only shown to submitter)').''; + } else { + $output.=''.$submission.''; + } } else { $output.=''; } @@ -1425,8 +1438,9 @@ sub previous_tries { $output.='
'; my $windowopen=&Apache::lonhtmlcommon::javascript_docopen(); + my $tries_text = &get_tries_text('link'); my $start_page = - &Apache::loncommon::start_page('Previous Tries', undef, + &Apache::loncommon::start_page($tries_text, undef, {'only_body' => 1, 'bgcolor' => '#FFFFFF', 'js_ready' => 1, @@ -1441,12 +1455,34 @@ sub previous_tries { // -".&mt("Previous Tries")."
"; +".&mt($tries_text)."
"; #use Data::Dumper; #&Apache::lonnet::logthis(&Dumper(\%Apache::inputtags::submission_display)); return $result; } +sub get_tries_text { + my ($context) = @_; + my $tries_text; + if ($context eq 'link') { + $tries_text = 'Previous Tries'; + } else { + $tries_text = 'Tries'; + } + if ( $Apache::lonhomework::type eq 'survey' || + $Apache::lonhomework::type eq 'surveycred' || + $Apache::lonhomework::type eq 'anonsurvey' || + $Apache::lonhomework::type eq 'anonsurveycred' || + $Apache::lonhomework::parsing_a_task) { + if ($context eq 'link') { + $tries_text = 'Previous Submissions'; + } else { + $tries_text = 'Submissions'; + } + } + return $tries_text; +} + 1; __END__