diff --git a/help.php b/help.php index e170c6ec619..7a89337ae0a 100644 --- a/help.php +++ b/help.php @@ -142,7 +142,7 @@ if(preg_match('~^(.*?)
'. get_string('hel
$CFG->docroot = ''; // We don't want a doc link here
print_footer('none');
-// Utility function =================================================================
-
-function get_emoticons_html(){
- global $CFG;
- $output = '';
- $emoticonstring = $CFG->emoticons;
- $output .= '';
- if ($emoticonstring) {
- $items = explode('{;}', $CFG->emoticons);
- foreach ($items as $item) {
- $item = explode('{:}', $item);
- $emoticons[$item[0]] = $item[1];
- $output .= '
';
- return $output;
-
-}
-
function file_exists_and_readable($filepath) {
return file_exists($filepath) and is_file($filepath) and is_readable($filepath);
}
diff --git a/lang/en_utf8/help/emoticons.html b/lang/en_utf8/help/emoticons.html
index db97c4f2388..99ee6b78ec2 100644
--- a/lang/en_utf8/help/emoticons.html
+++ b/lang/en_utf8/help/emoticons.html
@@ -1,5 +1,10 @@
'.' '.$item[0].
- 'Using Smilies (emoticons)
+
+
diff --git a/lib/javascript-static.js b/lib/javascript-static.js
index 5670f0da485..8959784abd4 100644
--- a/lib/javascript-static.js
+++ b/lib/javascript-static.js
@@ -514,7 +514,7 @@ function getElementsByClassName(oElm, strTagName, oClassNames){
}
function openpopup(url, name, options, fullscreen) {
- var fullurl = moodle_config.wwwroot + url;
+ var fullurl = moodle_cfg.wwwroot + url;
var windowobj = window.open(fullurl,name,options);
if (fullscreen) {
windowobj.moveTo(0,0);
@@ -523,3 +523,34 @@ function openpopup(url, name, options, fullscreen) {
windowobj.focus();
return false;
}
+
+/* This is only used on a few help pages. */
+emoticons_help = {
+ inputarea: null,
+
+ init: function(formname, fieldname, listid) {
+ if (!opener || !opener.document.forms[formname]) {
+ return;
+ }
+ emoticons_help.inputarea = opener.document.forms[formname][fieldname];
+ if (!emoticons_help.inputarea) {
+ return;
+ }
+ var emoticons = document.getElementById(listid).getElementsByTagName('li');
+ for (var i = 0; i < emoticons.length; i++) {
+ var text = emoticons[i].getElementsByTagName('img')[0].alt;
+ YAHOO.util.Event.addListener(emoticons[i], 'click', emoticons_help.inserttext, text);
+ }
+ },
+
+ inserttext: function(e, text) {
+ text = ' ' + text + ' ';
+ if (emoticons_help.inputarea.createTextRange && emoticons_help.inputarea.caretPos) {
+ var caretPos = emoticons_help.inputarea.caretPos;
+ caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
+ } else {
+ emoticons_help.inputarea.value += text;
+ }
+ emoticons_help.inputarea.focus();
+ }
+}
\ No newline at end of file
diff --git a/lib/javascript.php b/lib/javascript.php
index 69a273cbb47..a691468e363 100644
--- a/lib/javascript.php
+++ b/lib/javascript.php
@@ -1,17 +1,15 @@
editorsrc)) {
+ foreach ( $CFG->editorsrc as $scriptsource ) {
+ echo ''."\n";
}
-
- if (can_use_html_editor() && !empty($CFG->editorsrc)) {
- foreach ( $CFG->editorsrc as $scriptsource ) {
- echo ''."\n";
- }
- }
-
+}
?>
@@ -30,40 +28,19 @@ setTimeout('fix_column_widths()', 20);
\n";
+ $focus = false; // Prevent themes from adding it to body tag which breaks addonload(), MDL-10249
+}
?>
+//]]>
+
diff --git a/lib/weblib.php b/lib/weblib.php
index d9917b4dc14..0bf3b5f40b0 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -2040,6 +2040,40 @@ function replace_smilies(&$text) {
}
}
+/**
+ * This code is called from help.php to inject a list of smilies into the
+ * emoticons help file.
+ *
+ * @return string HTML for a list of smilies.
+ */
+function get_emoticons_list_for_help_file(){
+ global $CFG, $SESSION;
+ if (empty($CFG->emoticons)) {
+ return '';
+ }
+
+ require_js(array('yui_yahoo', 'yui_event'));
+ $items = explode('{;}', $CFG->emoticons);
+ $output = '
|