Added timeouts to Ajax requests.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2238 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2007-11-11 16:00:12 +00:00
parent 9670d8b5f6
commit 4f426ba966
2 changed files with 35 additions and 35 deletions

View File

@ -175,7 +175,7 @@ function streamPause( action )
setButtonState( $('fastRevBtn'), 'unavail' );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PAUSE ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_PAUSE ?>", onComplete: getCmdResponse } );
streamReq.request();
}
}
@ -190,7 +190,7 @@ function streamPlay( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PLAY ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_PLAY ?>", onComplete: getCmdResponse } );
streamReq.request();
}
}
@ -205,7 +205,7 @@ function streamFastFwd( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getCmdResponse } );
streamReq.request();
}
}
@ -220,7 +220,7 @@ function streamSlowFwd( action )
setButtonState( $('fastRevBtn'), 'unavail' );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getCmdResponse } );
streamReq.request();
}
setButtonState( $('pauseBtn'), 'active' );
@ -237,7 +237,7 @@ function streamSlowRev( action )
setButtonState( $('fastRevBtn'), 'unavail' );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getCmdResponse } );
streamReq.request();
}
setButtonState( $('pauseBtn'), 'active' );
@ -254,7 +254,7 @@ function streamFastRev( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_FASTREV ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_FASTREV ?>", onComplete: getCmdResponse } );
streamReq.request();
}
}
@ -264,7 +264,7 @@ function streamPrev( action )
streamPlay( false );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PREV ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_PREV ?>", onComplete: getCmdResponse } );
streamReq.request();
}
}
@ -274,44 +274,44 @@ function streamNext( action )
streamPlay( false );
if ( action )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_NEXT ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_NEXT ?>", onComplete: getCmdResponse } );
streamReq.request();
}
}
function streamZoomIn( x, y )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
streamReq.request();
}
function streamZoomOut()
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getCmdResponse } );
streamReq.request();
}
function streamScale( scale )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getCmdResponse } );
streamReq.request();
}
function streamPan( x, y )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
streamReq.request();
}
function streamSeek( offset )
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SEEK ?>&offset="+offset, onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_SEEK ?>&offset="+offset, onComplete: getCmdResponse } );
streamReq.request();
}
function streamQuery()
{
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_QUERY ?>", onComplete: getCmdResponse } );
var streamReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamParms+"&command=<?= CMD_QUERY ?>", onComplete: getCmdResponse } );
streamReq.request();
}
@ -358,7 +358,7 @@ function getEvtResponse( resp_text, resp_xml )
function evtQuery()
{
var evtParms = "view=request&request=status&entity=event&id="+eventId;
var evtReq = new Ajax( url, { method: 'post', postBody: evtParms, onComplete: getEvtResponse } );
var evtReq = new Ajax( url, { method: 'post', timeout: 3000, data: evtParms, onComplete: getEvtResponse } );
evtReq.request();
}
@ -386,7 +386,7 @@ function actQuery( action, parms )
actParms += "&"+Object.toQueryString( parms );
}
//console.log( actParms );
var actReq = new Ajax( url, { method: 'post', postBody: actParms, onComplete: getActResponse } );
var actReq = new Ajax( url, { method: 'post', timeout: 3000, data: actParms, onComplete: getActResponse } );
actReq.request();
}

View File

@ -320,7 +320,7 @@ function streamCmdPause( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_PAUSE ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_PAUSE ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
}
@ -347,7 +347,7 @@ function streamCmdPlay( action )
}
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_PLAY ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_PLAY ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
}
@ -365,7 +365,7 @@ function streamCmdStop( action )
//window.setTimeout('setButtonState( $('stopBtn'), 'unavail' ); setButtonState( $('playBtn'), 'active' );", 500 );
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_STOP ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_STOP ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
setButtonState( $('stopBtn'), 'unavail' );
@ -383,7 +383,7 @@ function streamCmdFastFwd( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
}
@ -399,7 +399,7 @@ function streamCmdSlowFwd( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
setButtonState( $('pauseBtn'), 'active' );
@ -417,7 +417,7 @@ function streamCmdSlowRev( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
setButtonState( $('pauseBtn'), 'active' );
@ -435,38 +435,38 @@ function streamCmdFastRev( action )
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_FASTREV ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_FASTREV ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
}
function streamCmdZoomIn( x, y )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
function streamCmdZoomOut()
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
function streamCmdScale( scale )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
function streamCmdPan( x, y )
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
function streamCmdQuery()
{
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_QUERY ?>", onComplete: getStreamCmdResponse } );
var streamCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: streamCmdParms+"&command=<?= CMD_QUERY ?>", onComplete: getStreamCmdResponse } );
streamCmdReq.request();
}
@ -483,25 +483,25 @@ function getAlarmCmdResponse( resp_text )
function cmdDisableAlarms()
{
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=disableAlarms", onComplete: getAlarmCmdResponse } );
var alarmCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: alarmCmdParms+"&command=disableAlarms", onComplete: getAlarmCmdResponse } );
alarmCmdReq.request();
}
function cmdEnableAlarms()
{
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=enableAlarms", onComplete: getAlarmCmdResponse } );
var alarmCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: alarmCmdParms+"&command=enableAlarms", onComplete: getAlarmCmdResponse } );
alarmCmdReq.request();
}
function cmdForceAlarm()
{
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=forceAlarm", onComplete: getAlarmCmdResponse } );
var alarmCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: alarmCmdParms+"&command=forceAlarm", onComplete: getAlarmCmdResponse } );
alarmCmdReq.request();
}
function cmdCancelForcedAlarm()
{
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=cancelForcedAlarm", onComplete: getAlarmCmdResponse } );
var alarmCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: alarmCmdParms+"&command=cancelForcedAlarm", onComplete: getAlarmCmdResponse } );
alarmCmdReq.request();
}
@ -600,7 +600,7 @@ function getEventCmdResponse( resp_text )
function eventCmdQuery()
{
var eventCmdReq = new Ajax( url, { method: 'post', postBody: eventCmdParms, onComplete: getEventCmdResponse } );
var eventCmdReq = new Ajax( url, { method: 'post', timeout: 3000, data: eventCmdParms, onComplete: getEventCmdResponse } );
eventCmdReq.request();
}
@ -652,7 +652,7 @@ function controlCmd( control, event, xtell, ytell )
locParms += "&yge="+yge;
}
}
var controlReq = new Ajax( url, { method: 'post', postBody: controlParms+"&control="+control+locParms, onComplete: getControlResponse } );
var controlReq = new Ajax( url, { method: 'post', timeout: 3000, data: controlParms+"&control="+control+locParms, onComplete: getControlResponse } );
controlReq.request();
}
@ -680,7 +680,7 @@ elseif ( $monitor['CanMoveCon'] )
<?php
}
?>
var controlReq = new Ajax( url, { method: 'post', postBody: imageControlParms+"&x="+x+"&y="+y, onComplete: getControlResponse } );
var controlReq = new Ajax( url, { method: 'post', timeout: 3000, data: imageControlParms+"&x="+x+"&y="+y, onComplete: getControlResponse } );
controlReq.request();
}
function startRequests()