Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-33041 (4) Use new system for existing added TinyMCE plugins

AMOS BEGIN
  MOV [dragmath:dragmath_desc,editor_tinymce],[dragmath_desc,tinymce_dragmath]
  MOV [dragmath:dragmath_javaneeded,editor_tinymce],[dragmath_javaneeded,tinymce_dragmath]
  MOV [dragmath:dragmath_title,editor_tinymce],[dragmath_title,tinymce_dragmath]
  MOV [moodleemoticon:desc,editor_tinymce],[desc,tinymce_moodleemoticon]
  MOV [moodlenolink:desc,editor_tinymce],[desc,tinymce_moodlenolink]
  CPY [desc,tinymce_moodleemoticon],[pluginname,tinymce_moodleemoticon]
  CPY [desc,tinymce_moodlenolink],[pluginname,tinymce_moodlenolink]
AMOS END
  • Loading branch information...
commit 204903363f923e9f280b18fad630b14e5ad66261 1 parent fae9117
@sammarshallou sammarshallou authored skodak committed
Showing with 465 additions and 74 deletions.
  1. +0 −5 lib/editor/tinymce/lang/en/editor_tinymce.php
  2. +5 −29 lib/editor/tinymce/lib.php
  3. +6 −3 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/dragmath/dragmath.php
  4. +29 −0 lib/editor/tinymce/plugins/dragmath/lang/en/tinymce_dragmath.php
  5. +43 −0 lib/editor/tinymce/plugins/dragmath/lib.php
  6. +4 −4 ...e/{tiny_mce/3.5.4.1/plugins/dragmath/editor_plugin_src.js → plugins/dragmath/tinymce/editor_plugin.js}
  7. 0  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/dragmath → plugins/dragmath/tinymce}/img/dragmath.gif
  8. 0  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/dragmath → plugins/dragmath/tinymce}/js/dragmath.js
  9. 0  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/dragmath → plugins/dragmath/tinymce}/langs/en_dlg.js
  10. +32 −0 lib/editor/tinymce/plugins/dragmath/version.php
  11. +7 −7 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/moodleemoticon/dialog.php
  12. +27 −0 lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php
  13. +55 −0 lib/editor/tinymce/plugins/moodleemoticon/lib.php
  14. +1 −1  ...3.5.4.1/plugins/moodleemoticon/editor_plugin_src.js → plugins/moodleemoticon/tinymce/editor_plugin.js}
  15. 0  ...ymce/{tiny_mce/3.5.4.1/plugins/moodleemoticon → plugins/moodleemoticon/tinymce}/img/moodleemoticon.gif
  16. 0  ...editor/tinymce/{tiny_mce/3.5.4.1/plugins/moodleemoticon → plugins/moodleemoticon/tinymce}/js/dialog.js
  17. +32 −0 lib/editor/tinymce/plugins/moodleemoticon/version.php
  18. +25 −0 lib/editor/tinymce/plugins/moodlemedia/lang/en/tinymce_moodlemedia.php
  19. +48 −0 lib/editor/tinymce/plugins/moodlemedia/lib.php
  20. +4 −4 lib/editor/tinymce/{tiny_mce/3.5.4.1 → }/plugins/moodlemedia/preview.php
  21. 0  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/moodlemedia → plugins/moodlemedia/tinymce}/css/media.css
  22. +2 −2 ...y_mce/3.5.4.1/plugins/moodlemedia/editor_plugin_src.js → plugins/moodlemedia/tinymce/editor_plugin.js}
  23. 0  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/moodlemedia → plugins/moodlemedia/tinymce}/img/icon.gif
  24. +1 −1  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/moodlemedia → plugins/moodlemedia/tinymce}/js/media.js
  25. +14 −5 lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/moodlemedia → plugins/moodlemedia/tinymce}/moodlemedia.htm
  26. +32 −0 lib/editor/tinymce/plugins/moodlemedia/version.php
  27. +27 −0 lib/editor/tinymce/plugins/moodlenolink/lang/en/tinymce_moodlenolink.php
  28. +37 −0 lib/editor/tinymce/plugins/moodlenolink/lib.php
  29. +2 −2 ...mce/3.5.4.1/plugins/moodlenolink/editor_plugin_src.js → plugins/moodlenolink/tinymce/editor_plugin.js}
  30. 0  ...ditor/tinymce/{tiny_mce/3.5.4.1/plugins/moodlenolink → plugins/moodlenolink/tinymce}/img/ed_nolink.gif
  31. 0  lib/editor/tinymce/{tiny_mce/3.5.4.1/plugins/moodlenolink → plugins/moodlenolink/tinymce}/langs/en.js
  32. +32 −0 lib/editor/tinymce/plugins/moodlenolink/version.php
  33. +0 −5 lib/editor/tinymce/readme_moodle.txt
  34. +0 −1  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/dragmath/editor_plugin.js
  35. +0 −2  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/moodleemoticon/editor_plugin.js
  36. +0 −1  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/moodlemedia/editor_plugin.js
  37. +0 −2  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/moodlenolink/editor_plugin.js
