Commit 75797883 authored by Aaron Wells's avatar Aaron Wells
Browse files

Replace obsolete TinyMCE GoogleSpell with in-browser spellcheck as default

Bug 1212541: The web service the TinyMCE GoogleSpell code was using,
is no longer in existence. This patch changes things so that TinyMCE will
let the browser's spellchecker work, by default.

The "pathtoaspell" is now null by default. If pathtoaspell is null, we
eliminate the TinyMCE spellcheck button and set the "gecko_spellcheck"
flag to let the browser spellcheck work. If pathtoaspell is not null,
we show the TinyMCE spellcheck button as before.

Change-Id: I9fd2b12169669d3d9705a1e23dc6c03af6f01948
parent 596273a5
<?php
/**
* config.php
*
* @package MCManager.includes
*/
// General settings
$config['general.engine'] = 'GoogleSpell';
//$config['general.engine'] = 'PSpell';
//$config['general.engine'] = 'PSpellShell';
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
define('INTERNAL', 1);
require_once(dirname(__FILE__).'/../../../../init.php');
$aspellpath = get_config('pathtoaspell');
if (file_exists($aspellpath) && is_executable($aspellpath)) {
$config['general.engine'] = 'PSpellShell';
}
// PSpell settings
$config['PSpell.mode'] = 'PSPELL_FAST';
$config['PSpell.spelling'] = "";
$config['PSpell.jargon'] = "";
$config['PSpell.encoding'] = "";
// PSpellShell settings
$config['PSpellShell.mode'] = 'PSPELL_FAST';
$config['PSpellShell.aspell'] = $aspellpath;
$config['PSpellShell.tmp'] = '/tmp';
// Windows PSpellShell settings
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
//$config['PSpellShell.tmp'] = 'c:/temp';
?>
<?php
/**
* config.php
*
* @package MCManager.includes
*/
define('INTERNAL', 1);
require_once(dirname(__FILE__).'/../../../../init.php');
$aspellpath = get_config('pathtoaspell');
if (file_exists($aspellpath) && is_executable($aspellpath)) {
$config['general.engine'] = 'PSpellShell';
}
else {
throw FeatureNotEnabledException;
}
// PSpell settings
$config['PSpell.mode'] = 'PSPELL_FAST';
$config['PSpell.spelling'] = "";
$config['PSpell.jargon'] = "";
$config['PSpell.encoding'] = "";
// PSpellShell settings
$config['PSpellShell.mode'] = 'PSPELL_FAST';
$config['PSpellShell.aspell'] = $aspellpath;
$config['PSpellShell.tmp'] = '/tmp';
// Windows PSpellShell settings
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
//$config['PSpellShell.tmp'] = 'c:/temp';
......@@ -273,9 +273,11 @@ $cfg->maximageresizememory = 104857600;
/**
* Paths and arguments for various system commands
*
* @global string $cfg->pathtoaspell Used by the TinyMCE spellchecker
* @global string $cfg->pathtoaspell Set this path to use the TinyMCE Spellcheck button in place of the
* browser's built-in spellchecker.
*/
$cfg->pathtoaspell = '/usr/bin/aspell';
//$cfg->pathtoaspell = '/usr/bin/aspell';
/**
* @global $cfg->pathtoclam The path to the ClamAV executable (clamscan or clamdscan); disabled by default
*/
......
......@@ -122,9 +122,20 @@ function smarty($javascript = array(), $headers = array(), $pagestrings = array(
}
$extrasetup = isset($extraconfig['tinymcesetup']) ? $extraconfig['tinymcesetup'] : '';
// Check whether to make the spellchecker available
$aspellpath = get_config('pathtoaspell');
if ($aspellpath && file_exists($aspellpath) && is_executable($aspellpath)) {
$spellchecker = ',spellchecker';
$spellchecker_config = "gecko_spellcheck : false, spellchecker_rpc_url : \"{$jsroot}tinymce/plugins/spellchecker/rpc.php\",";
}
else {
$spellchecker = '';
$spellchecker_config = 'gecko_spellcheck : true,';
}
$adv_buttons = array(
"undo,redo,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,link,unlink,separator,code,fullscreen",
"bold,italic,underline,strikethrough,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,hr,emotions,image,spellchecker,cleanup,separator,link,unlink,separator,code,fullscreen",
"bold,italic,underline,strikethrough,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,hr,emotions,image{$spellchecker},cleanup,separator,link,unlink,separator,code,fullscreen",
"undo,redo,separator,bullist,numlist,separator,tablecontrols,separator,cut,copy,paste,pasteword",
"fontselect,separator,fontsizeselect,separator,formatselect",
);
......@@ -134,18 +145,17 @@ function smarty($javascript = array(), $headers = array(), $pagestrings = array(
$toolbar_align = 'left';
if ($check[$key] == 'tinymce') {
$spellchecker_rpc = $jsroot.'tinymce/plugins/spellchecker/rpc.php';
$tinymce_config = <<<EOF
mode: "none",
theme: "advanced",
plugins: "table,emotions,spellchecker,inlinepopups,paste,fullscreen",
plugins: "table,emotions,inlinepopups,paste,fullscreen{$spellchecker}",
theme_advanced_buttons1 : "{$adv_buttons[1]}",
theme_advanced_buttons2 : "{$adv_buttons[2]}",
theme_advanced_buttons3 : "{$adv_buttons[3]}",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "{$toolbar_align}",
fix_list_elements: true,
spellchecker_rpc_url : "{$spellchecker_rpc}",
{$spellchecker_config}
//width: '512',
EOF;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment