--- loncom/homework/inputtags.pm 2012/12/19 17:35:34 1.312 +++ loncom/homework/inputtags.pm 2013/04/30 03:03:34 1.317 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.312 2012/12/19 17:35:34 raeburn Exp $ +# $Id: inputtags.pm,v 1.317 2013/04/30 03:03:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -216,7 +216,16 @@ sub start_textfield { } } unless ($newvariation) { - $oldresponse = $Apache::lonhomework::history{"resource.$partid.$resid.submission"}; + if ((($env{'form.grade_username'} eq '') && ($env{'form.grade_domain'} eq '')) || + (($env{'form.grade_username'} eq $env{'user.name'}) && + ($env{'form.grade_domain'} eq $env{'user.domain'}))) { + $oldresponse = $Apache::lonhomework::history{"resource.$partid.$resid.submission"}; + } elsif (($Apache::lonhomework::history{"resource.$partid.type"} eq 'anonsurvey') || + ($Apache::lonhomework::history{"resource.$partid.type"} eq 'anonsurveycred')) { + $oldresponse = '* '.&mt('only shown to submitter').' *'; + } else { + $oldresponse = $Apache::lonhomework::history{"resource.$partid.$resid.submission"}; + } } if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval); @@ -266,8 +275,9 @@ sub start_textfield { my $bodytext=&Apache::lonxml::get_all_text("/textfield",$parser, $style); $result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2); + my $spell_langs = &spelling_languages(); $result .= &Apache::edit::select_arg('Spellcheck for:', 'spellcheck', - ['none', 'en', 'de', 'fr'], $token); + $spell_langs, $token); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'rows','cols', @@ -286,12 +296,18 @@ sub start_textfield { for (my $i=0;$i[$#Apache::inputtags::inputlist]; @@ -455,8 +482,9 @@ sub start_textline { 'addchars',$token,10); $result.=&Apache::edit::select_arg('Readonly:','readonly', ['no','yes'],$token); - $result.=&Apache::edit::select_arg("Spellcheck for: ", 'spellcheck', - ['none', 'en', 'de', 'fr'], $token); + my $spell_langs = &spelling_languages(); + $result.=&Apache::edit::select_arg('Spellcheck for:', 'spellcheck', + $spell_langs, $token); $result.=&Apache::edit::end_row(); $result.=&Apache::edit::end_table(); } elsif ($target eq 'modified') { @@ -1070,7 +1098,7 @@ sub decideoutput { } else { $message .= '
'; } - $message .= &mt('Please use a different file name.'); + $message .= &mt('Please use a different filename.'); $css_class=$possible_class{'not_charged_try'}; $button=1; } elsif ($award eq 'INVALID_FILETYPE') { @@ -1749,6 +1777,21 @@ sub get_tries_text { return $tries_text; } +sub spelling_languages { + my %langchoices; + foreach my $id (&Apache::loncommon::languageids()) { + my $code = &Apache::loncommon::supportedlanguagecode($id); + if ($code ne '') { + $langchoices{$code} = &Apache::loncommon::plainlanguagedescription($id); + } + } + my @spelllangs = ('none'); + foreach my $code ('en','de','he','es','fr','pt','tr') { + push(@spelllangs,[$code,$langchoices{$code}]); + } + return \@spelllangs; +} + 1; __END__