MDL-33041 cleanup moodleemoticon plugin
AMOS BEGIN MOV [desc,tinymce_moodleemoticon],[moodleemoticon:desc,tinymce_moodleemoticon] AMOS END
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@@ -18,17 +17,17 @@
|
||||
/**
|
||||
* Displays the TinyMCE popup window to insert a Moodle emoticon
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2010 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @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
|
||||
define('NO_MOODLE_COOKIES', true); // Session not used here.
|
||||
|
||||
require_once(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php');
|
||||
require(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php');
|
||||
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_url('/lib/editor/tinymce/plugins/moodleemoticon/dialog.php');
|
||||
|
||||
$emoticonmanager = get_emoticon_manager();
|
||||
$stringmanager = get_string_manager();
|
||||
@@ -36,12 +35,14 @@ $stringmanager = get_string_manager();
|
||||
$editor = get_texteditor('tinymce');
|
||||
$plugin = $editor->get_plugin('moodleemoticon');
|
||||
|
||||
$htmllang = get_html_lang();
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
?>
|
||||
<!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">
|
||||
<!DOCTYPE html>
|
||||
<html <?php echo $htmllang ?>
|
||||
<head>
|
||||
<title><?php print_string('moodleemoticon:desc', 'editor_tinymce'); ?></title>
|
||||
<script type="text/javascript" src="../../tiny_mce/<?php echo $editor->version ?>/tiny_mce_popup.js"></script>
|
||||
<title><?php print_string('moodleemoticon:desc', 'tinymce_moodleemoticon'); ?></title>
|
||||
<script type="text/javascript" src="<?php echo $editor->get_tinymce_base_url(); ?>/tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $plugin->get_tinymce_file_url('js/dialog.js'); ?>"></script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -50,7 +51,7 @@ $plugin = $editor->get_plugin('moodleemoticon');
|
||||
<?php
|
||||
|
||||
$emoticons = $emoticonmanager->get_emoticons();
|
||||
// this is tricky - we must somehow include the information about the original
|
||||
// This is tricky - we must somehow include the information about the original
|
||||
// emoticon text so that we can replace the image back with it on editor save.
|
||||
// so we are going to encode the index of the emoticon. this will break when the
|
||||
// admin changes the mapping table while the user has the editor opened
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
/**
|
||||
* Strings for Moodle emoticon plugin.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Insert emoticon';
|
||||
|
||||
$string['desc'] = 'Insert emoticon';
|
||||
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
|
||||
$string['moodleemoticon:desc'] = 'Insert emoticon';
|
||||
|
||||
@@ -19,9 +19,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* Plugin for Moodle emoticons.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @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,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TinyMCE plugin MoodleEmoticon - provides GUI to insert emoticon images
|
||||
* TinyMCE plugin MoodleEmoticon - provides GUI to insert emoticon images.
|
||||
*
|
||||
* Based on the example plugin (c) 2009 Moxiecode Systems AB
|
||||
* Based on the example plugin (c) 2009 Moxiecode Systems AB.
|
||||
*
|
||||
* @author David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@@ -11,7 +11,7 @@
|
||||
tinymce.create('tinymce.plugins.MoodleEmoticon', {
|
||||
|
||||
/**
|
||||
* Holds the list of emoticons provided by emoticon_manager
|
||||
* Holds the list of emoticons provided by emoticon_manager.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
@@ -30,7 +30,7 @@
|
||||
ed.addCommand('mceMoodleEmoticon', function() {
|
||||
lang = ed.getParam('language');
|
||||
ed.windowManager.open({
|
||||
file : url + '/../../../moodleemoticon/dialog.php?lang=' + lang ,
|
||||
file : ed.getParam("moodle_plugin_base") + '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
|
||||
@@ -39,7 +39,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Add an observer to the onInit event to convert emoticon texts to images
|
||||
// Add an observer to the onInit event to convert emoticon texts to images.
|
||||
ed.onInit.add(function(ed) {
|
||||
var data = ed.getContent();
|
||||
this._emoticons = tinymce.util.JSON.parse(ed.getParam('moodleemoticon_emoticons'));
|
||||
@@ -54,7 +54,7 @@
|
||||
ed.setContent(data);
|
||||
});
|
||||
|
||||
// Add an observer to the onPreProcess event to convert emoticon images to texts
|
||||
// Add an observer to the onPreProcess event to convert emoticon images to texts.
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
if (o.save) {
|
||||
tinymce.each(ed.dom.select('img.emoticon', o.node), function(image) {
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Register moodleemoticon button
|
||||
// Register moodleemoticon button.
|
||||
ed.addButton('moodleemoticon', {
|
||||
title : 'moodleemoticon.desc',
|
||||
cmd : 'mceMoodleEmoticon',
|
||||
@@ -119,6 +119,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
// Register plugin.
|
||||
tinymce.PluginManager.add('moodleemoticon', tinymce.plugins.MoodleEmoticon);
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var MoodleEmoticonDialog = {
|
||||
|
||||
init : function() {
|
||||
// register event handlers for the table rows
|
||||
// Register event handlers for the table rows.
|
||||
tinymce.each(tinymce.DOM.select('tr.emoticoninfo', document), function(row) {
|
||||
|
||||
tinymce.dom.Event.add(row, 'mouseover', function(e) {
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
/**
|
||||
* TinyMCE emoticon plugin version details.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
Reference in New Issue
Block a user