**************************************************************************
** Jom Social                                                           **
** Module for 123 Flash Chat Server software                            **
** ==============================================                       **
**                                                                      **
** Copyright (c) by TopCMM                                              **
** Daniel Jiang (support@123flashchat.com)                              **
** http://www.topcmm.com                                                **
** http://www.123flashchat.com                                          **
** http://www.joomla.org/                                               ** 
** http://www.jomsocial.com/                                            **
**                                                                      **
**************************************************************************



####################################################################################################################
## Notes:                                                                                                         ##
##                                                                                                                ##
##     IMPORTANT!!!!                                                                                              ##
##     If you need to use the chat service on a local machine, before installing this module, please              ##
##     download 123FlashChat Server software first from this page:                                                ##
##     http://www.123flashchat.com/download.html                                                                  ##
##     You may get the latest free demo version of 123 flash chat server software at there.                       ##
##                                                                                                                ## 
##     And get professional support from: http://www.123flashchat.com/support.html                                ##
##     We provide email support, online live support, and phone support                                           ##
##     etc.                                                                                                       ##
##                                                                                                                ##
####################################################################################################################


Step 1, Install the component in the Joomla admin panel

            OPEN: Admin panel -> Extensions -> Install -> Upload Package File:
                    upload com_chat.zip

Step 2, Copy files & folder:

	files:	controllers\chat.php	=>	http://<Your Joomla root URL>/components/com_community/controllers/chat.php
		helper\chat.php		=>	http://<Your Joomla root URL>/components/com_community/helper/chat.php
		models\chat.php		=>	http://<Your Joomla root URL>/components/com_community/models/chat.php
		
	folder: views\chat		=>	http://<Your Joomla root URL>/components/com_community/views/chat

Step 3, Modify file:

	Open:	http://<Your Joomla root URL>/components/com_community/views/views.php

	Find:	$toolbar =& CFactory::getToolbar();

	After Add:
		
		//123 FlashChat
		$toolbar->addGroup('Chat', 'Chat', JRoute::_('index.php?option=com_community&view=chat&Itemid=2'));
		//123 FlashChat

Step 4, Modify Template to show Chat Status:

	The following code to be added:

		<!--123 Flash Chat-->
		<div class="cModule 123flashchat">
			<h3><span>123 Flash Chat</span></h3>
			<?php
				
				require_once(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'chat.php');

				$cfg = getConfig();
				if ($cfg->server!=2 && $cfg->full_screen==1)
				{
					$clientSize = 'fullscreen=1';
				}
				else
				{
					$clientSize = 'width=' . $cfg->client_width . 'px,height=' . $cfg->client_height . 'px';
				}
				$clientSize = "'" . $clientSize . "'";
				if ($cfg->chat_status)
				{
					$status = getStatus();
					if($cfg->server != 2)
					{
						echo ($status['rn'] ? $status['rn'] : '0') . ' <b>rooms</b>, ' . ($status['cn'] ? $status['cn'] : '0') . ' <b>connections</b>, ';
					}
					echo $status['ln'] . " <b>logins</b>";
		
					//if(isset($rooms))
					if ($cfg->room_list && ($cfg->server != 2))
					{
						$rooms = getRooms();
						echo "<br /><br /><b>Rooms:</b><br />";
		
						if(!$rooms)
						{
							echo "None";
						}
						else
						{
							$xa = '';
							foreach($rooms as $room)
							{
								$js = '';
								$app =& JFactory::getApplication();
								if (!$app->getCfg('sef_suffix'))
								{
									$url = 'index2.php?option=com_chat&view=chat&room=' . $room['id'];
									$url = "'" . $url . "'";
									$open = "'" . '123_flash_chat' . "'";
									$js = !($cfg->present_mode) ? '' : ('onclick="window.open(' . $url . ',' . $open . ',' . $clientSize . ');return false;"');
								}
								echo $xa . '<a href="index.php?option=com_community&view=chat&room=' . $room['id'] . '" ' .  $js . ">" .$room['name'] ."</a>(" . $room['count'] . ")";
								$xa = ";<br />";
							}
						}
					}
		
					//if(isset($users))
					if ($cfg->user_list)
					{
						$users = getUsers();
						echo "<br /><br /><b>Users:</b> ";
						if(!$users)
						{
							echo "None";
						}
						else
						{
							$xb = '';
							foreach($users as $user)
							{
								echo $xb . $user['name'];
								$xb = ', ';
							}
						}
					}
				}
				if ($cfg->chat_status == 0 || $cfg->room_list == 0 || $cfg->server == 2)
				{
					if ($cfg->chat_status != 0)
					{
						echo '<br/>';
					}
					$ss = '';
					$app =& JFactory::getApplication();
					if (!$app->getCfg('sef_suffix'))
					{
						$url = 'index2.php?option=com_chat&view=chat';
						$url = "'" . $url . "'";
						$open = "'" . '123_flash_chat' . "'";
						$clientSize = "'" . $clientSize . "'";
						$ss = !($cfg->present_mode) ? '' : ('onclick="window.open(' . $url . ',' . $open . ',' . $clientSize . ');return false;"');
					}
					echo '<br/><a href="' . CRoute::_('index.php?option=com_community&view=chat') . '" style="float: left"' .  $ss . '><b>Chat Now!</b></a><br/><br/>';
				}
			?>
		</div>
		<!--123 Flash Chat-->
	
	For example:

	1) show chat status in home page:

		Open:	Admin Panel ->Components->Jom Social ->Templates ->Select using Template

		Select File:	frontpage.index.php

		Find:		<?php $this->renderModules( 'js_side_bottom' ); ?>

		Before it add the code we provide.

	2) show chat status in profile page:

		Open:	Admin Panel ->Components->Jom Social ->Templates ->Select using Template

		Select File:	profile.index.php

		Find:		<?php echo $friends; ?>

		After it add the code we provide.


Step 5, Configure chat module's running mode:
        
            1.OPEN: Admin Panel -> Components -> 123 Flash Chat -> Chat Settings
             
            2.CONFIG: Configure your chat setting

Step 6, Integrate your chat with Joomla user database:

        If you choose running own server or host service, integration is needed, you may achieve this by following the instructions below.

            1.OPEN: Admin Panel -> Components -> 123 Flash Chat -> Chat Admin Panel
                    Click "Login" to login in Chat Admin Panel
               
            2.OPEN: System Settings -> Integrate Panel
              FING: DataBase -> SELECT: URL -> edit 
              EDIT: Change URL:
                    http://<Your Joomla root URL>/index.php?option=com_chat&view=login&username=%username%&password=%password%
              SAVE: Press OK to save your setting.
            3.Restart chat server at System Management -> Restart
            
Integration done, enjoy your chat:), if you have any question related to chat room,please visit http://www.123flashchat.com/faq.html or contact our online support at http://www.123flashchat.com
