New language file called pix.php for defining alt-text of pix files.

Smileys code is changed over to use this, both in replace_smileys
and in editor/popups/dlg_ins_smile.php

Needs testing please!
This commit is contained in:
moodler
2003-11-07 14:55:44 +00:00
parent 6476f5fca6
commit fbfc267591
3 changed files with 109 additions and 169 deletions
+24
View File
@@ -0,0 +1,24 @@
<?PHP // $Id$
$string['angry'] = "angry";
$string['approve'] = "approve";
$string['biggrin'] = "big grin";
$string['blackeye'] = "black eye";
$string['blush'] = "blush";
$string['clown'] = "clown";
$string['cool'] = "cool";
$string['dead'] = "dead";
$string['evil'] = "evil";
$string['kiss'] = "kiss";
$string['mixed'] = "mixed";
$string['sad'] = "sad";
$string['shy'] = "shy";
$string['sleepy'] = "sleepy";
$string['smiley'] = "smile";
$string['surprise'] = "surprise";
$string['thoughtful'] = "thoughtful";
$string['tongueout'] = "tongueout";
$string['wideeyes'] = "wide eyes";
$string['wink'] = "wink";
?>
+58 -144
View File
@@ -1,52 +1,37 @@
<!--
#################################################################################
##
## HTML Text Editing Component for hosting in Web Pages
## Copyright (C) 2001 Ramesys (Contracting Services) Limited
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU LesserGeneral Public License
## along with this program; if not a copy can be obtained from
##
## http://www.gnu.org/copyleft/lesser.html
##
## or by writing to:
##
## Free Software Foundation, Inc.
## 59 Temple Place - Suite 330,
## Boston,
## MA 02111-1307,
## USA.
##
## Original Developer:
##
## Austin David France
## Ramesys (Contracting Services) Limited
## Mentor House
## Ainsworth Street
## Blackburn
## Lancashire
## BB1 6AY
## United Kingdom
## email: [email protected]
##
## Home Page: http://richtext.sourceforge.net/
## Support: http://richtext.sourceforge.net/
## $Id$
##
#################################################################################
-->
<?php
include("../../../config.php");
$pix = $CFG->wwwroot . "/pix/s";
include('../../../config.php');
$pixpath = "$CFG->pixpath/s";
$fullnames = get_list_of_pixnames();
$emoticons = array ( 'smiley' => ':-)',
'biggrin' => ':-D',
'wink' => ';-)',
'mixed' => ':-/',
'thoughtful' => 'V-.',
'tongueout' => ':-P',
'cool' => 'B-)',
'approve' => '^-)',
'wideeyes' => '8-)',
'clown' => ':o)',
'sad' => ':-(',
'shy' => '8-.',
'blush' => ':-I',
'kiss' => ':-X',
'surprise' => '8-o',
'blackeye' => 'P-|',
'angry' => '8-[',
'dead' => 'xx-P',
'sleepy' => '|-.',
'evil' => '}-]' );
?>
<html style="width: 320px; height: 350px;">
<head>
@@ -54,7 +39,7 @@
<meta name=vs_targetSchema content="HTML 4.0">
<meta name="GENERATOR" content="Microsoft Visual Studio 7.0">
<LINK rel="stylesheet" type="text/css" href="dialog.css">
<title>Insert Smiley Icon &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<title><?php print_string('insertsmile', 'editor') ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<script type="text/javascript" src="popup.js"></script>
<script language="JavaScript" type="text/javascript">
@@ -95,110 +80,39 @@ function cancel() {
<tr valign="top">
<td>
<table border="0" align="center">
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/smiley.gif" onclick="insert('<?php echo $pix ?>/smiley.gif',':-)')" width="15" height="15"></td>
<td>smile</td>
<td class="smile">:-)</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/biggrin.gif" onclick="insert('<?php echo $pix ?>/biggrin.gif',':-D')" width="15" height="15"></td>
<td>big grin</td>
<td class="smile">:-D</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/wink.gif" onclick="insert('<?php echo $pix ?>/wink.gif',';-)')" width="15" height="15"></td>
<td>wink</td>
<td class="smile">;-)</td>
</tr>
<tr>
<td><img alt= border="0" hspace="10" src="<?php echo $pix ?>/mixed.gif" onclick="insert('<?php echo $pix ?>/mixed.gif',':-/')" width="15" height="15"></td>
<td>mixed</td>
<td class="smile">:-/</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/thoughtful.gif" onclick="insert('<?php echo $pix ?>/thoughtful.gif','V-.')" width="15" height="15"></td>
<td>thoughtful</td>
<td class="smile">V-.</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/tongueout.gif" onclick="insert('<?php echo $pix ?>/tongueout.gif',':-P')" width="15" height="15"></td>
<td>tongue out</td>
<td class="smile">:-P</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/cool.gif" onclick="insert('<?php echo $pix ?>/cool.gif','B-)')" width="15" height="15"></td>
<td>cool</td>
<td class="smile">B-)</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/approve.gif" onclick="insert('<?php echo $pix ?>/approve.gif','^-)')" width="15" height="15"></td>
<td>approve</td>
<td class="smile">^-)</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/wideeyes.gif" onclick="insert('<?php echo $pix ?>/wideeyes.gif','8-)')" width="15" height="15"></td>
<td>wide eyes</td>
<td class="smile">8-)</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/surprise.gif" onclick="insert('<?php echo $pix ?>/surprise.gif','8-o')" width="15" height="15"></td>
<td>surprise</td>
<td class="smile">8-o</td>
</tr>
<?php
$list = array('smiley', 'biggrin', 'wink', 'mixed', 'thoughtful',
'tongueout', 'cool', 'approve', 'wideeyes', 'surprise');
foreach ($list as $image) {
$name = $fullnames[$image];
$icon = $emoticons[$image];
echo '<tr>';
echo "<td><img alt=\"$name\" border=\"0\" hspace=\"10\" src=\"$pixpath/$image.gif\" ".
" onclick=\"insert('$pixpath/$image.gif','$name')\" width=\"15\" height=\"15\"></td>";
echo "<td>$name</td>";
echo "<td class=\"smile\">$icon</td>";
echo "</tr>";
}
?>
</table>
</td>
<td>
<table border="0" align="center">
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/sad.gif" onclick="insert('<?php echo $pix ?>/sad.gif',':-(')" width="15" height="15"></td>
<td>sad</td>
<td class="smile">:-(</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/shy.gif" onclick="insert('<?php echo $pix ?>/shy.gif','8-.')" width="15" height="15"></td>
<td>shy</td>
<td class="smile">8-.</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/blush.gif" onclick="insert('<?php echo $pix ?>/blush.gif',':-I')" width="15" height="15"></td>
<td>blush</td>
<td class="smile">:-I</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/kiss.gif" onclick="insert('<?php echo $pix ?>/kiss.gif',':-X')" width="15" height="15"></td>
<td>kisses</td>
<td class="smile">:-X</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/clown.gif" onclick="insert('<?php echo $pix ?>/clown.gif',':o)')" width="15" height="15"></td>
<td>clown</td>
<td class="smile">:o)</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/blackeye.gif" onclick="insert('<?php echo $pix ?>/blackeye.gif','P-|')" width="15" height="15"></td>
<td>black eye</td>
<td class="smile">P-|</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/angry.gif" onclick="insert('<?php echo $pix ?>/angry.gif','8-[')" width="15" height="15"></td>
<td>angry</td>
<td class="smile">8-[</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/dead.gif" onclick="insert('<?php echo $pix ?>/dead.gif','xx-P')" width="15" height="15"></td>
<td>dead</td>
<td class="smile">xx-P</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/sleepy.gif" onclick="insert('<?php echo $pix ?>/sleepy.gif','|-.')" width="15" height="15"></td>
<td>sleepy</td>
<td class="smile">|-.</td>
</tr>
<tr>
<td><img alt border="0" hspace="10" src="<?php echo $pix ?>/evil.gif" onclick="insert('<?php echo $pix ?>/evil.gif','}-]')" width="15" height="15"></td>
<td>evil</td>
<td class="smile">}-]</td>
</tr>
<?php
$list = array('sad', 'shy', 'blush', 'kiss', 'clown', 'blackeye',
'angry', 'dead', 'sleepy', 'evil');
foreach ($list as $image) {
$name = $fullnames[$image];
$icon = $emoticons[$image];
echo '<tr>';
echo "<td><img alt=\"$name\" border=\"0\" hspace=\"10\" src=\"$pixpath/$image.gif\" ".
" onclick=\"insert('$pixpath/$image.gif','$name')\" width=\"15\" height=\"15\"></td>";
echo "<td>$name</td>";
echo "<td class=\"smile\">$icon</td>";
echo "</tr>";
}
?>
</table>
</td>
</tr>
@@ -211,4 +125,4 @@ function cancel() {
<button type="button" onclick="cancel()"><?php print_string("close","editor") ?></button></td></tr>
</table>
</body>
</html>
</html>
+27 -25
View File
@@ -609,39 +609,41 @@ function replace_smilies(&$text) {
static $e = array();
static $img = array();
static $emoticons = array(
':-)' => 'smiley.gif',
':)' => 'smiley.gif',
':-D' => 'biggrin.gif',
';-)' => 'wink.gif',
':-/' => 'mixed.gif',
'V-.' => 'thoughtful.gif',
':-P' => 'tongueout.gif',
'B-)' => 'cool.gif',
'^-)' => 'approve.gif',
'8-)' => 'wideeyes.gif',
':o)' => 'clown.gif',
':-(' => 'sad.gif',
':(' => 'sad.gif',
'8-.' => 'shy.gif',
':-I' => 'blush.gif',
':-X' => 'kiss.gif',
'8-o' => 'surprise.gif',
'P-|' => 'blackeye.gif',
'8-[' => 'angry.gif',
'xx-P' => 'dead.gif',
'|-.' => 'sleepy.gif',
'}-]' => 'evil.gif',
':-)' => 'smiley',
':)' => 'smiley',
':-D' => 'biggrin',
';-)' => 'wink',
':-/' => 'mixed',
'V-.' => 'thoughtful',
':-P' => 'tongueout',
'B-)' => 'cool',
'^-)' => 'approve',
'8-)' => 'wideeyes',
':o)' => 'clown',
':-(' => 'sad',
':(' => 'sad',
'8-.' => 'shy',
':-I' => 'blush',
':-X' => 'kiss',
'8-o' => 'surprise',
'P-|' => 'blackeye',
'8-[' => 'angry',
'xx-P' => 'dead',
'|-.' => 'sleepy',
'}-]' => 'evil',
);
/// this is the meat of the code - this is run every time
if ($runonce == false){
if ($runonce == false) { /// After the first time this is not run again
foreach ($emoticons as $emoticon => $image){
$alttext = get_string($image, 'pix');
$e[] = $emoticon;
$img[] = "<img alt=\"$emoticon\" width=\"15\" height=\"15\" src=\"$CFG->pixpath/s/$image\" />";
$img[] = "<img alt=\"$alttext\" width=\"15\" height=\"15\" src=\"$CFG->pixpath/s/$image.gif\" />";
}
$runonce = true;
}
/// this is the meat of the code - this is run every time
$text = str_replace($e, $img, $text);
}