Skip to content

Commit

Permalink
"MDL-13233, make emoticons documentation should be dynamic"
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed Apr 30, 2008
1 parent 083acd2 commit 01260c7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 348 deletions.
26 changes: 25 additions & 1 deletion help.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
$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();
Expand All @@ -160,6 +165,25 @@

// 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);
}
Expand All @@ -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();
Expand Down
118 changes: 3 additions & 115 deletions lang/en_utf8/help/emoticons.html
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -122,4 +10,4 @@

<p>Note that the codes themselves are like little pictures - just turn your head to the left when looking at them</p>

</body></html>
</body></html>
118 changes: 2 additions & 116 deletions lang/en_utf8/help/richtext.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,120 +43,6 @@ <h2>Inserting Links <img alt="" src="lib/editor/htmlarea/images/ed_link.gif" />
<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>
Loading

0 comments on commit 01260c7

Please sign in to comment.