Skip to content
Permalink
Browse files

MDL-33041 (5) TinyMCE: Move spellchecker plugin as well

  • Loading branch information...
sammarshallou authored and skodak committed Aug 9, 2012
1 parent 2049033 commit 9b63a155fe0c28434a1064baea3f8177fd4cec96
Showing with 549 additions and 486 deletions.
  1. +8 −8 lib/editor/tinymce/lib.php
  2. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/changelog.txt
  3. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/EnchantSpell.php
  4. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/GoogleSpell.php
  5. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/PSpell.php
  6. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/PSpellShell.php
  7. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/SpellChecker.php
  8. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/utils/JSON.php
  9. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/classes/utils/Logger.php
  10. +58 −0 lib/editor/tinymce/plugins/spellchecker/config.php
  11. 0 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/includes/general.php
  12. +46 −0 lib/editor/tinymce/plugins/spellchecker/lib.php
  13. +1 −1 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/spellchecker/rpc.php
  14. 0 ...or/tinymce/{tiny_mce/3.5.4.1/plugins/spellchecker → plugins/spellchecker/tinymce}/css/content.css
  15. +436 −436 ....5.4.1/plugins/spellchecker/editor_plugin_src.js → plugins/spellchecker/tinymce/editor_plugin.js}
  16. BIN ...itor/tinymce/{tiny_mce/3.5.4.1/plugins/spellchecker → plugins/spellchecker/tinymce}/img/wline.gif
  17. +0 −40 lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/spellchecker/config.php
  18. +0 −1 lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/spellchecker/editor_plugin.js
@@ -97,13 +97,11 @@ protected function get_init_params($elementid, array $options=null) {
$config = get_config('editor_tinymce');
$spelllanguagelist = empty($config->spelllanguagelist) ? '' : $config->spelllanguagelist;
$spellbutton = ($spelllanguagelist === '') ? '' : ',spellchecker';
$fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist;
$fontbutton = ($fontselectlist === '') ? '' : 'fontselect,';
$params = array(
'moodle_config' => $config,
'mode' => "exact",
'elements' => $elementid,
'relative_urls' => false,
@@ -122,7 +120,7 @@ protected function get_init_params($elementid, array $options=null) {
'plugins' => 'advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,' .
'searchreplace,paste,directionality,fullscreen,nonbreaking,contextmenu,' .
'insertdatetime,save,iespell,preview,print,noneditable,visualchars,' .
'xhtmlxtras,template,pagebreak,spellchecker',
'xhtmlxtras,template,pagebreak',
'theme_advanced_font_sizes' => "1,2,3,4,5,6,7",
'theme_advanced_layout_manager' => "SimpleLayout",
'theme_advanced_toolbar_align' => "left",
@@ -132,16 +130,14 @@ protected function get_init_params($elementid, array $options=null) {
'justifyleft,justifycenter,justifyright,|,' .
'cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl',
'theme_advanced_buttons3' => 'bullist,numlist,outdent,indent,|,' .
'link,unlink,|,image,nonbreaking,charmap,table,|,code' . $spellbutton,
'link,unlink,|,image,nonbreaking,charmap,table,|,code',
'theme_advanced_fonts' => $fontselectlist,
'theme_advanced_resize_horizontal' => true,
'theme_advanced_resizing' => true,
'theme_advanced_resizing_min_height' => 30,
'min_height' => 30,
'theme_advanced_toolbar_location' => "top",
'theme_advanced_statusbar_location' => "bottom",
'spellchecker_rpc_url' => $CFG->httpswwwroot."/lib/editor/tinymce/tiny_mce/$this->version/plugins/spellchecker/rpc.php",
'spellchecker_languages' => $spelllanguagelist
);
if (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted'])) {
@@ -164,8 +160,12 @@ protected function get_init_params($elementid, array $options=null) {
$params['init_instance_callback'] = 'M.editor_tinymce.onblur_event';
}
// Allow plugins to adjust parameters, then return.
// Allow plugins to adjust parameters.
editor_tinymce_plugin::all_update_init_params($params, $context, $options);
// Remove temporary parameters.
unset($params['moodle_config']);
return $params;
}
@@ -0,0 +1,58 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Spellchecker configuration. (Has been rewritten for Moodle.)
*
* @package tinymce_spellchecker
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../../../../config.php');
@error_reporting(E_ALL ^ E_NOTICE); // hide notices even if Moodle is configured to show them
// General settings
$config['general.engine'] = get_config('editor_tinymce', 'spellengine') ?
get_config('editor_tinymce', 'spellengine') : 'GoogleSpell';
//$config['general.engine'] = 'PSpell';
//$config['general.engine'] = 'PSpellShell';
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
// GoogleSpell settings
$config['GoogleSpell.proxyhost'] = isset($CFG->proxyhost) ? $CFG->proxyhost : '';
$config['GoogleSpell.proxyport'] = isset($CFG->proxyport) ? $CFG->proxyport : '';
$config['GoogleSpell.proxytype'] = isset($CFG->proxytype) ? $CFG->proxytype : 'HTML';
$config['GoogleSpell.proxyuser'] = isset($CFG->proxyuser) ? $CFG->proxyuser : '';
$config['GoogleSpell.proxypassword'] = isset($CFG->proxypassword) ? $CFG->proxypassword : '';
if ($config['general.engine'] === 'PSpell' || $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'] = $CFG->aspellpath;
$config['PSpellShell.tmp'] = '/tmp';
// Windows PSpellShell settings
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
//$config['PSpellShell.tmp'] = 'c:/temp';
}
@@ -0,0 +1,46 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/**
* Plugin for spell checking (Moodle custom replacement for standard TinyMCE
* plugin, but with same name, which seems a bit unhelpful).
*
* @package tinymce_spellchecker
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tinymce_spellchecker extends editor_tinymce_plugin {
protected function update_init_params(array &$params, context $context,
array $options = null) {
global $CFG;
// Check at least one language is supported.
$config = $params['moodle_config'];
$spelllanguagelist = empty($config->spelllanguagelist) ? '' : $config->spelllanguagelist;
if ($spelllanguagelist !== '') {
// Add button after code button in advancedbuttons3.
$added = $this->add_button_after($params, 3, 'spellchecker', 'code', false);
// Add JS file, which uses default name.
$this->add_js_plugin($params);
$params['spellchecker_rpc_url'] = $CFG->httpswwwroot .
'/lib/editor/tinymce/plugins/spellchecker/rpc.php';
$params['spellchecker_languages'] = $spelllanguagelist;
}
}
}
@@ -4,7 +4,7 @@
*
* @package MCManager.includes
* @author Moxiecode
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright 2004-2007, Moxiecode Systems AB, All rights reserved.
*/
require_once("./includes/general.php");

0 comments on commit 9b63a15

Please sign in to comment.
You can’t perform that action at this time.