Merge pull request #1478 from ZoneMinder/fix_montage_server_refs

pass in the server url into the monitor object to use instead of the …
This commit is contained in:
Andrew Bauer 2016-05-23 20:14:35 -05:00
commit bec14bf111
2 changed files with 8 additions and 6 deletions

View File

@ -1,10 +1,11 @@
var requestQueue = new Request.Queue( { concurrent: 2 } ); var requestQueue = new Request.Queue( { concurrent: 2 } );
function Monitor( index, id, connKey ) function Monitor( index, monitorData )
{ {
this.index = index; this.index = index;
this.id = id; this.id = monitorData.id;
this.connKey = connKey; this.connKey = monitorData.connKey;
this.server_url = monitorData.server_url;
this.status = null; this.status = null;
this.alarmState = STATE_IDLE; this.alarmState = STATE_IDLE;
this.lastAlarmState = STATE_IDLE; this.lastAlarmState = STATE_IDLE;
@ -110,7 +111,7 @@ function Monitor( index, id, connKey )
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY ); this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
} }
this.streamCmdReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } ); this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } );
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq ); requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
} }
@ -146,7 +147,7 @@ function initPage()
{ {
for ( var i = 0; i < monitorData.length; i++ ) for ( var i = 0; i < monitorData.length; i++ )
{ {
monitors[i] = new Monitor( i, monitorData[i].id, monitorData[i].connKey ); monitors[i] = new Monitor( i, monitorData[i] );
var delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout ); var delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
monitors[i].start( delay ); monitors[i].start( delay );
} }

View File

@ -35,7 +35,8 @@ monitorData[monitorData.length] = {
'id': <?php echo $monitor->Id() ?>, 'id': <?php echo $monitor->Id() ?>,
'connKey': <?php echo $monitor->connKey() ?>, 'connKey': <?php echo $monitor->connKey() ?>,
'width': <?php echo $monitor->Width() ?>, 'width': <?php echo $monitor->Width() ?>,
'height':<?php echo $monitor->Height() ?> 'height':<?php echo $monitor->Height() ?>,
'server_url': '<?php echo $monitor->Server()->Url().$_SERVER['PHP_SELF'] ?>'
}; };
<?php <?php
} }