]> git.mjollnir.org Git - moodle.git/commitdiff
New pop-up help page about smileys - clicking on the smiley inserts it
authormoodler <moodler>
Thu, 8 May 2003 16:09:30 +0000 (16:09 +0000)
committermoodler <moodler>
Thu, 8 May 2003 16:09:30 +0000 (16:09 +0000)
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

lang/en/help/textformat.html
lang/en/moodle.php
lib/javascript.php
lib/weblib.php
mod/forum/post.html
mod/journal/edit.html

index 147132aba180c951b981205bab77abfb700fa9ed..4aaa9c4049da57bb18aeac11938dc314cec4e303 100644 (file)
@@ -1,11 +1,11 @@
 <P ALIGN=CENTER><B>Formatting text</B></P>
 
-<P>When writing text in Moodle there are currently two formats you can choose
+<P>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.
 
-<P><B>Usually you can just leave this setting alone and things should
-   work as you expect</B>.
+<P><B>Usually you can just leave this setting to the default value and things 
+      should work as you expect</B>.
 
 <P><B>1. Moodle auto-format</B></P>
 
index c0c8daff16cc15ea4918dce23bc3d73fca9775ba..6547a8e643af8d213e0615906cbfefcd849ec613 100644 (file)
@@ -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";
index efd1b818bc3e5ecb4c0c7844d2547bdffde8c90e..ae8e0d0195525d32bf26c6d1ecf6a29d0a9a9638 100644 (file)
@@ -34,7 +34,25 @@ function checkall() {
     void(el[i].checked=1) \r
 }\r
 \r
-<? if ($focus) { echo "function setfocus() { document.$focus.focus() }\n"; } ?>\r
+function inserttext(text) {\r
+<?PHP \r
+    if (!empty($SESSION->inserttextform)) {\r
+        $insertfield = "opener.document.forms['$SESSION->inserttextform'].$SESSION->inserttextfield";\r
+    } else {\r
+        $insertfield = "opener.document.forms['theform'].message";\r
+    }\r
+    echo "  text = ' ' + text + ' ';\n";\r
+    echo "  if ( $insertfield.createTextRange && $insertfield.caretPos) {\n";\r
+    echo "      var caretPos = $insertfield.caretPos;\n";\r
+    echo "      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;\n";\r
+    echo "  } else {\n";\r
+    echo "      $insertfield.value  += text;\n";\r
+    echo "  }\n";\r
+    echo "  $insertfield.focus();\n";\r
+?>\r
+}\r
+\r
+<?PHP if ($focus) { echo "function setfocus() { document.$focus.focus() }\n"; } ?>\r
 \r
 // done hiding -->\r
 </SCRIPT>\r
index 9fa7368c333f0ec39cccf4f7e325dc546ddb7dfe..32a4970b84a47099e1d841002a5dfa613a2e230a 100644 (file)
@@ -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 "&nbsp;<img src=\"$CFG->wwwroot/pix/s/smiley.gif\" align=\"absmiddle\" width=15 height=15></a>";
+}
+
 function notice ($message, $link="") {
     global $CFG, $THEME;
 
index 50bfd9c700eafabc45e7141791b11fcdc2074a1f..0c90dbe8cd289c7d8eedf87ad96d07b9dd7e8881 100644 (file)
     <td align="right" valign="center" nowrap>
 
     <font SIZE="1">
-     <? helpbutton("reading", get_string("helpreading"), "moodle", true, true) ?><br \>
-     <? helpbutton("writing", get_string("helpwriting"), "moodle", true, true) ?><br \>
-     <? helpbutton("questions", get_string("helpquestions"), "moodle", true, true) ?><br \>
-     <? if ($usehtmleditor) { ?>
-        <? helpbutton("richtext", get_string("helprichtext"), "moodle", true, true) ?>
-     <? } else { ?>
-        <? helpbutton("text", get_string("helptext"), "moodle", true, true) ?>
-     <? } ?><br \>
+     <?PHP
+        helpbutton("reading", get_string("helpreading"), "moodle", true, true);
+        echo "<br />";
+        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
+        echo "<br />";
+        helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
+        echo "<br />";
+        if ($usehtmleditor) {
+           helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
+        } else {
+           emoticonhelpbutton("theform", "message");
+        } 
+      ?>
+     <br />
      </font>
 
     </td>
 <tr valign=top>
     <td align=right><p><b><? print_string("formattexttype"); ?>:</b></p></td>
     <td>
-    <? choose_from_menu(format_text_menu(), "format", $post->format, ""); ?>
-    <? helpbutton("textformat", get_string("formattexttype")) ?>
+    <?PHP 
+       choose_from_menu(format_text_menu(), "format", $post->format, "");
+     ?>
+    <font SIZE="1">
+    <?PHP 
+        helpbutton("textformat", get_string("helpformatting"));
+     ?>
+    </font>
 
     </td>
 </tr>
index a298b8cda12b77ff7143e1fd9f187d24f8971d90..237de734644564c2ded756197454d74bbb75188d 100644 (file)
@@ -1,35 +1,44 @@
 <FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php">
 <table><tr>
     <td align=right>
-    <font SIZE="1">
-     <? helpbutton("reading", get_string("helpreading"), "moodle", true, true) ?><br \>
-     <? helpbutton("writing", get_string("helpwriting"), "moodle", true, true) ?><br \>
-     <? if ($usehtmleditor) { ?>
-        <? helpbutton("richtext", get_string("helprichtext"), "moodle", true, true) ?>
-     <? } else { ?>
-        <? helpbutton("text", get_string("helptext"), "moodle", true, true) ?>
-     <? } ?><br \>
+    <font size="1">
+     <?PHP
+        helpbutton("reading", get_string("helpreading"), "moodle", true, true);
+        echo "<br />";
+        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
+        echo "<br />";
+        if ($usehtmleditor) {
+           helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
+        } else {
+           emoticonhelpbutton("theform", "text");
+        } 
+      ?>
+     <br />
     </font>
     </td>
 </tr></table>
 
 <? print_textarea($usehtmleditor, 20, 60, 595, 400, "text", $entry->text); ?>
 
-<P align=center>
-<? print_string("formattexttype");
+<p align=center>
+<?PHP
+   print_string("formattexttype");
    echo ":&nbsp;";
    choose_from_menu(format_text_menu(), "format", $entry->format, "");
-   helpbutton("textformat", get_string("formattexttype")) ?>
-</P>
+   echo "<font size=\"1\">";
+   helpbutton("textformat", get_string("helpformatting"));
+   echo "</font>";
+?>
+</p>
 
-<P align=center>
-<INPUT type="hidden" name=id value="<?=$cm->id ?>">
-<INPUT type="submit" value="<? print_string("savechanges") ?>">
-<INPUT type="reset" value="<? print_string("revert") ?>">
+<p align=center>
+<input type="hidden" name=id value="<?=$cm->id ?>">
+<input type="submit" value="<? print_string("savechanges") ?>">
+<input type="reset" value="<? print_string("revert") ?>">
 </P>
-</FORM>
+</form>
 
-<? 
+<?PHP 
    if ($usehtmleditor) { 
        print_richedit_javascript("theform", "text", "no");
    }