Add setting call_center refresh type numeric
This commit is contained in:
parent
f5bdf6662e
commit
b74880f28e
|
|
@ -85,16 +85,18 @@
|
||||||
|
|
||||||
loadXmlHttp.prototype.stateChanged=function () {
|
loadXmlHttp.prototype.stateChanged=function () {
|
||||||
var url = new URL(this.xmlHttp.responseURL);
|
var url = new URL(this.xmlHttp.responseURL);
|
||||||
|
|
||||||
|
//logged out stop the refresh
|
||||||
if (/login\.php$/.test(url.pathname)) {
|
if (/login\.php$/.test(url.pathname)) {
|
||||||
// You are logged out. Stop refresh!
|
|
||||||
url.searchParams.set('path', '<?php echo $_SERVER['REQUEST_URI']; ?>');
|
url.searchParams.set('path', '<?php echo $_SERVER['REQUEST_URI']; ?>');
|
||||||
window.location.href = url.href;
|
window.location.href = url.href;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
|
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href))) {
|
||||||
//this.el.innerHTML = this.xmlHttp.responseText;
|
//this.el.innerHTML = this.xmlHttp.responseText;
|
||||||
document.getElementById('ajax_response').innerHTML = this.xmlHttp.responseText;
|
document.getElementById('ajax_response').innerHTML = this.xmlHttp.responseText;
|
||||||
|
}
|
||||||
|
|
||||||
//link table rows (except the last - the list_control_icons cell) on a table with a class of 'tr_hover', according to the href attribute of the <tr> tag
|
//link table rows (except the last - the list_control_icons cell) on a table with a class of 'tr_hover', according to the href attribute of the <tr> tag
|
||||||
$('.tr_hover tr,.list tr').each(function(i,e) {
|
$('.tr_hover tr,.list tr').each(function(i,e) {
|
||||||
|
|
@ -113,8 +115,23 @@
|
||||||
var url = 'call_center_active_inc.php?queue_name=<?php echo escape($queue_name); ?>&name=<?php echo urlencode(escape($name)); ?>';
|
var url = 'call_center_active_inc.php?queue_name=<?php echo escape($queue_name); ?>&name=<?php echo urlencode(escape($name)); ?>';
|
||||||
new loadXmlHttp(url, 'ajax_response');
|
new loadXmlHttp(url, 'ajax_response');
|
||||||
<?php
|
<?php
|
||||||
if (empty($_SESSION["ajax_refresh_rate"])) { $_SESSION["ajax_refresh_rate"] = "1777"; }
|
|
||||||
echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$_SESSION["ajax_refresh_rate"].");";
|
//determine refresh rate
|
||||||
|
$refresh_default = 15000; //milliseconds
|
||||||
|
$refresh = is_numeric($_SESSION['call_center']['refresh']['numeric']) ? $_SESSION['call_center']['refresh']['numeric'] : $refresh_default;
|
||||||
|
if ($refresh >= 0.5 && $refresh <= 120) { //convert seconds to milliseconds
|
||||||
|
$refresh = $refresh * 1000;
|
||||||
|
}
|
||||||
|
else if ($refresh < 0.5 || ($refresh > 120 && $refresh < 500)) {
|
||||||
|
$refresh = $refresh_default; //use default
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//>= 500, must be milliseconds
|
||||||
|
}
|
||||||
|
|
||||||
|
//set the value for the refresh
|
||||||
|
echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$refresh.");";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue