- Allow logged in user to chat live about a story
- Use the user's Pligg login as their chat name
- Use the story's name as the room name
- Do not require login to chat
- Disallow user creation of chat rooms
- Make chat UI appear in separate window
- Ajax and PHP constructed
- Allow multiple chat windows for multiple stories at once
After spending days scouring through SourceForge, this forum, the web, etc., I decide on phpFreeChat.
The integrations steps are as follows:
1 - Install phpFreeChat. I put mine into a subdirectory "chat" in htdocs. NOTE: The default download had some problems, so use SVN to get the latest from sourceforge.
2 - Modify phpFreeChat functionality to conform to the above requirements:
a - Remove the minimize button. Standard configuration has a minimize button to minimize the chat area if you embed the chat inline. Since each chat is opened in a separate window, this functionality was redundant and useless. Unfortunately, there is no configuration option to get rid of this, so this is a hack. First remove the first line from <yourchatdirectory>/themes/default/chat.html.tpl.php:3 - Create a file called start.php. Put it in your installed chat directory and insert the following code. You're Pligg interface will pass the username and roomname to this file to open the room, set the nickname of the user and connect in a new window. You can change the window size and titles.
Second, edit the file <yourchatdirectory>/data/public/js/pfcclient.js and stub out the function swap_minimize_maximize and refresh_minimize_maximize:Code:Remove this line: <img id="pfc_minmax" onclick="pfc.swap_minimize_maximize()" src="<?php echo $c->getFileUrlFromTheme('images/'.($start_minimized?'maximize':'minimize').'.gif'); ?>" alt=""/>
b - Modify the channels functionality. Make only one "room" or channel tab show up. Edit the file <yourchatdirectory>/data/public/js/pfcclient.js and stub out the following section in the code that processes the "nick" command around line 291:Code:/** * Minimize/Maximized the chat zone */ swap_minimize_maximize: function() { // CCC - We don't need this anymore as we have removed the image. Stub out this function to avoid problems. // if (this.minmax_status) { // this.minmax_status = false; // } else { // this.minmax_status = true; // } // setCookie('pfc_minmax_status', this.minmax_status); // this.refresh_minimize_maximize(); }, refresh_minimize_maximize: function() { // CCC - We don't need this anymore as we have removed the image. Stub out this function to avoid problems. // var content = $('pfc_content_expandable'); // var btn = $('pfc_minmax'); // if (this.minmax_status) // { // btn.src = this.res.getFileUrl('images/maximize.gif'); // btn.alt = this.res.getLabel('Magnify'); // btn.title = btn.alt; // content.style.display = 'none'; // } // else // { // btn.src = this.res.getFileUrl('images/minimize.gif'); // btn.alt = this.res.getLabel('Cut down'); // btn.title = btn.alt; // content.style.display = 'block'; // } },
c - Modify the global config settings. Edit the file <yourchatdirectory>/src/pfcglobalconfig.class.php. Change the following settings:Code:// now join channels comming from sessions // REMOVE - CCC - To only show the channel passed on the paramater list for multi window support //for (var i=0; i<pfc_userchan.length; i++) //{ // if (i<pfc_userchan.length-1) // cmd = '/join2'; // else // cmd = '/join'; // cmd += ' "'+pfc_userchan[i]+'"'; // this.sendRequest(cmd); //}
NOTE: phpFreeChat caches these config settings. So, to get them to show up immediately, delete the cache files located in <yourchatdirectory>/data/private/cache.Code:var $max_nick_len = 45; // To ensure the logins passed from Pligg aren't too long. var $theme = "blune"; // I used this theme as it was the cleanest
Code:
<?php
require_once "src/phpfreechat.class.php"; // adjust to your own path
$params["serverid"] = md5(__FILE__); // used to identify the chat
$params = array("title" => "ActtUp Chat",
"max_msg" => 21,
"clock" => false,
"showwhosonline" => false,
"channels" => array ($_GET['roomname']),
"nick" => $_GET['nickname'],
"showsmileys" => false,
"height" => "270px",
"width" => "300px",
"serverid" => md5(__FILE__),
"theme" => "blune", );
$chat = new phpFreeChat($params);
$title = $_GET['roomname'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>ActtUp Chat - <?php echo $title; ?></title>
<script type="text/javascript">window.resizeTo (860,640);</script>
<?php $chat->printJavascript(); ?>
<?php $chat->printStyle(); ?>
</head>
<body>
<?php $chat->printChat(); ?>
</body>
</html>
Code:
{if $Enable_Recommend eq 1}
{if $Recommend_Type eq 1}
<span id="emailto-{$link_shakebox_index}" style="display:none"></span>
{/if}
{/if}
Code:
{if $user_logged_in ne ''}
<span id="ls_category-{$link_shakebox_index}">| <a href="chat/start.php?roomname={$title_short}&nickname={$user_logged_in}" target="_blank">Chat</a> </span>
{/if}
I hope you find this useful. If someone tries this and I've missed something, please let me know.
You can see this functioning at http://www.acttup.com. Of course you must register and login to see it. Please be kind and don't spam it up. It's very new and untested. Thanks.




Linear Mode

