version 1.8, 2004/12/02 16:40:00
|
version 1.13, 2006/03/21 20:19:41
|
Line 33 package Apache::lonspeller;
|
Line 33 package Apache::lonspeller;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Text::Aspell; |
use Text::Aspell; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
use Apache::lontexconvert(); |
use Apache::lontexconvert(); |
use HTML::LCParser; |
use HTML::LCParser; |
use strict; |
use strict; |
Line 41 my $speller;
|
Line 42 my $speller;
|
my $insidelink; |
my $insidelink; |
|
|
sub spellcheck_language { |
sub spellcheck_language { |
if ($ENV{'form.lang'}) { return $ENV{'form.lang'}; } |
if ($env{'form.lang'}) { return $env{'form.lang'}; } |
if (&mt('spellcheck_lang') ne 'spellcheck_lang') { |
if (&mt('spellcheck_lang') ne 'spellcheck_lang') { |
return &mt('spellcheck_lang'); |
return &mt('spellcheck_lang'); |
} |
} |
Line 65 sub textsection {
|
Line 66 sub textsection {
|
my $suggestions=join(' ',$speller->suggest($word)); |
my $suggestions=join(' ',$speller->suggest($word)); |
$suggestions=~s/\'/\\\'/gs; |
$suggestions=~s/\'/\\\'/gs; |
if (($suggestions) && (!$insidelink)) { |
if (($suggestions) && (!$insidelink)) { |
|
my $start_page= |
|
&Apache::loncommon::start_page('Speller Suggestions',undef, |
|
{'only_body' => 1, |
|
'js_ready' => 1, |
|
'bgcolor' => '#FFFFFF'}); |
|
my $end_page= |
|
&Apache::loncommon::end_page({'js_ready' => 1}); |
$output.='<a href="javascript:spellwin=window.open('. |
$output.='<a href="javascript:spellwin=window.open('. |
&Apache::lonhtmlcommon::javascript_nothing(). |
&Apache::lonhtmlcommon::javascript_nothing(). |
',\'spellwin\',\'height=140,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no\');'. |
',\'spellwin\',\'height=140,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no\');'. |
'spellwin.'.&Apache::lonhtmlcommon::javascript_docopen.';spellwin.document.writeln(\'<html><body><h3>'.$word. |
'spellwin.'.&Apache::lonhtmlcommon::javascript_docopen().';spellwin.document.writeln(\''.$start_page.'<h3>'.$word. |
'</h3>'.$suggestions.'</body></html>\');spellwin.document.close();spellwin.focus()">'; |
'</h3>'.$suggestions.$end_page.'\');spellwin.document.close();spellwin.focus()">'; |
} |
} |
$output.='<font color="red">'.$word.'</font>'; |
$output.='<font color="red">'.$word.'</font>'; |
if (($suggestions) && (!$insidelink)) { $output.='</a>'; } |
if (($suggestions) && (!$insidelink)) { $output.='</a>'; } |
Line 126 sub handler {
|
Line 134 sub handler {
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
|
&initspeller(); |
&initspeller(); |
$r->print('<html><head><title>'. |
my $html = &Apache::lonxml::xmlbegin(); |
&mt('Spell Checker'). |
my $head = &Apache::loncommon::head('Spell Checker'); |
'</title></head><body bgcolor="#DDDDDD">'. |
$r->print($html.$head.'<body bgcolor="#DDDDDD">'. |
&Apache::lontexconvert::msgtexconverted( |
&Apache::lontexconvert::msgtexconverted( |
&markeduptext($ENV{'form.text'})). |
&markeduptext($env{'form.text'})). |
'</body></html>'); |
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|