forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-43842: Import atto back into core
- Loading branch information
Damyon Wiese
committed
Mar 26, 2014
1 parent
46c627c
commit adca732
Showing
350 changed files
with
12,326 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Small, fast, accessible, mobile friendly text editor for Moodle | ||
|
||
QUICK INSTALL | ||
============= | ||
Put this entire directory at: | ||
|
||
PATHTOMOODLE/lib/editors/atto | ||
|
||
Visit your site notifications page to install the new plugins. | ||
|
||
Enable the new editor on the page: | ||
|
||
Site administration / ► Plugins / ► Text editors / ► Manage editors | ||
|
||
To make it the default, change the order so this editor is the first in the list. | ||
|
||
In Moodle 2.6 users can also choose this editor from their profile preferences. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Subplugin info class. | ||
* | ||
* @package editor_atto | ||
* @copyright 2013 Petr Skoda {@link http://skodak.org} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
namespace editor_atto\plugininfo; | ||
|
||
use core\plugininfo\base; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
|
||
class atto extends base { | ||
public function is_uninstall_allowed() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Atto text editor installation steps. | ||
* | ||
* @package editor_atto | ||
* @copyright 2013 Damyon Wiese <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* Enable this text editor by default. | ||
* | ||
* @return bool | ||
*/ | ||
function xmldb_editor_atto_install() { | ||
global $CFG; | ||
// Get the current list of editors. | ||
$currentconfig = $CFG->texteditors; | ||
if (is_null($currentconfig)) { | ||
$currentconfig = ''; | ||
} | ||
$editors = explode(',', $currentconfig); | ||
// Insert atto in the second position. | ||
array_splice($editors, 1, 0, array('atto')); | ||
// Remove duplicates. | ||
$editors = array_unique($editors); | ||
// Set the new config. | ||
unset_config('texteditors'); | ||
set_config('texteditors', implode(',', $editors)); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Yui Editor | ||
* | ||
* @package editor_atto | ||
* @copyright 2013 Damyon Wiese <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$subplugins = array('atto' => 'lib/editor/atto/plugins'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Strings for component 'editor_atto', language 'en'. | ||
* | ||
* @package editor_atto | ||
* @copyright 2013 Damyon Wiese <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
$string['pluginname'] = 'Atto HTML editor'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?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/>. | ||
|
||
/** | ||
* YUI text editor integration. | ||
* | ||
* @package editor_atto | ||
* @copyright 2013 Damyon Wiese <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* This is the texteditor implementation. | ||
* @copyright 2013 Damyon Wiese <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class atto_texteditor extends texteditor { | ||
|
||
/** | ||
* Is the current browser supported by this editor? | ||
* | ||
* Of course! | ||
* @return bool | ||
*/ | ||
public function supported_by_browser() { | ||
return true; | ||
} | ||
|
||
/** | ||
* Returns array of supported text formats. | ||
* @return array | ||
*/ | ||
public function get_supported_formats() { | ||
// FORMAT_MOODLE is not supported here, sorry. | ||
return array(FORMAT_HTML => FORMAT_HTML); | ||
} | ||
|
||
/** | ||
* Returns text format preferred by this editor. | ||
* @return int | ||
*/ | ||
public function get_preferred_format() { | ||
return FORMAT_HTML; | ||
} | ||
|
||
/** | ||
* Does this editor support picking from repositories? | ||
* @return bool | ||
*/ | ||
public function supports_repositories() { | ||
return true; | ||
} | ||
|
||
/** | ||
* Use this editor for give element. | ||
* | ||
* @param string $elementid | ||
* @param array $options | ||
* @param null $fpoptions | ||
*/ | ||
public function use_editor($elementid, array $options=null, $fpoptions=null) { | ||
global $PAGE; | ||
$PAGE->requires->yui_module('moodle-editor_atto-editor', | ||
'M.editor_atto.init', | ||
array($this->get_init_params($elementid, $options, $fpoptions))); | ||
|
||
$plugins = core_component::get_plugin_list('atto'); | ||
|
||
foreach ($plugins as $name => $fulldir) { | ||
$PAGE->requires->string_for_js('pluginname', 'atto_' . $name); | ||
$plugins[$name] = component_callback('atto_' . $name, 'sort_order', array($elementid)); | ||
} | ||
|
||
asort($plugins); | ||
foreach ($plugins as $name => $sort) { | ||
component_callback('atto_' . $name, 'init_editor', array($elementid)); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Create a params array to init the editor. | ||
* | ||
* @param string $elementid | ||
* @param array $options | ||
* @param array $fpoptions | ||
*/ | ||
protected function get_init_params($elementid, array $options=null, array $fpoptions=null) { | ||
global $PAGE; | ||
|
||
$directionality = get_string('thisdirection', 'langconfig'); | ||
$strtime = get_string('strftimetime'); | ||
$strdate = get_string('strftimedaydate'); | ||
$lang = current_language(); | ||
$contentcss = $PAGE->theme->editor_css_url()->out(false); | ||
|
||
$params = array( | ||
'elementid' => $elementid, | ||
'content_css' => $contentcss, | ||
'language' => $lang, | ||
'directionality' => $directionality, | ||
'filepickeroptions' => array() | ||
); | ||
if ($fpoptions) { | ||
$params['filepickeroptions'] = $fpoptions; | ||
} | ||
return $params; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.