Allow for pre-population of and carrying of group_id through to new chat in chat_customer code
git-svn-id: svn://192.168.202.10@2432 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -8,12 +8,15 @@
|
||||
#
|
||||
# Builds:
|
||||
# 151212-0829 - First Build for customer chat
|
||||
# 151217-1015 - Allow for group_id variable
|
||||
#
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["chat_id"])) {$chat_id=$_GET["chat_id"];}
|
||||
elseif (isset($_POST["chat_id"])) {$chat_id=$_POST["chat_id"];}
|
||||
if (isset($_GET["group_id"])) {$chat_group_id=$_GET["group_id"];}
|
||||
elseif (isset($_POST["group_id"])) {$chat_group_id=$_POST["group_id"];}
|
||||
if (isset($_GET["chat_group_id"])) {$chat_group_id=$_GET["chat_group_id"];}
|
||||
elseif (isset($_POST["chat_group_id"])) {$chat_group_id=$_POST["chat_group_id"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# CHANGES
|
||||
# 151212-0828 - First Build for customer chat
|
||||
# 151213-1106 - Added variable filtering
|
||||
# 151217-1016 - Allow for carrying of group_id through to new chat
|
||||
#
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
@@ -43,6 +44,8 @@ if (isset($_GET["chat_message"])) {$chat_message=$_GET["chat_message"];}
|
||||
elseif (isset($_POST["chat_message"])) {$chat_message=$_POST["chat_message"];}
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];}
|
||||
elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["user_level"])) {$user_level=$_GET["user_level"];}
|
||||
@@ -143,7 +146,7 @@ if ($action=="update_chat_window" && $chat_id) {
|
||||
$status_stmt="select status, chat_creator from vicidial_live_chats where chat_id='$chat_id'";
|
||||
$status_rslt=mysql_to_mysqli($status_stmt, $link);
|
||||
if (mysqli_num_rows($status_rslt)==0) {
|
||||
echo "<font class='chat_title alert'>Chat $chat_id does not exist or has been closed</font><BR/><BR/><font class='chat_title'><a href='".$chat_url."'>GO BACK TO CHAT FORM</a></font>\n";
|
||||
echo "<font class='chat_title alert'>Chat $chat_id does not exist or has been closed</font><BR/><BR/><font class='chat_title'><a href='".$chat_url."?group_id=$group_id'>GO BACK TO CHAT FORM</a></font>\n";
|
||||
} else {
|
||||
$status_row=mysqli_fetch_row($status_rslt);
|
||||
|
||||
@@ -188,7 +191,7 @@ if ($action=="update_chat_window" && $chat_id) {
|
||||
echo "<input type='hidden' id='current_message_count' name='current_message_count' value='$current_messages'>\n";
|
||||
|
||||
} else {
|
||||
echo "<font class='chat_title bold'>You have left chat $chat_id.</font><BR/><BR/><font class='chat_title'><a href='".$chat_url."'>GO BACK TO CHAT FORM</a></font>\n";
|
||||
echo "<font class='chat_title bold'>You have left chat $chat_id.</font><BR/><BR/><font class='chat_title'><a href='".$chat_url."?group_id=$group_id'>GO BACK TO CHAT FORM</a></font>\n";
|
||||
}
|
||||
} else {
|
||||
if ($status_row[1]=="NONE") {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# 150902-2100 - First build
|
||||
# 151212-0830 - First Build for customer chat
|
||||
# 151213-1105 - Added variable filtering
|
||||
# 151217-1017 - Allow for pre-populating of group_id
|
||||
#
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
@@ -229,6 +230,8 @@ if ($send_request=="SEND REQUEST") { # For people requesting a chat with an agen
|
||||
<link rel="stylesheet" type="text/css" href="css/simpletree.css" />
|
||||
|
||||
<script language="Javascript">
|
||||
var group_id='<?php echo $group_id ?>';
|
||||
|
||||
function PleaseWait() {
|
||||
document.getElementById('chat_request_span').style.display="none";
|
||||
document.getElementById('please_wait_span').style.display="block";
|
||||
@@ -251,7 +254,7 @@ function LeaveChat(chat_id, user, chat_member_name) {
|
||||
{
|
||||
var chat_member_name=document.getElementById('chat_member_name').value;
|
||||
}
|
||||
|
||||
|
||||
var xmlhttp=false;
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
@@ -259,7 +262,7 @@ function LeaveChat(chat_id, user, chat_member_name) {
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
chat_query = "&action=leave_chat&chat_id="+chat_id+"&user="+user+"&chat_member_name="+chat_member_name;
|
||||
chat_query = "&action=leave_chat&chat_id="+chat_id+"&group_id="+group_id+"&user="+user+"&chat_member_name="+chat_member_name;
|
||||
// alert(chat_query);
|
||||
xmlhttp.open('POST', 'customer_chat_functions.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
@@ -294,7 +297,7 @@ function UpdateChatWindow() {
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
chat_query = "&chat_id="+chat_id+"&user="+user+"¤t_message_count="+current_message_count+"&action=update_chat_window&keepalive=1";
|
||||
chat_query = "&chat_id="+chat_id+"&group_id="+group_id+"&user="+user+"¤t_message_count="+current_message_count+"&action=update_chat_window&keepalive=1";
|
||||
xmlhttp.open('POST', 'customer_chat_functions.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(chat_query);
|
||||
@@ -331,7 +334,7 @@ function CustomerSendMessage(chat_id, user, message, chat_member_name) {
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
chat_query = "&chat_message="+chat_message+"&chat_id="+chat_id+"&chat_member_name="+chat_member_name+"&user="+user+"&chat_level=0&action=send_message";
|
||||
chat_query = "&chat_message="+chat_message+"&chat_id="+chat_id+"&group_id="+group_id+"&chat_member_name="+chat_member_name+"&user="+user+"&chat_level=0&action=send_message";
|
||||
xmlhttp.open('POST', 'customer_chat_functions.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(chat_query);
|
||||
@@ -363,7 +366,7 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
<body>
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
||||
<span id="chat_request_span">
|
||||
<table width="500" border=0 cellpadding=3 cellspacing=3 height="300">
|
||||
<table width="500" border=0 cellpadding=1 cellspacing=1 height="300">
|
||||
<tr>
|
||||
<th colspan='2' class='body_small_bold'><?php echo $chat_title; ?></th>
|
||||
</tr>
|
||||
@@ -373,6 +376,10 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
<input type='text' class="cust_form" name='first_name' id='first_name' size='10' maxlength='30'> <input class="cust_form" type='text' name='last_name' id='last_name' size='15' maxlength='30'>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($group_id=='')
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td align='right' class='body_small'>Select the department you wish to chat with:</td>
|
||||
<td align='left'>
|
||||
@@ -387,6 +394,13 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr><td><input type=hidden name=group_id value=\"$group_id\"></td></tr>\n";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td align='right' class='body_small'>Phone number (optional):</td>
|
||||
<td align='left'>
|
||||
@@ -409,7 +423,7 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
} else if ($chat_id && $group_id && (!$first_name || !$last_name)) {
|
||||
?>
|
||||
<body>
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post" name="chat_form" id="chat_form">
|
||||
<span id="chat_request_span">
|
||||
<table width="500" border=0 cellpadding=3 cellspacing=3 height="300">
|
||||
<tr>
|
||||
@@ -447,7 +461,7 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
} else {
|
||||
?>
|
||||
<body onLoad="StartRefresh();" onUnload="javascript:clearInterval(rInt); LeaveChat();">
|
||||
<form name='chat_form' action='<?php echo $PHP_SELF; ?>'>
|
||||
<form action='<?php echo $PHP_SELF; ?>' name="chat_form" id="chat_form">
|
||||
<table width='100%' border='0'>
|
||||
<tr>
|
||||
<td class='chat_window' height='250' width='100%'>
|
||||
@@ -472,7 +486,7 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
<input type='checkbox' id='MuteCustomerChatAlert' name='MuteCustomerChatAlert'>Mute alert sound
|
||||
</td>
|
||||
<td valign='top' align='right'><BR>
|
||||
<input class='red_btn' type='button' style="width:100px" value="<?php echo _QXZ("LEAVE CHAT"); ?>" onClick="LeaveChat(document.getElementById('chat_id').value, document.getElementById('user').value, document.getElementById('chat_member_name').value)"
|
||||
<input class='red_btn' type='button' style="width:100px" value="<?php echo _QXZ("LEAVE CHAT"); ?>" onClick="LeaveChat(document.getElementById('chat_id').value, document.getElementById('user').value, document.getElementById('chat_member_name').value)">;
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -489,6 +503,7 @@ $chat_title="Request chat with agent"; # This can be modified for customization
|
||||
<input type="hidden" id="chat_id" name="chat_id" value="<?php echo $chat_id; ?>">
|
||||
<input type="hidden" id="chat_creator" name="chat_creator" value="<?php echo $chat_creator; ?>">
|
||||
<input type="hidden" id="lead_id" name="lead_id" value="<?php echo $lead_id; ?>">
|
||||
<input type="hidden" id="group_id" name="group_id" value="<?php echo $group_id; ?>">
|
||||
<audio id='CustomerChatAudioAlertFile'><source src="sounds/chat_alert.mp3" type="audio/mpeg"></audio>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user