FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Frankie Kam -
Number of replies: 8
Picture of Plugin developers
Dear Moodlers

I. INTRODUCTION
For the last 3 weeks I've been working on an embedded chat widget for my Moodle 1.9.7  site. I am sure that it can be easily modified to suit Moodle 2.x.
My improved chat is based on modified PHP code of phpfreechat and Moodle's Multimovie filter  and the Voicethread filter.
I call this modified chat, "FreeEmbedChat".
 
        Sample screenshot1.

II. IMPROVED FEATURES ON THE CHAT
Here's what my improved chat can do:
 
    1. Direct Login (integrated with Moodle username)
     It takes the Moodle username login as the chat username automatically

   2. Posting of Images direct
    You can copy and paste in an image URL and the image appears on the Chat post directly.
    Example chat post syntax:   http://url/filename.png or jpg or gif

    3. Posting of embedded Youtube videos
     You can copy and paste in a youtube URL and the youtube video appears on the Chat post directly.
     Note: it requires a basic [b] <youtube url> [/b] post to embed the playable Youtube video inside the chat post
     Example chat post syntax:   [y]http://www.youtube.com/watch?v=crypticcode[/y]

    4. Embed Voicethreads 
     You can embed Voicethreads inside your chat post.
     Chat post syntax:   [[vt:value]]   or   vtsmall:value

The abovementioned features are NOT found in the stock downloadable version of PHPfreechat.
I'm trying to think of other useful Web 2.0 objects that would be useful if embedded in a chat. Does anything come to your mind? 
 
III. DEMO SITE FOR YOU TO HAVE A FEEL HOW IT WORKS
For a working demo, please check out my production site at
http://scm.moodleace.com/course/view.php?id=44
Username: student
Password: moodle
Click on the PHPFreeChat green collapsible topic tab.
I'm also attaching 2 screenshots of this new improved phpfreechat widget.
 
         Sample screenshot2.
  
IV. PEDAGOGICAL VALUE
Does this Chat have any learning value? I believe it has.
I think that it might be a useful activity (almost akin to the Wiki) where a classroom of students can share posts of images, Youtube videos and VoiceThreads inside the chat window.
BTW, phpfreechat is a galaxy on its own. See http://www.phpfreechat.net. For example, you can issue the command /join baseball and a new room tab is created. So multiple rooms can be created. There's also the whole slew of chatroom commands ala mIRC (harkening back to the good old days of chat - the 1990s!). Although one should be cautious of chat in the classroom, I think it might have some pedagogical value.  I'm not sure how it will fare with 20 or more users on other Linux servers. 
 
V. WISH LISTS AND FREE SOURCE CODE
This souped up, pimp-my-ride chat was created from Moodle php and phpfreechat code. So I am also releasing the code to others to improve upon it. 
IS ANYONE INTERESTED? I'm still testing it, AND I'll be releasing the FULL PHP code to ALL MOODLERS EVERYWHERE for download from my Blog in a couple of days. If I could make the code available on Moodle.org, it would be even better.

Wish Item A
I would want my Chat to work with TeacherTube video embeds. The code to do it does exist in my php source code files, but the TeacherTube embed does not work due to outdated embed syntax - TeacherTube has changed its embed code syntax from previously, I think.
Right now, to embed an image, you just type in the image's URL and hit the send button. As in http://url/filename.png
 
And so, 
 
Wish Item B
I would want VERY MUCH to embed Youtube videos WITHOUT the [y] and [/y] tags. It would be GREAT if the user could just type the Youtube video's URL directly, as in  http://www.youtube.com/watch?v=cyrpticode or even in full http://www.youtube.com/watch?v=cyrpticode&feature=feedu
 
and have the video embed itself in the chat stream.

Wish Item C
Also I would LOVE to have the user just copy and paste the Voicethread URL, as in  
and have the embed appear inside the chat stream. 

Wish Item D
In addition, there should still be a way to post links to Youtube and Voicethread and make them appear as clickable text hyperlinks on the chat post. Perhaps one would have to type a prefix tag to signal that the chat post is an actual link:

and then only the link http://voicethread.com/share/value will appear in the stream, not the embedded object itself.
 
in otherwords, I want to dispense with any tags when posting Web 2.0 objects. The aim is to allow the user to paste in Web 2.0 URLs in the most user-friendly and convenient manner possible. The above wish items are achievable if you undersand how to use the PHP functions preg_replace() and preg_match() and preg_match_all(). Example codes are:
	$voicethread_site = preg_replace('/http:\/\//','',$voicethread_site);

preg_match_all('/\[\[vt.*?)(\|(.*?))?\]\]/s'.$u, $text, $list_of_movies);
        $ret = preg_replace("#(^|[\n \]])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#ie", "'\\1<a href=\"mailto:\\2@\\3\">' . pfc_shorten_url('\\2@\\3') . '</a>'", $ret);
Any PHP programmers want to contribute to this project?
if those 3 lines of code did not give you a splitting headache, then you are the right person to make FreeEmbedChat better.

VI. FINAL THOUGHTS
Since the Chat code is heavily dependent on OBJECT EMBED code like
$replace = '<div id="voicethread-container">'.
$headertext . '<br>' .
'<object width="320" height="240"> '.
'<param name="movie" value="http://'.$voicethread_site.'/book.swf?b='.$movie->reference.'"></param> '.
'<param name="wmode" value="transparent"></param>'.
'<embed src="http://'.$voicethread_site.'/book.swf?b='.$movie->reference.'" type="application/x-shockwave-flash" wmode="transparent" width="800" height="600"></embed>'.
'</object>'.$footertext.'</div>';

..there may be security issues (hacking, code injecting and other nasty, irritating stuff) or compatibility/poratability issues (some admins may turn off the Object embed feature on their Moodle site). I need some advice on this. Anyone?

Finally, I hope you can also contribute to this chat code to make it better. If you end up using it on your Moodle site, that would be meat and drink enough for me. wink
 
Regards
Frankie Kam
Email: boonsengkam@gmail.com
Melaka, Malaysia
Average of ratings: -
In reply to Frankie Kam

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Frankie Kam -
Picture of Plugin developers

To download the entire source code, head on over to my blog - you'll have to You'll have to scroll down to the bottom of my blog post here

In reply to Frankie Kam

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Nicholas Walker -

Hi Frankie,

I visited your blog, downloaded the plugin, installed it as you recommended, but I could not get the plugin to work until I changed the permissions of the FreeEmbedChat folder to 0777. I changed permissions recursively. It now works, and I want to thank you for this exciting contribution to Moodle.

However, I am a little concerned about security. The only other folder with these permissions is moodledata. Do you see any potential issue with 777 here?

Can anyone else advise on this?

Thanks again. I look forward to trying it out in the classroom. 

Nick

In reply to Nicholas Walker

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Frankie Kam -
Picture of Plugin developers

Hi Nicholas

Thanks for highlighting the chmod problem.
I forgot to include that part of the install instructions!

From the phpFreeChat installation webpage,
http://www.phpfreechat.net/quickstart
it seems that you need not (should not?) chmod 777recursively.
Instead, just a couple of folders to be 'chmoded' with 777 privileges.

When reading the below instructions, when you see the text "phpfreechat-x.x", think "FreeEmbedChat".

Installation

  1. Get the zip (or tar.gz for unix users) archive from the download page
  2. Unzip the archive localy then upload the “phpfreechat-x.x” directory on your server into a browsable directory (public directory). Tip: if you have a SSH access, I suggest to untar the archives directly on the server usign “tar xzf phpfreechat-x.x.tar.gz” command.
  3. Give the web server's write permissions to “phpfreechat-x.x/data/public” and “phpfreechat-x.x/data/private” directories. If you are using FTP:
    CHMOD 777 phpfreechat-x.x/data/private
    CHMOD 777 phpfreechat-x.x/data/public

    If you are using SSH:

    chmod 777 phpfreechat-x.x/data/*

    Tip: On the latest version 1.x maybe it will not work and it will show you ”“Error: the chat cannot be loaded!…””, then try with 755 rights.

  4. Browse the “phpfreechat-x.x” directory with your browser and enjoy !

I think that answers the security question eh?

Frankie Kam

In reply to Frankie Kam

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Frankie Kam -
Picture of Plugin developers

To see an example of the Chat in action as a separate window, click on:

http://scm.moodleace.com/mod/resource/view.php?id=3302
Username: student
Password: moodle

In reply to Frankie Kam

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Doug Moody -

Frankie,

Thank you for working on this. I think it has great potential.

My wish would be embeddable and viewable PDF and PowerPoint files, especially Powerpoint. As a teacher, I have lots of POwerpoint shows that would be great teaching tools in a chat.  Consider both 2003 and 2007 versions (.ppt and .pptx) of Powepoint. Also, PDF files are awesome teaching tools, especially as there are so many free books available in PDF format now.

In reply to Doug Moody

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Frankie Kam -
Picture of Plugin developers

Hi Doug

Thanks for your insightful reply!

As forPDF files, you mean something like this?
http://moodurian.blogspot.com/2011/07/embedding-pdf-files-in-moodle-concise.html

On the http://phpFreeChat.net forums, these is a post on how to allow a user to upload an image to the chat.
http://www.phpfreechat.net/forum/viewtopic.php?id=4630
I tried it but couldn't get it to workwith phpFreeChat version 1.3. I think that the upload image hack only works with an earlier 0.x version.

My point is that with PHP anything is possible. Including what you mentioned about PDF, PPT/PPTX file embeds.

So in the past, someone in the phpFreeChat community had figured out a way to upload an image into the chat window. It should be logically possible to upload PDF file have have the system auto-generate the HMTL OBJECT embed code and to display it within the chat window/stream.

Displaying a PDF file within the chat widow is a god idea. It will work great if the user can zoom to full-window or full-screen size. Otherwise the text will be too small to read in the chat window.

The question is how difficult and how long would it take to program that it. If there is a will, there's a way they say. So that would be worth looking into.

Frankie Kam

In reply to Frankie Kam

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by Frankie Kam -
Picture of Plugin developers

I've also implemented the "user can post multiple-line input" by using a [br] syntax: E.g., text.....[br]text......[br].

And, you can also specify the background image file of your choice. On my demo site, I am using a yellow jpg background file. It can be changed of course.

There is a separate discussion on this Chat at phpFreeChat.net specifically at this forum post:
http://www.phpfreechat.net/forum/viewtopic.php?pid=17773#p17773
Some guy by the name of OldWolf picked up my message and I hope that the rest of the original development team will take notice. Who knows, this might help to kick in version 1.5 of PHPFreeChat?

Have fun extending the functionality of this excellent phpFreeChat chat!

Frankie Kam

In reply to Frankie Kam

Re: FreeEmbedChat - you've never seen a PHP chat like this for your Moodle site before!

by daniel black -
Where can I download the modified code, And thank you anyway, we reaslly apreciate your release of works. smile