From 9aa07e48de6189c5f8feb74fc13572369f51a684 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Fri, 24 Jul 2009 09:05:39 +0000 Subject: [PATCH] performance options git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@596 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/libs/settings.php | 3 +- src/messenger/webim/locales/en/properties | 9 ++ src/messenger/webim/operator/performance.php | 74 ++++++++++++++ src/messenger/webim/operator/themes.php | 2 +- src/messenger/webim/view/performance.php | 102 +++++++++++++++++++ 5 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 src/messenger/webim/operator/performance.php create mode 100644 src/messenger/webim/view/performance.php diff --git a/src/messenger/webim/libs/settings.php b/src/messenger/webim/libs/settings.php index dd0ddeae..f5f5de64 100644 --- a/src/messenger/webim/libs/settings.php +++ b/src/messenger/webim/libs/settings.php @@ -31,7 +31,8 @@ function setup_settings_tabs($active) { $page['tabs'] = array( getlocal("page_settings.tab.main") => $active != 0 ? "$webimroot/operator/settings.php" : "", getlocal("page_settings.tab.features") => $active != 1 ? "$webimroot/operator/features.php" : "", - getlocal("page_settings.tab.themes") => $active != 2 ? "$webimroot/operator/themes.php" : "", + getlocal("page_settings.tab.performance") => $active != 2 ? "$webimroot/operator/performance.php" : "", + getlocal("page_settings.tab.themes") => $active != 3 ? "$webimroot/operator/themes.php" : "", ); } diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index d1d6cb9c..9bdd9fd2 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -326,6 +326,7 @@ page_settings.intro=Specify options affecting chat window and common system beha page_settings.tab.features=Optional Services page_settings.tab.main=General page_settings.tab.themes=Themes preview +page_settings.tab.performance=Performance pending.menu.hide=Hide menu >> pending.menu.show=Show menu >> pending.popup_notification=New visitor is waiting for an answer. @@ -389,6 +390,12 @@ settings.enablestatistics.description=Adds page with messenger usage reports. settings.enablestatistics=Enable "Statistics" settings.forcessl.description=Show chats only through https connection settings.forcessl=Force all chats to be secure +settings.frequencychat.description=Specify the poll interval in seconds. Default is 2 seconds. +settings.frequencychat=Visitor's chat refresh time +settings.frequencyoldchat.description=Old browsers need to refresh the whole page to get messages. Default is 7 seconds. +settings.frequencyoldchat=Page refresh time for old browsers +settings.frequencyoperator.description=Specify the poll interval in seconds. Default is 2 seconds. +settings.frequencyoperator=Operator's chat refresh time settings.geolink.description=Each IP becomes a link opening in new window. {ip} is substituted with a real ip. settings.geolink=Link to an external geolocation service settings.geolinkparams.description=Window size and toolbars hiding @@ -402,6 +409,8 @@ settings.logo=Your company logo settings.no.title=Please enter your company title settings.onehostconnections.description=0 allows any number of connections settings.onehostconnections=Max number of threads from one address +settings.onlinetimeout.description=Set the number of seconds to show operator as online. Default is 30 seconds. +settings.onlinetimeout=Operator online time threshold settings.popup_notification.description=Small dialog appears to attract your attention. settings.popup_notification=Enable "Popup dialog notification of the new visitor". settings.saved=Changes saved diff --git a/src/messenger/webim/operator/performance.php b/src/messenger/webim/operator/performance.php new file mode 100644 index 00000000..b0e430ce --- /dev/null +++ b/src/messenger/webim/operator/performance.php @@ -0,0 +1,74 @@ + ''); +$errors = array(); + +$options = array( + 'online_timeout', 'updatefrequency_operator', 'updatefrequency_chat', 'updatefrequency_oldchat'); + +loadsettings(); +$params = array(); +foreach($options as $opt) { + $params[$opt] = $settings[$opt]; +} + +if (isset($_POST['onlinetimeout'])) { + $params['online_timeout'] = getparam('onlinetimeout'); + if(!is_numeric($params['online_timeout'])) { + $errors[] = wrong_field("settings.onlinetimeout"); + } + + $params['updatefrequency_operator'] = getparam('frequencyoperator'); + if(!is_numeric($params['updatefrequency_operator'])) { + $errors[] = wrong_field("settings.frequencyoperator"); + } + + $params['updatefrequency_chat'] = getparam('frequencychat'); + if(!is_numeric($params['updatefrequency_chat'])) { + $errors[] = wrong_field("settings.frequencychat"); + } + + $params['updatefrequency_oldchat'] = getparam('frequencyoldchat'); + if(!is_numeric($params['updatefrequency_oldchat'])) { + $errors[] = wrong_field("settings.frequencyoldchat"); + } + + if (count($errors) == 0) { + foreach($options as $opt) { + $settings[$opt] = $params[$opt]; + } + update_settings(); + header("Location: $webimroot/operator/performance.php?stored"); + exit; + } +} + +$page['formonlinetimeout'] = $params['online_timeout']; +$page['formfrequencyoperator'] = $params['updatefrequency_operator']; +$page['formfrequencychat'] = $params['updatefrequency_chat']; +$page['formfrequencyoldchat'] = $params['updatefrequency_oldchat']; +$page['stored'] = isset($_GET['stored']); + +prepare_menu($operator); +setup_settings_tabs(2); +start_html_output(); +require('../view/performance.php'); +?> \ No newline at end of file diff --git a/src/messenger/webim/operator/themes.php b/src/messenger/webim/operator/themes.php index 45a6f92a..2307e998 100644 --- a/src/messenger/webim/operator/themes.php +++ b/src/messenger/webim/operator/themes.php @@ -130,6 +130,6 @@ foreach($templateList as $tpl) { prepare_menu($operator); start_html_output(); -setup_settings_tabs(2); +setup_settings_tabs(3); require('../view/themes.php'); ?> \ No newline at end of file diff --git a/src/messenger/webim/view/performance.php b/src/messenger/webim/view/performance.php new file mode 100644 index 00000000..24ad3fbc --- /dev/null +++ b/src/messenger/webim/view/performance.php @@ -0,0 +1,102 @@ + + + +
+
+ + +
+ + +
+ +
+ +
    + + $v) { if($v) { ?> +
  • + +
  • +
+ +
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ + \ No newline at end of file