Adding Smilies to chat

Adding Smilies to chat

by Mark Little -
Number of replies: 3
Hi,

Is there anyway to add smilies to Chat?

Thanks
Average of ratings: -
In reply to Mark Little

Re: Adding Smilies to chat

by Mark Burnet -
Manually typing the characters seems to work : - ) creates smile  ; - )
In reply to Mark Burnet

Re: Adding Smilies to chat

by Francisco Gutiérrez -

something better?

our students are old teachers; and they don't understand the equivalency between text and images.

In reply to Mark Little

Re: Adding Smilies to chat

by Francisco Gutiérrez -

 done.

1-- I´ve added a few lines to the file called chatinput.php (located in /mod/chat/gui_header_js)

<a target="popup" href="http://moodle.org/help.php?module=moodle&amp;file=emoticons2.html" Xonclick="return openpopup('
/help.php?module=moodle&amp;file=emoticons2.html', 'popup', 'menubar=0,location=0,scrollbars,resizable,width=500,height=400',
0);">Emoticons<img src="
http://moodle.org/pix/s/smiley.gif" border="0" align="middle" width="15" height="15" alt=""
            class="emoticon" style="margin-left: 7px" /></a>

if you try to use the emoticons using the link at the left of this text area you'll have the same effect of those lines (without the htmleditor, try opera browser); the difference is that there is a "duplicated" file (emoticons2.html, in your help directory, moddata folder)

2-- The file "emoticons2.html" also is modified adding a js function called inserttext2 (the same used to insert emoticons in this text area, but I´ve changed the value of the text area for the the name of the textbox in chatinput.php --->chat_message)here is the script:

function inserttext2(text) {
text = ' ' + text + ' ';
if ( opener.document.forms['inputForm'].chat_message.createTextRange && opener.document.forms['inputForm'].chat_message.caretP
os) {
        var caretPos = opener.document.forms['inputForm'].chat_message.caretPos;
        caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
    } else {
        opener.document.forms['inputForm'].chat_message.value  += text;
}
opener.document.forms['inputform'].chat_message.focus();
}

3-- Finally; I´ve changed the emoticons2.html file replacing all instances of "inserttext" for "inserttext2".

We duplicate the file and the function to use a different textbox name to insert the emoticons.  Otherwise, the emoticons in the forums will not work (and probably in other places too).

4-- This method is not the same of the "htmlarea" also used to format the text.

5-- I know that probably is not the best way to do it; but I'm needing this urgently and it works (opera, ie, firefox tested).

6-- Attached screenshot.

7-- Sorry about my english

Attachment smile2.jpg