From: moodler Date: Thu, 8 May 2003 16:09:30 +0000 (+0000) Subject: New pop-up help page about smileys - clicking on the smiley inserts it X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e825f2796737281042144997d233632416be16f3;p=moodle.git New pop-up help page about smileys - clicking on the smiley inserts it into the form using Javascript! Also rationalised and patched some of the other help about text formats. LANGUAGE EDITORS MAY WANT TO RE-CHECK: lang/en/help/textformat.html --- diff --git a/lang/en/help/textformat.html b/lang/en/help/textformat.html index 147132aba1..4aaa9c4049 100644 --- a/lang/en/help/textformat.html +++ b/lang/en/help/textformat.html @@ -1,11 +1,11 @@

Formatting text

-

When writing text in Moodle there are currently two formats you can choose +

When writing text in Moodle there are several formats you can choose to produce your text, depending on your expertise and the type of browser you are using. -

Usually you can just leave this setting alone and things should - work as you expect. +

Usually you can just leave this setting to the default value and things + should work as you expect.

1. Moodle auto-format

diff --git a/lang/en/moodle.php b/lang/en/moodle.php index c0c8daff16..6547a8e643 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -262,14 +262,16 @@ $string['guestsyes'] = "Allow guests without the key"; $string['guestuser'] = "Guest User"; $string['guestuserinfo'] = "This user is a special user that allows read-only access to some courses."; $string['help'] = "Help"; +$string['helpemoticons'] = "Use emoticons"; +$string['helpformatting'] = "About formatting text"; $string['helphtml'] = "How to write html"; $string['helppicture'] = "How to upload a picture"; $string['helpreading'] = "Read carefully"; $string['helptext'] = "How to write text"; -$string['helpwiki'] = "How to write Wiki text"; $string['helprichtext'] = "About Richtext editor"; $string['helpsummaries'] = "About these summaries"; $string['helpquestions'] = "Ask good questions"; +$string['helpwiki'] = "How to write Wiki text"; $string['helpwriting'] = "Write carefully"; $string['hide'] = "Hide"; $string['hits'] = "Hits"; diff --git a/lib/javascript.php b/lib/javascript.php index efd1b818bc..ae8e0d0195 100644 --- a/lib/javascript.php +++ b/lib/javascript.php @@ -34,7 +34,25 @@ function checkall() { void(el[i].checked=1) } - +function inserttext(text) { +inserttextform)) { + $insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield"; + } else { + $insertfield = "opener.document.forms['theform'].message"; + } + echo " text = ' ' + text + ' ';\n"; + echo " if ( $insertfield.createTextRange && $insertfield.caretPos) {\n"; + echo " var caretPos = $insertfield.caretPos;\n"; + echo " caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n"; + echo " } else {\n"; + echo " $insertfield.value += text;\n"; + echo " }\n"; + echo " $insertfield.focus();\n"; +?> +} + + // done hiding --> diff --git a/lib/weblib.php b/lib/weblib.php index 9fa7368c33..32a4970b84 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -637,7 +637,7 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta= // $cache - should this page be cacheable? // $button - HTML code for a button (usually for module editing) // $menu - HTML code for a popup menu - global $USER, $CFG, $THEME; + global $USER, $CFG, $THEME, $SESSION; if (file_exists("$CFG->dirroot/theme/$CFG->theme/styles.php")) { $styles = $CFG->stylesheet; @@ -1182,6 +1182,16 @@ function helpbutton ($page, $title="", $module="moodle", $image=true, $linktext= link_to_popup_window ($url, "popup", $linkobject, 400, 500, $title); } +function emoticonhelpbutton($form, $field) { +/// Prints a special help button that is a link to the "live" emoticon popup + global $CFG, $SESSION; + + $SESSION->inserttextform = $form; + $SESSION->inserttextfield = $field; + helpbutton("emoticons", get_string("helpemoticons"), "moodle", false, true); + echo " wwwroot/pix/s/smiley.gif\" align=\"absmiddle\" width=15 height=15>"; +} + function notice ($message, $link="") { global $CFG, $THEME; diff --git a/mod/forum/post.html b/mod/forum/post.html index 50bfd9c700..0c90dbe8cd 100644 --- a/mod/forum/post.html +++ b/mod/forum/post.html @@ -18,14 +18,20 @@ -
-
-
- - - - -
+ "; + helpbutton("writing", get_string("helpwriting"), "moodle", true, true); + echo "
"; + helpbutton("questions", get_string("helpquestions"), "moodle", true, true); + echo "
"; + if ($usehtmleditor) { + helpbutton("richtext", get_string("helprichtext"), "moodle", true, true); + } else { + emoticonhelpbutton("theform", "message"); + } + ?> +
@@ -33,8 +39,14 @@

:

- format, ""); ?> - + format, ""); + ?> + + + diff --git a/mod/journal/edit.html b/mod/journal/edit.html index a298b8cda1..237de73464 100644 --- a/mod/journal/edit.html +++ b/mod/journal/edit.html @@ -1,35 +1,44 @@
action="edit.php">
- -
-
- - - - -
+ + "; + helpbutton("writing", get_string("helpwriting"), "moodle", true, true); + echo "
"; + if ($usehtmleditor) { + helpbutton("richtext", get_string("helprichtext"), "moodle", true, true); + } else { + emoticonhelpbutton("theform", "text"); + } + ?> +
text); ?> -

- +format, ""); - helpbutton("textformat", get_string("formattexttype")) ?> -

+ echo ""; + helpbutton("textformat", get_string("helpformatting")); + echo ""; +?> +

-

- -"> -"> +

+ +"> +">

-
+ -