mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
"MDL-16639, enable spellchecker plugin, and added config pages"
This commit is contained in:
parent
1fe3281dce
commit
7a856a9330
@ -17,6 +17,7 @@ $action = optional_param('action', '', PARAM_ACTION);
|
||||
$editor = optional_param('editor', '', PARAM_SAFEDIR);
|
||||
|
||||
// get currently installed and enabled auth plugins
|
||||
$settingsurl = "$CFG->wwwroot/$CFG->admin/editors.php?sesskey=".sesskey()."&action=edit&editor=$editor";
|
||||
$available_editors = get_available_editors();
|
||||
if (!empty($editor) and empty($available_editors[$editor])) {
|
||||
redirect ($returnurl);
|
||||
@ -36,6 +37,8 @@ if (!confirm_sesskey()) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
|
||||
$return = true;
|
||||
switch ($action) {
|
||||
case 'disable':
|
||||
// remove from enabled list
|
||||
@ -77,6 +80,37 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
|
||||
$form_file = $CFG->dirroot . '/lib/editor/'.$editor.'/settings.php';
|
||||
if (file_exists($form_file)) {
|
||||
require_once($form_file);
|
||||
$classname = 'editor_settings_' . $editor;
|
||||
$pagename = 'editorsettings' . $editor;
|
||||
admin_externalpage_setup($pagename);
|
||||
$form = new $classname();
|
||||
$data = $form->get_data();
|
||||
// $form->addElement('hidden', 'action', 'edit');
|
||||
if ($form->is_cancelled()){
|
||||
} else if (!empty($data)) {
|
||||
foreach ($data as $key=>$value) {
|
||||
if (strpos($key, 'editor_') === 0) {
|
||||
set_config($key, $value, 'editor');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$form->set_data(array('editor_tinymce_spellengine'=>get_config('editor', 'editor_tinymce_spellengine')));
|
||||
$PAGE->set_pagetype('admin-editors-' . $editor);
|
||||
admin_externalpage_print_header();
|
||||
echo $OUTPUT->heading(get_string('modulename', 'editor_'.$editor));
|
||||
$OUTPUT->box_start();
|
||||
$form->display();
|
||||
$OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
$return = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -88,4 +122,6 @@ if (empty($active_editors)) {
|
||||
|
||||
set_config('texteditors', implode(',', $active_editors));
|
||||
|
||||
redirect ($returnurl);
|
||||
if ($return) {
|
||||
redirect ($returnurl);
|
||||
}
|
||||
|
@ -75,6 +75,14 @@ if ($hassiteconfig) {
|
||||
$temp->add(new admin_setting_manageeditors());
|
||||
$ADMIN->add('editorsettings', $temp);
|
||||
|
||||
$editors_available = get_available_editors();
|
||||
$url = $CFG->wwwroot.'/'.$CFG->admin.'/editors.php?sesskey='.sesskey();
|
||||
foreach ($editors_available as $editor=>$editorstr) {
|
||||
if (file_exists($CFG->dirroot . '/lib/editor/'.$editor.'/settings.php')) {
|
||||
$editor_setting = new admin_externalpage('editorsettings'.$editor, $editorstr, $url.'&action=edit&editor='.$editor);
|
||||
$ADMIN->add('editorsettings', $editor_setting);
|
||||
}
|
||||
}
|
||||
|
||||
/// Filter plugins
|
||||
$ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters')));
|
||||
|
@ -834,6 +834,7 @@ $string['smtpmaxbulk'] = 'SMTP session limit';
|
||||
$string['smtppass'] = 'SMTP password';
|
||||
$string['smtpuser'] = 'SMTP username';
|
||||
$string['soaprecommended'] = 'Installing the optional soap extension is useful for web services and some contrib modules.';
|
||||
$string['spellengine'] = 'Spell engine';
|
||||
$string['stats'] = 'Statistics';
|
||||
$string['statscatdepth'] = 'Maximum parent categories';
|
||||
$string['statsfirstrun'] = 'Maximum processing interval';
|
||||
|
@ -4992,8 +4992,8 @@ class admin_setting_manageeditors extends admin_setting {
|
||||
}
|
||||
|
||||
// settings link
|
||||
if (file_exists($CFG->dirroot.'/editor/'.$editor.'/settings.php')) {
|
||||
$settings = "<a href=\"settings.php?section=editorsetting$editor\">{$txt->settings}</a>";
|
||||
if (file_exists($CFG->dirroot.'/lib/editor/'.$editor.'/settings.php')) {
|
||||
$settings = "<a href='$url&editor=$editor&action=edit'>{$txt->settings}</a>";
|
||||
} else {
|
||||
$settings = '';
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class tinymce_texteditor extends texteditor {
|
||||
'apply_source_formatting' => true,
|
||||
'remove_script_host' => false,
|
||||
'entity_encoding' => "raw",
|
||||
'plugins' => "{$xmedia}advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,searchreplace,paste,directionality,fullscreen,moodlenolink,{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak",
|
||||
'plugins' => "{$xmedia}advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,searchreplace,paste,directionality,fullscreen,moodlenolink,{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak,spellchecker",
|
||||
'theme_advanced_font_sizes' => "1,2,3,4,5,6,7",
|
||||
'theme_advanced_layout_manager' => "SimpleLayout",
|
||||
'theme_advanced_toolbar_align' => "left",
|
||||
@ -121,12 +121,13 @@ class tinymce_texteditor extends texteditor {
|
||||
'theme_advanced_buttons2' => "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,|,cite,abbr,acronym",
|
||||
'theme_advanced_buttons2_add' => "|,selectall,cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl",
|
||||
'theme_advanced_buttons3' => "bullist,numlist,outdent,indent,|,link,unlink,moodlenolink,anchor,|,image,{$xmedia},emotions,{$xdragmath}advhr,nonbreaking,charmap",
|
||||
'theme_advanced_buttons3_add' => "|,table,insertlayer,styleprops,visualchars,|,code,preview",
|
||||
'theme_advanced_buttons3_add' => "|,table,insertlayer,styleprops,visualchars,|,code,preview,spellchecker",
|
||||
'theme_advanced_fonts' => "Trebuchet=Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;Wingdings=wingdings",
|
||||
'theme_advanced_resize_horizontal' => true,
|
||||
'theme_advanced_resizing' => true,
|
||||
'theme_advanced_toolbar_location' => "top",
|
||||
'theme_advanced_statusbar_location' => "bottom",
|
||||
'spellchecker_rpc_url' => $CFG->wwwroot."/lib/editor/tinymce/plugins/spellchecker/rpc.php"
|
||||
);
|
||||
|
||||
if (empty($options['legacy'])) {
|
||||
|
@ -25,6 +25,7 @@ Added:
|
||||
* plugins/gragmath/*
|
||||
* plugins/moodlenolink/*
|
||||
* plugins/moodlemedia/*
|
||||
* plugins/spellchecker/*
|
||||
|
||||
Modified:
|
||||
* Popup.js --> compressed into tiny_mce_popup.js (extra/patches/tinymce_strings.patch)
|
||||
@ -32,7 +33,3 @@ Modified:
|
||||
|
||||
Removed:
|
||||
*
|
||||
|
||||
TODO:
|
||||
* reimplement spellchecker support in plugins/spellchecker/*
|
||||
|
||||
|
22
lib/editor/tinymce/settings.php
Normal file
22
lib/editor/tinymce/settings.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* TinyMCE editor settings moodle form class.
|
||||
*
|
||||
* @copyright 2010 Dongsheng Cai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package moodlecore
|
||||
*/
|
||||
class editor_settings_tinymce extends editor_settings_form {
|
||||
public function definition() {
|
||||
$mform =& $this->_form;
|
||||
$options = array(
|
||||
'PSpell'=>'PSpell',
|
||||
'GoogleSpell'=>'Google Spell',
|
||||
'PSpellShell'=>'PSpellShell');
|
||||
// options must be started with editor_ to get stored
|
||||
$mform->addElement('select', 'editor_tinymce_spellengine', get_string('spellengine', 'admin'), $options);
|
||||
$mform->addElement('hidden', 'editor', 'tinymce');
|
||||
|
||||
parent::definition();
|
||||
}
|
||||
}
|
@ -184,7 +184,22 @@ abstract class texteditor {
|
||||
}
|
||||
}
|
||||
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
/**
|
||||
* Editor settings moodle form class.
|
||||
*
|
||||
* @copyright 2010 Dongsheng Cai
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package moodlecore
|
||||
*/
|
||||
class editor_settings_form extends moodleform {
|
||||
public function definition() {
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('hidden', 'action', 'edit');
|
||||
$this->add_action_buttons(true, get_string('savechanges'));
|
||||
}
|
||||
}
|
||||
|
||||
//=== DEPRECATED =====================
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user