View
5 lib/editor/tinymce/lang/en/editor_tinymce.php
@@ -28,13 +28,8 @@
//== Custom Moodle strings that are not part of upstream TinyMCE ==
$string['common:browseimage'] = 'Find or upload an image...';
$string['common:browsemedia'] = 'Find or upload a sound, video or applet...';
-$string['dragmath:dragmath_desc'] = 'Insert equation';
-$string['dragmath:dragmath_javaneeded'] = 'To use this page you need a Java-enabled browser. Download the latest Java plug-in from {$a}.';
-$string['dragmath:dragmath_title'] = 'DragMath Equation Editor';
$string['fontselectlist'] = 'Available fonts list';
$string['media_dlg:filename'] = 'Filename';
-$string['moodleemoticon:desc'] = 'Insert emoticon';
-$string['moodlenolink:desc'] = 'Prevent automatic linking';
$string['pluginname'] = 'TinyMCE HTML editor';
View
34 lib/editor/tinymce/lib.php
@@ -103,18 +103,6 @@ protected function get_init_params($elementid, array $options=null) {
$fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist;
$fontbutton = ($fontselectlist === '') ? '' : 'fontselect,';
- $filters = filter_get_active_in_context($context);
- if (array_key_exists('filter/tex', $filters)) {
- $xdragmath = 'dragmath,';
- } else {
- $xdragmath = '';
- }
- if (array_key_exists('filter/emoticon', $filters)) {
- $xemoticon = 'moodleemoticon,';
- } else {
- $xemoticon = '';
- }
-
$params = array(
'mode' => "exact",
'elements' => $elementid,
@@ -131,7 +119,10 @@ protected function get_init_params($elementid, array $options=null) {
'apply_source_formatting' => true,
'remove_script_host' => false,
'entity_encoding' => "raw",
- 'plugins' => "moodlemedia,advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,searchreplace,paste,directionality,fullscreen,moodlenolink,{$xemoticon}{$xdragmath}nonbreaking,contextmenu,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak,spellchecker",
+ 'plugins' => 'advimage,safari,table,style,layer,advhr,advlink,emotions,inlinepopups,' .
+ 'searchreplace,paste,directionality,fullscreen,nonbreaking,contextmenu,' .
+ 'insertdatetime,save,iespell,preview,print,noneditable,visualchars,' .
+ 'xhtmlxtras,template,pagebreak,spellchecker',
'theme_advanced_font_sizes' => "1,2,3,4,5,6,7",
'theme_advanced_layout_manager' => "SimpleLayout",
'theme_advanced_toolbar_align' => "left",
@@ -141,9 +132,7 @@ protected function get_init_params($elementid, array $options=null) {
'justifyleft,justifycenter,justifyright,|,' .
'cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl',
'theme_advanced_buttons3' => 'bullist,numlist,outdent,indent,|,' .
- 'link,unlink,moodlenolink,|,' .
- "image,{$xemoticon}moodlemedia,{$xdragmath}nonbreaking,charmap,table,|," .
- 'code' . $spellbutton,
+ 'link,unlink,|,image,nonbreaking,charmap,table,|,code' . $spellbutton,
'theme_advanced_fonts' => $fontselectlist,
'theme_advanced_resize_horizontal' => true,
'theme_advanced_resizing' => true,
@@ -155,19 +144,6 @@ protected function get_init_params($elementid, array $options=null) {
'spellchecker_languages' => $spelllanguagelist
);
- if ($xemoticon) {
- $manager = get_emoticon_manager();
- $emoticons = $manager->get_emoticons();
- $imgs = array();
- // see the TinyMCE plugin moodleemoticon for how the emoticon index is (ab)used :-S
- $index = 0;
- foreach ($emoticons as $emoticon) {
- $imgs[$emoticon->text] = $OUTPUT->render(
- $manager->prepare_renderable_emoticon($emoticon, array('class' => 'emoticon emoticon-index-'.$index++)));
- }
- $params['moodleemoticon_emoticons'] = json_encode($imgs);
- }
-
if (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted'])) {
// now deal somehow with non-standard tags, people scream when we do not make moodle code xtml strict,
// but they scream even more when we strip all tags that are not strict :-(
View
9 ...ce/tiny_mce/3.5.4.1/plugins/dragmath/dragmath.php → lib/editor/tinymce/plugins/dragmath/dragmath.php
@@ -2,7 +2,7 @@
define('NO_MOODLE_COOKIES', true);
-require("../../../../../../../config.php");
+require("../../../../../config.php");
$lang = required_param('elanguage', PARAM_SAFEDIR);
@@ -22,6 +22,9 @@
$lang = 'en';
}
+$editor = get_texteditor('tinymce');
+$plugin = $editor->get_plugin('dragmath');
+
@header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -30,8 +33,8 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php print_string('dragmath:dragmath_title', 'editor_tinymce')?></title>
-<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
-<script type="text/javascript" src="js/dragmath.js"></script>
+<script type="text/javascript" src="../../tiny_mce/<?php echo $editor->version ?>/tiny_mce_popup.js"></script>
+<script type="text/javascript" src="<?php echo $plugin->get_tinymce_file_url('js/dragmath.js'); ?>"></script>
</head>
<body>
View
29 lib/editor/tinymce/plugins/dragmath/lang/en/tinymce_dragmath.php
@@ -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/>.
+
+/**
+ * Strings for dragmath editor plugin.
+ *
+ * @package tinymce_dragmath
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Insert equation';
+
+$string['dragmath_desc'] = 'Insert equation';
+$string['dragmath_javaneeded'] = 'To use this page you need a Java-enabled browser. Download the latest Java plug-in from {$a}.';
+$string['dragmath_title'] = 'DragMath Equation Editor';
View
43 lib/editor/tinymce/plugins/dragmath/lib.php
@@ -0,0 +1,43 @@
+<?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/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Plugin for 'dragmath' equation editor (for use with TeX filter).
+ *
+ * @package tinymce_dragmath
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class tinymce_dragmath extends editor_tinymce_plugin {
+ protected function update_init_params(array &$params, context $context,
+ array $options = null) {
+ global $OUTPUT;
+
+ // If TeX filter is disabled, do not add button.
+ $filters = filter_get_active_in_context($context);
+ if (!array_key_exists('filter/tex', $filters)) {
+ return;
+ }
+
+ // Add button before 'nonbreaking' in advancedbuttons3.
+ $this->add_button_before($params, 3, 'dragmath', 'nonbreaking');
+
+ // Add JS file, which uses default name.
+ $this->add_js_plugin($params);
+ }
+}
View
8 ...mce/3.5.4.1/plugins/dragmath/editor_plugin_src.js → ...tinymce/plugins/dragmath/tinymce/editor_plugin.js
@@ -14,11 +14,11 @@
init : function(ed, url) {
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
lang = tinyMCE.activeEditor.getParam('language');
-
+
ed.addCommand('mceDragMath', function() {
ed.windowManager.open({
-
- file : url + '/dragmath.php?elanguage=' + lang,
+
+ file : url + '/../../../dragmath/dragmath.php?elanguage=' + lang,
width : 540,
height : 380,
inline : 1
@@ -34,7 +34,7 @@
cmd : 'mceDragMath',
image : url + '/img/dragmath.gif'
});
-
+
// Add a node change handler, selects the button in the UI when a image is selected
ed.onNodeChange.add(function(ed, cm, n) {
View
0  ...iny_mce/3.5.4.1/plugins/dragmath/img/dragmath.gif → ...tinymce/plugins/dragmath/tinymce/img/dragmath.gif
File renamed without changes
View
0  .../tiny_mce/3.5.4.1/plugins/dragmath/js/dragmath.js → ...r/tinymce/plugins/dragmath/tinymce/js/dragmath.js
File renamed without changes
View
0  ...tiny_mce/3.5.4.1/plugins/dragmath/langs/en_dlg.js → .../tinymce/plugins/dragmath/tinymce/langs/en_dlg.js
File renamed without changes
View
32 lib/editor/tinymce/plugins/dragmath/version.php
@@ -0,0 +1,32 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * TinyMCE dragmath plugin version details.
+ *
+ * @package tinymce_dragmath
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+// The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2012051700;
+// Required Moodle version.
+$plugin->requires = 2011112900;
+// Full name of the plugin (used for diagnostics).
+$plugin->component = 'tinymce_dragmath';
View
14 ...iny_mce/3.5.4.1/plugins/moodleemoticon/dialog.php → lib/editor/tinymce/plugins/moodleemoticon/dialog.php
@@ -18,16 +18,15 @@
/**
* Displays the TinyMCE popup window to insert a Moodle emoticon
*
- * @package tinymceplugin
- * @subpackage moodleemoticon
- * @copyright 2010 David Mudrak <david@moodle.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package tinymce_moodleemoticon
+ * @copyright 2010 David Mudrak <david@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_MOODLE_COOKIES', true); // Session not used here
define('NO_UPGRADE_CHECK', true); // Ignore upgrade check
-require_once(dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))))) . '/config.php');
+require_once(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php');
$PAGE->set_context(get_system_context());
@@ -35,14 +34,15 @@
$stringmanager = get_string_manager();
$editor = get_texteditor('tinymce');
+$plugin = $editor->get_plugin('moodleemoticon');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php print_string('moodleemoticon:desc', 'editor_tinymce'); ?></title>
- <script type="text/javascript" src="../../tiny_mce_popup.js?v=<?php echo $editor->version ?>"></script>
- <script type="text/javascript" src="js/dialog.js?v=<?php echo $editor->version ?>"></script>
+ <script type="text/javascript" src="../../tiny_mce/<?php echo $editor->version ?>/tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="<?php echo $plugin->get_tinymce_file_url('js/dialog.js'); ?>"></script>
</head>
<body>
View
27 lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php
@@ -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/>.
+
+/**
+ * Strings for Moodle emoticon plugin.
+ *
+ * @package tinymce_moodleemoticon
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Insert emoticon';
+
+$string['desc'] = 'Insert emoticon';
View
55 lib/editor/tinymce/plugins/moodleemoticon/lib.php
@@ -0,0 +1,55 @@
+<?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/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Plugin for Moodle emoticons.
+ *
+ * @package tinymce_moodleemoticon
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class tinymce_moodleemoticon extends editor_tinymce_plugin {
+ protected function update_init_params(array &$params, context $context,
+ array $options = null) {
+ global $OUTPUT;
+
+ // If emoticon filter is disabled, do not add button.
+ $filters = filter_get_active_in_context($context);
+ if (!array_key_exists('filter/emoticon', $filters)) {
+ return;
+ }
+
+ // Add button after 'image' in advancedbuttons3.
+ $this->add_button_after($params, 3, 'moodleemoticon', 'image');
+
+ // Add JS file, which uses default name.
+ $this->add_js_plugin($params);
+
+ // Extra params specifically for emoticon plugin.
+ $manager = get_emoticon_manager();
+ $emoticons = $manager->get_emoticons();
+ $imgs = array();
+ // See the TinyMCE plugin moodleemoticon for how the emoticon index is (ab)used.
+ $index = 0;
+ foreach ($emoticons as $emoticon) {
+ $imgs[$emoticon->text] = $OUTPUT->render($manager->prepare_renderable_emoticon(
+ $emoticon, array('class' => 'emoticon emoticon-index-'.$index++)));
+ }
+ $params['moodleemoticon_emoticons'] = json_encode($imgs);
+ }
+}
View
2  ...5.4.1/plugins/moodleemoticon/editor_plugin_src.js → ...e/plugins/moodleemoticon/tinymce/editor_plugin.js
@@ -30,7 +30,7 @@
ed.addCommand('mceMoodleEmoticon', function() {
lang = ed.getParam('language');
ed.windowManager.open({
- file : url + '/dialog.php?lang=' + lang ,
+ file : url + '/../../../moodleemoticon/dialog.php?lang=' + lang ,
width : 250 + parseInt(ed.getLang('moodleemoticon.delta_width', 0)),
height : 400 + parseInt(ed.getLang('moodleemoticon.delta_height', 0)),
inline : 1
View
0  ...4.1/plugins/moodleemoticon/img/moodleemoticon.gif → ...ins/moodleemoticon/tinymce/img/moodleemoticon.gif
File renamed without changes
View
0  ...y_mce/3.5.4.1/plugins/moodleemoticon/js/dialog.js → ...nymce/plugins/moodleemoticon/tinymce/js/dialog.js
File renamed without changes
View
32 lib/editor/tinymce/plugins/moodleemoticon/version.php
@@ -0,0 +1,32 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * TinyMCE emoticon plugin version details.
+ *
+ * @package tinymce_moodleemoticon
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+// The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2012051700;
+// Required Moodle version.
+$plugin->requires = 2011112900;
+// Full name of the plugin (used for diagnostics).
+$plugin->component = 'tinymce_moodleemoticon';
View
25 lib/editor/tinymce/plugins/moodlemedia/lang/en/tinymce_moodlemedia.php
@@ -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 Moodle Media plugin.
+ *
+ * @package tinymce_moodlemedia
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Insert media';
View
48 lib/editor/tinymce/plugins/moodlemedia/lib.php
@@ -0,0 +1,48 @@
+<?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/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Plugin for Moodle media (audio/video) insertion dialog.
+ *
+ * @package tinymce_moodlemedia
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class tinymce_moodlemedia extends editor_tinymce_plugin {
+ protected function update_init_params(array &$params, context $context,
+ array $options = null) {
+ global $OUTPUT;
+
+ // Add button after emoticon button in advancedbuttons3.
+ $added = $this->add_button_after($params, 3, 'moodlemedia', 'moodleemoticon', false);
+
+ // Note: We know that the emoticon button has already been added, if it
+ // exists, because I set the sort order higher for this. So, if no
+ // emoticon, add after 'image'.
+ if (!$added) {
+ $this->add_button_after($params, 3, 'moodlemedia', 'image');
+ }
+
+ // Add JS file, which uses default name.
+ $this->add_js_plugin($params);
+ }
+
+ protected function get_sort_order() {
+ return 110;
+ }
+}
View
8 .../tiny_mce/3.5.4.1/plugins/moodlemedia/preview.php → lib/editor/tinymce/plugins/moodlemedia/preview.php
@@ -17,13 +17,13 @@
/**
* Provides A/V preview features for the TinyMCE editor Moodle Media plugin.
* The preview is included in an iframe within the popup dialog.
- * @package editor
- * @subpackage tinymce
+ *
+ * @package tinymce_moodlemedia
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require(dirname(__FILE__) . '/../../../../../../../config.php');
+require(dirname(__FILE__) . '/../../../../../config.php');
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/editorlib.php');
require_once($CFG->libdir . '/editor/tinymce/lib.php');
@@ -38,7 +38,7 @@
// Now output this file which is super-simple
$PAGE->set_pagelayout('embedded');
-$PAGE->set_url(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$editor->version.'/plugins/moodlemedia/preview.php',
+$PAGE->set_url(new moodle_url('/lib/editor/tinymce/tiny_mce/' . $editor->version . '/plugins/moodlemedia/preview.php',
array('path' => $path)));
$PAGE->set_context(context_system::instance());
$PAGE->add_body_class('core_media_preview');
View
0  ...iny_mce/3.5.4.1/plugins/moodlemedia/css/media.css → ...tinymce/plugins/moodlemedia/tinymce/css/media.css
File renamed without changes
View
4 .../3.5.4.1/plugins/moodlemedia/editor_plugin_src.js → ...ymce/plugins/moodlemedia/tinymce/editor_plugin.js
@@ -10,7 +10,7 @@
tinymce.create('tinymce.plugins.MoodlemediaPlugin', {
init : function(ed, url) {
var t = this;
-
+
t.editor = ed;
t.url = url;
@@ -28,7 +28,7 @@
// Register buttons
ed.addButton('moodlemedia', {
- title : 'Moodle Media',
+ title : 'Moodle Media',
image : url + '/img/icon.gif',
cmd : 'mceMoodleMedia'});
View
0  ...tiny_mce/3.5.4.1/plugins/moodlemedia/img/icon.gif → .../tinymce/plugins/moodlemedia/tinymce/img/icon.gif
File renamed without changes
View
2  .../tiny_mce/3.5.4.1/plugins/moodlemedia/js/media.js → ...r/tinymce/plugins/moodlemedia/tinymce/js/media.js
@@ -126,7 +126,7 @@ function generatePreview(c) {
if (!tinymce.isIE || document.location.protocol != 'https:') {
// Include all the draftfile params after the ?
var draftparams = pl.src.toString().replace(/^.*\/draftfile.php\//, '');
- h = '<iframe src="' + tinyMCE.baseURL + '/plugins/moodlemedia/preview.php?path=' +
+ h = '<iframe src="../../..//moodlemedia/preview.php?path=' +
draftparams + '" width="100%" height="100%"></iframe>';
}
View
19 ...y_mce/3.5.4.1/plugins/moodlemedia/moodlemedia.htm → ...nymce/plugins/moodlemedia/tinymce/moodlemedia.htm
@@ -2,12 +2,21 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#media_dlg.title}</title>
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript">
+ // Because there is no relative path to TinyMCE, we have to use JavaScript
+ // to work out correct path from the .js files from TinyMCE. Only files
+ // inside this plugin can be included with relative path (below).
+ var editor_tinymce_include = function(path) {
+ document.write('<script type="text/javascript" src="' +
+ parent.tinyMCE.baseURL + '/' + path + '"></' + 'script>');
+ };
+ editor_tinymce_include('tiny_mce_popup.js');
+ editor_tinymce_include('utils/mctabs.js');
+ editor_tinymce_include('utils/validate.js');
+ editor_tinymce_include('utils/form_utils.js');
+ editor_tinymce_include('utils/editable_selects.js');
+ </script>
<script type="text/javascript" src="js/media.js"></script>
- <script type="text/javascript" src="../../utils/mctabs.js"></script>
- <script type="text/javascript" src="../../utils/validate.js"></script>
- <script type="text/javascript" src="../../utils/form_utils.js"></script>
- <script type="text/javascript" src="../../utils/editable_selects.js"></script>
<link href="css/media.css" rel="stylesheet" type="text/css" />
</head>
<body style="display: none">
View
32 lib/editor/tinymce/plugins/moodlemedia/version.php
@@ -0,0 +1,32 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * TinyMCE media insert plugin version details.
+ *
+ * @package tinymce_moodlemedia
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+// The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2012051701;
+// Required Moodle version.
+$plugin->requires = 2011112900;
+// Full name of the plugin (used for diagnostics).
+$plugin->component = 'tinymce_moodlemedia';
View
27 lib/editor/tinymce/plugins/moodlenolink/lang/en/tinymce_moodlenolink.php
@@ -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/>.
+
+/**
+ * Strings for 'no link' plugin.
+ *
+ * @package tinymce_moodlenolink
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['pluginname'] = 'Prevent automatic linking';
+
+$string['desc'] = 'Prevent automatic linking';
View
37 lib/editor/tinymce/plugins/moodlenolink/lib.php
@@ -0,0 +1,37 @@
+<?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/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Plugin for Moodle 'no link' button.
+ *
+ * @package tinymce_moodlenolink
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class tinymce_moodlenolink extends editor_tinymce_plugin {
+ protected function update_init_params(array &$params, context $context,
+ array $options = null) {
+ global $OUTPUT;
+
+ // Add button after 'unlink' in advancedbuttons3.
+ $this->add_button_after($params, 3, 'moodlenolink', 'unlink');
+
+ // Add JS file, which uses default name.
+ $this->add_js_plugin($params);
+ }
+}
View
4 ...3.5.4.1/plugins/moodlenolink/editor_plugin_src.js → ...mce/plugins/moodlenolink/tinymce/editor_plugin.js
@@ -19,9 +19,9 @@
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mcemoodlenolink');
ed.addCommand('mcemoodlenolink', function() {
var n, p;
-
+
n = ed.selection.getNode();
- p = ed.dom.getParent(n, function(t) {
+ p = ed.dom.getParent(n, function(t) {
return ed.dom.getAttrib(t, 'class') == 'nolink';
});
View
0  ...ce/3.5.4.1/plugins/moodlenolink/img/ed_nolink.gif → ...ce/plugins/moodlenolink/tinymce/img/ed_nolink.gif
File renamed without changes
View
0  ...tiny_mce/3.5.4.1/plugins/moodlenolink/langs/en.js → .../tinymce/plugins/moodlenolink/tinymce/langs/en.js
File renamed without changes
View
32 lib/editor/tinymce/plugins/moodlenolink/version.php
@@ -0,0 +1,32 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * TinyMCE no-link marker plugin version details.
+ *
+ * @package tinymce_moodlenolink
+ * @copyright 2012 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+// The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2012051700;
+// Required Moodle version.
+$plugin->requires = 2011112900;
+// Full name of the plugin (used for diagnostics).
+$plugin->component = 'tinymce_moodlenolink';
View
5 lib/editor/tinymce/readme_moodle.txt
@@ -39,11 +39,6 @@ Note1: if the local modification includes lang changes, then steps 6-8 (from upg
AMOS maintainer / custom-tinymce maintainer / integrators about that.
=========================================================================================
-Added:
- * plugins/gragmath/*
- * plugins/moodlemotions/*
- * plugins/moodlenolink/*
- * plugins/moodlemedia/*
Modified:
* image integration - file picker integration
View
1  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/dragmath/editor_plugin.js
@@ -1 +0,0 @@
-(function(){tinymce.create("tinymce.plugins.DragMathPlugin",{init:function(a,b){lang=tinyMCE.activeEditor.getParam("language");a.addCommand("mceDragMath",function(){a.windowManager.open({file:b+"/dragmath.php?elanguage="+lang,width:540,height:380,inline:1},{plugin_url:b,some_custom_arg:"custom arg"})});a.addButton("dragmath",{title:"dragmath.dragmath_desc",cmd:"mceDragMath",image:b+"/img/dragmath.gif"});a.onNodeChange.add(function(d,c,e){c.setActive("dragmath",e.nodeName=="IMG")})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Moodle Dragmath plugin",author:"Glen Davies",authorurl:"http://www.canterbury.ac.nz",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example",version:"1.0"}}});tinymce.PluginManager.add("dragmath",tinymce.plugins.DragMathPlugin)})();
View
2  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/moodleemoticon/editor_plugin.js
@@ -1,2 +0,0 @@
-(function(){tinymce.create("tinymce.plugins.MoodleEmoticon",{_emoticons:{},init:function(a,b){a.addCommand("mceMoodleEmoticon",function(){lang=a.getParam("language");a.windowManager.open({file:b+"/dialog.php?lang="+lang,width:250+parseInt(a.getLang("moodleemoticon.delta_width",0)),height:400+parseInt(a.getLang("moodleemoticon.delta_height",0)),inline:1},{plugin_url:b})});a.onInit.add(function(d){var e=d.getContent();this._emoticons=tinymce.util.JSON.parse(d.getParam("moodleemoticon_emoticons"));for(var c in this._emoticons){search=c.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");search=new RegExp(search,"g");e=e.replace(search,this._emoticons[c])}d.setContent(e)});a.onPreProcess.add(function(c,d){if(d.save){tinymce.each(c.dom.select("img.emoticon",d.node),function(j){var h="";var i=/^emoticon emoticon-index-([0-9]+)$/.exec(j.className);if(i.length!=2){return true}var f=i[1];var g=new RegExp('class="emoticon emoticon-index-'.concat(f,'"'));for(var e in this._emoticons){if(g.test(this._emoticons[e])){h=e;
-break}}if(h){c.dom.setOuterHTML(j,h)}},this)}});a.addButton("moodleemoticon",{title:"moodleemoticon.desc",cmd:"mceMoodleEmoticon",image:b+"/img/moodleemoticon.gif"})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Moodle Emoticon plugin",author:"David Mudrak",authorurl:"http://mudrak.name",infourl:"http://moodle.org",version:"1.0"}}});tinymce.PluginManager.add("moodleemoticon",tinymce.plugins.MoodleEmoticon)})();
View
1  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/moodlemedia/editor_plugin.js
@@ -1 +0,0 @@
-(function(){var a=tinymce.each;tinymce.PluginManager.requireLangPack("moodlemedia");tinymce.create("tinymce.plugins.MoodlemediaPlugin",{init:function(b,c){var d=this;d.editor=b;d.url=c;b.addCommand("mceMoodleMedia",function(){b.windowManager.open({file:c+"/moodlemedia.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("moodlemedia",{title:"Moodle Media",image:c+"/img/icon.gif",cmd:"mceMoodleMedia"})},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},getInfo:function(){return{longname:"Moodle media",author:"Dongsheng Cai <dongsheng@moodle.com>",version:"1.0"}}});tinymce.PluginManager.add("moodlemedia",tinymce.plugins.MoodlemediaPlugin)})();
View
2  lib/editor/tinymce/tiny_mce/3.5.4.1/plugins/moodlenolink/editor_plugin.js
@@ -1,2 +0,0 @@
-(function(){tinymce.PluginManager.requireLangPack("moodlenolink");tinymce.create("tinymce.plugins.moodlenolinkPlugin",{init:function(a,b){a.addCommand("mcemoodlenolink",function(){var d,c;d=a.selection.getNode();c=a.dom.getParent(d,function(e){return a.dom.getAttrib(e,"class")=="nolink"});if(c){a.dom.remove(c,true)}else{a.selection.setContent('<span class="nolink">'+a.selection.getContent()+"</span>")}});a.addButton("moodlenolink",{title:"moodlenolink.desc",cmd:"mcemoodlenolink",image:b+"/img/ed_nolink.gif"});a.onNodeChange.add(function(e,d,h){var f,g;g=d.get("moodlenolink");f=e.dom.getParent(h,"SPAN");g.setActive(f&&e.dom.hasClass(f,"nolink"));if(f&&e.dom.hasClass(f,"nolink")||e.selection.getContent()){g.setDisabled(false)}else{g.setDisabled(true)}})},getInfo:function(){return{longname:"moodlenolink plugin",author:"Mathieu Petit-Clair",authorurl:"http://moodle.com/hq",infourl:"http://docs.moodle.org/en/TinyMCE",version:"1.0"}}});tinymce.PluginManager.add("moodlenolink",tinymce.plugins.moodlenolinkPlugin)
-})();
Please sign in to comment.
Something went wrong with that request. Please try again.