extract update intervals into settings array

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@550 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-06-08 23:19:21 +00:00
parent 79df1b80f1
commit 1c4d739f75
8 changed files with 18 additions and 9 deletions

View File

@ -142,7 +142,7 @@ function get_messages($threadid,$meth,$isuser,&$lastid) {
} }
function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agentid=null) { function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agentid=null) {
global $webim_encoding, $webimroot, $connection_timeout; global $webim_encoding, $webimroot, $connection_timeout, $settings;
$threadid = $thread['threadid']; $threadid = $thread['threadid'];
$istyping = abs($thread['current']-$thread[$isuser ? "lpagent" : "lpuser"]) < $connection_timeout $istyping = abs($thread['current']-$thread[$isuser ? "lpagent" : "lpuser"]) < $connection_timeout
&& $thread[$isuser?"agentTyping":"userTyping"] == "1" ? "1" : "0"; && $thread[$isuser?"agentTyping":"userTyping"] == "1" ? "1" : "0";
@ -157,6 +157,7 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen
} }
print("</thread>"); print("</thread>");
} else if( $format == "html" ) { } else if( $format == "html" ) {
loadsettings();
$output = get_messages($threadid,"html",$isuser,$lastid); $output = get_messages($threadid,"html",$isuser,$lastid);
start_html_output(); start_html_output();
@ -166,7 +167,7 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">". "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">".
"<html>\n<head>\n". "<html>\n<head>\n".
"<link href=\"$webimroot/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n". "<link href=\"$webimroot/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n".
"<meta http-equiv=\"Refresh\" content=\"7; URL=$url&amp;sn=11\">\n". "<meta http-equiv=\"Refresh\" content=\"".$settings['updatefrequency_oldchat']."; URL=$url&amp;sn=11\">\n".
"<meta http-equiv=\"Pragma\" content=\"no-cache\">\n". "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n".
"<title>chat</title>\n". "<title>chat</title>\n".
"</head>\n". "</head>\n".
@ -330,6 +331,7 @@ function setup_chatview_for_user($thread,$level) {
$page['isOpera95'] = is_agent_opera95(); $page['isOpera95'] = is_agent_opera95();
$page['neediframesrc'] = needsFramesrc(); $page['neediframesrc'] = needsFramesrc();
$page['frequency'] = $settings['updatefrequency_chat'];
} }
function load_canned_messages($locale, $groupid) { function load_canned_messages($locale, $groupid) {
@ -393,6 +395,7 @@ function setup_chatview_for_operator($thread,$operator) {
$page['redirectLink'] = "$webimroot/operator/agent.php?".$params."&amp;act=redirect"; $page['redirectLink'] = "$webimroot/operator/agent.php?".$params."&amp;act=redirect";
$page['namePostfix'] = ""; $page['namePostfix'] = "";
$page['frequency'] = $settings['updatefrequency_chat'];
} }
function update_thread_access($threadid, $params, $link) { function update_thread_access($threadid, $params, $link) {

View File

@ -553,7 +553,6 @@ $settings = array(
'chattitle' => 'Live Support', 'chattitle' => 'Live Support',
'geolink' => 'http://api.hostip.info/get_html.php?ip={ip}', 'geolink' => 'http://api.hostip.info/get_html.php?ip={ip}',
'geolinkparams' => 'width=440,height=100,toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1', 'geolinkparams' => 'width=440,height=100,toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1',
'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */
'max_uploaded_file_size' => 100000, 'max_uploaded_file_size' => 100000,
'max_connections_from_one_host' => 10, 'max_connections_from_one_host' => 10,
@ -572,6 +571,11 @@ $settings = array(
'surveyaskgroup' => '1', 'surveyaskgroup' => '1',
'surveyaskmessage' => '0', 'surveyaskmessage' => '0',
'enablepopupnotification' => '0', 'enablepopupnotification' => '0',
'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */
'updatefrequency_operator' => 2,
'updatefrequency_chat' => 2,
'updatefrequency_oldchat' => 7,
); );
$settingsloaded = false; $settingsloaded = false;
$settings_in_db = array(); $settings_in_db = array();

View File

@ -22,7 +22,8 @@ function demo_print_message($msg,$format) {
} }
function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping,$postmessage) { function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping,$postmessage) {
global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent, $webimroot; global $kind_for_agent, $kind_info, $kind_events, $kind_user, $kind_agent, $webimroot, $settings;
loadsettings();
if( $act == "refresh" || $act == "post" ) { if( $act == "refresh" || $act == "post" ) {
$lastid++; $lastid++;
if($outformat == "xml") { if($outformat == "xml") {
@ -36,7 +37,7 @@ function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping,
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">". "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">".
"<html>\n<head>\n". "<html>\n<head>\n".
"<link href=\"$webimroot/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n". "<link href=\"$webimroot/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n".
"<meta http-equiv=\"Refresh\" content=\"7; URL=$url&amp;sn=11\">\n". "<meta http-equiv=\"Refresh\" content=\"".$settings['updatefrequency_oldchat']."; URL=$url&amp;sn=11\">\n".
"<meta http-equiv=\"Pragma\" content=\"no-cache\">\n". "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n".
"<title>chat</title>\n". "<title>chat</title>\n".
"</head>\n". "</head>\n".

View File

@ -36,6 +36,7 @@ if($settings['enablegroups'] == '1') {
$page = array(); $page = array();
$page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1"; $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1";
$page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0"; $page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0";
$page['frequency'] = $settings['updatefrequency_operator'];
prepare_menu($operator); prepare_menu($operator);
start_html_output(); start_html_output();

View File

@ -7,7 +7,7 @@
<script type="text/javascript" language="javascript" src="${webimroot}/js/common.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/common.js?v=161"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/brws.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/brws.js?v=161"></script>
<script type="text/javascript" language="javascript"><!-- <script type="text/javascript" language="javascript"><!--
var threadParams = { servl:"${webimroot}/thread.php",wroot:"${webimroot}",frequency:2,${if:user}user:"true",${endif:user}threadid:${page:ct.chatThreadId},token:${page:ct.token},cssfile:"${tplroot}/chat.css",ignorectrl:${page:ignorectrl} }; var threadParams = { servl:"${webimroot}/thread.php",wroot:"${webimroot}",frequency:${page:frequency},${if:user}user:"true",${endif:user}threadid:${page:ct.chatThreadId},token:${page:ct.token},cssfile:"${tplroot}/chat.css",ignorectrl:${page:ignorectrl} };
//--> //-->
</script> </script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/chat.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/chat.js?v=161"></script>

View File

@ -7,7 +7,7 @@
<script type="text/javascript" language="javascript" src="${webimroot}/js/common.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/common.js?v=161"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/brws.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/brws.js?v=161"></script>
<script type="text/javascript" language="javascript"><!-- <script type="text/javascript" language="javascript"><!--
var threadParams = { servl:"${webimroot}/thread.php",wroot:"${webimroot}",frequency:2,${if:user}user:"true",${endif:user}threadid:${page:ct.chatThreadId},token:${page:ct.token},cssfile:"${tplroot}/chat.css",ignorectrl:${page:ignorectrl} }; var threadParams = { servl:"${webimroot}/thread.php",wroot:"${webimroot}",frequency:${page:frequency},${if:user}user:"true",${endif:user}threadid:${page:ct.chatThreadId},token:${page:ct.token},cssfile:"${tplroot}/chat.css",ignorectrl:${page:ignorectrl} };
//--> //-->
</script> </script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/chat.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/chat.js?v=161"></script>

View File

@ -7,7 +7,7 @@
<script type="text/javascript" language="javascript" src="${webimroot}/js/common.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/common.js?v=161"></script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/brws.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/brws.js?v=161"></script>
<script type="text/javascript" language="javascript"><!-- <script type="text/javascript" language="javascript"><!--
var threadParams = { servl:"${webimroot}/thread.php",wroot:"${webimroot}",frequency:2,${if:user}user:"true",${endif:user}threadid:${page:ct.chatThreadId},token:${page:ct.token},cssfile:"${tplroot}/chat.css",ignorectrl:${page:ignorectrl} }; var threadParams = { servl:"${webimroot}/thread.php",wroot:"${webimroot}",frequency:${page:frequency},${if:user}user:"true",${endif:user}threadid:${page:ct.chatThreadId},token:${page:ct.token},cssfile:"${tplroot}/chat.css",ignorectrl:${page:ignorectrl} };
//--> //-->
</script> </script>
<script type="text/javascript" language="javascript" src="${webimroot}/js/chat.js?v=161"></script> <script type="text/javascript" language="javascript" src="${webimroot}/js/chat.js?v=161"></script>

View File

@ -31,7 +31,7 @@ var localized = new Array(
); );
var updaterOptions = { var updaterOptions = {
url:"<?php echo $webimroot ?>/operator/update.php",wroot:"<?php echo $webimroot ?>", url:"<?php echo $webimroot ?>/operator/update.php",wroot:"<?php echo $webimroot ?>",
agentservl:"<?php echo $webimroot ?>/operator/agent.php", agentservl:"<?php echo $webimroot ?>/operator/agent.php", frequency:<?php echo $page['frequency'] ?>,
noclients:"<?php echo getlocal("clients.no_clients") ?>", havemenu: <?php echo $page['havemenu'] ?>, showpopup: <?php echo $page['showpopup'] ?> }; noclients:"<?php echo getlocal("clients.no_clients") ?>", havemenu: <?php echo $page['havemenu'] ?>, showpopup: <?php echo $page['showpopup'] ?> };
//--></script> //--></script>
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/users.js?v=161"></script> <script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/users.js?v=161"></script>