**************************************************************************
** 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
		controllers\friendlist.php	=>	http://<Your Joomla root URL>/components/com_community/controllers/friendlist.php
		models\friendlist.php		=>	http://<Your Joomla root URL>/components/com_community/models/friendlist.php

	folder: views\chat		=>	http://<Your Joomla root URL>/components/com_community/views/chat
	folder: views\friendlist		=>	http://<Your Joomla root URL>/components/com_community/views/friendlist

Step 3, Modify file to show on Toolbar:
	The following code to be added:
		<!--123 FlashChat Code Begin-->
		<li class="no-child">
			<a href="index.php?option=com_community&view=chat&Itemid=2">Chat</a>
                </li>
                <!--123 FlashChat Code End-->
				
	For example:

	1) show chat status in home page:

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

		Select File:	toolbar.index.php

		Find:	</ul>
			</div><div class="jsMenuIcon">

		Before it add the code we provide.



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 = 'index.php?tmpl=component&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)
					{
						echo '<br/>';
					}
					$ss = '';
					$app =& JFactory::getApplication();
					if (!$app->getCfg('sef_suffix'))
					{
						$url = 'index.php?option=com_chat&view=chat&tmpl=component';
						$url = "'" . $url . "'";
						$open = "'" . '123_flash_chat' . "'";

						$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, Modify Template to show Live Show:

	1) The following code to be added:
	<!--123 Flash Chat-->
	<?php if($cfg->show_live == 1){ ?>
	<div>        <div class="contentheading">Live Show</div>
<div class="app-box-content">
       <!-- FOR 123FLASHCHAT CODE BEGIN -->
<div id="live_show_123flashchat" align="left" style="width:<?php echo $cfg->own_width; ?>px; height:<?php echo $cfg->own_height; ?>px">
<link rel="stylesheet" id="css_123flashchat" type="text/css" href="<?php echo $cfg->liveurl; ?>css/<?php echo $cfg->sty; ?>.css" />
<div id="loading_123flashchat" align="center">
<div class="loading_main_123flashchat">
<a href="http://www.123flashchat.com" class="logo" title="123 Flash Chat" target="_blank">
<img src="<?php echo $cfg->liveurl; ?>images/123flashchat_logo.gif" alt="123 Flash Chat" style="cursor:point;border: 0px none"/>
</a>
</div>
<div class="loading_main_123flashchat"><img src="<?php echo $cfg->liveurl; ?>images/loading_image.gif"></div>
</div>
<script language="javascript">
var init_host_123flashchat = "<?php echo $cfg->server_host; ?>";
var init_port_123flashchat = "<?php echo $cfg->server_port; ?>";
var init_host_s_123flashchat = "<?php echo $cfg->server_host; ?>";
var init_port_s_123flashchat = "";
var init_host_h_123flashchat = "<?php echo $cfg->server_host; ?>";
var init_port_h_123flashchat = "";
var init_group_123flashchat = "default";
var init_room_123flashchat = "<?php echo $cfg->liveroom; ?>";
var http_root_123flashchat = "<?php echo $cfg->client_location; ?>liveshow";
</script>
<script language='javascript' src='<?php echo $cfg->liveurl; ?>js/123flashchat_liveshow.js'></script>
<script language='javascript' src="<?php echo $cfg->liveurl; ?>123flashchat_liveshow_core.js"></script>
</div>
<!-- FOR 123FLASHCHAT CODE END -->
        </div>
</div>
<?php }  ?>
<!--123 Flash Chat-->

	For example:

		(1) show chat status in frontpage page:

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

			Select File:	frontpage.index.php

			Find:<!-- end: .cSidebar -->

			After it add the code we provide.

	2) The following code to be added:
	<!--123 Flash Chat-->
<?php
        require_once(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'chat.php');
       $cfg = getConfig();
	if( $cfg->show_live == 1 ){
?>
<div class="cMain">
	<div class="app-box" id="live-show">
		<div class="app-box-header">
        	<h2 class="app-box-title">Live Show</h2>
			<div class="app-box-menus">
				<div class="app-box-menu toggle">
					<a onclick="joms.apps.toggle('#live-show');" href="javascript: void(0)" class="app-box-menu-icon"><span class="app-box-menu-title">Expand</span></a>
				</div>
			</div>
		</div>
		<div class="app-box-content">
       	<!-- FOR 123FLASHCHAT CODE BEGIN -->
			<div id="live_show_123flashchat" align="left" style="width:<?php echo $cfg->own_width; ?>px; height:<?php echo $cfg->own_height; ?>px">
				<link rel="stylesheet" id="css_123flashchat" type="text/css" href="<?php echo $cfg->liveurl; ?>css/<?php echo $cfg->sty; ?>.css" />
				<div id="loading_123flashchat" align="center">
					<div class="loading_main_123flashchat">
						<a href="http://www.123flashchat.com" class="logo" title="123 Flash Chat" target="_blank">
							<img src="<?php echo $cfg->liveurl; ?>images/123flashchat_logo.gif" alt="123 Flash Chat" style="cursor:point;border: 0px none"/>
						</a>
					</div>
					<div class="loading_main_123flashchat"><img src="<?php echo $cfg->liveurl; ?>images/loading_image.gif">
					</div>
				</div>
				<script language="javascript">
					var init_host_123flashchat = "<?php echo $cfg->server_host; ?>";
					var init_port_123flashchat = "<?php echo $cfg->server_port; ?>";
					var init_host_s_123flashchat = "<?php echo $cfg->server_host; ?>";
					var init_port_s_123flashchat = "";
					var init_host_h_123flashchat = "<?php echo $cfg->server_host; ?>";
					var init_port_h_123flashchat = "";
					var init_group_123flashchat = "default";
					var init_room_123flashchat = "<?php echo $cfg->liveroom; ?>";
					var http_root_123flashchat = "<?php echo $cfg->client_location; ?>liveshow";
				</script>
				<script language='javascript' src='<?php echo $cfg->liveurl; ?>js/123flashchat_liveshow.js'></script>
				<script language='javascript' src="<?php echo $cfg->liveurl; ?>123flashchat_liveshow_core.js"></script>
			</div>
		<!-- FOR 123FLASHCHAT CODE END -->
		</div>
	</div>
</div>
<?php }  ?>
<!--123 Flash Chat-->

	For example:

		(1) show chat status in profile page:

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

			Select File:	profile.index.php

			Find:<!-- end: .cSidebar -->

			After it add the code we provide.

Step 6, Configure chat module's running mode:

            1.OPEN: Admin Panel -> Components -> 123 Flash Chat -> Chat Settings

            2.CONFIG: Configure your chat setting

Step 7, 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
