无法将文本编辑器集成到 Moodle 2 中

Unable to integrate text editor into Moodle 2

我无法将 CkEditor 与 Moodle 2.9.1+ 集成。 (我怀疑这个问题适用于任何文本编辑器,而不仅仅是 CkEditor。)

根据 README instructions, I cloned moodle-ckeditor from https://github.com/electrolinux/moodle-ckeditor 进入我管理的 moodle 安装的 lib/editor 目录。

我将下载的目录从 moodle-ckeditor 重命名为 ckeditor

我在 moodle 根目录的 config.php 中添加了这一行:

$CFG->texteditors='ckeditor,tinymce,htmlarea';

当我导航到管理 > 插件 > 文本编辑器 > 管理编辑器时,我只看到原来的 3 个编辑器:TinyMCS HTML 编辑器、纯文本区域和 Atto HTML 编辑器。

FWIW,当我实验性地从 config.php 的显示行中删除 "tinymce," 时,它仍然出现在 "Manage editors" 页面上。这让我觉得 $CFG->texteditors 没有被使用。我知道它正在被阅读,因为如果我在该行中输入语法错误,我会在 "Manage editors" 页面上收到错误消息。

我附加了一个控制台会话,以防引起注意或排除由于拼写错误、权限等引起的错误:

[~/public_html]# grep ckeditor config.php
$CFG->texteditors='ckeditor,tinymce,htmlarea';
[~/public_html]# ls -l lib/editor
total 28
drwxr-xr-x  7 millscso millscso 4096 Jul 23 16:09 ./
drwxr-xr-x 48 millscso millscso 4096 Jul 16 02:16 ../
drwxr-xr-x  9 millscso millscso 4096 Jul 16 02:16 atto/
drwxr-xr-x  5 millscso millscso 4096 Jul 23 16:09 ckeditor/
drwxr-xr-x  7 millscso millscso 4096 Jul 23 15:59 ckeditor-/
-rw-r--r--  1 millscso millscso    0 Jul 16 02:16 index.html
drwxr-xr-x  3 millscso millscso 4096 Jul 16 02:16 textarea/
drwxr-xr-x  9 millscso millscso 4096 Jul 16 02:16 tinymce/

更新

将更改还原为 config.php 几天后,"CKEditor HTML editor" 开始出现在“管理”>“插件”>“文本编辑器”>“管理编辑器”中。不幸的是,当我点击设置 [http://mills-cs.org/admin/settings.php?section=editorsettingsckeditor], I get a Section error.

适用于 Moodle 2.7,这是我所做的

  1. git 克隆 https://github.com/electrolinux/moodle-ckeditor.git

  2. 复制并粘贴文件夹 /moodle-ckeditor/ 到 moodlewww/lib/editor/

  3. 将 moodlewww/lib/editor/moodle-ckeditor/ 重命名为 moodlewww/lib/editor/ckeditor/

  4. 登录到我的站点并单击站点管理 -> 安装 ckeditor 的通知

  5. 我跳过了 $CFG->texteditors='ckeditor,tinymce,htmlarea';

  6. 而是转到站点管理 -> 插件 -> 编辑器 -> 管理编辑器,然后 启用 ckeditor - 这可能是你的情况出了什么问题?

  7. 然后将 ckeditor 移到列表的最前面。

更新:

我尝试安装 2.9 但失败了,因为缺少 version.php 文件 - 我猜这是 2.9 的要求。

我总是在开发中使用调试器。您可能会发现它也很有用,在 config.php

中进行这些设置
// Developer settings - not for production!
error_reporting(E_ALL & ~E_STRICT);
ini_set('display_errors', 1);

$CFG->debug = E_ALL & ~E_STRICT;
$CFG->debugdisplay = true;

所以我用下面的内容创建了丢失的文件 /lib/editor/ckeditor/version.php 并且它在 2.9

中正确安装
<?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/>.

/**
 * CKEditor text editor integration version file.
 *
 * @package    editor_ckeditor
 * @copyright  
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

defined('MOODLE_INTERNAL') || die();

$plugin->version   = 2015073000;        // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires  = 2015051100;        // Requires this Moodle version
$plugin->component = 'editor_ckeditor';  // Full name of the plugin (used for diagnostics)