[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm
raeburn
raeburn at source.lon-capa.org
Fri Dec 28 13:22:13 EST 2012
raeburn Fri Dec 28 18:22:13 2012 EDT
Modified files:
/loncom/homework inputtags.pm
Log:
- Spell checking for textareas: supported languages:
en, de, es, fr, he, pt, tr.
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.313 loncom/homework/inputtags.pm:1.314
--- loncom/homework/inputtags.pm:1.313 Fri Dec 28 16:12:07 2012
+++ loncom/homework/inputtags.pm Fri Dec 28 18:22:13 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.313 2012/12/28 16:12:07 raeburn Exp $
+# $Id: inputtags.pm,v 1.314 2012/12/28 18:22:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -266,8 +266,9 @@
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',
@@ -461,8 +462,9 @@
'addchars',$token,10);
$result.=&Apache::edit::select_arg('Readonly:','readonly',
['no','yes'],$token);
+ my $spell_langs = &spelling_languages();
$result.=&Apache::edit::select_arg("Spellcheck for: ", 'spellcheck',
- ['none', 'en', 'de', 'fr'], $token);
+ $spell_langs, $token);
$result.=&Apache::edit::end_row();
$result.=&Apache::edit::end_table();
} elsif ($target eq 'modified') {
@@ -1755,6 +1757,21 @@
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__
More information about the LON-CAPA-cvs
mailing list