Commit 909736f8 authored by lrargerich's avatar lrargerich

Live support system updated

parent c49b2d9c
...@@ -205,7 +205,10 @@ class Lslib { ...@@ -205,7 +205,10 @@ class Lslib {
$this->query($query); $this->query($query);
} }
function operators_online()
{
return $this->getOne("select count(*) from tiki_live_support_operators where status='online'");
}
} }
......
<a class="pagetitle" href="tiki-live_support_admin.php">{tr}Live support system{/tr}</a> <a class="pagetitle" href="tiki-live_support_admin.php">{tr}Live support system{/tr}</a>
<br/><br/> <br/><br/>
[ <a class="link" {jspopup href="tiki-live_support_console.php"}>{tr}Open operator console{/tr}</a> | [ <a class="link" {jspopup href="tiki-live_support_console.php"}>{tr}Open operator console{/tr}</a> |
<a class="link" {jspopup width="300" height="450" href="tiki-live_support_client.php"}>{tr} Open client window{/tr}</a> ] <a class="link" {jspopup width="300" height="450" href="tiki-live_support_client.php"}>{tr} Open client window{/tr}</a> |
<a class="link" href="tiki-live_support_admin.php?show_html">{tr}Generate HTML{/tr}</a> ]
<br/><br/> <br/><br/>
{if $html}
<b>Generated HTML code:</b><br/>
Copy-paste the following XHTML snippet in the pages where you want to provide live support.<br/>
<table>
<tr>
<td>
<small>HTML code</small><br/>
<textarea rows="5" cols="60">{$html|escape}</textarea>
</td>
<td>
<small>result</small><br/>
{$html}
</td>
</tr>
</table>
{/if}
{if count($online_operators) > 0} {if count($online_operators) > 0}
<h3>{tr}Online operators{/tr}</h3> <h3>{tr}Online operators{/tr}</h3>
<table class="normal">
<tr>
<td width="2%" class="heading" style="text-align:center;">
{tr}Operator{/tr}
</td>
<td class="heading" colspan='2'>
{tr}stats{/tr}
</td>
</tr>
{cycle values='odd,even' print=false}
{section name=ix loop=$online_operators} {section name=ix loop=$online_operators}
{$online_operators[ix].user|avatarize}<br/> <tr>
<td width="2%" class="{cycle advance=false}" style="text-align:center;">
{$online_operators[ix].user|avatarize}<br />
<b>{$online_operators[ix].user}</b>
</td>
<td class="{cycle advance=false}">
<table width="100%">
<tr>
<td>{tr}Accepted requests{/tr}:</td>
<td>{$online_operators[ix].accepted_requests}</td>
</tr>
<tr>
<td>{$online_operators[ix].status} {tr}since{/tr}:</td>
<td>{$online_operators[ix].status_since|tiki_short_datetime}</td>
</tr>
</table>
</td>
<td class="{cycle}" style="text-align:right;">
<a href='tiki-live_support_admin.php?removeuser={$offline_operators[ix].user}'><img src='img/icons/trash.gif' border='0' alt='{tr}del{/tr}' title='{tr}del{/tr}' /></a>
</td>
</tr>
{/section} {/section}
</table>
{/if} {/if}
{if count($offline_operators) > 0} {if count($offline_operators) > 0}
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
{if $role eq 'user'} {if $role eq 'user'}
<table> <table>
<tr> <tr>
<td style="text-align:center;">{$req_info.operator|avatarize}<br/> <td valign="top" style="text-align:center;">{$req_info.operator|avatarize}<br/>
<b>{$req_info.operator}</b> <b>{$req_info.operator}</b>
</td> </td>
<td> <td valign="top" >
{tr}Chat started{/tr}<br/> {tr}Chat started{/tr}<br/>
<i>{$req_info.reason}</i> <i>{$req_info.reason}</i>
</td> </td>
...@@ -32,12 +32,52 @@ ...@@ -32,12 +32,52 @@
</table> </table>
{elseif $role eq 'operator'} {elseif $role eq 'operator'}
{if $req_info.tiki_user} {if $req_info.tiki_user}
{tr}Chatting with: {$req_info.tiki_user}{/tr} <table>
<tr>
<td valign="top" style="text-align:center;">{$req_info.tiki_user|avatarize}<br/>
<b>{$req_info.tiki_user}</b>
</td>
<td valign="top" >
{tr}Chat started{/tr}<br/>
<i>{$req_info.reason}</i>
</td>
</tr>
</table>
{else} {else}
{tr}Chatting with: {$req_info.user}{/tr} <table>
<tr>
<td valign="top" style="text-align:center;">
<b>{$req_info.user}</b>
</td>
<td valign="top" >
{tr}Chat started{/tr}<br/>
<i>{$req_info.reason}</i>
</td>
</tr>
</table>
{/if} {/if}
{else} {else}
Observer: display operator and user <table width="100%">
<tr>
<td width="2%" style="text-align:center;" valign="top">
<b>{tr}User:{/tr}</b><br/>
{if $req_info.tiki_user}
{$req_info.tiki_user|avatarize}<br/>
<b>{$req_info.tiki_user}</b>
{else}
<b>{$req_info.user}</b>
{/if}
</td>
<td valign="top">
<i>{$req_info.reason}</i>
</td>
<td width="2%" style="text-align:center;" valign="top">
<b>{tr}Operator:{/tr}</b><br/>
{$req_info.operator|avatarize}<br/>
<b>{$req_info.operator}</b>
</td>
</tr>
</table>
{/if} {/if}
<iframe name='chat_data' src='tiki-live_support_chat_frame.php' width="290" height="300" scrolling="yes"> <iframe name='chat_data' src='tiki-live_support_chat_frame.php' width="290" height="300" scrolling="yes">
</iframe> </iframe>
......
...@@ -568,48 +568,48 @@ if(isset($_REQUEST["homeforumprefs"])&&isset($_REQUEST["homeForum"])) { ...@@ -568,48 +568,48 @@ if(isset($_REQUEST["homeforumprefs"])&&isset($_REQUEST["homeForum"])) {
} }
if(isset($_REQUEST["forumlistprefs"])) { if(isset($_REQUEST["forumlistprefs"])) {
if(isset($_REQUEST["forum_list_topics"]) && $_REQUEST["forum_list_topics"]=="on") { if(isset($_REQUEST["forum_list_topics"]) && $_REQUEST["forum_list_topics"]=="on") {
$tikilib->set_preference("forum_list_topics",'y'); $tikilib->set_preference("forum_list_topics",'y');
$smarty->assign("forum_list_topics",'y'); $smarty->assign("forum_list_topics",'y');
} else { } else {
$tikilib->set_preference("forum_list_topics",'n'); $tikilib->set_preference("forum_list_topics",'n');
$smarty->assign("forum_list_topics",'n'); $smarty->assign("forum_list_topics",'n');
} }
if(isset($_REQUEST["forum_list_posts"]) && $_REQUEST["forum_list_posts"]=="on") { if(isset($_REQUEST["forum_list_posts"]) && $_REQUEST["forum_list_posts"]=="on") {
$tikilib->set_preference("forum_list_posts",'y'); $tikilib->set_preference("forum_list_posts",'y');
$smarty->assign("forum_list_posts",'y'); $smarty->assign("forum_list_posts",'y');
} else { } else {
$tikilib->set_preference("forum_list_posts",'n'); $tikilib->set_preference("forum_list_posts",'n');
$smarty->assign("forum_list_posts",'n'); $smarty->assign("forum_list_posts",'n');
} }
if(isset($_REQUEST["forum_list_ppd"]) && $_REQUEST["forum_list_ppd"]=="on") { if(isset($_REQUEST["forum_list_ppd"]) && $_REQUEST["forum_list_ppd"]=="on") {
$tikilib->set_preference("forum_list_ppd",'y'); $tikilib->set_preference("forum_list_ppd",'y');
$smarty->assign("forum_list_ppd",'y'); $smarty->assign("forum_list_ppd",'y');
} else { } else {
$tikilib->set_preference("forum_list_ppd",'n'); $tikilib->set_preference("forum_list_ppd",'n');
$smarty->assign("forum_list_ppd",'n'); $smarty->assign("forum_list_ppd",'n');
} }
if(isset($_REQUEST["forum_list_lastpost"]) && $_REQUEST["forum_list_lastpost"]=="on") { if(isset($_REQUEST["forum_list_lastpost"]) && $_REQUEST["forum_list_lastpost"]=="on") {
$tikilib->set_preference("forum_list_lastpost",'y'); $tikilib->set_preference("forum_list_lastpost",'y');
$smarty->assign("forum_list_lastpost",'y'); $smarty->assign("forum_list_lastpost",'y');
} else { } else {
$tikilib->set_preference("forum_list_lastpost",'n'); $tikilib->set_preference("forum_list_lastpost",'n');
$smarty->assign("forum_list_lastpost",'n'); $smarty->assign("forum_list_lastpost",'n');
} }
if(isset($_REQUEST["forum_list_visits"]) && $_REQUEST["forum_list_visits"]=="on") { if(isset($_REQUEST["forum_list_visits"]) && $_REQUEST["forum_list_visits"]=="on") {
$tikilib->set_preference("forum_list_visits",'y'); $tikilib->set_preference("forum_list_visits",'y');
$smarty->assign("forum_list_visits",'y'); $smarty->assign("forum_list_visits",'y');
} else { } else {
$tikilib->set_preference("forum_list_visits",'n'); $tikilib->set_preference("forum_list_visits",'n');
$smarty->assign("forum_list_visits",'n'); $smarty->assign("forum_list_visits",'n');
} }
if(isset($_REQUEST["forum_list_desc"]) && $_REQUEST["forum_list_desc"]=="on") { if(isset($_REQUEST["forum_list_desc"]) && $_REQUEST["forum_list_desc"]=="on") {
$tikilib->set_preference("forum_list_desc",'y'); $tikilib->set_preference("forum_list_desc",'y');
$smarty->assign("forum_list_desc",'y'); $smarty->assign("forum_list_desc",'y');
} else { } else {
$tikilib->set_preference("forum_list_desc",'n'); $tikilib->set_preference("forum_list_desc",'n');
$smarty->assign("forum_list_desc",'n'); $smarty->assign("forum_list_desc",'n');
} }
} }
...@@ -628,13 +628,13 @@ if(isset($_REQUEST["forumprefs"])) { ...@@ -628,13 +628,13 @@ if(isset($_REQUEST["forumprefs"])) {
$tikilib->set_preference("feature_forum_parse",'n'); $tikilib->set_preference("feature_forum_parse",'n');
$smarty->assign("feature_forum_parse",'n'); $smarty->assign("feature_forum_parse",'n');
} }
if(isset($_REQUEST["feature_forum_quickjump"]) && $_REQUEST["feature_forum_quickjump"]=="on") { if(isset($_REQUEST["feature_forum_quickjump"]) && $_REQUEST["feature_forum_quickjump"]=="on") {
$tikilib->set_preference("feature_forum_quickjump",'y'); $tikilib->set_preference("feature_forum_quickjump",'y');
$smarty->assign("feature_forum_quickjump",'y'); $smarty->assign("feature_forum_quickjump",'y');
} else { } else {
$tikilib->set_preference("feature_forum_quickjump",'n'); $tikilib->set_preference("feature_forum_quickjump",'n');
$smarty->assign("feature_forum_quickjump",'n'); $smarty->assign("feature_forum_quickjump",'n');
} }
if(isset($_REQUEST["feature_forum_topicd"]) && $_REQUEST["feature_forum_topicd"]=="on") { if(isset($_REQUEST["feature_forum_topicd"]) && $_REQUEST["feature_forum_topicd"]=="on") {
$tikilib->set_preference("feature_forum_topicd",'y'); $tikilib->set_preference("feature_forum_topicd",'y');
...@@ -1445,7 +1445,13 @@ if(isset($_REQUEST["features"])) { ...@@ -1445,7 +1445,13 @@ if(isset($_REQUEST["features"])) {
$smarty->assign("feature_eph",'n'); $smarty->assign("feature_eph",'n');
} }
if(isset($_REQUEST["feature_live_support"]) && $_REQUEST["feature_live_support"]=="on") {
$tikilib->set_preference("feature_live_support",'y');
$smarty->assign("feature_live_support",'y');
} else {
$tikilib->set_preference("feature_live_support",'n');
$smarty->assign("feature_live_support",'n');
}
if(isset($_REQUEST["feature_contact"]) && $_REQUEST["feature_contact"]=="on") { if(isset($_REQUEST["feature_contact"]) && $_REQUEST["feature_contact"]=="on") {
$tikilib->set_preference("feature_contact",'y'); $tikilib->set_preference("feature_contact",'y');
......
...@@ -4,6 +4,11 @@ require_once('tiki-setup.php'); ...@@ -4,6 +4,11 @@ require_once('tiki-setup.php');
include('lib/live_support/lsadminlib.php'); include('lib/live_support/lsadminlib.php');
include('lib/live_support/lslib.php'); include('lib/live_support/lslib.php');
if($feature_live_support != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("styles/$style_base/error.tpl");
die;
}
if($tiki_p_admin != 'y' && !$lsadminlib->user_is_operator($user)) { if($tiki_p_admin != 'y' && !$lsadminlib->user_is_operator($user)) {
$smarty->assign('msg',tra("You dont have permission to use this feature")); $smarty->assign('msg',tra("You dont have permission to use this feature"));
...@@ -11,7 +16,11 @@ if($tiki_p_admin != 'y' && !$lsadminlib->user_is_operator($user)) { ...@@ -11,7 +16,11 @@ if($tiki_p_admin != 'y' && !$lsadminlib->user_is_operator($user)) {
die; die;
} }
$smarty->assign('html',false);
if(isset($_REQUEST['show_html'])) {
$html='<a href="#" onClick=\'javascript:window.open("tiki-live_support_client.php","","menubar=,scrollbars=yes,resizable=yes,height=450,width=300");\'><img border="0" src="tiki-live_support_server.php?operators_online" alt="image" /></a>';
$smarty->assign('html',$html);
}
if(isset($_REQUEST['adduser'])) { if(isset($_REQUEST['adduser'])) {
$lsadminlib->add_operator($_REQUEST['user']); $lsadminlib->add_operator($_REQUEST['user']);
......
...@@ -8,6 +8,13 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 ...@@ -8,6 +8,13 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
if($feature_live_support != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("styles/$style_base/error.tpl");
die;
}
// This is a generic chat window used by users, operators and observers // This is a generic chat window used by users, operators and observers
// should receive the following parameters // should receive the following parameters
// reqId: the requestId // reqId: the requestId
......
...@@ -8,6 +8,18 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 ...@@ -8,6 +8,18 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
if($feature_live_support != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("styles/$style_base/error.tpl");
die;
}
if(!$lslib->operators_online()) {
header("location: tiki-live_support_message.php");
die;
}
$smarty->assign('senderId',md5(uniqid('.'))); $smarty->assign('senderId',md5(uniqid('.')));
if($user) { if($user) {
$smarty->assign('user_email',$tikilib->get_user_email($user)); $smarty->assign('user_email',$tikilib->get_user_email($user));
......
...@@ -8,6 +8,12 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 ...@@ -8,6 +8,12 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
if($feature_live_support != 'y') {
$smarty->assign('msg',tra("This feature is disabled"));
$smarty->display("styles/$style_base/error.tpl");
die;
}
$max_active_request = $lslib->get_max_active_request(); $max_active_request = $lslib->get_max_active_request();
$smarty->assign('new_requests','n'); $smarty->assign('new_requests','n');
......
...@@ -36,15 +36,28 @@ if(isset($_REQUEST['set_operator_status'])) { ...@@ -36,15 +36,28 @@ if(isset($_REQUEST['set_operator_status'])) {
$lslib->set_operator_status($_REQUEST['set_operator_status'],$_REQUEST['status']); $lslib->set_operator_status($_REQUEST['set_operator_status'],$_REQUEST['status']);
} }
if(isset($_REQUEST['operators_online'])) {
if($lslib->operators_online()) {
header("Content-type: image/gif");
readfile('img/icons/support_on.gif');
} else {
header("Content-type: image/gif");
readfile('img/icons/support_off.gif');
}
}
if(isset($_REQUEST['write'])) { if(isset($_REQUEST['write'])) {
if($_REQUEST['role']=='operator') { if($_REQUEST['role']=='operator') {
$color='blue';
} }
if($_REQUEST['role']=='user') { if($_REQUEST['role']=='user') {
$color='black';
}
if($_REQUEST['role']=='observer') {
$color='grey';
} }
if(!strstr('has left the chat',$_REQUEST['msg'])) { if(!strstr($_REQUEST['msg'],'has left')) {
$_REQUEST['msg']='('.$_REQUEST['name'].')'.' '.$_REQUEST['msg']; $_REQUEST['msg']='<span style="color:'.$color.';">('.$_REQUEST['name'].')'.' '.$_REQUEST['msg'].'</span>';
} }
$lslib->put_message($_REQUEST['write'],$_REQUEST['msg'],$_REQUEST['senderId']); $lslib->put_message($_REQUEST['write'],$_REQUEST['msg'],$_REQUEST['senderId']);
} }
......
...@@ -361,6 +361,9 @@ $smarty->assign('feature_phpopentracker',$feature_phpopentracker); ...@@ -361,6 +361,9 @@ $smarty->assign('feature_phpopentracker',$feature_phpopentracker);
$feature_eph = 'n'; $feature_eph = 'n';
$smarty->assign('feature_eph',$feature_eph); $smarty->assign('feature_eph',$feature_eph);
$feature_live_support = 'n';
$smarty->assign('feature_live_support',$feature_live_support);
$feature_wiki_usrlock = 'n'; $feature_wiki_usrlock = 'n';
$smarty->assign('feature_wiki_usrlock',$feature_wiki_usrlock); $smarty->assign('feature_wiki_usrlock',$feature_wiki_usrlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment