Jquerychat
Questions answered by this recipe
How to offer a modern and private chat to the authenticated users of my PmWiki ?
Description
Provide recipe to use a jquery chat into pmwiki.
The jquery chat, by Anant Garg, is a robust system. A js "chat.js" telling messages and events to a chat.php which has to be in the root of the PmWiki. The stream of messages is in a sql table.
I have just wrote a very ugly system to list connected people... and offer a minimal markup (:chats:)
You can see a standalone online demo of this chat system:
Put these urls in three differents browsers: you can chat between them.
http://anantgarg.com/chat/samplea.php http://anantgarg.com/chat/sampleb.php http://anantgarg.com/chat/samplec.php
Installation
Intallation of jquerychat
- Download http://anantgarg.com/wp-content/uploads/2009/05/jquerychat.zip in the /pub directory of your PmWiki
- unzip it, you have now a 'chat' directory pub/chat
- copy the pub/chat/chat.php in the root of your PmWiki
cd pub [of your PmWiki] sudo wget http://anantgarg.com/wp-content/uploads/2009/05/jquerychat.zip unzip jquerychat.zip sudo cp chat/chat.php ..
Create a sql table for the communication stream
CREATE TABLE `chat` ( `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `from` VARCHAR(255) NOT NULL DEFAULT '', `to` VARCHAR(255) NOT NULL DEFAULT '', `message` TEXT NOT NULL, `sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `recd` INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id`), INDEX `to` (`to`), INDEX `from` (`from`) ) ENGINE = InnoDB;
Create un loggedin directory
The recipe jquerychat.php uses a 'very ugly' system to know who is connected (if you have a better, tell me!).
You have to create pub/loggedin directory with right to PmWiki to write in it
Installation of jquerychat.php
Download jquerychat.txtΔ in your cookbook directory and rename it jquerychat.php
Tell to PmWiki that you want to use the recipe
Add in your local/config.php the linge
$_SESSION['username']=$Author; include_once('cookbook/jquerychat.php'); include_once('chat.php');
Configuration
Access to the sql table
You have to tell to chat.php' how to connect to the database to retreive the chat table.
The default nickname in the chat system is $Author
but maybe you can change it: jquerychat use $_SESSION['username']
Usage
The recipe provide a very simple markup (:chats:)
which provide links to chats with each other connected people.
Notes
Change log / Release notes
See also
Contributors
Comments
See discussion at Jquerychat-Talk?
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.