Skip to content
Browse files

Merge branch 'w41_MDL-35645_m24_tinymcebuttons' of git://github.com/s…

…kodak/moodle
  • Loading branch information...
2 parents 9f707d6 + f4b9800 commit ec467d04d92c59f444c80e63553c20d3cea47c37 @stronk7 stronk7 committed Oct 9, 2012
View
2 lib/editor/tinymce/plugins/dragmath/lang/en/tinymce_dragmath.php
@@ -24,6 +24,8 @@
$string['javaneeded'] = 'To use this page you need a Java-enabled browser. Download the latest Java plug-in from {$a}.';
$string['pluginname'] = 'Insert equation';
+$string['requiretex'] = 'Require TeX filter';
+$string['requiretex_desc'] = 'If enabled the Dragmath button is visible only when the TeX filter is enabled in the editor context. Disable if you have a custom TeX filter that is enabled in global scope.';
$string['title'] = 'DragMath Equation Editor';
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
View
10 lib/editor/tinymce/plugins/dragmath/lib.php
@@ -30,10 +30,12 @@ class tinymce_dragmath extends editor_tinymce_plugin {
protected function update_init_params(array &$params, context $context,
array $options = null) {
- // If TeX filter is disabled, do not add button.
- $filters = filter_get_active_in_context($context);
- if (!array_key_exists('filter/tex', $filters)) {
- return;
+ if ($this->get_config('requiretex', 1)) {
+ // 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.
View
30 lib/editor/tinymce/plugins/dragmath/settings.php
@@ -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/>.
+
+/**
+ * DragMath integration settings.
+ *
+ * @package tinymce_dragmath
+ * @copyright 2012 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($ADMIN->fulltree) {
+ $settings->add(new admin_setting_configcheckbox('tinymce_dragmath/requiretex',
+ get_string('requiretex', 'tinymce_dragmath'), get_string('requiretex_desc', 'tinymce_dragmath'), 1));
+}
View
4 lib/editor/tinymce/plugins/dragmath/version.php
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
// The current plugin version (Date: YYYYMMDDXX).
-$plugin->version = 2012051700;
+$plugin->version = 2012100200;
// Required Moodle version.
-$plugin->requires = 2011112900;
+$plugin->requires = 2012092700;
// Full name of the plugin (used for diagnostics).
$plugin->component = 'tinymce_dragmath';
View
2 lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php
@@ -23,6 +23,8 @@
*/
$string['pluginname'] = 'Insert emoticon';
+$string['requireemoticon'] = 'Require emoticon filter';
+$string['requireemoticon_desc'] = 'If enabled the emoticon button is visible only when the emoticon filter is enabled in the editor context.';
/* 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';
View
10 lib/editor/tinymce/plugins/moodleemoticon/lib.php
@@ -31,10 +31,12 @@ 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;
+ if ($this->get_config('requireemoticon', 1)) {
+ // 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.
View
30 lib/editor/tinymce/plugins/moodleemoticon/settings.php
@@ -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/>.
+
+/**
+ * Emoticon integration settings.
+ *
+ * @package tinymce_moodleemoticon
+ * @copyright 2012 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+if ($ADMIN->fulltree) {
+ $settings->add(new admin_setting_configcheckbox('tinymce_moodleemoticon/requireemoticon',
+ get_string('requireemoticon', 'tinymce_moodleemoticon'), get_string('requireemoticon_desc', 'tinymce_moodleemoticon'), 1));
+}
View
4 lib/editor/tinymce/plugins/moodleemoticon/version.php
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
// The current plugin version (Date: YYYYMMDDXX).
-$plugin->version = 2012051700;
+$plugin->version = 2012100200;
// Required Moodle version.
-$plugin->requires = 2011112900;
+$plugin->requires = 2012092700;
// Full name of the plugin (used for diagnostics).
$plugin->component = 'tinymce_moodleemoticon';

0 comments on commit ec467d0

Please sign in to comment.
Something went wrong with that request. Please try again.