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
|
@ -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';
|
||||
|
||||
|
||||
|
|
|
@ -103,18 +103,6 @@ class tinymce_texteditor extends texteditor {
|
|||
$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 @@ class tinymce_texteditor extends texteditor {
|
|||
'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 @@ class tinymce_texteditor extends texteditor {
|
|||
'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 @@ class tinymce_texteditor extends texteditor {
|
|||
'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 :-(
|
||||
|
|
|
@ -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 @@ if (!file_exists("$CFG->dirroot/lib/dragmath/applet/lang/$lang.xml")) {
|
|||
$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 @@ if (!file_exists("$CFG->dirroot/lib/dragmath/applet/lang/$lang.xml")) {
|
|||
<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>
|
||||
|
|
@ -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';
|
43
lib/editor/tinymce/plugins/dragmath/lib.php
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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) {
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
32
lib/editor/tinymce/plugins/dragmath/version.php
Normal file
|
@ -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';
|
|
@ -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 @@ $emoticonmanager = get_emoticon_manager();
|
|||
$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>
|
||||
|
|
@ -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';
|
55
lib/editor/tinymce/plugins/moodleemoticon/lib.php
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
32
lib/editor/tinymce/plugins/moodleemoticon/version.php
Normal file
|
@ -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';
|
|
@ -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';
|
48
lib/editor/tinymce/plugins/moodlemedia/lib.php
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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 @@ $editor = new tinymce_texteditor();
|
|||
|
||||
// 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');
|
|
@ -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'});
|
||||
|
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 910 B |
|
@ -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>';
|
||||
}
|
||||
|
|
@ -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">
|
32
lib/editor/tinymce/plugins/moodlemedia/version.php
Normal file
|
@ -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';
|
|
@ -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';
|
37
lib/editor/tinymce/plugins/moodlenolink/lib.php
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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';
|
||||
});
|
||||
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
32
lib/editor/tinymce/plugins/moodlenolink/version.php
Normal file
|
@ -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';
|
|
@ -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
|
||||
|
|
|
@ -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)})();
|
|
@ -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)})();
|
|
@ -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)})();
|
|
@ -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)
|
||||
})();
|