]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-13233, make emoticons documentation should be dynamic"
authordongsheng <dongsheng>
Wed, 30 Apr 2008 03:49:12 +0000 (03:49 +0000)
committerdongsheng <dongsheng>
Wed, 30 Apr 2008 03:49:12 +0000 (03:49 +0000)
help.php
lang/en_utf8/help/emoticons.html
lang/en_utf8/help/richtext.html
lang/en_utf8/help/text.html

index 5d034a5aaeaedc486e3e733b493a3cc725b3d64b..6c8b3b6b2e05090ac752096a6d1d634f8e64adb1 100644 (file)
--- a/help.php
+++ b/help.php
@@ -140,6 +140,11 @@ if(preg_match('~^(.*?)<title>(.*?)</title>(.*)$~s',$output,$matches)) {
     $title=$title.' - '.$matches[2];
 }
 
+// use ##emoticons_html## to replace the emoticons documentation
+if(preg_match('~(##emoticons_html##)~', $output, $matches)) {
+    $output = preg_replace('~(##emoticons_html##)~', get_emoticons_html(), $output);
+}
+
 // Do the main output.
 print_header($title);
 print_simple_box_start();
@@ -160,6 +165,25 @@ print_footer('none');
 
 // Utility function =================================================================
 
+function get_emoticons_html(){
+    global $CFG;
+    $output = '';
+    $emoticonstring = $CFG->emoticons;
+    $output .= '<ul>';
+    if ($emoticonstring) {
+        $items = explode('{;}', $CFG->emoticons);
+        foreach ($items as $item) {
+            $item = explode('{:}', $item);
+            $emoticons[$item[0]] = $item[1];
+            $output .= '<li><a href="###" onclick="inserttext(\''.$item[0].'\')"><img src="'.$CFG->pixpath.'/s/'.$item[1].'.gif" alt="'.$item[0].'" /></a>'.' <code>'.$item[0].'</code>';
+        }
+
+    }
+    $output .= '</ul>';
+    return $output;
+
+}
+
 function file_exists_and_readable($filepath) {
     return file_exists($filepath) and is_file($filepath) and is_readable($filepath);
 }
@@ -170,7 +194,7 @@ function include_help_for_each_module($file, $langs, $helpdir) {
     global $CFG;
 
     if (!$modules = get_records('modules', 'visible', 1)) {
-        print_error('No modules found!!');        // Should never happen
+        print_error('nomodules', 'debug');        // Should never happen
     }
     
     $grade = new stdClass();
index 3c6babd815fd9a33c392235a787d306eff34c370..8b34e5778d6e06e2f60ad6ae8825f3de21140010 100644 (file)
@@ -1,119 +1,7 @@
 <html><head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body><h1>Using Smilies (emoticons)</h1>
-
-<table align="center" border="1">
-  <tbody><tr valign="top">
-    <td>
-    <table align="center" border="0" cellpadding="5">
-    <tbody><tr>
-      <td><a href="javascript:inserttext(':-)')"><img src="emoticons_files/smiley.html" class="icon" alt=""></a></td>
-      <td>smile</td>
-      <td><code>:-)</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(':-D')"><img src="emoticons_files/biggrin.html" class="icon" alt=""></a></td>
-      <td>big grin</td>
-      <td><code>:-D</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(';-)')"><img src="emoticons_files/wink.html" class="icon" alt=""></a></td>
-      <td>wink</td>
-      <td><code>;-)</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(':-/')"><img src="emoticons_files/mixed.html" class="icon" alt=""></a></td>
-      <td>mixed</td>
-      <td><code>:-/</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('V-.')"><img src="emoticons_files/thoughtful.html" class="icon" alt=""></a></td>
-      <td>thoughtful</td>
-      <td><code>V-.</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(':-P')"><img src="emoticons_files/tongueout.html" class="icon" alt=""></a></td>
-      <td>tongue out</td>
-      <td><code>:-P</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('B-)')"><img src="emoticons_files/cool.html" class="icon" alt=""></a></td>
-      <td>cool</td>
-      <td><code>B-)</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('^-)')"><img src="emoticons_files/approve.html" class="icon" alt=""></a></td>
-      <td>approve</td>
-      <td><code>^-)</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('8-)')"><img src="emoticons_files/wideeyes.html" class="icon" alt=""></a></td>
-      <td>wide eyes</td>
-      <td><code>8-)</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('8-o')"><img src="emoticons_files/surprise.html" class="icon" alt=""></a></td>
-      <td>surprise</td>
-      <td><code>8-o</code></td>
-    </tr>
-    </tbody></table>
-  </td>
-
-  <td>
-    <table align="center" border="0" cellpadding="5">
-    <tbody><tr>
-      <td><a href="javascript:inserttext(':-(')"><img src="emoticons_files/sad.html" class="icon" alt=""></a></td>
-      <td>sad</td>
-      <td><code>:-(</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('8-.')"><img src="emoticons_files/shy.html" class="icon" alt=""></a></td>
-      <td>shy</td>
-      <td><code>8-.</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(':-I')"><img src="emoticons_files/blush.html" class="icon" alt=""></a></td>
-      <td>blush</td>
-      <td><code>:-I</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(':-X')"><img src="emoticons_files/kiss.html" class="icon" alt=""></a></td>
-      <td>kisses</td>
-      <td><code>:-X</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext(':o)')"><img src="emoticons_files/clown.html" class="icon" alt=""></a></td>
-      <td>clown</td>
-      <td><code>:o)</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('P-|')"><img src="emoticons_files/blackeye.html" class="icon" alt=""></a></td>
-      <td>black eye</td>
-      <td><code>P-|</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('8-[')"><img src="emoticons_files/angry.html" class="icon" alt=""></a></td>
-      <td>angry</td>
-      <td><code>8-[</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('xx-P')"><img src="emoticons_files/dead.html" class="icon" alt=""></a></td>
-      <td>dead</td>
-      <td><code>xx-P</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('|-.')"><img src="emoticons_files/sleepy.html" class="icon" alt=""></a></td>
-      <td>sleepy</td>
-      <td><code>|-.</code></td>
-    </tr>
-    <tr>
-      <td><a href="javascript:inserttext('}-]')"><img src="emoticons_files/evil.html" class="icon" alt=""></a></td>
-      <td>evil</td>
-      <td><code>}-]</code></td>
-    </tr>
-    </tbody></table>
-    </td>
-  </tr>
-</tbody></table>
+<div id="emoticons">##emoticons_html##</div>
+<div style="clear: both;"></div>
 
 <p>When writing online, it can sometimes difficult to express emotion with plain text.
    These little icons can help.  </p>
 
 <p>Note that the codes themselves are like little pictures - just turn your head to the left when looking at them</p>
 
-</body></html>
\ No newline at end of file
+</body></html>
index c7ef61ed98c7a9a4a16610f1471512a0a7a239d2..dc240a64a9c26b136e993b2e895c2101e382590f 100644 (file)
 <h2>Inserting smilies (emoticons) <img alt="" src="pix/s/smiley.gif" class="icon" /></h2>
 <div class="indent">
 <p>To embed these small icons in your text, click on the smiley icon in the toolbar.  A dialog will pop up that allows you to select from the following smiley icons. (Alternatively, you can just type the corresponding code straight into your text and it will be converted later when your text is displayed).</p>
-
-    <table border="1">
-      <tr valign="top">
-        <td>
-        <table border="0" align="center" cellpadding="10">
-          <tr>
-            <td><img alt="" src="pix/s/smiley.gif" class="icon" /></td>
-            <td>smile</td>
-            <td nowrap="nowrap"><code>:-)</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/biggrin.gif" class="icon" /></td>
-            <td>big grin</td>
-            <td nowrap="nowrap"><code>:-D</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/wink.gif" class="icon" /></td>
-            <td>wink</td>
-            <td nowrap="nowrap"><code>;-)</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/mixed.gif" class="icon" /></td>
-            <td>mixed</td>
-            <td nowrap="nowrap"><code>:-/</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/thoughtful.gif" class="icon" /></td>
-              <td>thoughtful</td>
-              <td nowrap="nowrap"><code>V-.</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/tongueout.gif" class="icon" /></td>
-            <td>tongue out</td>
-            <td nowrap="nowrap"><code>:-P</code></td>
-         </tr>
-          <tr>
-            <td><img alt="" src="pix/s/cool.gif" class="icon" /></td>
-            <td>cool</td>
-            <td nowrap="nowrap"><code>B-)</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/approve.gif" class="icon" /></td>
-              <td>approve</td>
-              <td nowrap="nowrap"><code>^-)</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/wideeyes.gif" class="icon" /></td>
-              <td>wide eyes</td>
-              <td nowrap="nowrap"><code>8-)</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/surprise.gif" class="icon" /></td>
-              <td>surprise</td>
-              <td nowrap="nowrap"><code>8-o</code></td>
-            </tr>
-        </table>
-        </td>
-        <td>
-        <table border="0" align="center" cellpadding="10">
-            <tr>
-              <td><img alt="" src="pix/s/sad.gif" class="icon" /></td>
-              <td>sad</td>
-              <td nowrap="nowrap"><code>:-(</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/shy.gif" class="icon" /></td>
-              <td>shy</td>
-              <td nowrap="nowrap"><code>8-.</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/blush.gif" class="icon" /></td>
-            <td>blush</td>
-            <td nowrap="nowrap"><code>:-I</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/kiss.gif" class="icon" /></td>
-              <td>kisses</td>
-              <td nowrap="nowrap"><code>:-X</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/clown.gif" class="icon" /></td>
-            <td>clown</td>
-            <td nowrap="nowrap"><code>:o)</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/blackeye.gif" class="icon" /></td>
-            <td>black eye</td>
-            <td nowrap="nowrap"><code>P-|</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/angry.gif" class="icon" /></td>
-              <td>angry</td>
-              <td nowrap="nowrap"><code>8-[</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/dead.gif" class="icon" /></td>
-              <td>dead</td>
-              <td nowrap="nowrap"><code>xx-P</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/sleepy.gif" class="icon" /></td>
-              <td>sleepy</td>
-              <td nowrap="nowrap"><code>|-.</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/evil.gif" class="icon" /></td>
-            <td>evil</td>
-            <td nowrap="nowrap"><code>}-]</code></td>
-          </tr>
-        </table>
-        </td>
-      </tr>
-    </table>
-
+<div id="emoticons">##emoticons_html##</div>
 </div>
-
-
+<div style="clear:both">&nbsp<div>
index ad62aba9ec21e2c1aa4d5466bce84ae27d5489bd..b384bbc53ec7730ac0eb872e5c99ad100e4da9b7 100644 (file)
@@ -5,123 +5,9 @@ Writing text in Moodle works pretty much the way you would expect, but you also
 <h2>Smilies (emoticons)</h2>
 <div class="indent">
 <p>To embed these small icons in your text, just type the associated code.  These codes themselves are like little pictures if you turn your head to the left when looking at them.</p>
-
-    <table border="1">
-      <tr valign="top">
-        <td>
-        <table border="0" align="center" cellpadding="10">
-          <tr>
-            <td><img alt="" src="pix/s/smiley.gif" class="icon" /></td>
-            <td>smile</td>
-            <td><code>:-)</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/biggrin.gif" class="icon" /></td>
-            <td>big grin</td>
-            <td><code>:-D</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/wink.gif" class="icon" /></td>
-            <td>wink</td>
-            <td><code>;-)</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/mixed.gif" class="icon" /></td>
-            <td>mixed</td>
-            <td><code>:-/</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/thoughtful.gif" class="icon" /></td>
-              <td>thoughtful</td>
-              <td><code>V-.</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/tongueout.gif" class="icon" /></td>
-            <td>tongue out</td>
-            <td><code>:-P</code></td>
-         </tr>
-          <tr>
-            <td><img alt="" src="pix/s/cool.gif" class="icon" /></td>
-            <td>cool</td>
-            <td><code>B-)</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/approve.gif" class="icon" /></td>
-              <td>approve</td>
-              <td><code>^-)</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/wideeyes.gif" class="icon" /></td>
-              <td>wide eyes</td>
-              <td><code>8-)</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/surprise.gif" class="icon" /></td>
-              <td>surprise</td>
-              <td><code>8-o</code></td>
-            </tr>
-        </table>
-        </td>
-
-        <td>
-        <table border="0" align="center" cellpadding="10">
-            <tr>
-              <td><img alt="" src="pix/s/sad.gif" class="icon" /></td>
-              <td>sad</td>
-              <td><code>:-(</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/shy.gif" class="icon" /></td>
-              <td>shy</td>
-              <td><code>8-.</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/blush.gif" class="icon" /></td>
-            <td>blush</td>
-            <td><code>:-I</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/kiss.gif" class="icon" /></td>
-              <td>kisses</td>
-              <td><code>:-X</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/clown.gif" class="icon" /></td>
-            <td>clown</td>
-            <td><code>:o)</code></td>
-          </tr>
-          <tr>
-            <td><img alt="" src="pix/s/blackeye.gif" class="icon" /></td>
-            <td>black eye</td>
-            <td><code>P-|</code></td>
-          </tr>
-            <tr>
-              <td><img alt="" src="pix/s/angry.gif" class="icon" /></td>
-              <td>angry</td>
-              <td><code>8-[</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/dead.gif" class="icon" /></td>
-              <td>dead</td>
-              <td><code>xx-P</code></td>
-            </tr>
-            <tr>
-              <td><img alt="" src="pix/s/sleepy.gif" class="icon" /></td>
-              <td>sleepy</td>
-              <td><code>|-.</code></td>
-            </tr>
-          <tr>
-            <td><img alt="" src="pix/s/evil.gif" class="icon" /></td>
-            <td>evil</td>
-            <td><code>}-]</code></td>
-          </tr>
-        </table>
-        </td>
-      </tr>
-    </table>
-
+<div id="emoticons">##emoticons_html##</div>
 </div>
-
+<div style="clear:both"></div>
 <h2>URLs</h2>
 <div class="indent">
 <p>Any "word" starting with <b>www.</b> or <b>http://</b> will automatically be turned into a clickable link.</p>