2018-04-13 15:47:41 +02:00
< ? php
2012-06-04 16:58:40 +02:00
/*
FusionPBX
Version : MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 ( the " License " ); you may not use this file except in compliance with
the License . You may obtain a copy of the License at
http :// www . mozilla . org / MPL /
Software distributed under the License is distributed on an " AS IS " basis ,
WITHOUT WARRANTY OF ANY KIND , either express or implied . See the License
for the specific language governing rights and limitations under the
License .
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane < markjcrane @ fusionpbx . com >
2019-06-17 02:21:30 +02:00
Portions created by the Initial Developer are Copyright ( C ) 2008 - 2019
2012-06-04 16:58:40 +02:00
the Initial Developer . All Rights Reserved .
Contributor ( s ) :
Mark J Crane < markjcrane @ fusionpbx . com >
*/
2017-02-21 04:57:29 +01:00
2022-10-11 00:35:14 +02:00
//set the include path
$conf = glob ( " { /usr/local/etc,/etc}/fusionpbx/config.conf " , GLOB_BRACE );
set_include_path ( parse_ini_file ( $conf [ 0 ])[ 'document.root' ]);
//includes files
2017-02-21 04:57:29 +01:00
require_once " resources/require.php " ;
require_once " resources/check_auth.php " ;
//check permissions
if ( permission_exists ( 'call_center_active_view' )) {
//access granted
}
else {
echo " access denied " ;
exit ;
}
2012-06-04 16:58:40 +02:00
2013-05-29 23:14:36 +02:00
//add multi-lingual support
2015-01-18 11:33:34 +01:00
$language = new text ;
$text = $language -> get ();
2013-05-29 23:14:36 +02:00
2012-06-04 16:58:40 +02:00
//get the queue_name and set it as a variable
2018-03-31 20:47:43 +02:00
$queue_name = $_GET [ 'queue_name' ];
$name = $_GET [ 'name' ];
2012-06-04 16:58:40 +02:00
2018-04-13 15:47:41 +02:00
//get a new session array
unset ( $_SESSION [ 'queues' ]);
unset ( $_SESSION [ 'agents' ]);
2012-06-04 16:58:40 +02:00
//get the header
2014-07-10 02:32:50 +02:00
$document [ 'title' ] = $text [ 'title-call_center_queue_activity' ];
2020-01-13 17:45:21 +01:00
require_once " resources/header.php " ;
2013-05-29 23:14:36 +02:00
2017-02-21 04:57:29 +01:00
//add the ajax
?> <script type="text/javascript">
function loadXmlHttp ( url , id ) {
var f = this ;
2012-06-04 16:58:40 +02:00
f . xmlHttp = null ;
2017-02-21 04:57:29 +01:00
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@ if ( @ _jscript_version >= 5 ) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try { f . ie = window . ActiveXObject } catch ( e ){ f . ie = false ;}
2012-06-04 16:58:40 +02:00
@ end @*/
2017-02-21 04:57:29 +01:00
if ( window . XMLHttpRequest &&! f . ie ||/^ http /. test ( window . location . href ))
f . xmlHttp = new XMLHttpRequest (); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if ( / ( object ) | ( function ) /. test ( typeof createRequest ))
f . xmlHttp = createRequest (); // ICEBrowser, perhaps others
else {
f . xmlHttp = null ;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@ if ( @ _jscript_version >= 5 )
try { f . xmlHttp = new ActiveXObject ( " Msxml2.XMLHTTP " );}
catch ( e ){ try { f . xmlHttp = new ActiveXObject ( " Microsoft.XMLHTTP " );} catch ( e ){ f . xmlHttp = null ;}}
@ end @*/
}
2018-03-31 20:47:43 +02:00
if ( f . xmlHttp != null ) {
2017-02-21 04:57:29 +01:00
f . el = document . getElementById ( id );
f . xmlHttp . open ( " GET " , url , true );
f . xmlHttp . onreadystatechange = function (){ f . stateChanged ();};
f . xmlHttp . send ( null );
}
}
loadXmlHttp . prototype . stateChanged = function () {
2021-05-29 06:45:11 +02:00
var url = new URL ( this . xmlHttp . responseURL );
if ( / login\ . php $ /. test ( url . pathname )) {
// You are logged out. Stop refresh!
url . searchParams . set ( 'path' , '<?php echo $_SERVER[' REQUEST_URI ']; ?>' );
window . location . href = url . href ;
return ;
}
if ( this . xmlHttp . readyState == 4 && ( this . xmlHttp . status == 200 || !/^ http /. test ( window . location . href )))
//this.el.innerHTML = this.xmlHttp.responseText;
document . getElementById ( 'ajax_response' ) . innerHTML = this . xmlHttp . responseText ;
2020-01-13 17:45:21 +01:00
//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 ) {
$ ( e ) . children ( 'td:not(.list_control_icon,.list_control_icons,.tr_link_void,.list-row > .no-link,.list-row > .checkbox,.list-row > .button,.list-row > .action-button)' ) . on ( 'click' , function () {
var href = $ ( this ) . closest ( 'tr' ) . attr ( 'href' );
var target = $ ( this ) . closest ( 'tr' ) . attr ( 'target' );
if ( href ) {
if ( target ) { window . open ( href , target ); }
else { window . location = href ; }
}
});
});
2012-06-04 16:58:40 +02:00
}
2017-02-21 04:57:29 +01:00
var requestTime = function () {
2019-06-17 02:21:30 +02:00
var url = 'call_center_active_inc.php?queue_name=<?php echo escape($queue_name); ?>&name=<?php echo urlencode(escape($name)); ?>' ;
2017-02-21 04:57:29 +01:00
new loadXmlHttp ( url , 'ajax_response' );
< ? php
2023-05-05 18:46:37 +02:00
if ( empty ( $_SESSION [ " ajax_refresh_rate " ])) { $_SESSION [ " ajax_refresh_rate " ] = " 1777 " ; }
2017-02-21 04:57:29 +01:00
echo " setInterval(function() { new loadXmlHttp(url, 'ajax_reponse');}, " . $_SESSION [ " ajax_refresh_rate " ] . " ); " ;
?>
2012-06-04 16:58:40 +02:00
}
2017-02-21 04:57:29 +01:00
if ( window . addEventListener ) {
window . addEventListener ( 'load' , requestTime , false );
2012-06-04 16:58:40 +02:00
}
2017-02-21 04:57:29 +01:00
else if ( window . attachEvent ) {
window . attachEvent ( 'onload' , requestTime );
2012-06-04 16:58:40 +02:00
}
2019-06-17 02:21:30 +02:00
function send_command ( url ) {
2017-02-21 04:57:29 +01:00
if ( window . XMLHttpRequest ) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest ();
}
else { // code for IE6, IE5
xmlhttp = new ActiveXObject ( " Microsoft.XMLHTTP " );
}
2019-06-17 10:03:41 +02:00
xmlhttp . open ( " GET " , url , false );
2017-02-21 04:57:29 +01:00
xmlhttp . send ( null );
//document.getElementById('cmd_response').innerHTML=xmlhttp.responseText;
}
</ script >
2012-06-04 16:58:40 +02:00
< ? php
2017-02-21 04:57:29 +01:00
//show the response
2020-01-13 17:45:21 +01:00
echo " <div id='ajax_response'></div> \n " ;
2017-02-21 04:57:29 +01:00
echo " <br><br> " ;
//include the footer
require_once " resources/footer.php " ;
2020-01-13 17:45:21 +01:00
?>