From 1c4d739f75d71b7e9f7bd0a7844e74f6895ff8ca Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Mon, 8 Jun 2009 23:19:21 +0000 Subject: [PATCH] extract update intervals into settings array git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@550 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/libs/chat.php | 7 +++++-- src/messenger/webim/libs/common.php | 6 +++++- src/messenger/webim/libs/demothread.php | 5 +++-- src/messenger/webim/operator/users.php | 1 + src/messenger/webim/styles/default/templates/chat.tpl | 2 +- src/messenger/webim/styles/original/templates/chat.tpl | 2 +- src/messenger/webim/styles/simplicity/templates/chat.tpl | 2 +- src/messenger/webim/view/pending_users.php | 2 +- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 7929c738..fe2e131c 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -142,7 +142,7 @@ function get_messages($threadid,$meth,$isuser,&$lastid) { } 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']; $istyping = abs($thread['current']-$thread[$isuser ? "lpagent" : "lpuser"]) < $connection_timeout && $thread[$isuser?"agentTyping":"userTyping"] == "1" ? "1" : "0"; @@ -157,6 +157,7 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen } print(""); } else if( $format == "html" ) { + loadsettings(); $output = get_messages($threadid,"html",$isuser,$lastid); start_html_output(); @@ -166,7 +167,7 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen "". "\n\n". "\n". - "\n". + "\n". "\n". "chat\n". "\n". @@ -330,6 +331,7 @@ function setup_chatview_for_user($thread,$level) { $page['isOpera95'] = is_agent_opera95(); $page['neediframesrc'] = needsFramesrc(); + $page['frequency'] = $settings['updatefrequency_chat']; } function load_canned_messages($locale, $groupid) { @@ -393,6 +395,7 @@ function setup_chatview_for_operator($thread,$operator) { $page['redirectLink'] = "$webimroot/operator/agent.php?".$params."&act=redirect"; $page['namePostfix'] = ""; + $page['frequency'] = $settings['updatefrequency_chat']; } function update_thread_access($threadid, $params, $link) { diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index ad0bc8c3..438ddfc9 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -553,7 +553,6 @@ $settings = array( 'chattitle' => 'Live Support', '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', - 'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */ 'max_uploaded_file_size' => 100000, 'max_connections_from_one_host' => 10, @@ -572,6 +571,11 @@ $settings = array( 'surveyaskgroup' => '1', 'surveyaskmessage' => '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; $settings_in_db = array(); diff --git a/src/messenger/webim/libs/demothread.php b/src/messenger/webim/libs/demothread.php index ec5fe144..916870e2 100644 --- a/src/messenger/webim/libs/demothread.php +++ b/src/messenger/webim/libs/demothread.php @@ -22,7 +22,8 @@ function demo_print_message($msg,$format) { } 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" ) { $lastid++; if($outformat == "xml") { @@ -36,7 +37,7 @@ function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping, "". "\n\n". "\n". - "\n". + "\n". "\n". "chat\n". "\n". diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php index af1836f3..96a251b5 100644 --- a/src/messenger/webim/operator/users.php +++ b/src/messenger/webim/operator/users.php @@ -36,6 +36,7 @@ if($settings['enablegroups'] == '1') { $page = array(); $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1"; $page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0"; +$page['frequency'] = $settings['updatefrequency_operator']; prepare_menu($operator); start_html_output(); diff --git a/src/messenger/webim/styles/default/templates/chat.tpl b/src/messenger/webim/styles/default/templates/chat.tpl index 27ed1e1c..0728cde8 100644 --- a/src/messenger/webim/styles/default/templates/chat.tpl +++ b/src/messenger/webim/styles/default/templates/chat.tpl @@ -7,7 +7,7 @@ diff --git a/src/messenger/webim/styles/original/templates/chat.tpl b/src/messenger/webim/styles/original/templates/chat.tpl index 4619bf18..e971eb10 100644 --- a/src/messenger/webim/styles/original/templates/chat.tpl +++ b/src/messenger/webim/styles/original/templates/chat.tpl @@ -7,7 +7,7 @@ diff --git a/src/messenger/webim/styles/simplicity/templates/chat.tpl b/src/messenger/webim/styles/simplicity/templates/chat.tpl index fbd6e474..af72b6df 100644 --- a/src/messenger/webim/styles/simplicity/templates/chat.tpl +++ b/src/messenger/webim/styles/simplicity/templates/chat.tpl @@ -7,7 +7,7 @@ diff --git a/src/messenger/webim/view/pending_users.php b/src/messenger/webim/view/pending_users.php index 477cf2f6..11489930 100644 --- a/src/messenger/webim/view/pending_users.php +++ b/src/messenger/webim/view/pending_users.php @@ -31,7 +31,7 @@ var localized = new Array( ); var updaterOptions = { url:"/operator/update.php",wroot:"", - agentservl:"/operator/agent.php", + agentservl:"/operator/agent.php", frequency:, noclients:"", havemenu: , showpopup: }; //-->