Forum OpenACS Development: html tags on chat package

Collapse
Posted by Iuri Sampaio on
Hi there,

How do i enable html tags on chat package to display html texts in the chat rooms instead of plain text?

I want write text such as Link html and

Text paragraph

and have them presented in html format.

I was browsing the files on chat package in order to understand how a message gets in the chat room...
The file /chat/www/chat.tcl has the variable "message" as one of the its arguments and its datatype is already HTML, as in:

{ -message:html "" }

However the text is treated as plain text, it is showed with all the html tags, instead of hiding them presenting only the link in a nice format.
For example: to post a message like Link html and to present ponly the link to the users be able to click on it.

any ideas how to enable such html codes?

Collapse
Posted by Iuri Sampaio on
I found the place where the message is treated.
It is within /chat/tcl/chat-ajax-procs.tcl line 25 ad_proc Chat instproc render {}

It assigns to the varaible "result" the chunk of code:
append result "...
span class='message'>[my encode $msg]</span>
"

Moreover, If i remove [my encode $msg] and leave only $msg the text gets in the chat box in html format.
However, there are plenty of details, that i am sure i missed, to arrange in order to get these stuff working nicely.

Is chat package being maintained by anyone in the community?

cheers,

Collapse
Posted by Gustaf Neumann on
if you remove the encoding many strange things can and will occur, including security breaches. Note that the type of encoding depends on the chat communication strategy as described in http://www.openacs.org/xowiki/chat

Since the chosen encoder is defined on a per-chat object basis (instance variable "encoder") you are certainly free to provide your own pair of encoder/decoder. See xotcl-core/tcl/chat-procs.tcl for some examples.

Collapse
Posted by Iuri Sampaio on
Gustaf,

The description at http://www.openacs.org/xowiki/chat tells that streaming mode requieres libthread (which i already installed) and a small patch for aolserver.

What and where is the aoslerver patch. I need to install on my box.

Collapse
Posted by Gustaf Neumann on
The default configuration of the usage of the chat classes in the chat packages use just the polling mode, which is the simplest and and has the least requirement. Recent versions of aolserver do not need the patches (see http://www.openacs.org/xowiki/tag/patches?popular=1)
Collapse
Posted by Iuri Sampaio on
Gustaf,

Here it is the scenario i am trying to accomplish:
The functionality is the possibility to attach files on real time, when people are having a conversation in the chat. (i.e. Add download file link within a chat room)

In the chat room template (i.e. ajax-chat-script.adp) I created a button "Add a file", which is a link to an ad_form on an extra popup.

Once submited, the formulary adds the file in the content repository as well as its respective revision.
Then a message, with the link available to download the file, is sent to the chat room and the popup is closed

However, i got problems with posting the message in the chat room.

1) Somehow, the link has not been posted in the chat room. Online users can't see the new message with the link to download the file.
I used the API [chat_message_post $room_id $user_id $message $moderator_p], in the end of the ad_form new_data block. I believe i missed something to make the message go through

Please see the code for the file file-add.tcl
http://pastebin.com/AvxWPjjZ

2) how to make this link html enable

Do I make sense?

cheers,