MDL-41098 Atto Text editor: Add new text editor to core
authorDamyon Wiese <damyon@moodle.com>
Fri, 9 Aug 2013 06:32:28 +0000 (14:32 +0800)
committerDamyon Wiese <damyon.wiese@gmail.com>
Mon, 26 Aug 2013 14:16:43 +0000 (22:16 +0800)
This is an alternative to the TinyMCE text editor that is based on HTML5
content editable regions.

It has been designed to "gel" with Moodle and uses YUI for javascript,
Moodle standard dialogs and standard moodle buttons. It has also been designed
to work well on mobile devices and can collapse down to a narrow column if required.

Imported from the plugins database here:
https://moodle.org/plugins/view.php?plugin=editor_contenteditable

Original git repository here:
https://github.com/damyon/contenteditable

178 files changed:
lib/editor/atto/db/subplugins.php [new file with mode: 0644]
lib/editor/atto/lang/en/editor_atto.php [new file with mode: 0644]
lib/editor/atto/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/bold/lang/en/atto_bold.php [new file with mode: 0644]
lib/editor/atto/plugins/bold/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/bold/pix/bold.png [new file with mode: 0644]
lib/editor/atto/plugins/bold/pix/bold.svg [new file with mode: 0644]
lib/editor/atto/plugins/bold/version.php [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button.js [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/bold/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/clear/lang/en/atto_clear.php [new file with mode: 0644]
lib/editor/atto/plugins/clear/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/clear/pix/clear.png [new file with mode: 0644]
lib/editor/atto/plugins/clear/pix/clear.svg [new file with mode: 0644]
lib/editor/atto/plugins/clear/version.php [new file with mode: 0644]
lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button.js [new file with mode: 0644]
lib/editor/atto/plugins/clear/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/clear/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/clear/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/html/lang/en/atto_html.php [new file with mode: 0644]
lib/editor/atto/plugins/html/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/html/pix/html.png [new file with mode: 0644]
lib/editor/atto/plugins/html/pix/html.svg [new file with mode: 0644]
lib/editor/atto/plugins/html/version.php [new file with mode: 0644]
lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button.js [new file with mode: 0644]
lib/editor/atto/plugins/html/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/html/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/html/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/image/lang/en/atto_image.php [new file with mode: 0644]
lib/editor/atto/plugins/image/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/image/pix/image.png [new file with mode: 0644]
lib/editor/atto/plugins/image/pix/image.svg [new file with mode: 0644]
lib/editor/atto/plugins/image/version.php [new file with mode: 0644]
lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js [new file with mode: 0644]
lib/editor/atto/plugins/image/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/image/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/image/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/indent/lang/en/atto_indent.php [new file with mode: 0644]
lib/editor/atto/plugins/indent/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/indent/pix/indent.png [new file with mode: 0644]
lib/editor/atto/plugins/indent/pix/indent.svg [new file with mode: 0644]
lib/editor/atto/plugins/indent/version.php [new file with mode: 0644]
lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js [new file with mode: 0644]
lib/editor/atto/plugins/indent/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/indent/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/indent/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/italic/lang/en/atto_italic.php [new file with mode: 0644]
lib/editor/atto/plugins/italic/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/italic/pix/italic.png [new file with mode: 0644]
lib/editor/atto/plugins/italic/pix/italic.svg [new file with mode: 0644]
lib/editor/atto/plugins/italic/version.php [new file with mode: 0644]
lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button.js [new file with mode: 0644]
lib/editor/atto/plugins/italic/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/italic/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/italic/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/link/lang/en/atto_link.php [new file with mode: 0644]
lib/editor/atto/plugins/link/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/link/pix/link.png [new file with mode: 0644]
lib/editor/atto/plugins/link/pix/link.svg [new file with mode: 0644]
lib/editor/atto/plugins/link/version.php [new file with mode: 0644]
lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js [new file with mode: 0644]
lib/editor/atto/plugins/link/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/link/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/link/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/media/lang/en/atto_media.php [new file with mode: 0644]
lib/editor/atto/plugins/media/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/media/pix/media.png [new file with mode: 0644]
lib/editor/atto/plugins/media/pix/media.svg [new file with mode: 0644]
lib/editor/atto/plugins/media/version.php [new file with mode: 0644]
lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js [new file with mode: 0644]
lib/editor/atto/plugins/media/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/media/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/media/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/lang/en/atto_orderedlist.php [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/pix/orderedlist.png [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/pix/orderedlist.svg [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/version.php [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button.js [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/orderedlist/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/outdent/lang/en/atto_outdent.php [new file with mode: 0644]
lib/editor/atto/plugins/outdent/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/outdent/pix/outdent.png [new file with mode: 0644]
lib/editor/atto/plugins/outdent/pix/outdent.svg [new file with mode: 0644]
lib/editor/atto/plugins/outdent/version.php [new file with mode: 0644]
lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button.js [new file with mode: 0644]
lib/editor/atto/plugins/outdent/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/outdent/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/outdent/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/strike/lang/en/atto_strike.php [new file with mode: 0644]
lib/editor/atto/plugins/strike/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/strike/pix/strike.png [new file with mode: 0644]
lib/editor/atto/plugins/strike/pix/strike.svg [new file with mode: 0644]
lib/editor/atto/plugins/strike/version.php [new file with mode: 0644]
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js [new file with mode: 0644]
lib/editor/atto/plugins/strike/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/strike/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/strike/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/title/lang/en/atto_title.php [new file with mode: 0644]
lib/editor/atto/plugins/title/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/title/pix/title.png [new file with mode: 0644]
lib/editor/atto/plugins/title/pix/title.svg [new file with mode: 0644]
lib/editor/atto/plugins/title/version.php [new file with mode: 0644]
lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button.js [new file with mode: 0644]
lib/editor/atto/plugins/title/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/title/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/title/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/underline/lang/en/atto_underline.php [new file with mode: 0644]
lib/editor/atto/plugins/underline/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/underline/pix/underline.png [new file with mode: 0644]
lib/editor/atto/plugins/underline/pix/underline.svg [new file with mode: 0644]
lib/editor/atto/plugins/underline/version.php [new file with mode: 0644]
lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button.js [new file with mode: 0644]
lib/editor/atto/plugins/underline/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/underline/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/underline/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php [new file with mode: 0644]
lib/editor/atto/plugins/unlink/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/unlink/pix/unlink.png [new file with mode: 0644]
lib/editor/atto/plugins/unlink/pix/unlink.svg [new file with mode: 0644]
lib/editor/atto/plugins/unlink/version.php [new file with mode: 0644]
lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js [new file with mode: 0644]
lib/editor/atto/plugins/unlink/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/unlink/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/unlink/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/lang/en/atto_unorderedlist.php [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/lib.php [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.png [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.svg [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/version.php [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-debug.js [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-min.js [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button.js [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/yui/src/button/build.json [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/yui/src/button/js/button.js [new file with mode: 0644]
lib/editor/atto/plugins/unorderedlist/yui/src/button/meta/editor.json [new file with mode: 0644]
lib/editor/atto/styles.css [new file with mode: 0644]
lib/editor/atto/version.php [new file with mode: 0644]
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js [new file with mode: 0644]
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js [new file with mode: 0644]
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js [new file with mode: 0644]
lib/editor/atto/yui/src/editor/build.json [new file with mode: 0644]
lib/editor/atto/yui/src/editor/js/editor.js [new file with mode: 0644]
lib/editor/atto/yui/src/editor/meta/editor.json [new file with mode: 0644]
lib/editorlib.php
lib/pluginlib.php

diff --git a/lib/editor/atto/db/subplugins.php b/lib/editor/atto/db/subplugins.php
new file mode 100644 (file)
index 0000000..de0b440
--- /dev/null
@@ -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  <damyon@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$subplugins = array('atto' => 'lib/editor/atto/plugins');
diff --git a/lib/editor/atto/lang/en/editor_atto.php b/lib/editor/atto/lang/en/editor_atto.php
new file mode 100644 (file)
index 0000000..3ade27d
--- /dev/null
@@ -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  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Atto HTML editor';
diff --git a/lib/editor/atto/lib.php b/lib/editor/atto/lib.php
new file mode 100644 (file)
index 0000000..f2ec963
--- /dev/null
@@ -0,0 +1,128 @@
+<?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  <damyon@moodle.com>
+ * @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  <damyon@moodle.com>
+ * @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, $CFG;
+        $PAGE->requires->yui_module('moodle-editor_atto-editor',
+                                    'M.editor_atto.init',
+                                    array($this->get_init_params($elementid, $options, $fpoptions)), true);
+        require_once($CFG->libdir . '/pluginlib.php');
+
+        $pluginman = plugin_manager::instance();
+        $plugins = $pluginman->get_subplugins_of_plugin('editor_atto');
+
+        $sortedplugins = array();
+
+        foreach ($plugins as $id => $plugin) {
+            $sortorder = component_callback($plugin->type . '_' . $plugin->name, 'sort_order', array($elementid));
+            $sortedplugins[$sortorder] = $plugin;
+        }
+
+        ksort($sortedplugins);
+        foreach ($sortedplugins as $plugin) {
+            component_callback($plugin->type . '_' . $plugin->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;
+    }
+}
diff --git a/lib/editor/atto/plugins/bold/lang/en/atto_bold.php b/lib/editor/atto/plugins/bold/lang/en/atto_bold.php
new file mode 100644 (file)
index 0000000..7c92bdf
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_bold', language 'en'.
+ *
+ * @package    atto_bold
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Bold';
+$string['bold'] = 'Bold';
diff --git a/lib/editor/atto/plugins/bold/lib.php b/lib/editor/atto/plugins/bold/lib.php
new file mode 100644 (file)
index 0000000..35d97c8
--- /dev/null
@@ -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 integration version file.
+ *
+ * @package    atto_bold
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_bold_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('bold', get_string('bold', 'atto_bold'), 'atto_bold', array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_bold-button',
+                                'M.atto_bold.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_bold_sort_order() {
+    return 0;
+}
diff --git a/lib/editor/atto/plugins/bold/pix/bold.png b/lib/editor/atto/plugins/bold/pix/bold.png
new file mode 100644 (file)
index 0000000..57ee78e
Binary files /dev/null and b/lib/editor/atto/plugins/bold/pix/bold.png differ
diff --git a/lib/editor/atto/plugins/bold/pix/bold.svg b/lib/editor/atto/plugins/bold/pix/bold.svg
new file mode 100644 (file)
index 0000000..dd49ae9
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="bold.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Bold"
+       x="7.2604713"
+       y="1049.6475"
+       id="text2984"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan2986"
+         x="7.2604713"
+         y="1049.6475"
+         style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold">b</tspan></text>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/bold/version.php b/lib/editor/atto/plugins/bold/version.php
new file mode 100644 (file)
index 0000000..d25795b
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_bold
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_bold';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-debug.js b/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-debug.js
new file mode 100644 (file)
index 0000000..210bb07
Binary files /dev/null and b/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-debug.js differ
diff --git a/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-min.js b/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-min.js
new file mode 100644 (file)
index 0000000..e843f39
Binary files /dev/null and b/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button-min.js differ
diff --git a/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button.js b/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button.js
new file mode 100644 (file)
index 0000000..210bb07
Binary files /dev/null and b/lib/editor/atto/plugins/bold/yui/build/moodle-atto_bold-button/moodle-atto_bold-button.js differ
diff --git a/lib/editor/atto/plugins/bold/yui/src/button/build.json b/lib/editor/atto/plugins/bold/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..1120750
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_bold-button",
+  "builds": {
+    "moodle-atto_bold-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/bold/yui/src/button/js/button.js b/lib/editor/atto/plugins/bold/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..5648d91
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 bold plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_bold = M.atto_bold || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('bold', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'bold', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/bold/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/bold/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..e668c0f
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_bold-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/clear/lang/en/atto_clear.php b/lib/editor/atto/plugins/clear/lang/en/atto_clear.php
new file mode 100644 (file)
index 0000000..4f14b91
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_clear', language 'en'.
+ *
+ * @package    atto_clear
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Clear formatting';
+$string['clear'] = 'Clear formatting';
diff --git a/lib/editor/atto/plugins/clear/lib.php b/lib/editor/atto/plugins/clear/lib.php
new file mode 100644 (file)
index 0000000..0e2081c
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 integration version file.
+ *
+ * @package    atto_clear
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_clear_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('clear',
+                              get_string('clear', 'atto_clear'),
+                              'atto_clear',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_clear-button',
+                                'M.atto_clear.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_clear_sort_order() {
+    return 10;
+}
diff --git a/lib/editor/atto/plugins/clear/pix/clear.png b/lib/editor/atto/plugins/clear/pix/clear.png
new file mode 100644 (file)
index 0000000..7f5815b
Binary files /dev/null and b/lib/editor/atto/plugins/clear/pix/clear.png differ
diff --git a/lib/editor/atto/plugins/clear/pix/clear.svg b/lib/editor/atto/plugins/clear/pix/clear.svg
new file mode 100644 (file)
index 0000000..6d20464
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="clear.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-3.8870379"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:clear />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <g
+       id="g3756"
+       transform="translate(0,-0.44194174)">
+      <rect
+         ry="0"
+         transform="translate(0,1036.3622)"
+         y="2.3629408"
+         x="7.0079331"
+         height="5.3664355"
+         width="2.0203052"
+         id="rect2982"
+         style="fill:#999999;fill-opacity:1;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+      <rect
+         ry="0.4152233"
+         y="1043.2078"
+         x="3.9774756"
+         height="2.7870839"
+         width="8.0812302"
+         id="rect2984"
+         style="fill:#999999;fill-opacity:1;stroke:#999999;stroke-width:0.82672101;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+      <rect
+         ry="0.053281363"
+         y="1045.6699"
+         x="4.4825521"
+         height="3.1562684"
+         width="7.0079417"
+         id="rect3754"
+         style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/clear/version.php b/lib/editor/atto/plugins/clear/version.php
new file mode 100644 (file)
index 0000000..63868ee
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_clear
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_clear';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-debug.js b/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-debug.js
new file mode 100644 (file)
index 0000000..bcfb704
Binary files /dev/null and b/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-debug.js differ
diff --git a/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-min.js b/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-min.js
new file mode 100644 (file)
index 0000000..7716f7b
Binary files /dev/null and b/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button-min.js differ
diff --git a/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button.js b/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button.js
new file mode 100644 (file)
index 0000000..bcfb704
Binary files /dev/null and b/lib/editor/atto/plugins/clear/yui/build/moodle-atto_clear-button/moodle-atto_clear-button.js differ
diff --git a/lib/editor/atto/plugins/clear/yui/src/button/build.json b/lib/editor/atto/plugins/clear/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..aeee2de
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_clear-button",
+  "builds": {
+    "moodle-atto_clear-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/clear/yui/src/button/js/button.js b/lib/editor/atto/plugins/clear/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..0430f8b
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 clear plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_clear = M.atto_clear || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('removeFormat', false);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'clear', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/clear/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/clear/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..39aab1c
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_clear-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/html/lang/en/atto_html.php b/lib/editor/atto/plugins/html/lang/en/atto_html.php
new file mode 100644 (file)
index 0000000..2f76ccf
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_html', language 'en'.
+ *
+ * @package    atto_html
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'HTML';
+$string['html'] = 'HTML';
diff --git a/lib/editor/atto/plugins/html/lib.php b/lib/editor/atto/plugins/html/lib.php
new file mode 100644 (file)
index 0000000..f97ed33
--- /dev/null
@@ -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 integration version file.
+ *
+ * @package    atto_html
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_html_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('html', get_string('html', 'atto_html'), 'atto_html', array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_html-button',
+                                'M.atto_html.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_html_sort_order() {
+    return 15;
+}
diff --git a/lib/editor/atto/plugins/html/pix/html.png b/lib/editor/atto/plugins/html/pix/html.png
new file mode 100644 (file)
index 0000000..0623bd7
Binary files /dev/null and b/lib/editor/atto/plugins/html/pix/html.png differ
diff --git a/lib/editor/atto/plugins/html/pix/html.svg b/lib/editor/atto/plugins/html/pix/html.svg
new file mode 100644 (file)
index 0000000..5009302
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="html.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="11.313709"
+     inkscape:cx="-8.155614"
+     inkscape:cy="13.234355"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>media/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillMedia" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:52.96332169000000079px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#999999;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
+       x="10.191385"
+       y="836.76996"
+       id="text2988"
+       sodipodi:linespacing="125%"
+       transform="scale(0.79843788,1.2524456)"><tspan
+         sodipodi:role="line"
+         id="tspan2990"
+         x="10.191385"
+         y="836.76996"
+         style="font-size:9.93062304999999945px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:FreeMono;-inkscape-font-specification:FreeMono Bold;fill:#999999;fill-opacity:1">&lt;/&gt;</tspan></text>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/html/version.php b/lib/editor/atto/plugins/html/version.php
new file mode 100644 (file)
index 0000000..6058df1
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_html
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_html';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-debug.js b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-debug.js
new file mode 100644 (file)
index 0000000..8b32aad
Binary files /dev/null and b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-debug.js differ
diff --git a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-min.js b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-min.js
new file mode 100644 (file)
index 0000000..bf8e2cc
Binary files /dev/null and b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button-min.js differ
diff --git a/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button.js b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button.js
new file mode 100644 (file)
index 0000000..8b32aad
Binary files /dev/null and b/lib/editor/atto/plugins/html/yui/build/moodle-atto_html-button/moodle-atto_html-button.js differ
diff --git a/lib/editor/atto/plugins/html/yui/src/button/build.json b/lib/editor/atto/plugins/html/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..9648961
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_html-button",
+  "builds": {
+    "moodle-atto_html-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/html/yui/src/button/js/button.js b/lib/editor/atto/plugins/html/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..18520ed
--- /dev/null
@@ -0,0 +1,54 @@
+// 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 html plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_html = M.atto_html || {
+    /**
+     * Are we in html editing mode or not?
+     */
+    ishtml : false,
+
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            var textarea = Y.one('#' + elementid);
+            var atto = Y.one('#' + elementid + 'editable');
+
+            if (M.atto_html.ishtml) {
+                M.editor_atto.enable_all_widgets(elementid);
+                atto.setHTML('');
+                atto.append(textarea.get('value'));
+                textarea.hide();
+                atto.show();
+            } else {
+                M.editor_atto.disable_all_widgets(elementid);
+                M.editor_atto.enable_widget(elementid, 'html');
+                textarea.set('value', atto.getHTML());
+                atto.hide();
+                textarea.show();
+            }
+
+            M.atto_html.ishtml = !M.atto_html.ishtml;
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'html', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/html/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/html/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..e498f30
--- /dev/null
@@ -0,0 +1,7 @@
+{
+  "moodle-atto_html-button": {
+    "requires": [
+        "node"
+    ]
+  }
+}
diff --git a/lib/editor/atto/plugins/image/lang/en/atto_image.php b/lib/editor/atto/plugins/image/lang/en/atto_image.php
new file mode 100644 (file)
index 0000000..4e164c3
--- /dev/null
@@ -0,0 +1,34 @@
+<?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 'atto_image', language 'en'.
+ *
+ * @package    atto_image
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Image';
+$string['image'] = 'Image';
+$string['createimage'] = 'Insert image';
+$string['enterurl'] = 'Enter URL';
+$string['enteralt'] = 'Enter alternative text';
+$string['browserepositories'] = 'Browse repositories...';
+$string['accessibilityhint'] = '<p>Web content accessibility guidelines (WCAG):<br/><ul><li><a href="http://www.w3.org/TR/WCAG20/#text-equiv" target="_blank">Text Alternatives</a></li></ul></p>';
+$string['width'] = 'Width';
+$string['height'] = 'Height';
+$string['preview'] = 'Preview';
diff --git a/lib/editor/atto/plugins/image/lib.php b/lib/editor/atto/plugins/image/lib.php
new file mode 100644 (file)
index 0000000..ed4a2b9
--- /dev/null
@@ -0,0 +1,60 @@
+<?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 integration version file.
+ *
+ * @package    atto_image
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_image_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('image',
+                              get_string('image', 'atto_image'),
+                              'atto_image',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->strings_for_js(array('createimage',
+                                          'enterurl',
+                                          'enteralt',
+                                          'preview',
+                                          'browserepositories',
+                                          'accessibilityhint',
+                                          'width',
+                                          'height'), 'atto_image');
+    $PAGE->requires->yui_module('moodle-atto_image-button',
+                                'M.atto_image.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_image_sort_order() {
+    return 13;
+}
diff --git a/lib/editor/atto/plugins/image/pix/image.png b/lib/editor/atto/plugins/image/pix/image.png
new file mode 100644 (file)
index 0000000..b5644b2
Binary files /dev/null and b/lib/editor/atto/plugins/image/pix/image.png differ
diff --git a/lib/editor/atto/plugins/image/pix/image.svg b/lib/editor/atto/plugins/image/pix/image.svg
new file mode 100644 (file)
index 0000000..bce2c83
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="image.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="32"
+     inkscape:cx="11.577509"
+     inkscape:cy="9.3016902"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <rect
+       style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-opacity:1"
+       id="rect2986"
+       width="14.142136"
+       height="13.131983"
+       x="1.0101526"
+       y="1.4159228"
+       transform="translate(0,1036.3622)"
+       ry="0.053281363" />
+    <path
+       style="fill:#999999;fill-opacity:1;stroke:none"
+       d="m 13.794977,1041.1242 c 0,0.9241 -0.749059,1.6732 -1.673146,1.6732 -0.9241,0 -1.673146,-0.7491 -1.673146,-1.6732 0,-0.924 0.749059,-1.6731 1.673146,-1.6731 0.9241,0 1.673146,0.7491 1.673146,1.6731 z"
+       id="path3761"
+       inkscape:connector-curvature="0" />
+    <path
+       transform="translate(0,1036.3622)"
+       style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
+       d="m 1.5711386,10.553572 c 1.7890625,-0.125 3.8205354,-3.734909 6.286004,-3.75 2.4654684,-0.015091 3.8591064,3.4375 6.4645754,3.75 0.01465,0.0018 0.02808,0.0059 0.03771,0.01557 0.0096,0.0096 0.01557,0.02295 0.01557,0.03771 l 0,3.018437 c 0,0.02952 -0.02376,0.05328 -0.05328,0.05328 l -12.7505794,0 c -0.029518,0 -0.053281,-0.02376 -0.053281,-0.05328 l 0,-3.018437 c 0,-0.01476 0.00594,-0.02808 0.015572,-0.03771 0.00963,-0.0096 0.022987,-0.01454 0.037709,-0.01557 z"
+       id="rect3753"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="szssssssssss" />
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/image/version.php b/lib/editor/atto/plugins/image/version.php
new file mode 100644 (file)
index 0000000..f8320eb
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_image
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_image';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js
new file mode 100644 (file)
index 0000000..2658d79
Binary files /dev/null and b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js differ
diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js
new file mode 100644 (file)
index 0000000..6fed538
Binary files /dev/null and b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js differ
diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js
new file mode 100644 (file)
index 0000000..2658d79
Binary files /dev/null and b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button.js differ
diff --git a/lib/editor/atto/plugins/image/yui/src/button/build.json b/lib/editor/atto/plugins/image/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..15fda37
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_image-button",
+  "builds": {
+    "moodle-atto_image-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/image/yui/src/button/js/button.js b/lib/editor/atto/plugins/image/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..ee7989b
--- /dev/null
@@ -0,0 +1,179 @@
+// 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 image plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_image = M.atto_image || {
+    dialogue : null,
+    selection : null,
+    init : function(params) {
+        var display_chooser = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            M.atto_image.selection = M.editor_atto.get_selection();
+            if (M.atto_image.selection !== false) {
+                var dialogue;
+                if (!M.atto_image.dialogue) {
+                    dialogue = new M.core.dialogue({
+                        visible: false,
+                        modal: true,
+                        close: true,
+                        draggable: true
+                    });
+                } else {
+                    dialogue = M.atto_image.dialogue;
+                }
+
+                dialogue.set('bodyContent', M.atto_image.get_form_content(elementid));
+                dialogue.set('headerContent', M.util.get_string('createimage', 'atto_image'));
+                dialogue.render();
+                dialogue.centerDialogue();
+                M.atto_image.dialogue = dialogue;
+
+                var selectedText = M.editor_atto.get_selection_text();
+                var i = 0;
+
+                var images = [];
+                for (i = 0; i < selectedText.childNodes.length; i++) {
+                    var child = selectedText.childNodes[0];
+                    if (images.length === 0) {
+                        if (child.nodeName.toLowerCase() === 'img') {
+                            images[0] = child;
+                        } else {
+                            if (child.getElementsByTagName) {
+                                images = child.getElementsByTagName('img');
+                            }
+                        }
+                    }
+                }
+
+                if (images.length > 0) {
+                    var image = Y.one(images[0]);
+                    var width = image.getAttribute('width');
+                    var height = image.getAttribute('height');
+                    if (width > 0) {
+                        Y.one('#atto_image_widthentry').set('value', width);
+                    }
+                    if (height > 0) {
+                        Y.one('#atto_image_heightentry').set('value', height);
+                    }
+                    Y.one('#atto_image_preview').set('src', image.get('src'));
+                    Y.one('#atto_image_preview').setStyle('display', 'inline');
+                    Y.one('#atto_image_altentry').set('value', image.get('alt'));
+                    Y.one('#atto_image_urlentry').set('value', image.get('src'));
+                }
+                dialogue.show();
+            }
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'image', params.icon, display_chooser, this);
+    },
+    open_filepicker : function(e) {
+        var elementid = this.getAttribute('data-editor');
+        e.preventDefault();
+
+        M.editor_atto.show_filepicker(elementid, 'image', M.atto_image.filepicker_callback);
+    },
+    filepicker_callback : function(params) {
+        if (params.url !== '') {
+            var input = Y.one('#atto_image_urlentry');
+            input.set('value', params.url);
+            input = Y.one('#atto_image_altentry');
+            input.set('value', params.file);
+
+            // Auto set the width and height.
+            var image = new Image();
+            image.onload = function() {
+                Y.one('#atto_image_widthentry').set('value', this.width);
+                Y.one('#atto_image_heightentry').set('value', this.height);
+                Y.one('#atto_image_preview').set('src', this.src);
+                Y.one('#atto_image_preview').setStyle('display', 'inline');
+            };
+            image.src = params.url;
+        }
+    },
+    set_image : function(e) {
+        e.preventDefault();
+        M.atto_image.dialogue.hide();
+
+        var input = e.currentTarget.get('parentNode').one('#atto_image_urlentry');
+
+        var url = input.get('value');
+        input = e.currentTarget.get('parentNode').one('#atto_image_altentry');
+        var alt = input.get('value');
+        input = e.currentTarget.get('parentNode').one('#atto_image_widthentry');
+        var width = input.get('value');
+        input = e.currentTarget.get('parentNode').one('#atto_image_heightentry');
+        var height = input.get('value');
+        if (url !== '' && alt !== '') {
+            M.editor_atto.set_selection(M.atto_image.selection);
+            var imagehtml = '<img src="' + Y.Escape.html(url) + '" alt="' + Y.Escape.html(alt) + '"';
+
+            if (width) {
+                imagehtml += ' width="' + Y.Escape.html(width) + '"';
+            }
+            if (height) {
+                imagehtml += ' height="' + Y.Escape.html(height) + '"';
+            }
+            imagehtml += '"/>';
+
+            if (document.selection && document.selection.createRange().pasteHTML) {
+                document.selection.createRange().pasteHTML(imagehtml);
+            } else {
+                document.execCommand('insertHTML', false, imagehtml);
+            }
+        }
+    },
+    get_form_content : function(elementid) {
+        var content = Y.Node.create('<form class="atto_form">' +
+                             '<label for="atto_image_urlentry">' + M.util.get_string('enterurl', 'atto_image') +
+                             '</label>' +
+                             '<input type="url" value="" id="atto_image_urlentry" size="32"/>' +
+                             '<label for="atto_image_altentry">' + M.util.get_string('enteralt', 'atto_image') +
+                             '</label>' +
+                             '<input type="text" value="" id="atto_image_altentry" size="32" required="true"/>' +
+                             '<label for="atto_image_widthentry">' + M.util.get_string('width', 'atto_image') +
+                             '</label>' +
+                             '<input type="text" value="" id="atto_image_widthentry" size="10"/>' +
+                             '<br/>' +
+                             '<label for="atto_image_heightentry">' + M.util.get_string('height', 'atto_image') +
+                             '</label>' +
+                             '<input type="text" value="" id="atto_image_heightentry" size="10"/>' +
+                             '<label for="atto_image_preview">' + M.util.get_string('preview', 'atto_image') +
+                             '</label>' +
+                             '<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>' +
+                             '<hr/>' +
+                             '<button id="openimagebrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
+                             M.util.get_string('browserepositories', 'atto_image') +
+                             '</button>' +
+                             '<hr/>' +
+                             '<button id="atto_image_urlentrysubmit">' +
+                             M.util.get_string('createimage', 'atto_image') +
+                             '</button>' +
+                             '</form>' +
+                             '<hr/>' + M.util.get_string('accessibilityhint', 'atto_image'));
+
+        content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image);
+        content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
+        return content;
+    }
+};
diff --git a/lib/editor/atto/plugins/image/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/image/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..3a97310
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "moodle-atto_image-button": {
+    "requires": [
+        "node",
+        "escape"
+    ]
+  }
+}
diff --git a/lib/editor/atto/plugins/indent/lang/en/atto_indent.php b/lib/editor/atto/plugins/indent/lang/en/atto_indent.php
new file mode 100644 (file)
index 0000000..492b4b1
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_indent', language 'en'.
+ *
+ * @package    atto_indent
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Indent';
+$string['indent'] = 'Indent';
diff --git a/lib/editor/atto/plugins/indent/lib.php b/lib/editor/atto/plugins/indent/lib.php
new file mode 100644 (file)
index 0000000..eb31579
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 integration version file.
+ *
+ * @package    atto_indent
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_indent_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('indent',
+                              get_string('indent', 'atto_indent'),
+                              'atto_indent',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_indent-button',
+                                'M.atto_indent.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_indent_sort_order() {
+    return 5;
+}
diff --git a/lib/editor/atto/plugins/indent/pix/indent.png b/lib/editor/atto/plugins/indent/pix/indent.png
new file mode 100644 (file)
index 0000000..227ddd6
Binary files /dev/null and b/lib/editor/atto/plugins/indent/pix/indent.png differ
diff --git a/lib/editor/atto/plugins/indent/pix/indent.svg b/lib/editor/atto/plugins/indent/pix/indent.svg
new file mode 100644 (file)
index 0000000..af8a046
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="indent.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Indent"
+       x="7.2604713"
+       y="1049.6475"
+       id="text2984"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan2986"
+         x="7.2604713"
+         y="1049.6475"
+         style="font-size:14px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Indent">&gt;</tspan></text>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/indent/version.php b/lib/editor/atto/plugins/indent/version.php
new file mode 100644 (file)
index 0000000..1ae0fda
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_indent
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_indent';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js
new file mode 100644 (file)
index 0000000..0a98a2b
Binary files /dev/null and b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js differ
diff --git a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js
new file mode 100644 (file)
index 0000000..3079b97
Binary files /dev/null and b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js differ
diff --git a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js
new file mode 100644 (file)
index 0000000..0a98a2b
Binary files /dev/null and b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js differ
diff --git a/lib/editor/atto/plugins/indent/yui/src/button/build.json b/lib/editor/atto/plugins/indent/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..29b8001
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_indent-button",
+  "builds": {
+    "moodle-atto_indent-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/indent/yui/src/button/js/button.js b/lib/editor/atto/plugins/indent/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..05593e3
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 indent plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_indent = M.atto_indent || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('indent', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'indent', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/indent/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/indent/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..812a3bc
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_indent-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/italic/lang/en/atto_italic.php b/lib/editor/atto/plugins/italic/lang/en/atto_italic.php
new file mode 100644 (file)
index 0000000..177ebaa
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_italic', language 'en'.
+ *
+ * @package    atto_italic
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Italic';
+$string['italic'] = 'Italic';
diff --git a/lib/editor/atto/plugins/italic/lib.php b/lib/editor/atto/plugins/italic/lib.php
new file mode 100644 (file)
index 0000000..fb12b86
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 integration version file.
+ *
+ * @package    atto_italic
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_italic_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('italic',
+                              get_string('italic', 'atto_italic'),
+                              'atto_italic',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_italic-button',
+                                'M.atto_italic.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_italic_sort_order() {
+    return 1;
+}
diff --git a/lib/editor/atto/plugins/italic/pix/italic.png b/lib/editor/atto/plugins/italic/pix/italic.png
new file mode 100644 (file)
index 0000000..0efebc2
Binary files /dev/null and b/lib/editor/atto/plugins/italic/pix/italic.png differ
diff --git a/lib/editor/atto/plugins/italic/pix/italic.svg b/lib/editor/atto/plugins/italic/pix/italic.svg
new file mode 100644 (file)
index 0000000..848e67e
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="italic.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
+       x="7.2604713"
+       y="1049.6475"
+       id="text2984"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan2986"
+         x="7.2604713"
+         y="1049.6475"
+         style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial Italic;fill:#999999;fill-opacity:1">i</tspan></text>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/italic/version.php b/lib/editor/atto/plugins/italic/version.php
new file mode 100644 (file)
index 0000000..e5c8fe9
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_italic
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_italic';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-debug.js b/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-debug.js
new file mode 100644 (file)
index 0000000..78285fc
Binary files /dev/null and b/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-debug.js differ
diff --git a/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-min.js b/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-min.js
new file mode 100644 (file)
index 0000000..568d6df
Binary files /dev/null and b/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button-min.js differ
diff --git a/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button.js b/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button.js
new file mode 100644 (file)
index 0000000..78285fc
Binary files /dev/null and b/lib/editor/atto/plugins/italic/yui/build/moodle-atto_italic-button/moodle-atto_italic-button.js differ
diff --git a/lib/editor/atto/plugins/italic/yui/src/button/build.json b/lib/editor/atto/plugins/italic/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..d7df4fc
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_italic-button",
+  "builds": {
+    "moodle-atto_italic-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/italic/yui/src/button/js/button.js b/lib/editor/atto/plugins/italic/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..c22dcce
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 italic plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_italic = M.atto_italic || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('italic', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'italic', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/italic/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/italic/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..4109b10
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_italic-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/link/lang/en/atto_link.php b/lib/editor/atto/plugins/link/lang/en/atto_link.php
new file mode 100644 (file)
index 0000000..9735788
--- /dev/null
@@ -0,0 +1,30 @@
+<?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 'atto_link', language 'en'.
+ *
+ * @package    atto_link
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Link';
+$string['link'] = 'Link';
+$string['createlink'] = 'Create link';
+$string['enterurl'] = 'Enter a URL';
+$string['browserepositories'] = 'Browse repositories...';
+$string['accessibilityhint'] = '<p>Web content accessibility guidelines (WCAG):<br/><ul><li><a href="http://www.w3.org/TR/WCAG20/#navigation-mechanisms-refs" target="_blank">2.4.4 Link Purpose (In Context)</a></li><li><a href="http://www.w3.org/TR/WCAG20/#navigation-mechanisms-link" target="_blank">2.4.9 Link Purpose (Link Only)</a></li></ul></p>';
diff --git a/lib/editor/atto/plugins/link/lib.php b/lib/editor/atto/plugins/link/lib.php
new file mode 100644 (file)
index 0000000..56067e7
--- /dev/null
@@ -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/>.
+
+/**
+ * Atto text editor integration version file.
+ *
+ * @package    atto_link
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_link_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('link',
+                              get_string('link', 'atto_link'),
+                              'atto_link',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->strings_for_js(array('createlink',
+                                          'enterurl',
+                                          'browserepositories',
+                                          'accessibilityhint'),
+                                    'atto_link');
+
+    $PAGE->requires->yui_module('moodle-atto_link-button',
+                                'M.atto_link.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_link_sort_order() {
+    return 11;
+}
diff --git a/lib/editor/atto/plugins/link/pix/link.png b/lib/editor/atto/plugins/link/pix/link.png
new file mode 100644 (file)
index 0000000..5a0ac7f
Binary files /dev/null and b/lib/editor/atto/plugins/link/pix/link.png differ
diff --git a/lib/editor/atto/plugins/link/pix/link.svg b/lib/editor/atto/plugins/link/pix/link.svg
new file mode 100644 (file)
index 0000000..54b80db
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="link.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="22.4"
+     inkscape:cx="-3.7446839"
+     inkscape:cy="10.171143"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1440"
+     inkscape:window-height="872"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <rect
+       style="fill:none;stroke:#999999;stroke-width:2.89999999999999991;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       id="rect2984"
+       width="19.107143"
+       height="6.8750005"
+       x="-13.535714"
+       y="1040.9337"
+       ry="0.053281363" />
+    <rect
+       ry="0.053281363"
+       y="1040.9337"
+       x="10.432884"
+       height="6.8750005"
+       width="19.107143"
+       id="rect3754"
+       style="fill:none;stroke:#999999;stroke-width:2.90000010000000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    <rect
+       style="fill:none;stroke:#999999;stroke-width:2.90000010000000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       id="rect3756"
+       width="9.0510426"
+       height="0.26916784"
+       x="3.5273302"
+       y="1044.2031"
+       ry="0.053281363" />
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/link/version.php b/lib/editor/atto/plugins/link/version.php
new file mode 100644 (file)
index 0000000..e2739eb
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_link
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_link';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js
new file mode 100644 (file)
index 0000000..c352f07
Binary files /dev/null and b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-debug.js differ
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js
new file mode 100644 (file)
index 0000000..6454678
Binary files /dev/null and b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button-min.js differ
diff --git a/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js
new file mode 100644 (file)
index 0000000..c352f07
Binary files /dev/null and b/lib/editor/atto/plugins/link/yui/build/moodle-atto_link-button/moodle-atto_link-button.js differ
diff --git a/lib/editor/atto/plugins/link/yui/src/button/build.json b/lib/editor/atto/plugins/link/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..0f84aad
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_link-button",
+  "builds": {
+    "moodle-atto_link-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/link/yui/src/button/js/button.js b/lib/editor/atto/plugins/link/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..b719e9a
--- /dev/null
@@ -0,0 +1,127 @@
+// 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 link plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_link = M.atto_link || {
+    dialogue : null,
+    selection : null,
+    init : function(params) {
+        var display_chooser = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            M.atto_link.selection = M.editor_atto.get_selection();
+            if (M.atto_link.selection !== false && (!M.atto_link.selection.collapsed)) {
+                var dialogue;
+                if (!M.atto_link.dialogue) {
+                    dialogue = new M.core.dialogue({
+                        visible: false,
+                        modal: true,
+                        close: true,
+                        draggable: true
+                    });
+                } else {
+                    dialogue = M.atto_link.dialogue;
+                }
+
+                dialogue.render();
+                dialogue.set('bodyContent', M.atto_link.get_form_content(elementid));
+                dialogue.set('headerContent', M.util.get_string('createlink', 'atto_link'));
+
+                M.atto_link.resolve_anchors();
+
+                dialogue.show();
+                M.atto_link.dialogue = dialogue;
+            }
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'link', params.icon, display_chooser, this);
+    },
+    resolve_anchors : function() {
+        // Find the first anchor tag in the selection.
+        var selectednode = M.editor_atto.get_selection_parent_node(),
+            anchornode,
+            url;
+
+        // Note this is a document fragment and YUI doesn't like them.
+        if (!selectednode) {
+            return;
+        }
+
+        anchornode = Y.one(selectednode).ancestor('a');
+
+        if (anchornode) {
+            url = anchornode.getAttribute('href');
+            if (url !== '') {
+                M.atto_link.selection = M.editor_atto.get_selection_from_node(anchornode);
+                Y.one('#atto_link_urlentry').set('value', url);
+            }
+        }
+    },
+    open_filepicker : function(e) {
+        var elementid = this.getAttribute('data-editor');
+        e.preventDefault();
+
+        M.editor_atto.show_filepicker(elementid, 'link', M.atto_link.filepicker_callback);
+    },
+    filepicker_callback : function(params) {
+        M.atto_link.dialogue.hide();
+        if (params.url !== '') {
+            M.editor_atto.set_selection(M.atto_link.selection);
+            document.execCommand('unlink', false, null);
+            document.execCommand('createLink', false, params.url);
+        }
+    },
+    set_link : function(e) {
+        e.preventDefault();
+        M.atto_link.dialogue.hide();
+
+        var input = e.currentTarget.get('parentNode').one('input');
+
+        var value = input.get('value');
+        if (value !== '') {
+            M.editor_atto.set_selection(M.atto_link.selection);
+            document.execCommand('unlink', false, null);
+            document.execCommand('createLink', false, value);
+        }
+    },
+    get_form_content : function(elementid) {
+        var content = Y.Node.create('<form>' +
+                             '<label for="atto_link_urlentry">' + M.util.get_string('enterurl', 'atto_link') +
+                             '</label><br/>' +
+                             '<input type="url" value="" id="atto_link_urlentry" size="32"/>' +
+                             '<br/>' +
+                             '<button id="openlinkbrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
+                             M.util.get_string('browserepositories', 'atto_link') +
+                             '</button>' +
+                             '<hr/>' +
+                             '<button id="atto_link_urlentrysubmit">' +
+                             M.util.get_string('createlink', 'atto_link') +
+                             '</button>' +
+                             '</form>' +
+                             '<hr/>' + M.util.get_string('accessibilityhint', 'atto_link'));
+
+        content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link);
+        content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
+        return content;
+    }
+};
diff --git a/lib/editor/atto/plugins/link/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/link/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..41593ed
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "moodle-atto_link-button": {
+    "requires": [
+        "node",
+        "escape"
+    ]
+  }
+}
diff --git a/lib/editor/atto/plugins/media/lang/en/atto_media.php b/lib/editor/atto/plugins/media/lang/en/atto_media.php
new file mode 100644 (file)
index 0000000..913f579
--- /dev/null
@@ -0,0 +1,33 @@
+<?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 'atto_media', language 'en'.
+ *
+ * @package    atto_media
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Media';
+$string['media'] = 'Media';
+$string['createmedia'] = 'Insert media';
+$string['enterurl'] = 'Enter URL';
+$string['entername'] = 'Enter name';
+$string['browserepositories'] = 'Browse repositories...';
+$string['accessibilityhint'] = '<p>Web content accessibility guidelines (WCAG):<br/><ul><li><a href="http://www.w3.org/TR/WCAG20/#text-equiv" target="_blank">Text Alternatives</a></li></ul></p>';
+$string['width'] = 'Width';
+$string['height'] = 'Height';
diff --git a/lib/editor/atto/plugins/media/lib.php b/lib/editor/atto/plugins/media/lib.php
new file mode 100644 (file)
index 0000000..d0a4428
--- /dev/null
@@ -0,0 +1,56 @@
+<?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 integration version file.
+ *
+ * @package    atto_media
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_media_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('media',
+                              get_string('media', 'atto_media'),
+                              'atto_media',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->strings_for_js(array('createmedia',
+                                          'enterurl',
+                                          'entername',
+                                          'browserepositories',
+                                          'accessibilityhint'),
+                                    'atto_media');
+    $PAGE->requires->yui_module('moodle-atto_media-button',
+                                'M.atto_media.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_media_sort_order() {
+    return 14;
+}
diff --git a/lib/editor/atto/plugins/media/pix/media.png b/lib/editor/atto/plugins/media/pix/media.png
new file mode 100644 (file)
index 0000000..36b2828
Binary files /dev/null and b/lib/editor/atto/plugins/media/pix/media.png differ
diff --git a/lib/editor/atto/plugins/media/pix/media.svg b/lib/editor/atto/plugins/media/pix/media.svg
new file mode 100644 (file)
index 0000000..13a7147
--- /dev/null
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="media.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="32"
+     inkscape:cx="6.077509"
+     inkscape:cy="9.3016902"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>media/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillMedia" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <rect
+       style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-opacity:1"
+       id="rect2986"
+       width="14.142136"
+       height="13.131983"
+       x="1.0101526"
+       y="1.4159228"
+       transform="translate(0,1036.3622)"
+       ry="0.053281363" />
+    <g
+       id="g3766"
+       transform="matrix(0.84027762,0,0,0.84027762,1.3177096,166.78804)">
+      <path
+         transform="matrix(1.5411765,0,0,1.5411765,-1.938603,1033.428)"
+         d="M 5.71875,5.421875 C 5.71875,6.1553782 5.1241282,6.75 4.390625,6.75 3.6571218,6.75 3.0625,6.1553782 3.0625,5.421875 c 0,-0.7335032 0.5946218,-1.328125 1.328125,-1.328125 0.7335032,0 1.328125,0.5946218 1.328125,1.328125 z"
+         sodipodi:ry="1.328125"
+         sodipodi:rx="1.328125"
+         sodipodi:cy="5.421875"
+         sodipodi:cx="4.390625"
+         id="path3756"
+         style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none"
+         sodipodi:type="arc" />
+      <path
+         sodipodi:type="arc"
+         style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none"
+         id="path3760"
+         sodipodi:cx="4.390625"
+         sodipodi:cy="5.421875"
+         sodipodi:rx="1.328125"
+         sodipodi:ry="1.328125"
+         d="M 5.71875,5.421875 C 5.71875,6.1553782 5.1241282,6.75 4.390625,6.75 3.6571218,6.75 3.0625,6.1553782 3.0625,5.421875 c 0,-0.7335032 0.5946218,-1.328125 1.328125,-1.328125 0.7335032,0 1.328125,0.5946218 1.328125,1.328125 z"
+         transform="matrix(1.5411765,0,0,1.5411765,2.655147,1033.428)" />
+      <rect
+         ry="0.74078137"
+         y="1043.9247"
+         x="2.375"
+         height="4.8125"
+         width="9.625"
+         id="rect3762"
+         style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <rect
+         ry="0.74078137"
+         y="1045.4247"
+         x="12.09375"
+         height="2"
+         width="2.03125"
+         id="rect3764"
+         style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+    </g>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/media/version.php b/lib/editor/atto/plugins/media/version.php
new file mode 100644 (file)
index 0000000..104b5d5
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_media
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_media';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
new file mode 100644 (file)
index 0000000..587b482
Binary files /dev/null and b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js differ
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js
new file mode 100644 (file)
index 0000000..207fa8f
Binary files /dev/null and b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js differ
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js
new file mode 100644 (file)
index 0000000..587b482
Binary files /dev/null and b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js differ
diff --git a/lib/editor/atto/plugins/media/yui/src/button/build.json b/lib/editor/atto/plugins/media/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..b20a6f5
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_media-button",
+  "builds": {
+    "moodle-atto_media-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/media/yui/src/button/js/button.js b/lib/editor/atto/plugins/media/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..ccbbbb5
--- /dev/null
@@ -0,0 +1,114 @@
+// 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 media plugin.
+ *
+ * @package editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_media = M.atto_media || {
+    dialogue : null,
+    selection : null,
+    init : function(params) {
+        var display_chooser = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            M.atto_media.selection = M.editor_atto.get_selection();
+            if (M.atto_media.selection !== false) {
+                var dialogue;
+                if (!M.atto_media.dialogue) {
+                    dialogue = new M.core.dialogue({
+                        visible: false,
+                        modal: true,
+                        close: true,
+                        draggable: true
+                    });
+                } else {
+                    dialogue = M.atto_media.dialogue;
+                }
+
+                dialogue.render();
+                dialogue.set('bodyContent', M.atto_media.get_form_content(elementid));
+                dialogue.set('headerContent', M.util.get_string('createmedia', 'atto_media'));
+                dialogue.centerDialogue();
+                dialogue.show();
+                M.atto_media.dialogue = dialogue;
+            }
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'media', params.icon, display_chooser, this);
+    },
+    open_browser : function(e) {
+        var elementid = this.getAttribute('data-editor');
+        e.preventDefault();
+
+        M.editor_atto.show_filepicker(elementid, 'media', M.atto_media.filepicker_callback);
+    },
+    filepicker_callback : function(params) {
+        if (params.url !== '') {
+            var input = Y.one('#atto_media_urlentry');
+            input.set('value', params.url);
+            input = Y.one('#atto_media_nameentry');
+            input.set('value', params.file);
+        }
+    },
+    set_media : function(e) {
+        e.preventDefault();
+        M.atto_media.dialogue.hide();
+
+        var input = e.currentTarget.get('parentNode').one('#atto_media_urlentry');
+        var url = input.get('value');
+        input = e.currentTarget.get('parentNode').one('#atto_media_nameentry');
+        var name = input.get('value');
+
+        if (url !== '' && name !== '') {
+            M.editor_atto.set_selection(M.atto_media.selection);
+            var mediahtml = '<a href="' + Y.Escape.html(url) + '">' + name + '</a>';
+
+            if (document.selection && document.selection.createRange().pasteHTML) {
+                document.selection.createRange().pasteHTML(mediahtml);
+            } else {
+                document.execCommand('insertHTML', false, mediahtml);
+            }
+        }
+    },
+    get_form_content : function(elementid) {
+        var content = Y.Node.create('<form class="atto_form">' +
+                             '<label for="atto_media_urlentry">' + M.util.get_string('enterurl', 'atto_media') +
+                             '</label>' +
+                             '<input type="url" value="" id="atto_media_urlentry" size="32"/>' +
+                             '<label for="atto_media_nameentry">' + M.util.get_string('entername', 'atto_media') +
+                             '</label>' +
+                             '<input type="text" value="" id="atto_media_nameentry" size="32" required="true"/>' +
+                             '<hr/>' +
+                             '<button id="openmediabrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
+                             M.util.get_string('browserepositories', 'atto_media') +
+                             '</button>' +
+                             '<hr/>' +
+                             '<button id="atto_media_urlentrysubmit">' +
+                             M.util.get_string('createmedia', 'atto_media') +
+                             '</button>' +
+                             '</form>' +
+                             '<hr/>' + M.util.get_string('accessibilityhint', 'atto_media'));
+
+        content.one('#atto_media_urlentrysubmit').on('click', M.atto_media.set_media);
+        content.one('#openmediabrowser').on('click', M.atto_media.open_browser);
+        return content;
+    }
+};
diff --git a/lib/editor/atto/plugins/media/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/media/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..3632bf7
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "moodle-atto_media-button": {
+    "requires": [
+        "node",
+        "escape"
+    ]
+  }
+}
diff --git a/lib/editor/atto/plugins/orderedlist/lang/en/atto_orderedlist.php b/lib/editor/atto/plugins/orderedlist/lang/en/atto_orderedlist.php
new file mode 100644 (file)
index 0000000..8070eb5
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_orderedlist', language 'en'.
+ *
+ * @package    atto_orderedlist
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Ordered list';
+$string['orderedlist'] = 'Ordered list';
diff --git a/lib/editor/atto/plugins/orderedlist/lib.php b/lib/editor/atto/plugins/orderedlist/lib.php
new file mode 100644 (file)
index 0000000..524202c
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 integration version file.
+ *
+ * @package    atto_orderedlist
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_orderedlist_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('orderedlist',
+                              get_string('orderedlist', 'atto_orderedlist'),
+                              'atto_orderedlist',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_orderedlist-button',
+                                'M.atto_orderedlist.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_orderedlist_sort_order() {
+    return 6;
+}
diff --git a/lib/editor/atto/plugins/orderedlist/pix/orderedlist.png b/lib/editor/atto/plugins/orderedlist/pix/orderedlist.png
new file mode 100644 (file)
index 0000000..33fbb63
Binary files /dev/null and b/lib/editor/atto/plugins/orderedlist/pix/orderedlist.png differ
diff --git a/lib/editor/atto/plugins/orderedlist/pix/orderedlist.svg b/lib/editor/atto/plugins/orderedlist/pix/orderedlist.svg
new file mode 100644 (file)
index 0000000..1172fd5
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="orderedlist.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="4.0559186"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Ordered list"
+       x="6.2503185"
+       y="1043.1448"
+       id="text2984"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="6.2503185"
+         y="1043.1448"
+         style="font-size:9px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Ordered list"
+         id="tspan2984">1-</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text2987"
+       y="1051.6046"
+       x="6.2503185"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Ordered list"
+       xml:space="preserve"><tspan
+         id="tspan2989"
+         style="font-size:9px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Ordered list"
+         y="1051.6046"
+         x="6.2503185"
+         sodipodi:role="line">2-</tspan></text>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/orderedlist/version.php b/lib/editor/atto/plugins/orderedlist/version.php
new file mode 100644 (file)
index 0000000..e48cc60
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_orderedlist
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_orderedlist';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-debug.js b/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-debug.js
new file mode 100644 (file)
index 0000000..c1a0706
Binary files /dev/null and b/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-debug.js differ
diff --git a/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-min.js b/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-min.js
new file mode 100644 (file)
index 0000000..d606ba0
Binary files /dev/null and b/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button-min.js differ
diff --git a/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button.js b/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button.js
new file mode 100644 (file)
index 0000000..c1a0706
Binary files /dev/null and b/lib/editor/atto/plugins/orderedlist/yui/build/moodle-atto_orderedlist-button/moodle-atto_orderedlist-button.js differ
diff --git a/lib/editor/atto/plugins/orderedlist/yui/src/button/build.json b/lib/editor/atto/plugins/orderedlist/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..2326ff6
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_orderedlist-button",
+  "builds": {
+    "moodle-atto_orderedlist-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/orderedlist/yui/src/button/js/button.js b/lib/editor/atto/plugins/orderedlist/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..8f54943
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 orderedlist plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_orderedlist = M.atto_orderedlist || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('insertOrderedList', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'orderedlist', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/orderedlist/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/orderedlist/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..08ed48a
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_orderedlist-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/outdent/lang/en/atto_outdent.php b/lib/editor/atto/plugins/outdent/lang/en/atto_outdent.php
new file mode 100644 (file)
index 0000000..ee5f5f2
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_outdent', language 'en'.
+ *
+ * @package    atto_outdent
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Outdent';
+$string['outdent'] = 'Outdent';
diff --git a/lib/editor/atto/plugins/outdent/lib.php b/lib/editor/atto/plugins/outdent/lib.php
new file mode 100644 (file)
index 0000000..29cca4c
--- /dev/null
@@ -0,0 +1,50 @@
+<?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 integration version file.
+ *
+ * @package    atto_outdent
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_outdent_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('outdent',
+                              get_string('outdent', 'atto_outdent'),
+                              'atto_outdent',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_outdent-button',
+                                'M.atto_outdent.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_outdent_sort_order() {
+    return 4;
+}
diff --git a/lib/editor/atto/plugins/outdent/pix/outdent.png b/lib/editor/atto/plugins/outdent/pix/outdent.png
new file mode 100644 (file)
index 0000000..2c708fa
Binary files /dev/null and b/lib/editor/atto/plugins/outdent/pix/outdent.png differ
diff --git a/lib/editor/atto/plugins/outdent/pix/outdent.svg b/lib/editor/atto/plugins/outdent/pix/outdent.svg
new file mode 100644 (file)
index 0000000..a2be28a
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="outdent.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Outdent"
+       x="7.2604713"
+       y="1049.6475"
+       id="text2984"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan2986"
+         x="7.2604713"
+         y="1049.6475"
+         style="font-size:14px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Outdent">&lt;</tspan></text>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/outdent/version.php b/lib/editor/atto/plugins/outdent/version.php
new file mode 100644 (file)
index 0000000..535850c
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_outdent
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_outdent';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-debug.js b/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-debug.js
new file mode 100644 (file)
index 0000000..cd8bd52
Binary files /dev/null and b/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-debug.js differ
diff --git a/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-min.js b/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-min.js
new file mode 100644 (file)
index 0000000..4d14a82
Binary files /dev/null and b/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button-min.js differ
diff --git a/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button.js b/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button.js
new file mode 100644 (file)
index 0000000..cd8bd52
Binary files /dev/null and b/lib/editor/atto/plugins/outdent/yui/build/moodle-atto_outdent-button/moodle-atto_outdent-button.js differ
diff --git a/lib/editor/atto/plugins/outdent/yui/src/button/build.json b/lib/editor/atto/plugins/outdent/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..177e1c7
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_outdent-button",
+  "builds": {
+    "moodle-atto_outdent-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/outdent/yui/src/button/js/button.js b/lib/editor/atto/plugins/outdent/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..2f7eebc
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 outdent plugin.
+ *
+ * @package editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_outdent = M.atto_outdent || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('outdent', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'outdent', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/outdent/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/outdent/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..5c46b6c
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_outdent-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/strike/lang/en/atto_strike.php b/lib/editor/atto/plugins/strike/lang/en/atto_strike.php
new file mode 100644 (file)
index 0000000..f25ee27
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_strike', language 'en'.
+ *
+ * @package    atto_strike
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Strike through';
+$string['strike'] = 'Strike through';
diff --git a/lib/editor/atto/plugins/strike/lib.php b/lib/editor/atto/plugins/strike/lib.php
new file mode 100644 (file)
index 0000000..000bb44
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 integration version file.
+ *
+ * @package    atto_strike
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_strike_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('strike',
+                              get_string('strike', 'atto_strike'),
+                              'atto_strike',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_strike-button',
+                                'M.atto_strike.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_strike_sort_order() {
+    return 3;
+}
diff --git a/lib/editor/atto/plugins/strike/pix/strike.png b/lib/editor/atto/plugins/strike/pix/strike.png
new file mode 100644 (file)
index 0000000..c5c3a61
Binary files /dev/null and b/lib/editor/atto/plugins/strike/pix/strike.png differ
diff --git a/lib/editor/atto/plugins/strike/pix/strike.svg b/lib/editor/atto/plugins/strike/pix/strike.svg
new file mode 100644 (file)
index 0000000..5633651
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="strike.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <g
+       id="g2985"
+       transform="translate(0.3788072,0.69447987)">
+      <text
+         sodipodi:linespacing="125%"
+         id="text2984"
+         y="1047.1852"
+         x="7.7024131"
+         style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
+         xml:space="preserve"><tspan
+           style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial"
+           y="1047.1852"
+           x="7.7024131"
+           id="tspan2986"
+           sodipodi:role="line">s</tspan></text>
+      <path
+         inkscape:connector-curvature="0"
+         id="path2984"
+         d="m 3.0304576,1043.3971 9.6595834,0"
+         style="fill:none;stroke:#999999;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+    </g>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/strike/version.php b/lib/editor/atto/plugins/strike/version.php
new file mode 100644 (file)
index 0000000..9cca900
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_strike
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_strike';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js
new file mode 100644 (file)
index 0000000..34f2908
Binary files /dev/null and b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-debug.js differ
diff --git a/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js
new file mode 100644 (file)
index 0000000..d37fd84
Binary files /dev/null and b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button-min.js differ
diff --git a/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js
new file mode 100644 (file)
index 0000000..34f2908
Binary files /dev/null and b/lib/editor/atto/plugins/strike/yui/build/moodle-atto_strike-button/moodle-atto_strike-button.js differ
diff --git a/lib/editor/atto/plugins/strike/yui/src/button/build.json b/lib/editor/atto/plugins/strike/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..b24dfb5
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_strike-button",
+  "builds": {
+    "moodle-atto_strike-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/strike/yui/src/button/js/button.js b/lib/editor/atto/plugins/strike/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..06b0629
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 strike plugin.
+ *
+ * @package editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_strike = M.atto_strike || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('strikeThrough', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'strike', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/strike/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/strike/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..71772d2
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_strike-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/title/lang/en/atto_title.php b/lib/editor/atto/plugins/title/lang/en/atto_title.php
new file mode 100644 (file)
index 0000000..fd66aed
--- /dev/null
@@ -0,0 +1,30 @@
+<?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 'atto_title', language 'en'.
+ *
+ * @package    atto_title
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Paragraph styles';
+$string['title'] = 'Paragraph styles';
+$string['h1'] = 'Title';
+$string['h2'] = 'Heading';
+$string['blockquote'] = 'Quoted';
+$string['p'] = 'Plain';
diff --git a/lib/editor/atto/plugins/title/lib.php b/lib/editor/atto/plugins/title/lib.php
new file mode 100644 (file)
index 0000000..5480467
--- /dev/null
@@ -0,0 +1,56 @@
+<?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 integration version file.
+ *
+ * @package    atto_title
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_title_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('title',
+                              get_string('title', 'atto_title'),
+                              'atto_title',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->strings_for_js(array('h1',
+                                          'h2',
+                                          'blockquote',
+                                          'p'), 'atto_title');
+    $PAGE->requires->yui_module('moodle-atto_title-button',
+                                'M.atto_title.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_title_sort_order() {
+    return 9;
+}
diff --git a/lib/editor/atto/plugins/title/pix/title.png b/lib/editor/atto/plugins/title/pix/title.png
new file mode 100644 (file)
index 0000000..9a587fb
Binary files /dev/null and b/lib/editor/atto/plugins/title/pix/title.png differ
diff --git a/lib/editor/atto/plugins/title/pix/title.svg b/lib/editor/atto/plugins/title/pix/title.svg
new file mode 100644 (file)
index 0000000..fc86cca
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="32"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="title.svg"
+   inkscape:export-filename="/home/damyonw/Documents/Moodle/instances/im/moodle/lib/editor/atto/plugins/title/pix/title.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="10.944636"
+     inkscape:cy="10.261282"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1175"
+     inkscape:window-height="714"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:60.68878555px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Title"
+       x="7.4835119"
+       y="1106.6505"
+       id="text2984"
+       sodipodi:linespacing="125%"
+       transform="scale(1.0545606,0.94826226)"><tspan
+         sodipodi:role="line"
+         id="tspan2986"
+         x="7.4835119"
+         y="1106.6505"
+         style="font-size:13.27567196px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Title">T</tspan></text>
+    <rect
+       style="fill:none;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       id="rect2984"
+       width="13.068849"
+       height="13.195118"
+       x="1.3889598"
+       y="1.2896537"
+       transform="translate(0,1036.3622)"
+       ry="0.74078137" />
+    <path
+       style="fill:#999999;fill-opacity:1;stroke:#999999;stroke-width:0.46544716;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
+       d="m 23.655897,1047.3429 c -3.478888,-4.407 -1.017073,-1.216 -3.777349,-4.5667 0,-0.1504 0.1952,-0.2718 0.437667,-0.2718 l 6.845979,0 c 0.242467,0 0.547252,0.1374 0.437667,0.2718 l -3.506296,4.2951 c -0.109585,0.1342 -0.1952,0.2716 -0.437668,0.2716 z"
+       id="rect2985"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="ccssssc" />
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/title/version.php b/lib/editor/atto/plugins/title/version.php
new file mode 100644 (file)
index 0000000..a6542af
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_title
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_title';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-debug.js b/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-debug.js
new file mode 100644 (file)
index 0000000..f99197f
Binary files /dev/null and b/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-debug.js differ
diff --git a/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-min.js b/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-min.js
new file mode 100644 (file)
index 0000000..94806e6
Binary files /dev/null and b/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button-min.js differ
diff --git a/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button.js b/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button.js
new file mode 100644 (file)
index 0000000..f99197f
Binary files /dev/null and b/lib/editor/atto/plugins/title/yui/build/moodle-atto_title-button/moodle-atto_title-button.js differ
diff --git a/lib/editor/atto/plugins/title/yui/src/button/build.json b/lib/editor/atto/plugins/title/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..8ee3ce0
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_title-button",
+  "builds": {
+    "moodle-atto_title-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/title/yui/src/button/js/button.js b/lib/editor/atto/plugins/title/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..aaa1c20
--- /dev/null
@@ -0,0 +1,69 @@
+// 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 title plugin.
+ *
+ * @package editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_title = M.atto_title || {
+    init : function(params) {
+        var click_h1 = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('formatBlock', false, '<h1>');
+        };
+        var click_h2 = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('formatBlock', false, '<h2>');
+        };
+        var click_blockquote = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('formatBlock', false, '<blockquote>');
+        };
+        var click_p = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('formatBlock', false, '<p>');
+        };
+
+        var h1 = '<h1>' +  M.util.get_string('h1', 'atto_title') + '</h1>';
+        var h2 = '<h2>' +  M.util.get_string('h2', 'atto_title') + '</h2>';
+        var blockquote = '<p>&nbsp;&nbsp;&nbsp;&nbsp;' +  M.util.get_string('blockquote', 'atto_title') + '</p>';
+        var p = '<p>' +  M.util.get_string('p', 'atto_title') + '</p>';
+
+        M.editor_atto.add_toolbar_menu(params.elementid,
+                                                  'title',
+                                                  params.icon,
+                                                  [
+                                                      {'text' : h1, 'handler' : click_h1},
+                                                      {'text' : h2, 'handler' : click_h2},
+                                                      {'text' : blockquote, 'handler' : click_blockquote},
+                                                      {'text' : p, 'handler' : click_p}
+                                                  ]);
+    }
+};
diff --git a/lib/editor/atto/plugins/title/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/title/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..c073041
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_title-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/underline/lang/en/atto_underline.php b/lib/editor/atto/plugins/underline/lang/en/atto_underline.php
new file mode 100644 (file)
index 0000000..53c93de
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_underline', language 'en'.
+ *
+ * @package    atto_underline
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Underline';
+$string['underline'] = 'Underline';
diff --git a/lib/editor/atto/plugins/underline/lib.php b/lib/editor/atto/plugins/underline/lib.php
new file mode 100644 (file)
index 0000000..bde1f90
--- /dev/null
@@ -0,0 +1,52 @@
+<?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 integration version file.
+ *
+ * @package    atto_underline
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_underline_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('underline',
+                              get_string('underline', 'atto_underline'),
+                              'atto_underline',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_underline-button',
+                                'M.atto_underline.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_underline_sort_order() {
+    return 2;
+}
diff --git a/lib/editor/atto/plugins/underline/pix/underline.png b/lib/editor/atto/plugins/underline/pix/underline.png
new file mode 100644 (file)
index 0000000..329e497
Binary files /dev/null and b/lib/editor/atto/plugins/underline/pix/underline.png differ
diff --git a/lib/editor/atto/plugins/underline/pix/underline.svg b/lib/editor/atto/plugins/underline/pix/underline.svg
new file mode 100644 (file)
index 0000000..001012e
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="underline.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.312045"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <text
+       xml:space="preserve"
+       style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
+       x="8.0812206"
+       y="1047.1852"
+       id="text2984"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan2986"
+         x="8.0812206"
+         y="1047.1852"
+         style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial">u</tspan></text>
+    <path
+       style="fill:none;stroke:#999999;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 3.5986684,1048.4479 9.6595836,0"
+       id="path2984"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/underline/version.php b/lib/editor/atto/plugins/underline/version.php
new file mode 100644 (file)
index 0000000..4938a10
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_underline
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_underline';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-debug.js b/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-debug.js
new file mode 100644 (file)
index 0000000..caa347e
Binary files /dev/null and b/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-debug.js differ
diff --git a/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-min.js b/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-min.js
new file mode 100644 (file)
index 0000000..6954ce2
Binary files /dev/null and b/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button-min.js differ
diff --git a/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button.js b/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button.js
new file mode 100644 (file)
index 0000000..caa347e
Binary files /dev/null and b/lib/editor/atto/plugins/underline/yui/build/moodle-atto_underline-button/moodle-atto_underline-button.js differ
diff --git a/lib/editor/atto/plugins/underline/yui/src/button/build.json b/lib/editor/atto/plugins/underline/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..7617273
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_underline-button",
+  "builds": {
+    "moodle-atto_underline-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/underline/yui/src/button/js/button.js b/lib/editor/atto/plugins/underline/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..f4ac98f
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 underline plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_underline = M.atto_underline || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('underline', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'underline', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/underline/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/underline/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..e96b89b
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_underline-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php b/lib/editor/atto/plugins/unlink/lang/en/atto_unlink.php
new file mode 100644 (file)
index 0000000..2ab5b16
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_unlink', language 'en'.
+ *
+ * @package    atto_unlink
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Unlink';
+$string['unlink'] = 'Unlink';
diff --git a/lib/editor/atto/plugins/unlink/lib.php b/lib/editor/atto/plugins/unlink/lib.php
new file mode 100644 (file)
index 0000000..eef0449
--- /dev/null
@@ -0,0 +1,50 @@
+<?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 integration version file.
+ *
+ * @package    atto_unlink
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_unlink_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('unlink',
+                              get_string('unlink', 'atto_unlink'),
+                              'atto_unlink',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_unlink-button',
+                                'M.atto_unlink.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_unlink_sort_order() {
+    return 12;
+}
diff --git a/lib/editor/atto/plugins/unlink/pix/unlink.png b/lib/editor/atto/plugins/unlink/pix/unlink.png
new file mode 100644 (file)
index 0000000..1dbbb9c
Binary files /dev/null and b/lib/editor/atto/plugins/unlink/pix/unlink.png differ
diff --git a/lib/editor/atto/plugins/unlink/pix/unlink.svg b/lib/editor/atto/plugins/unlink/pix/unlink.svg
new file mode 100644 (file)
index 0000000..114b77b
--- /dev/null
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="unlink.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.5976985"
+     inkscape:cy="1.7715312"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1440"
+     inkscape:window-height="872"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <g
+       id="g3812">
+      <rect
+         ry="0.053281363"
+         y="1040.9337"
+         x="-13.535714"
+         height="6.8750005"
+         width="19.107143"
+         id="rect2984"
+         style="fill:none;stroke:#999999;stroke-width:2.90000010000000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+      <path
+         id="rect3756"
+         transform="translate(0,1036.3622)"
+         d="m 1.875,7.84375 c -0.029518,0 -0.03125,0.032982 -0.03125,0.0625 l 0,0.1875 c 0,0.029518 0.00173,0.0625 0.03125,0.0625 l 5.03125,0 0,-0.3125 z"
+         style="fill:none;stroke:#999999;stroke-width:2.89999999999999991;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+         inkscape:connector-curvature="0"
+         sodipodi:nodetypes="ssssccs" />
+    </g>
+    <g
+       id="g3808"
+       transform="matrix(0.92557914,0.37855417,-0.37855417,0.92557914,396.7365,74.82763)">
+      <rect
+         style="fill:none;stroke:#999999;stroke-width:2.90000010000000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+         id="rect3754"
+         width="19.107143"
+         height="6.8750005"
+         x="10.432884"
+         y="1040.9337"
+         ry="0.053281363" />
+      <path
+         inkscape:connector-curvature="0"
+         style="fill:none;stroke:#999999;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+         d="m 13.973214,1044.206 c 0.02952,0 0.03125,0.033 0.03125,0.063 l 0,0.1875 c 0,0.03 -0.0017,0.063 -0.03125,0.063 l -4.4838532,-0.2046 0,-0.3125 4.4838532,0.2046 z"
+         id="path3806"
+         sodipodi:nodetypes="cssscccc" />
+    </g>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/unlink/version.php b/lib/editor/atto/plugins/unlink/version.php
new file mode 100644 (file)
index 0000000..4b9e76e
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_unlink
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_unlink';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js
new file mode 100644 (file)
index 0000000..365a993
Binary files /dev/null and b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-debug.js differ
diff --git a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js
new file mode 100644 (file)
index 0000000..4f412d0
Binary files /dev/null and b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button-min.js differ
diff --git a/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js
new file mode 100644 (file)
index 0000000..365a993
Binary files /dev/null and b/lib/editor/atto/plugins/unlink/yui/build/moodle-atto_unlink-button/moodle-atto_unlink-button.js differ
diff --git a/lib/editor/atto/plugins/unlink/yui/src/button/build.json b/lib/editor/atto/plugins/unlink/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..57ceaa5
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_unlink-button",
+  "builds": {
+    "moodle-atto_unlink-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/unlink/yui/src/button/js/button.js b/lib/editor/atto/plugins/unlink/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..fd19d81
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 unlink plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_unlink = M.atto_unlink || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('unlink', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'unlink', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/unlink/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/unlink/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..4486469
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_unlink-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/plugins/unorderedlist/lang/en/atto_unorderedlist.php b/lib/editor/atto/plugins/unorderedlist/lang/en/atto_unorderedlist.php
new file mode 100644 (file)
index 0000000..3428508
--- /dev/null
@@ -0,0 +1,26 @@
+<?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 'atto_unorderedlist', language 'en'.
+ *
+ * @package    atto_unorderedlist
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Unordered list';
+$string['unorderedlist'] = 'Unordered list';
diff --git a/lib/editor/atto/plugins/unorderedlist/lib.php b/lib/editor/atto/plugins/unorderedlist/lib.php
new file mode 100644 (file)
index 0000000..6224f90
--- /dev/null
@@ -0,0 +1,50 @@
+<?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 integration version file.
+ *
+ * @package    atto_unorderedlist
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Initialise this plugin
+ * @param string $elementid
+ */
+function atto_unorderedlist_init_editor($elementid) {
+    global $PAGE, $OUTPUT;
+
+    $icon = $OUTPUT->pix_icon('unorderedlist',
+                              get_string('unorderedlist', 'atto_unorderedlist'),
+                              'atto_unorderedlist',
+                              array('class'=>'icon'));
+
+    $PAGE->requires->yui_module('moodle-atto_unorderedlist-button',
+                                'M.atto_unorderedlist.init',
+                                array(array('elementid'=>$elementid, 'icon'=>$icon)),
+                                true);
+
+}
+
+/**
+ * Return the order this plugin should be displayed in the toolbar
+ * @return int
+ */
+function atto_unorderedlist_sort_order() {
+    return 7;
+}
diff --git a/lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.png b/lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.png
new file mode 100644 (file)
index 0000000..95b9d12
Binary files /dev/null and b/lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.png differ
diff --git a/lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.svg b/lib/editor/atto/plugins/unorderedlist/pix/unorderedlist.svg
new file mode 100644 (file)
index 0000000..e85158f
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="unorderedlist.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-8.2482624"
+     inkscape:cy="15.941996"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1122"
+     inkscape:window-height="685"
+     inkscape:window-x="162"
+     inkscape:window-y="57"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <g
+       id="g3761">
+      <text
+         sodipodi:linespacing="125%"
+         id="text2984"
+         y="1048.511"
+         x="4.8613591"
+         style="font-size:64px;font-style:normal;font-variant:normal;font-weight:unorderedlist;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Unordered list"
+         xml:space="preserve"><tspan
+           id="tspan2984"
+           style="font-size:14px;font-style:normal;font-variant:normal;font-weight:unorderedlist;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Unordered list"
+           y="1048.511"
+           x="4.8613591"
+           sodipodi:role="line">*</tspan></text>
+      <text
+         sodipodi:linespacing="125%"
+         id="text2989"
+         y="1044.4072"
+         x="11.111678"
+         style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
+         xml:space="preserve"><tspan
+           style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial"
+           y="1044.4072"
+           x="11.111678"
+           id="tspan2991"
+           sodipodi:role="line">-</tspan></text>
+    </g>
+    <g
+       id="g3767"
+       transform="translate(0,6)">
+      <text
+         xml:space="preserve"
+         style="font-size:64px;font-style:normal;font-variant:normal;font-weight:unorderedlist;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Unordered list"
+         x="4.8613591"
+         y="1048.511"
+         id="text3769"
+         sodipodi:linespacing="125%"><tspan
+           sodipodi:role="line"
+           x="4.8613591"
+           y="1048.511"
+           style="font-size:14px;font-style:normal;font-variant:normal;font-weight:unorderedlist;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Unordered list"
+           id="tspan3771">*</tspan></text>
+      <text
+         xml:space="preserve"
+         style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
+         x="11.111678"
+         y="1044.4072"
+         id="text3773"
+         sodipodi:linespacing="125%"><tspan
+           sodipodi:role="line"
+           id="tspan3775"
+           x="11.111678"
+           y="1044.4072"
+           style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial">-</tspan></text>
+    </g>
+  </g>
+</svg>
diff --git a/lib/editor/atto/plugins/unorderedlist/version.php b/lib/editor/atto/plugins/unorderedlist/version.php
new file mode 100644 (file)
index 0000000..ec5600d
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    atto_unorderedlist
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'atto_unorderedlist';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-debug.js b/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-debug.js
new file mode 100644 (file)
index 0000000..4915b2e
Binary files /dev/null and b/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-debug.js differ
diff --git a/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-min.js b/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-min.js
new file mode 100644 (file)
index 0000000..5694eae
Binary files /dev/null and b/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button-min.js differ
diff --git a/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button.js b/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button.js
new file mode 100644 (file)
index 0000000..4915b2e
Binary files /dev/null and b/lib/editor/atto/plugins/unorderedlist/yui/build/moodle-atto_unorderedlist-button/moodle-atto_unorderedlist-button.js differ
diff --git a/lib/editor/atto/plugins/unorderedlist/yui/src/button/build.json b/lib/editor/atto/plugins/unorderedlist/yui/src/button/build.json
new file mode 100644 (file)
index 0000000..eced221
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-atto_unorderedlist-button",
+  "builds": {
+    "moodle-atto_unorderedlist-button": {
+      "jsfiles": [
+        "button.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/plugins/unorderedlist/yui/src/button/js/button.js b/lib/editor/atto/plugins/unorderedlist/yui/src/button/js/button.js
new file mode 100644 (file)
index 0000000..e86e3e9
--- /dev/null
@@ -0,0 +1,35 @@
+// 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 unorderedlist plugin.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.atto_unorderedlist = M.atto_unorderedlist || {
+    init : function(params) {
+        var click = function(e, elementid) {
+            e.preventDefault();
+            if (!M.editor_atto.is_active(elementid)) {
+                M.editor_atto.focus(elementid);
+            }
+            document.execCommand('insertUnorderedList', false, null);
+        };
+
+        M.editor_atto.add_toolbar_button(params.elementid, 'unorderedlist', params.icon, click);
+    }
+};
diff --git a/lib/editor/atto/plugins/unorderedlist/yui/src/button/meta/editor.json b/lib/editor/atto/plugins/unorderedlist/yui/src/button/meta/editor.json
new file mode 100644 (file)
index 0000000..58307eb
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "moodle-atto_unorderedlist-button": {
+    "requires": ["node"]
+  }
+}
diff --git a/lib/editor/atto/styles.css b/lib/editor/atto/styles.css
new file mode 100644 (file)
index 0000000..437ae34
--- /dev/null
@@ -0,0 +1,71 @@
+div.editor_atto {
+    background-color: white;
+    border: 1px solid #444;
+}
+
+div.editor_atto_toolbar {
+    display: block;
+}
+
+div.editor_atto_toolbar button {
+    padding: 1px;
+    padding: 3px;
+}
+div.editor_atto_toolbar button img {
+    padding: 1px;
+}
+
+div.editor_atto_toolbar button.atto_strike_button,
+div.editor_atto_toolbar button.atto_unorderedlist_button,
+div.editor_atto_toolbar button.atto_clear_button,
+div.editor_atto_toolbar button.atto_indent_button {
+    margin-right: 1em;
+}
+body.dir-rtl div.editor_atto_toolbar button.atto_strike_button,
+body.dir-rtl div.editor_atto_toolbar button.atto_unorderedlist_button,
+body.dir-rtl div.editor_atto_toolbar button.atto_clear_button,
+body.dir-rtl div.editor_atto_toolbar button.atto_indent_button {
+    margin-right: 0px;
+    margin-left: 1em;
+}
+
+.atto_hasmenu .icon {
+    width: 32px;
+}
+
+.editor_atto img {
+    resize: both; overflow: auto;
+}
+.atto_menuentry {
+    clear: left;
+}
+.atto_menuentry img {
+    width: 16px;
+    height: 16px;
+}
+
+.atto_menu {
+    min-width: 12em;
+    background: white;
+    padding: 1px;
+}
+
+.atto_menu a {
+    color: black;
+}
+.atto_menuentry {
+    border-bottom: 1px solid #eee;
+    padding: 2px;
+}
+
+.atto_menuentry h1,
+.atto_menuentry h2,
+.atto_menuentry p {
+    margin: 4px;
+}
+
+
+.atto_form label {
+    display: block;
+    margin: 5px;
+}
diff --git a/lib/editor/atto/version.php b/lib/editor/atto/version.php
new file mode 100644 (file)
index 0000000..90d5388
--- /dev/null
@@ -0,0 +1,29 @@
+<?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 integration version file.
+ *
+ * @package    editor_atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version   = 2013080900;        // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires  = 2013050100;        // Requires this Moodle version.
+$plugin->component = 'editor_atto';  // Full name of the plugin (used for diagnostics).
diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
new file mode 100644 (file)
index 0000000..82a3d47
Binary files /dev/null and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js differ
diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
new file mode 100644 (file)
index 0000000..8c038da
Binary files /dev/null and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js differ
diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js
new file mode 100644 (file)
index 0000000..82a3d47
Binary files /dev/null and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js differ
diff --git a/lib/editor/atto/yui/src/editor/build.json b/lib/editor/atto/yui/src/editor/build.json
new file mode 100644 (file)
index 0000000..88718f4
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "moodle-editor_atto-editor",
+  "builds": {
+    "moodle-editor_atto-editor": {
+      "jsfiles": [
+        "editor.js"
+      ]
+    }
+  }
+}
diff --git a/lib/editor/atto/yui/src/editor/js/editor.js b/lib/editor/atto/yui/src/editor/js/editor.js
new file mode 100644 (file)
index 0000000..a2d967d
--- /dev/null
@@ -0,0 +1,407 @@
+// 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 editor main class.
+ * Common functions required by editor plugins.
+ *
+ * @package    editor-atto
+ * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+M.editor_atto = M.editor_atto || {
+    /**
+     * List of attached button handlers to prevent duplicates.
+     */
+    buttonhandlers : {},
+
+    /**
+     * List of YUI overlays for custom menus.
+     */
+    menus : {},
+
+    /**
+     * List of attached menu handlers to prevent duplicates.
+     */
+    menuhandlers : {},
+
+    /**
+     * List of file picker options for specific editor instances.
+     */
+    filepickeroptions : {},
+
+    /**
+     * List of buttons and menus that have been added to the toolbar.
+     */
+    widgets : {},
+
+    /**
+     * Toggle a menu.
+     * @param event e
+     */
+    showhide_menu_handler : function(e) {
+        e.preventDefault();
+        var disabled = this.getAttribute('disabled');
+        var overlayid = this.getAttribute('data-menu');
+        var overlay = M.editor_atto.menus[overlayid];
+
+        if (overlay.get('visible') || disabled) {
+            overlay.hide();
+        } else {
+            overlay.show();
+        }
+
+    },
+
+    /**
+     * Handle clicks on editor buttons.
+     * @param event e
+     */
+    buttonclicked_handler : function(e) {
+        var elementid = this.getAttribute('data-editor');
+        var plugin = this.getAttribute('data-plugin');
+        var handler = this.getAttribute('data-handler');
+        var overlay = M.editor_atto.menus[plugin + '_' + elementid];
+
+        if (overlay) {
+            overlay.hide();
+        }
+
+        if (M.editor_atto.is_enabled(elementid, plugin)) {
+            // Pass it on.
+            handler = M.editor_atto.buttonhandlers[handler];
+            return handler(e, elementid);
+        }
+    },
+
+    /**
+     * Determine if the specified toolbar button/menu is enabled.
+     * @param string elementid, the element id of this editor.
+     * @param string plugin, the plugin that created the button/menu.
+     */
+    is_enabled : function(elementid, plugin) {
+        var element = Y.one('#' + elementid + '_toolbar .atto_' + plugin + '_button');
+
+        return !element.hasAttribute('disabled');
+    },
+    /**
+     * Disable all buttons and menus in the toolbar.
+     * @param string elementid, the element id of this editor.
+     */
+    disable_all_widgets : function(elementid) {
+        var plugin, element;
+        for (plugin in M.editor_atto.widgets) {
+            element = Y.one('#' + elementid + '_toolbar .atto_' + plugin + '_button');
+
+            if (element) {
+                element.setAttribute('disabled', 'true');
+            }
+        }
+    },
+
+    /**
+     * Enable a single widget in the toolbar.
+     * @param string elementid, the element id of this editor.
+     * @param string plugin, the name of the plugin that created the widget.
+     */
+    enable_widget : function(elementid, plugin) {
+        var element = Y.one('#' + elementid + '_toolbar .atto_' + plugin + '_button');
+
+        if (element) {
+            element.removeAttribute('disabled');
+        }
+    },
+
+    /**
+     * Enable all buttons and menus in the toolbar.
+     * @param string elementid, the element id of this editor.
+     */
+    enable_all_widgets : function(elementid) {
+        var plugin, element;
+        for (plugin in M.editor_atto.widgets) {
+            element = Y.one('#' + elementid + '_toolbar .atto_' + plugin + '_button');
+
+            if (element) {
+                element.removeAttribute('disabled');
+            }
+        }
+    },
+
+    /**
+     * Add a button to the toolbar belonging to the editor for element with id "elementid".
+     * @param string elementid - the id of the textarea we created this editor from.
+     * @param string plugin - the plugin defining the button
+     * @param string icon - the html used for the content of the button
+     * @handler function handler- A function to call when the button is clicked.
+     */
+    add_toolbar_menu : function(elementid, plugin, icon, entries) {
+        var toolbar = Y.one('#' + elementid + '_toolbar');
+        var button = Y.Node.create('<button class="atto_' + plugin + '_button atto_hasmenu" ' +
+                                    'data-editor="' + Y.Escape.html(elementid) + '" ' +
+                                    'data-menu="' + plugin + '_' + elementid + '" >' +
+                                    icon +
+                                    '</button>');
+
+        toolbar.append(button);
+
+        // Save the name of the plugin.
+        M.editor_atto.widgets[plugin] = plugin;
+
+        var menu = Y.Node.create('<div class="atto_' + plugin + '_menu' +
+                                 ' atto_menu" data-editor="' + Y.Escape.html(elementid) + '"></div>');
+
+        var i = 0, entry = {};
+
+        for (i = 0; i < entries.length; i++) {
+            entry = entries[i];
+
+            menu.append(Y.Node.create('<div class="atto_menuentry">' +
+                                       '<a href="#" class="atto_' + plugin + '_action_' + i + '" ' +
+                                       'data-editor="' + Y.Escape.html(elementid) + '" ' +
+                                       'data-plugin="' + Y.Escape.html(plugin) + '" ' +
+                                       'data-handler="' + Y.Escape.html(plugin + '_action_' + i) + '">' +
+                                       entry.text +
+                                       '</a>' +
+                                       '</div>'));
+            if (!M.editor_atto.buttonhandlers[plugin + '_action_' + i]) {
+                Y.one('body').delegate('click', M.editor_atto.buttonclicked_handler, '.atto_' + plugin + '_action_' + i);
+                M.editor_atto.buttonhandlers[plugin + '_action_' + i] = entry.handler;
+            }
+        }
+
+        if (!M.editor_atto.buttonhandlers[plugin]) {
+            Y.one('body').delegate('click', M.editor_atto.showhide_menu_handler, '.atto_' + plugin + '_button');
+            M.editor_atto.buttonhandlers[plugin] = true;
+        }
+
+        var overlay = new M.core.dialogue({
+            bodyContent : menu,
+            visible : false,
+            width: '14em',
+            zindex: 100,
+            lightbox: false,
+            closeButton: false,
+            align: {node: button, points: [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]}
+        });
+
+        M.editor_atto.menus[plugin + '_' + elementid] = overlay;
+        overlay.render();
+        overlay.hide();
+        overlay.headerNode.hide();
+    },
+
+    /**
+     * Add a button to the toolbar belonging to the editor for element with id "elementid".
+     * @param string elementid - the id of the textarea we created this editor from.
+     * @param string plugin - the plugin defining the button
+     * @param string icon - the html used for the content of the button
+     * @handler function handler- A function to call when the button is clicked.
+     */
+    add_toolbar_button : function(elementid, plugin, icon, handler) {
+        var toolbar = Y.one('#' + elementid + '_toolbar');
+        var button = Y.Node.create('<button class="atto_' + plugin + '_button" ' +
+                                   'data-editor="' + Y.Escape.html(elementid) + '" ' +
+                                   'data-plugin="' + Y.Escape.html(plugin) + '" ' +
+                                   'data-handler="' + Y.Escape.html(plugin) + '">' +
+                                    icon +
+                                    '</button>');
+
+        toolbar.append(button);
+
+        // We only need to attach this once.
+        if (!M.editor_atto.buttonhandlers[plugin]) {
+            Y.one('body').delegate('click', M.editor_atto.buttonclicked_handler, '.atto_' + plugin + '_button');
+            M.editor_atto.buttonhandlers[plugin] = handler;
+        }
+
+        // Save the name of the plugin.
+        M.editor_atto.widgets[plugin] = plugin;
+
+    },
+
+    /**
+     * Work out if the cursor is in the editable area for this editor instance.
+     * @param string elementid of this editor
+     * @return bool
+     */
+    is_active : function(elementid) {
+        var selection = M.editor_atto.get_selection();
+
+        if (selection.length) {
+            selection = selection.pop();
+        }
+
+        var node = null;
+        if (selection.parentElement) {
+            node = Y.one(selection.parentElement());
+        } else {
+            node = Y.one(selection.startContainer);
+        }
+
+        return node && node.ancestor('#' + elementid + 'editable') !== null;
+    },
+
+    /**
+     * Focus on the editable area for this editor.
+     * @param string elementid of this editor
+     */
+    focus : function(elementid) {
+        Y.one('#' + elementid + 'editable').focus();
+    },
+
+    /**
+     * Initialise the editor
+     * @param object params for this editor instance.
+     */
+    init : function(params) {
+        var textarea = Y.one('#' +params.elementid);
+        var atto = Y.Node.create('<div id="' + params.elementid + 'editable" ' +
+                                            'contenteditable="true" ' +
+                                            'spellcheck="true" ' +
+                                            'class="editor_atto"/>');
+        var cssfont = '';
+        var toolbar = Y.Node.create('<div class="editor_atto_toolbar" id="' + params.elementid + '_toolbar"/>');
+
+        // Bleh - why are we sent a url and not the css to apply directly?
+        var css = Y.io(params.content_css, { sync: true });
+        var pos = css.responseText.indexOf('font:');
+        if (pos) {
+            cssfont = css.responseText.substring(pos + 'font:'.length, css.responseText.length - 1);
+            atto.setStyle('font', cssfont);
+        }
+        atto.setStyle('min-height', (1.2 * (textarea.getAttribute('rows') - 1)) + 'em');
+
+        // Copy text to editable div.
+        atto.append(textarea.get('value'));
+
+        // Add the toolbar to the page.
+        textarea.get('parentNode').insert(toolbar, textarea);
+        // Add the editable div to the page.
+        textarea.get('parentNode').insert(atto, textarea);
+        // Hide the old textarea.
+        textarea.hide();
+
+        // Copy the current value back to the textarea when focus leaves us.
+        atto.on('blur', function() {
+            textarea.set('value', atto.getHTML());
+        });
+
+        // Save the file picker options for later.
+        M.editor_atto.filepickeroptions[params.elementid] = params.filepickeroptions;
+    },
+
+    /**
+     * Show the filepicker.
+     * @param string elementid for this editor instance.
+     * @param string type The media type for the file picker
+     * @param function callback
+     */
+    show_filepicker : function(elementid, type, callback) {
+        Y.use('core_filepicker', function (Y) {
+            var options = M.editor_atto.filepickeroptions[elementid][type];
+
+            options.formcallback = callback;
+            options.editor_target = Y.one(elementid);
+
+            M.core_filepicker.show(Y, options);
+        });
+    },
+
+    /**
+     * Create a cross browser selection object that represents a yui node.
+     * @param Node yui node for the selection
+     * @return range (browser dependent)
+     */
+    get_selection_from_node: function(node) {
+        var range;
+
+        if (window.getSelection) {
+            range = document.createRange();
+
+            range.setStartBefore(node.getDOMNode());
+            range.setEndAfter(node.getDOMNode());
+            return [range];
+        } else if (document.selection) {
+            range = document.body.createTextRange();
+            range.moveToElementText(node.getDOMNode());
+            return range;
+        }
+        return false;
+    },
+
+    /**
+     * Get the selection object that can be passed back to set_selection.
+     * @return range (browser dependent)
+     */
+    get_selection : function() {
+        if (window.getSelection) {
+            var sel = window.getSelection();
+            var ranges = [], i = 0;
+            for (i = 0; i < sel.rangeCount; i++) {
+                ranges.push(sel.getRangeAt(i));
+            }
+            return ranges;
+        } else if (document.selection) {
+            // IE < 9
+            if (document.selection.createRange) {
+                return document.selection.createRange();
+            }
+        }
+        return false;
+    },
+
+    /**
+     * Get the dom node representing the common anscestor of the selection nodes.
+     * @return DOMNode
+     */
+    get_selection_parent_node : function() {
+        var selection = M.editor_atto.get_selection();
+        if (selection.length > 0) {
+            return selection[0].commonAncestorContainer;
+        }
+    },
+
+    /**
+     * Get the list of child nodes of the selection.
+     * @return DOMNode[]
+     */
+    get_selection_text : function() {
+        var selection = M.editor_atto.get_selection();
+        if (selection.length > 0 && selection[0].cloneContents) {
+            return selection[0].cloneContents();
+        }
+    },
+
+    /**
+     * Set the current selection. Used to restore a selection.
+     */
+    set_selection : function(selection) {
+        var sel, i;
+
+        if (window.getSelection) {
+            sel = window.getSelection();
+            sel.removeAllRanges();
+            for (i = 0; i < selection.length; i++) {
+                sel.addRange(selection[i]);
+            }
+        } else if (document.selection) {
+            // IE < 9
+            if (selection.select) {
+                selection.select();
+            }
+        }
+    }
+
+};
diff --git a/lib/editor/atto/yui/src/editor/meta/editor.json b/lib/editor/atto/yui/src/editor/meta/editor.json
new file mode 100644 (file)
index 0000000..9e6959c
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "moodle-editor_atto-editor": {
+    "requires": [
+        "node",
+        "io",
+        "overlay",
+        "escape",
+        "moodle-core-notification"
+      ]
+  }
+}
index 8080d80..15f667b 100644 (file)
@@ -114,7 +114,7 @@ function editors_get_enabled() {
     global $CFG;
 
     if (empty($CFG->texteditors)) {
-        $CFG->texteditors = 'tinymce,textarea';
+        $CFG->texteditors = 'tinymce,atto,textarea';
     }
     $active = array();
     foreach(explode(',', $CFG->texteditors) as $e) {
index 6e83947..b319958 100644 (file)
@@ -666,6 +666,12 @@ class plugin_manager {
                 'comments', 'file', 'offline'
             ),
 
+            'atto' => array(
+                'bold', 'clear', 'html', 'image', 'indent', 'italic', 'link',
+                'media', 'orderedlist', 'outdent', 'strike', 'title',
+                'underline', 'unlink', 'unorderedlist'
+            ),
+
             'auth' => array(
                 'cas', 'db', 'email', 'fc', 'imap', 'ldap', 'manual', 'mnet',
                 'nntp', 'nologin', 'none', 'pam', 'pop3', 'radius',
@@ -712,7 +718,7 @@ class plugin_manager {
             ),
 
             'editor' => array(
-                'textarea', 'tinymce'
+                'textarea', 'tinymce', 'atto'
             ),
 
             'enrol' => array(