mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-34877 add tinymce subplugin setting support
Includes migration of spell related settings to spellchecker plugin.
This commit is contained in:
parent
d71c486507
commit
116ad39b7a
11 changed files with 243 additions and 15 deletions
|
@ -27,8 +27,11 @@ 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';
|
||||
$engine = get_config('tinymce_spellchecker', 'spellengine');
|
||||
if (!$engine) {
|
||||
$engine = 'GoogleSpell';
|
||||
}
|
||||
$config['general.engine'] = $engine;
|
||||
|
||||
// GoogleSpell settings
|
||||
$config['GoogleSpell.proxyhost'] = isset($CFG->proxyhost) ? $CFG->proxyhost : '';
|
||||
|
|
32
lib/editor/tinymce/plugins/spellchecker/db/install.php
Normal file
32
lib/editor/tinymce/plugins/spellchecker/db/install.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?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 post install script.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_tinymce_spellchecker_install() {
|
||||
global $CFG, $DB;
|
||||
require_once(__DIR__.'/upgradelib.php');
|
||||
|
||||
tinymce_spellchecker_migrate_settings();
|
||||
}
|
40
lib/editor/tinymce/plugins/spellchecker/db/upgrade.php
Normal file
40
lib/editor/tinymce/plugins/spellchecker/db/upgrade.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?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 upgrade script.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_tinymce_spellchecker_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
require_once(__DIR__.'/upgradelib.php');
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2012051800) {
|
||||
tinymce_spellchecker_migrate_settings();
|
||||
upgrade_plugin_savepoint(true, 2012051800, 'tinymce', 'spellchecker');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
41
lib/editor/tinymce/plugins/spellchecker/db/upgradelib.php
Normal file
41
lib/editor/tinymce/plugins/spellchecker/db/upgradelib.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?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 upgrade script.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Migrate spell related settings from tinymce.
|
||||
*/
|
||||
function tinymce_spellchecker_migrate_settings() {
|
||||
$engine = get_config('editor_tinymce', 'spellengine');
|
||||
if ($engine !== false) {
|
||||
set_config('spellengine', $engine, 'tinymce_spellchecker');
|
||||
unset_config('spellengine', 'editor_tinymce');
|
||||
}
|
||||
$list = get_config('editor_tinymce', 'spelllanguagelist');
|
||||
if ($list !== false) {
|
||||
set_config('spelllanguagelist', $list, 'tinymce_spellchecker');
|
||||
unset_config('spelllanguagelist', 'editor_tinymce');
|
||||
}
|
||||
}
|
|
@ -30,8 +30,7 @@ class tinymce_spellchecker extends editor_tinymce_plugin {
|
|||
global $CFG;
|
||||
|
||||
// Check at least one language is supported.
|
||||
$config = $params['moodle_config'];
|
||||
$spelllanguagelist = empty($config->spelllanguagelist) ? '' : $config->spelllanguagelist;
|
||||
$spelllanguagelist = $this->get_config('spelllanguagelist', '');
|
||||
if ($spelllanguagelist !== '') {
|
||||
// Add button after code button in advancedbuttons3.
|
||||
$added = $this->add_button_after($params, 3, 'spellchecker', 'code', false);
|
||||
|
|
38
lib/editor/tinymce/plugins/spellchecker/settings.php
Normal file
38
lib/editor/tinymce/plugins/spellchecker/settings.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?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 settings.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
$options = array(
|
||||
'PSpell'=>'PSpell',
|
||||
'GoogleSpell'=>'Google Spell',
|
||||
'PSpellShell'=>'PSpellShell');
|
||||
$settings->add(new admin_setting_configselect('tinymce_spellchecker/spellengine',
|
||||
get_string('spellengine', 'admin'), '', 'GoogleSpell', $options));
|
||||
$settings->add(new admin_setting_configtextarea('tinymce_spellchecker/spelllanguagelist',
|
||||
get_string('spelllanguagelist', 'admin'), '',
|
||||
'+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,' .
|
||||
'Portuguese=pt,Spanish=es,Swedish=sv', PARAM_RAW));
|
||||
}
|
|
@ -25,7 +25,7 @@
|
|||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2012051701;
|
||||
$plugin->version = 2012051800;
|
||||
// Required Moodle version.
|
||||
$plugin->requires = 2011112900;
|
||||
// Full name of the plugin (used for diagnostics).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue