User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:phpfreechat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mantisbt:phpfreechat [2006/11/08 11:06] – Add comment block for observations by users testing out this extension DGtlRiftmantisbt:phpfreechat [2019/01/14 06:00] (current) – [Integration Steps] ref Admin Guide for custom string localization dregad
Line 1: Line 1:
 +====== Integrate phpFreeChat into Mantis ======
 +
 +**Author:** Victor Boctor
 +
 +===== Introduction =====
 +
 +A lot of open source projects use IRC for chatting and a lot of companies use some sort of Instant Messaging, which makes chatting an essential part of the software development environment.  I have found IRC to be a very useful communication tool between Mantis developers, however, I found there are some issues with IRC:
 +   * A lot of users are not familiar with IRC.
 +   * In the workplace, it is common to have the IRC port blocked.
 +   * The IRC client is yet another tool that the person has to open and run.
 +   * The IRC connection sometimes keeps connecting and disconnecting and sometime it remains disconnected requiring some user interaction.
 +
 +For these reasons it would be an advantage to how some sort of a web interface for chatting.  The obvious options are:
 +   * Java IRC applet (requires JVM)
 +   * AJAX Chat (only a browser is required).
 +
 +I've researched the available options ([[http://ajax.phpmagazine.net/2006/02/ajax_powered_chat_applications.html|AJAX powered chat applications reviewed]]) and decided to go for [[http://www.phpfreechat.net/news.en.html|phpFreeChat]], however, this doesn't mean that we can not have integrate with more chat options.  At the moment, no chat program will be distributed with Mantis, so integrating with another chat can be as simple as writing another recipe in the Wiki.
 +
 +===== Integration Steps =====
 +
 +  * Following is the directory structure on which the code sample below is based:
 +<code>
 +   www\
 +     chat\               # it is assumed the phpFreeChat is installed in a folder called "chat"
 +     mantis\             # this can be any name as long as it in the same level as phpFreeChat.
 +</code>
 +
 +  * Install [[http://ajax.phpmagazine.net/2006/02/ajax_powered_chat_applications.html|phpFreeChat]] and make sure it works.  Make sure you make the private/public data folders writable.
 +  * Create the chat_page.php in Mantis root folder:
 +
 +<code php>
 +<?php
 + # Mantis - a php based bugtracking system
 + # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 + # Copyright (C) 2002 - 2006  Mantis Team   - mantisbt-dev@lists.sourceforge.net
 + # This program is distributed under the terms and conditions of the GPL
 + # See the README and LICENSE files for details
 +
 + # --------------------------------------------------------
 + # $Id: $
 + # --------------------------------------------------------
 +
 + require_once( 'core.php' );
 +
 + access_ensure_project_level( REPORTER );   // change minimum access level if required.
 +
 + $t_chat_path = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'chat' . DIRECTORY_SEPARATOR;  // adjust to your own path
 +
 + require_once ( $t_chat_path . 'src' . DIRECTORY_SEPARATOR . 'phpfreechat.class.php' );
 +
 + $t_project_name = project_get_name( helper_get_current_project() );
 + $t_nick = user_get_name( auth_get_current_user_id() );
 +
 + $params['isadmin'] = user_is_administrator( auth_get_current_user_id() ); 
 +
 + $params["serverid"] = md5( __FILE__ );
 + $params["title"    = $t_project_name;
 + $params["nick"    = $t_nick;
 + $params["frozen_nick"] = true;
 + $params["refresh_delay"] = 5000;
 + $params["clock"] = true;
 + 
 + $chat = new phpFreeChat( $params );
 +
 + html_page_top1();
 + echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
 + $chat->printJavascript();
 + $chat->printStyle();
 + html_page_top2();
 +
 + # uncomment the following line if you are using Mantis 1.1.0a1 or above.
 + # print_recently_visited();
 +
 + echo '<br />';
 +
 + $chat->printChat();
 +
 + html_page_bottom1( __FILE__ );
 +?>
 +</code>
 +
 +  * Add the "Chat" option to the main menu by adding the following code to config_inc.php
 +
 +<code php>
 + $g_main_menu_custom_options = array (
 + array( "Chat", REPORTER, 'chat_page.php' )   // the access level here must match the one in chat_page.php
 + );
 +</code>
 +
 +   * If you would like to localize the menu option then replace "Chat" with "chat" in the config_inc.php and define $s_chat based in custom_strings_inc.php based on the current language.  See [[https://mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.customize.customfields.localize|Customizing MantisBT section in the Admin Guide]] for an example of how to do this.
 +
 +
 +===== Observations =====
 +
 +   * After adding this into our installation, I have seen that our apache server starts hammering on the cpu of the server once there are just 3 or 4 people using phpchat.  Has there been similar observations by others?
 +
 +How to clear the chat history in phpfree chat??
  

CC Attribution-Noncommercial-Share Alike 4.0 International Driven by DokuWiki