From 0ac97084faa3d0114b8cb6d69332dfa47b6edfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 7 Apr 2013 18:18:01 +0200 Subject: [PATCH 1/2] MDL-34674 use browser built-in spell checking in all browsers except < IE10 --- error/index.php | 2 +- lib/adminlib.php | 4 ++-- lib/deprecatedlib.php | 2 +- .../spellchecker/lang/en/tinymce_spellchecker.php | 2 +- lib/editor/tinymce/plugins/spellchecker/lib.php | 13 +++++++++++++ lib/form/editor.php | 2 +- mod/assignment/lib.php | 4 ++-- mod/data/field/textarea/field.class.php | 2 +- user/addnote.php | 2 +- user/groupaddnote.php | 2 +- 10 files changed, 24 insertions(+), 11 deletions(-) diff --git a/error/index.php b/error/index.php index 0e57570747d..6798a48f475 100644 --- a/error/index.php +++ b/error/index.php @@ -60,7 +60,7 @@ ?>

-
+
diff --git a/lib/adminlib.php b/lib/adminlib.php index 3156374c2df..71c244ce055 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1920,7 +1920,7 @@ class admin_setting_configtextarea extends admin_setting_configtext { } return format_admin_setting($this, $this->visiblename, - '
', + '
', $this->description, true, '', $defaultinfo, $query); } } @@ -1966,7 +1966,7 @@ class admin_setting_confightmleditor extends admin_setting_configtext { $editor->use_editor($this->get_id(), array('noclean'=>true)); return format_admin_setting($this, $this->visiblename, - '
', + '
', $this->description, true, '', $defaultinfo, $query); } } diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 8022c44df6f..7a94b59effc 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -1909,7 +1909,7 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v $editorclass = ''; } - $str .= "\n".''; + . $auser->id.'" rows="2" cols="20" spellcheck="true">'.($auser->submissioncomment).''; } else { $comment = '
'.shorten_text(strip_tags($auser->submissioncomment),15).'
'; } @@ -1549,7 +1549,7 @@ class assignment_base { } else if ($quickgrade) { $comment = '
' . '
'; + . $auser->id.'" rows="2" cols="20" spellcheck="true">'.($auser->submissioncomment).''; } else { $comment = '
 
'; } diff --git a/mod/data/field/textarea/field.class.php b/mod/data/field/textarea/field.class.php index 847bae1a6bd..3fc7a711f07 100644 --- a/mod/data/field/textarea/field.class.php +++ b/mod/data/field/textarea/field.class.php @@ -125,7 +125,7 @@ class data_field_textarea extends data_field_base { } $editor->use_editor($field, $options, $fpoptions); $str .= ''; - $str .= '
'; + $str .= '
'; $str .= '
'; $str .= ''. fullname($user, true), - '', + '', $checkbox ); } diff --git a/user/groupaddnote.php b/user/groupaddnote.php index 69fdfb11348..3d63e65f36f 100644 --- a/user/groupaddnote.php +++ b/user/groupaddnote.php @@ -112,7 +112,7 @@ echo get_string('users'). ': ' . implode(', ', $userlist) . '.'; echo '

'; echo '

' . get_string('content', 'notes'); -echo '

'; +echo '

'; echo '

'; echo html_writer::label(get_string('publishstate', 'notes'), 'menustate'); From ca117d1e5b28129b5304742ec33d07c76bf94c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Fri, 12 Apr 2013 14:35:30 +0200 Subject: [PATCH 2/2] MDL-34674 add CTRL+right click hint to tinymce context menus --- .../ctrlhelp/lang/en/tinymce_ctrlhelp.php | 28 +++++++++++++++ lib/editor/tinymce/plugins/ctrlhelp/lib.php | 35 +++++++++++++++++++ .../plugins/ctrlhelp/tinymce/editor_plugin.js | 23 ++++++++++++ .../tinymce/plugins/ctrlhelp/version.php | 29 +++++++++++++++ lib/pluginlib.php | 2 +- 5 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 lib/editor/tinymce/plugins/ctrlhelp/lang/en/tinymce_ctrlhelp.php create mode 100644 lib/editor/tinymce/plugins/ctrlhelp/lib.php create mode 100644 lib/editor/tinymce/plugins/ctrlhelp/tinymce/editor_plugin.js create mode 100644 lib/editor/tinymce/plugins/ctrlhelp/version.php diff --git a/lib/editor/tinymce/plugins/ctrlhelp/lang/en/tinymce_ctrlhelp.php b/lib/editor/tinymce/plugins/ctrlhelp/lang/en/tinymce_ctrlhelp.php new file mode 100644 index 00000000000..8c346445bb0 --- /dev/null +++ b/lib/editor/tinymce/plugins/ctrlhelp/lang/en/tinymce_ctrlhelp.php @@ -0,0 +1,28 @@ +. + +/** + * Strings for CTRL+Right click helper. + * + * @package tinymce_ctrlhelp + * @copyright 2013 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$string['pluginname'] = 'CTRL+right click helper'; + +/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */ +$string['ctrlhelp:desc'] = 'CTRL + right click for more options'; diff --git a/lib/editor/tinymce/plugins/ctrlhelp/lib.php b/lib/editor/tinymce/plugins/ctrlhelp/lib.php new file mode 100644 index 00000000000..97fc7116fae --- /dev/null +++ b/lib/editor/tinymce/plugins/ctrlhelp/lib.php @@ -0,0 +1,35 @@ +. + +defined('MOODLE_INTERNAL') || die(); + +/** + * CTRL + right click helper + * + * @package tinymce_ctrlhelp + * @copyright 2013 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class tinymce_ctrlhelp extends editor_tinymce_plugin { + protected function update_init_params(array &$params, context $context, array $options = null) { + $this->add_js_plugin($params); + } + + protected function get_sort_order() { + // We want this plugin to register as the last one in the context menu. + return 66666; + } +} diff --git a/lib/editor/tinymce/plugins/ctrlhelp/tinymce/editor_plugin.js b/lib/editor/tinymce/plugins/ctrlhelp/tinymce/editor_plugin.js new file mode 100644 index 00000000000..9a2e5ec4169 --- /dev/null +++ b/lib/editor/tinymce/plugins/ctrlhelp/tinymce/editor_plugin.js @@ -0,0 +1,23 @@ +(function() { + tinymce.create('tinymce.plugins.CtrlHelpPlugin', { + + init : function(ed, url) { + ed.onContextMenu.add(function(ed, e) { + var m = ed.plugins.contextmenu._menu; + m.add({title : 'ctrlhelp.desc', icon : '', cmd : ''}); + }); + }, + + getInfo : function() { + return { + longname : 'Moodle CTRL + right click helper plugin', + author : 'Petr Skoda', + authorurl : 'http://skodak.org/', + infourl : 'http://moodle.org', + version : '1.0' + }; + } + }); + + tinymce.PluginManager.add('ctrlhelp', tinymce.plugins.CtrlHelpPlugin); +})(); diff --git a/lib/editor/tinymce/plugins/ctrlhelp/version.php b/lib/editor/tinymce/plugins/ctrlhelp/version.php new file mode 100644 index 00000000000..e4d582bcb4f --- /dev/null +++ b/lib/editor/tinymce/plugins/ctrlhelp/version.php @@ -0,0 +1,29 @@ +. + +/** + * CTRL + right click helper. + * + * @package tinymce_ctrlhelp + * @copyright 2013 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->version = 2013041200; +$plugin->requires = 2013041100; +$plugin->component = 'tinymce_ctrlhelp'; diff --git a/lib/pluginlib.php b/lib/pluginlib.php index de23503162f..d1aabf7328f 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -597,7 +597,7 @@ class plugin_manager { ), 'tinymce' => array( - 'dragmath', 'moodleemoticon', 'moodleimage', 'moodlemedia', 'moodlenolink', 'spellchecker', + 'ctrlhelp', 'dragmath', 'moodleemoticon', 'moodleimage', 'moodlemedia', 'moodlenolink', 'spellchecker', ), 'theme' => array(