version 1.15, 2006/03/23 23:43:13
|
version 1.17, 2006/07/03 13:40:42
|
Line 54 sub set_language {
|
Line 54 sub set_language {
|
$speller->set_option('lang',$lang); |
$speller->set_option('lang',$lang); |
} |
} |
|
|
|
{ |
|
my $uniq; |
|
sub get_uniq { |
|
return ++$uniq; |
|
} |
|
} |
|
|
sub textsection { |
sub textsection { |
my $input=shift; |
my $input=shift; |
my $output=''; |
my $output=''; |
Line 64 sub textsection {
|
Line 71 sub textsection {
|
$output.=$word; |
$output.=$word; |
} else { |
} else { |
my $suggestions=join(' ',$speller->suggest($word)); |
my $suggestions=join(' ',$speller->suggest($word)); |
$suggestions=~s/\'/\\\'/gs; |
$suggestions = &Apache::loncommon::js_ready($suggestions); |
if (($suggestions) && (!$insidelink)) { |
if (($suggestions) && (!$insidelink)) { |
my $start_page= |
my $start_page= |
&Apache::loncommon::start_page('Speller Suggestions',undef, |
&Apache::loncommon::start_page('Speller Suggestions',undef, |
{'only_body' => 1, |
{'only_body' => 1, |
'js_ready' => 1, |
'js_ready' => 1, |
'html_encode' => 1, |
|
'bgcolor' => '#FFFFFF'}); |
'bgcolor' => '#FFFFFF'}); |
my $end_page= |
my $end_page= |
&Apache::loncommon::end_page({'js_ready' => 1, |
&Apache::loncommon::end_page({'js_ready' => 1,}); |
'html_encode' => 1,}); |
my $num = &get_uniq(); |
$output.='<a href="javascript:spellwin=window.open('. |
my $info ='<h3>'.$word.'</h3>'.$suggestions; |
&Apache::lonhtmlcommon::javascript_nothing(). |
$output .= "<script type=\"text/javascript\"> |
',\'spellwin\',\'height=140,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no\');'. |
//<!-- |
'spellwin.'.&Apache::lonhtmlcommon::javascript_docopen().';spellwin.document.writeln(\''.$start_page.'<h3>'.$word. |
function LONCAPA_lonspeller_$num() { |
'</h3>'.$suggestions.$end_page.'\');spellwin.document.close();spellwin.focus()">'; |
spellwin=open(".&Apache::lonhtmlcommon::javascript_nothing().",'spellwin','width=140,height=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
|
spellwin.".&Apache::lonhtmlcommon::javascript_docopen()."; |
|
spellwin.document.writeln('$start_page $info $end_page'); |
|
spellwin.document.close(); |
|
spellwin.focus(); |
|
} |
|
//--> |
|
</script><a href=\"javascript:LONCAPA_lonspeller_$num();void(0);\">"; |
} |
} |
$output.='<font color="red">'.$word.'</font>'; |
$output.='<font color="red">'.$word.'</font>'; |
if (($suggestions) && (!$insidelink)) { $output.='</a>'; } |
if (($suggestions) && (!$insidelink)) { $output.='</a>'; } |