--- loncom/homework/inputtags.pm 2010/06/05 01:38:43 1.262 +++ 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.262 2010/06/05 01:38:43 www Exp $ +# $Id: inputtags.pm,v 1.263 2010/06/06 21:42:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1255,15 +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::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 +1267,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 +1354,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 +1405,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 +1427,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 +1444,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__