Revamped Ajax request files and fixed force/disable alarm commands.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2231 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
b75c33afa2
commit
69850ef6bc
|
@ -19,10 +19,11 @@ web_DATA = \
|
||||||
zm_db.php \
|
zm_db.php \
|
||||||
zm_export_funcs.php \
|
zm_export_funcs.php \
|
||||||
zm_funcs.php \
|
zm_funcs.php \
|
||||||
zm_request_status.php \
|
zm_request_alarm.php \
|
||||||
zm_request_command.php \
|
|
||||||
zm_request_control.php \
|
zm_request_control.php \
|
||||||
zm_request_event.php \
|
zm_request_event.php \
|
||||||
|
zm_request_status.php \
|
||||||
|
zm_request_stream.php \
|
||||||
zm_html.php \
|
zm_html.php \
|
||||||
zm_html.js \
|
zm_html.js \
|
||||||
zm_html_js.php \
|
zm_html_js.php \
|
||||||
|
@ -138,10 +139,11 @@ EXTRA_DIST = \
|
||||||
zm_db.php \
|
zm_db.php \
|
||||||
zm_export_funcs.php \
|
zm_export_funcs.php \
|
||||||
zm_funcs.php \
|
zm_funcs.php \
|
||||||
zm_request_status.php \
|
zm_request_alarm.php \
|
||||||
zm_request_control.php \
|
zm_request_control.php \
|
||||||
zm_request_command.php \
|
|
||||||
zm_request_event.php \
|
zm_request_event.php \
|
||||||
|
zm_request_status.php \
|
||||||
|
zm_request_stream.php \
|
||||||
zm_html.php \
|
zm_html.php \
|
||||||
zm_html.js \
|
zm_html.js \
|
||||||
zm_html_js.php \
|
zm_html_js.php \
|
||||||
|
|
|
@ -163,10 +163,11 @@ switch( $view )
|
||||||
{
|
{
|
||||||
switch( $request )
|
switch( $request )
|
||||||
{
|
{
|
||||||
case "status" :
|
case "alarm" :
|
||||||
case "command" :
|
|
||||||
case "control" :
|
case "control" :
|
||||||
case "event" :
|
case "event" :
|
||||||
|
case "status" :
|
||||||
|
case "stream" :
|
||||||
{
|
{
|
||||||
require_once( "zm_request_".$request.".php" );
|
require_once( "zm_request_".$request.".php" );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -94,7 +94,7 @@ function closeWindow()
|
||||||
<input type="hidden" name="view" value="<?= $view ?>">
|
<input type="hidden" name="view" value="<?= $view ?>">
|
||||||
<input type="hidden" name="mid" value="<?= $mid ?>">
|
<input type="hidden" name="mid" value="<?= $mid ?>">
|
||||||
<input type="hidden" name="action" value="control">
|
<input type="hidden" name="action" value="control">
|
||||||
<input type="hidden" name="control" value="preset_set">
|
<input type="hidden" name="control" value="presetSet">
|
||||||
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" align="center" class="head">ZoneMinder - <?= $zmSlangSetPreset ?></td>
|
<td colspan="4" align="center" class="head">ZoneMinder - <?= $zmSlangSetPreset ?></td>
|
||||||
|
|
|
@ -106,14 +106,14 @@ function changeScale()
|
||||||
var newWidth = ( baseWidth * scale ) / <?= SCALE_BASE ?>;
|
var newWidth = ( baseWidth * scale ) / <?= SCALE_BASE ?>;
|
||||||
var newHeight = ( baseHeight * scale ) / <?= SCALE_BASE ?>;
|
var newHeight = ( baseHeight * scale ) / <?= SCALE_BASE ?>;
|
||||||
|
|
||||||
cmdScale( scale );
|
streamScale( scale );
|
||||||
|
|
||||||
var streamImg = $('imageFeed').getElement('img');
|
var streamImg = $('imageFeed').getElement('img');
|
||||||
$(streamImg).setStyles( { width: newWidth, height: newHeight } );
|
$(streamImg).setStyles( { width: newWidth, height: newHeight } );
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdParms = "view=request&request=command&connkey=<?= $connkey ?>";
|
var streamParms = "view=request&request=stream&connkey=<?= $connkey ?>";
|
||||||
var cmdTimeoutId = 0;
|
var streamTimeoutId = 0;
|
||||||
|
|
||||||
var status;
|
var status;
|
||||||
var event;
|
var event;
|
||||||
|
@ -122,10 +122,10 @@ var lastEventId = 0;
|
||||||
|
|
||||||
function getCmdResponse( resp_text, resp_xml )
|
function getCmdResponse( resp_text, resp_xml )
|
||||||
{
|
{
|
||||||
if ( cmdTimeoutId )
|
if ( streamTimeoutId )
|
||||||
{
|
{
|
||||||
window.clearTimeout( cmdTimeoutId );
|
window.clearTimeout( streamTimeoutId );
|
||||||
cmdTimeoutId = 0;
|
streamTimeoutId = 0;
|
||||||
}
|
}
|
||||||
if ( !resp_text )
|
if ( !resp_text )
|
||||||
return;
|
return;
|
||||||
|
@ -143,14 +143,14 @@ function getCmdResponse( resp_text, resp_xml )
|
||||||
{
|
{
|
||||||
$('modeValue').setHTML( "Paused" );
|
$('modeValue').setHTML( "Paused" );
|
||||||
$('rate').addClass( 'hidden' );
|
$('rate').addClass( 'hidden' );
|
||||||
cmdPause( false );
|
streamPause( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('modeValue').setHTML( "Replay" );
|
$('modeValue').setHTML( "Replay" );
|
||||||
$('rateValue').setHTML( status.rate );
|
$('rateValue').setHTML( status.rate );
|
||||||
$('rate').removeClass( 'hidden' );
|
$('rate').removeClass( 'hidden' );
|
||||||
cmdPlay( false );
|
streamPlay( false );
|
||||||
}
|
}
|
||||||
$('progressValue').setHTML( secsToTime( parseInt(status.progress) ) );
|
$('progressValue').setHTML( secsToTime( parseInt(status.progress) ) );
|
||||||
$('zoomValue').setHTML( status.zoom );
|
$('zoomValue').setHTML( status.zoom );
|
||||||
|
@ -161,11 +161,11 @@ function getCmdResponse( resp_text, resp_xml )
|
||||||
|
|
||||||
updateProgressBar();
|
updateProgressBar();
|
||||||
|
|
||||||
var cmdTimeout = <?= ZM_WEB_REFRESH_STATUS ?>;
|
var streamTimeout = <?= ZM_WEB_REFRESH_STATUS ?>;
|
||||||
cmdTimeoutId = window.setTimeout( 'cmdQuery()', 1000 * cmdTimeout );
|
streamTimeoutId = window.setTimeout( 'streamQuery()', 1000 * streamTimeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPause( action )
|
function streamPause( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'active' );
|
setButtonState( $('pauseBtn'), 'active' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -175,12 +175,12 @@ function cmdPause( action )
|
||||||
setButtonState( $('fastRevBtn'), 'unavail' );
|
setButtonState( $('fastRevBtn'), 'unavail' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PAUSE ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PAUSE ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPlay( action )
|
function streamPlay( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), status.rate==1?'active':'inactive' );
|
setButtonState( $('playBtn'), status.rate==1?'active':'inactive' );
|
||||||
|
@ -190,12 +190,12 @@ function cmdPlay( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PLAY ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PLAY ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdFastFwd( action )
|
function streamFastFwd( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -205,12 +205,12 @@ function cmdFastFwd( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdSlowFwd( action )
|
function streamSlowFwd( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -220,14 +220,14 @@ function cmdSlowFwd( action )
|
||||||
setButtonState( $('fastRevBtn'), 'unavail' );
|
setButtonState( $('fastRevBtn'), 'unavail' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
setButtonState( $('pauseBtn'), 'active' );
|
setButtonState( $('pauseBtn'), 'active' );
|
||||||
setButtonState( $('slowFwdBtn'), 'inactive' );
|
setButtonState( $('slowFwdBtn'), 'inactive' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdSlowRev( action )
|
function streamSlowRev( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -237,14 +237,14 @@ function cmdSlowRev( action )
|
||||||
setButtonState( $('fastRevBtn'), 'unavail' );
|
setButtonState( $('fastRevBtn'), 'unavail' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
setButtonState( $('pauseBtn'), 'active' );
|
setButtonState( $('pauseBtn'), 'active' );
|
||||||
setButtonState( $('slowRevBtn'), 'inactive' );
|
setButtonState( $('slowRevBtn'), 'inactive' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdFastRev( action )
|
function streamFastRev( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -254,65 +254,65 @@ function cmdFastRev( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_FASTREV ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_FASTREV ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPrev( action )
|
function streamPrev( action )
|
||||||
{
|
{
|
||||||
cmdPlay( false );
|
streamPlay( false );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PREV ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PREV ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdNext( action )
|
function streamNext( action )
|
||||||
{
|
{
|
||||||
cmdPlay( false );
|
streamPlay( false );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_NEXT ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_NEXT ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdZoomIn( x, y )
|
function streamZoomIn( x, y )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdZoomOut()
|
function streamZoomOut()
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdScale( scale )
|
function streamScale( scale )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPan( x, y )
|
function streamPan( x, y )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdSeek( offset )
|
function streamSeek( offset )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SEEK ?>&offset="+offset, onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_SEEK ?>&offset="+offset, onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdQuery()
|
function streamQuery()
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_QUERY ?>", onComplete: getCmdResponse } );
|
var streamReq = new Ajax( url, { method: 'post', postBody: streamParms+"&command=<?= CMD_QUERY ?>", onComplete: getCmdResponse } );
|
||||||
cmdReq.request();
|
streamReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEvtResponse( resp_text, resp_xml )
|
function getEvtResponse( resp_text, resp_xml )
|
||||||
|
@ -392,13 +392,13 @@ function actQuery( action, parms )
|
||||||
|
|
||||||
function startRequests()
|
function startRequests()
|
||||||
{
|
{
|
||||||
cmdTimeoutId = window.setTimeout( 'cmdQuery()', 1000 );
|
streamTimeoutId = window.setTimeout( 'streamQuery()', 1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteEvent()
|
function deleteEvent()
|
||||||
{
|
{
|
||||||
actQuery( 'delete' );
|
actQuery( 'delete' );
|
||||||
cmdNext();
|
streamNext();
|
||||||
opener.location.reload(true);
|
opener.location.reload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ function drawProgressBar()
|
||||||
var offset = parseInt((index*event.Length)/$$(cells).length);
|
var offset = parseInt((index*event.Length)/$$(cells).length);
|
||||||
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
|
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
|
||||||
$(cell).removeEvent( 'click' );
|
$(cell).removeEvent( 'click' );
|
||||||
$(cell).addEvent( 'click', function(){ cmdSeek( offset ); } );
|
$(cell).addEvent( 'click', function(){ streamSeek( offset ); } );
|
||||||
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
|
$(cell).setProperty( 'title', '+'+secsToTime(offset)+'s' );
|
||||||
barWidth += $(cell).getCoordinates().width;
|
barWidth += $(cell).getCoordinates().width;
|
||||||
}
|
}
|
||||||
|
@ -546,15 +546,15 @@ else
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<p id="dvrControls">
|
<p id="dvrControls">
|
||||||
<input type="button" value="<+" id="prevBtn" title="<?= $zmSlangPrev ?>" class="inactive" onclick="cmdPrev( true )"/>
|
<input type="button" value="<+" id="prevBtn" title="<?= $zmSlangPrev ?>" class="inactive" onclick="streamPrev( true )"/>
|
||||||
<input type="button" value="<<" id="fastRevBtn" title="<?= $zmSlangRewind ?>" class="inactive" disabled="disabled" onclick="cmdFastRev( true )"/>
|
<input type="button" value="<<" id="fastRevBtn" title="<?= $zmSlangRewind ?>" class="inactive" disabled="disabled" onclick="streamFastRev( true )"/>
|
||||||
<input type="button" value="<" id="slowRevBtn" title="<?= $zmSlangStepBack ?>" class="unavail" disabled="disabled" onclick="cmdSlowRev( true )"/>
|
<input type="button" value="<" id="slowRevBtn" title="<?= $zmSlangStepBack ?>" class="unavail" disabled="disabled" onclick="streamSlowRev( true )"/>
|
||||||
<input type="button" value="||" id="pauseBtn" title="<?= $zmSlangPause ?>" class="inactive" onclick="cmdPause( true )"/>
|
<input type="button" value="||" id="pauseBtn" title="<?= $zmSlangPause ?>" class="inactive" onclick="streamPause( true )"/>
|
||||||
<input type="button" value="|>" id="playBtn" title="<?= $zmSlangPlay ?>" class="active" disabled="disabled" onclick="cmdPlay( true )"/>
|
<input type="button" value="|>" id="playBtn" title="<?= $zmSlangPlay ?>" class="active" disabled="disabled" onclick="streamPlay( true )"/>
|
||||||
<input type="button" value=">" id="slowFwdBtn" title="<?= $zmSlangStepForward ?>" class="unavail" disabled="disabled" onclick="cmdSlowFwd( true )"/>
|
<input type="button" value=">" id="slowFwdBtn" title="<?= $zmSlangStepForward ?>" class="unavail" disabled="disabled" onclick="streamSlowFwd( true )"/>
|
||||||
<input type="button" value=">>" id="fastFwdBtn" title="<?= $zmSlangFastForward ?>" class="inactive" disabled="disabled" onclick="cmdFastFwd( true )"/>
|
<input type="button" value=">>" id="fastFwdBtn" title="<?= $zmSlangFastForward ?>" class="inactive" disabled="disabled" onclick="streamFastFwd( true )"/>
|
||||||
<input type="button" value="–" id="zoomOutBtn" title="<?= $zmSlangZoomOut ?>" class="avail" onclick="cmdZoomOut()"/>
|
<input type="button" value="–" id="zoomOutBtn" title="<?= $zmSlangZoomOut ?>" class="avail" onclick="streamZoomOut()"/>
|
||||||
<input type="button" value="+>" id="nextBtn" title="<?= $zmSlangNext ?>" class="inactive" onclick="cmdNext( true )"/>
|
<input type="button" value="+>" id="nextBtn" title="<?= $zmSlangNext ?>" class="inactive" onclick="streamNext( true )"/>
|
||||||
</p>
|
</p>
|
||||||
<div id="replayStatus"><span id="mode">Mode: <span id="modeValue"> </span></span><span id="rate"> – Rate: <span id="rateValue"></span>x</span><span id="progress"> – Progress: <span id="progressValue"></span>s</span><span id="zoom"> – Zoom: <span id="zoomValue"></span>x</span>
|
<div id="replayStatus"><span id="mode">Mode: <span id="modeValue"> </span></span><span id="rate"> – Rate: <span id="rateValue"></span>x</span><span id="progress"> – Progress: <span id="progressValue"></span>s</span><span id="zoom"> – Zoom: <span id="zoomValue"></span>x</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -584,9 +584,9 @@ function handleClick( event )
|
||||||
var y = event.page.y - $(target).getTop();
|
var y = event.page.y - $(target).getTop();
|
||||||
|
|
||||||
if ( event.shift )
|
if ( event.shift )
|
||||||
cmdPan( x, y );
|
streamPan( x, y );
|
||||||
else
|
else
|
||||||
cmdZoomIn( x, y );
|
streamZoomIn( x, y );
|
||||||
//console.log(x+","+y)
|
//console.log(x+","+y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ function changeScale()
|
||||||
var newWidth = ( baseWidth * scale ) / <?= SCALE_BASE ?>;
|
var newWidth = ( baseWidth * scale ) / <?= SCALE_BASE ?>;
|
||||||
var newHeight = ( baseHeight * scale ) / <?= SCALE_BASE ?>;
|
var newHeight = ( baseHeight * scale ) / <?= SCALE_BASE ?>;
|
||||||
|
|
||||||
cmdScale( scale );
|
streamCmdScale( scale );
|
||||||
|
|
||||||
var streamImg = $('imageFeed').getElement('img');
|
var streamImg = $('imageFeed').getElement('img');
|
||||||
if ( !streamImg )
|
if ( !streamImg )
|
||||||
|
@ -94,43 +94,43 @@ function changeScale()
|
||||||
$(streamImg).setStyles( { width: newWidth, height: newHeight } );
|
$(streamImg).setStyles( { width: newWidth, height: newHeight } );
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdParms = "view=request&request=command&connkey=<?= $connkey ?>";
|
var streamCmdParms = "view=request&request=stream&connkey=<?= $connkey ?>";
|
||||||
var cmdTimeoutId = 0;
|
var streamCmdTimeoutId = 0;
|
||||||
|
|
||||||
var lastState = STATE_IDLE;
|
var alarmState = STATE_IDLE;
|
||||||
|
var lastAlarmState = STATE_IDLE;
|
||||||
var status;
|
var status;
|
||||||
|
|
||||||
function getCmdResponse( resp_text, resp_xml )
|
function getStreamCmdResponse( resp_text )
|
||||||
{
|
{
|
||||||
if ( cmdTimeoutId )
|
if ( streamCmdTimeoutId )
|
||||||
{
|
{
|
||||||
window.clearTimeout( cmdTimeoutId );
|
window.clearTimeout( streamCmdTimeoutId );
|
||||||
cmdTimeoutId = 0;
|
streamCmdTimeoutId = 0;
|
||||||
}
|
}
|
||||||
if ( !resp_text )
|
if ( !resp_text )
|
||||||
return;
|
return;
|
||||||
var resp_func = new Function( "return "+resp_text );
|
var response = Json.evaluate( resp_text );
|
||||||
var resp_obj = resp_func();
|
status = response.status;
|
||||||
status = resp_obj.status;
|
|
||||||
$('fpsValue').setHTML( status.fps );
|
$('fpsValue').setHTML( status.fps );
|
||||||
var state = status.state;
|
alarmState = status.state;
|
||||||
var stateString = "Unknown";
|
var stateString = "Unknown";
|
||||||
var stateClass = "";
|
var stateClass = "";
|
||||||
if ( state <= STATE_PREALARM )
|
if ( alarmState <= STATE_PREALARM )
|
||||||
{
|
{
|
||||||
stateString = "<?= $zmSlangIdle ?>";
|
stateString = "<?= $zmSlangIdle ?>";
|
||||||
}
|
}
|
||||||
else if ( state == STATE_ALARM )
|
else if ( alarmState == STATE_ALARM )
|
||||||
{
|
{
|
||||||
stateString = "<?= $zmSlangAlarm ?>";
|
stateString = "<?= $zmSlangAlarm ?>";
|
||||||
stateClass = "alarm";
|
stateClass = "alarm";
|
||||||
}
|
}
|
||||||
else if ( state == STATE_ALERT )
|
else if ( alarmState == STATE_ALERT )
|
||||||
{
|
{
|
||||||
stateString = "<?= $zmSlangAlert ?>";
|
stateString = "<?= $zmSlangAlert ?>";
|
||||||
stateClass = "alert";
|
stateClass = "alert";
|
||||||
}
|
}
|
||||||
else if ( state == STATE_TAPE )
|
else if ( alarmState == STATE_TAPE )
|
||||||
{
|
{
|
||||||
stateString = "<?= $zmSlangRecord ?>";
|
stateString = "<?= $zmSlangRecord ?>";
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ function getCmdResponse( resp_text, resp_xml )
|
||||||
$('delayValue').setHTML( delayString );
|
$('delayValue').setHTML( delayString );
|
||||||
$('delay').removeClass( 'hidden' );
|
$('delay').removeClass( 'hidden' );
|
||||||
$('level').removeClass( 'hidden' );
|
$('level').removeClass( 'hidden' );
|
||||||
cmdPause( false );
|
streamCmdPause( false );
|
||||||
}
|
}
|
||||||
else if ( status.delayed == true )
|
else if ( status.delayed == true )
|
||||||
{
|
{
|
||||||
|
@ -200,21 +200,21 @@ function getCmdResponse( resp_text, resp_xml )
|
||||||
$('level').removeClass( 'hidden' );
|
$('level').removeClass( 'hidden' );
|
||||||
if ( status.rate == 1 )
|
if ( status.rate == 1 )
|
||||||
{
|
{
|
||||||
cmdPlay( false );
|
streamCmdPlay( false );
|
||||||
}
|
}
|
||||||
else if ( status.rate > 0 )
|
else if ( status.rate > 0 )
|
||||||
{
|
{
|
||||||
if ( status.rate < 1 )
|
if ( status.rate < 1 )
|
||||||
cmdSlowFwd( false );
|
streamCmdSlowFwd( false );
|
||||||
else
|
else
|
||||||
cmdFastFwd( false );
|
streamCmdFastFwd( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( status.rate > -1 )
|
if ( status.rate > -1 )
|
||||||
cmdSlowRev( false );
|
streamCmdSlowRev( false );
|
||||||
else
|
else
|
||||||
cmdFastRev( false );
|
streamCmdFastRev( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -223,7 +223,7 @@ function getCmdResponse( resp_text, resp_xml )
|
||||||
$('rate').addClass( 'hidden' );
|
$('rate').addClass( 'hidden' );
|
||||||
$('delay').addClass( 'hidden' );
|
$('delay').addClass( 'hidden' );
|
||||||
$('level').addClass( 'hidden' );
|
$('level').addClass( 'hidden' );
|
||||||
cmdPlay( false );
|
streamCmdPlay( false );
|
||||||
}
|
}
|
||||||
$('zoomValue').setHTML( status.zoom );
|
$('zoomValue').setHTML( status.zoom );
|
||||||
if ( status.zoom == "1.0" )
|
if ( status.zoom == "1.0" )
|
||||||
|
@ -231,8 +231,41 @@ function getCmdResponse( resp_text, resp_xml )
|
||||||
else
|
else
|
||||||
setButtonState( $('zoomOutBtn'), 'inactive' );
|
setButtonState( $('zoomOutBtn'), 'inactive' );
|
||||||
|
|
||||||
var isAlarmed = ( state == STATE_ALARM || state == STATE_ALERT );
|
<?php
|
||||||
var wasAlarmed = ( lastState == STATE_ALARM || lastState == STATE_ALERT );
|
if ( canEdit( 'Monitors' ) )
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
$('enableLink').removeEvents( 'click' );
|
||||||
|
if ( status.enabled )
|
||||||
|
{
|
||||||
|
$('enableLink').setText( '<?= $zmSlangDisableAlarms ?>' );
|
||||||
|
$('enableLink').addEvent( 'click', cmdDisableAlarms );
|
||||||
|
$('forceLink').removeEvents( 'click' );
|
||||||
|
if ( status.forced )
|
||||||
|
{
|
||||||
|
$('forceLink').setText( '<?= $zmSlangCancelForcedAlarm ?>' );
|
||||||
|
$('forceLink').addEvent( 'click', cmdCancelForcedAlarm );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('forceLink').setText( '<?= $zmSlangForceAlarm ?>' );
|
||||||
|
$('forceLink').addEvent( 'click', cmdForceAlarm );
|
||||||
|
}
|
||||||
|
$('forceLink').removeClass( 'hidden' );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('enableLink').setText( '<?= $zmSlangEnableAlarms ?>' );
|
||||||
|
$('enableLink').addEvent( 'click', cmdEnableAlarms );
|
||||||
|
$('forceLink').addClass( 'hidden' );
|
||||||
|
}
|
||||||
|
$('enableLink').removeClass( 'hidden' );
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
var isAlarmed = ( alarmState == STATE_ALARM || alarmState == STATE_ALERT );
|
||||||
|
var wasAlarmed = ( lastAlarmState == STATE_ALARM || lastAlarmState == STATE_ALERT );
|
||||||
|
|
||||||
var newAlarm = ( isAlarmed && !wasAlarmed );
|
var newAlarm = ( isAlarmed && !wasAlarmed );
|
||||||
var oldAlarm = ( !isAlarmed && wasAlarmed );
|
var oldAlarm = ( !isAlarmed && wasAlarmed );
|
||||||
|
@ -267,16 +300,16 @@ if ( ZM_WEB_SOUND_ON_ALARM )
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
var cmdTimeout = <?= ZM_WEB_REFRESH_STATUS ?>;
|
var streamCmdTimeout = <?= 1000*ZM_WEB_REFRESH_STATUS ?>;
|
||||||
if ( state == STATE_ALARM || state == STATE_ALERT )
|
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||||
{
|
{
|
||||||
cmdTimeout = 1;
|
streamCmdTimeout = streamCmdTimeout/5;
|
||||||
}
|
}
|
||||||
cmdTimeoutId = window.setTimeout( 'cmdQuery()', 1000 * cmdTimeout );
|
streamCmdTimeoutId = window.setTimeout( 'streamCmdQuery()', streamCmdTimeout );
|
||||||
lastState = state;
|
lastAlarmState = alarmState;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPause( action )
|
function streamCmdPause( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'active' );
|
setButtonState( $('pauseBtn'), 'active' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -287,12 +320,12 @@ function cmdPause( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PAUSE ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_PAUSE ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPlay( action )
|
function streamCmdPlay( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'active' );
|
setButtonState( $('playBtn'), 'active' );
|
||||||
|
@ -314,12 +347,12 @@ function cmdPlay( action )
|
||||||
}
|
}
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PLAY ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_PLAY ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdStop( action )
|
function streamCmdStop( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'unavail' );
|
setButtonState( $('playBtn'), 'unavail' );
|
||||||
|
@ -332,14 +365,14 @@ function cmdStop( action )
|
||||||
//window.setTimeout('setButtonState( $('stopBtn'), 'unavail' ); setButtonState( $('playBtn'), 'active' );", 500 );
|
//window.setTimeout('setButtonState( $('stopBtn'), 'unavail' ); setButtonState( $('playBtn'), 'active' );", 500 );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_STOP ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_STOP ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
setButtonState( $('stopBtn'), 'unavail' );
|
setButtonState( $('stopBtn'), 'unavail' );
|
||||||
setButtonState( $('playBtn'), 'active' );
|
setButtonState( $('playBtn'), 'active' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdFastFwd( action )
|
function streamCmdFastFwd( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -350,12 +383,12 @@ function cmdFastFwd( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_FASTFWD ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdSlowFwd( action )
|
function streamCmdSlowFwd( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -366,14 +399,14 @@ function cmdSlowFwd( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_SLOWFWD ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
setButtonState( $('pauseBtn'), 'active' );
|
setButtonState( $('pauseBtn'), 'active' );
|
||||||
setButtonState( $('slowFwdBtn'), 'inactive' );
|
setButtonState( $('slowFwdBtn'), 'inactive' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdSlowRev( action )
|
function streamCmdSlowRev( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -384,14 +417,14 @@ function cmdSlowRev( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_SLOWREV ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
setButtonState( $('pauseBtn'), 'active' );
|
setButtonState( $('pauseBtn'), 'active' );
|
||||||
setButtonState( $('slowRevBtn'), 'inactive' );
|
setButtonState( $('slowRevBtn'), 'inactive' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdFastRev( action )
|
function streamCmdFastRev( action )
|
||||||
{
|
{
|
||||||
setButtonState( $('pauseBtn'), 'inactive' );
|
setButtonState( $('pauseBtn'), 'inactive' );
|
||||||
setButtonState( $('playBtn'), 'inactive' );
|
setButtonState( $('playBtn'), 'inactive' );
|
||||||
|
@ -402,58 +435,92 @@ function cmdFastRev( action )
|
||||||
setButtonState( $('fastRevBtn'), 'inactive' );
|
setButtonState( $('fastRevBtn'), 'inactive' );
|
||||||
if ( action )
|
if ( action )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_FASTREV ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_FASTREV ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdZoomIn( x, y )
|
function streamCmdZoomIn( x, y )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_ZOOMIN ?>&x="+x+"&y="+y, onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdZoomOut()
|
function streamCmdZoomOut()
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_ZOOMOUT ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdScale( scale )
|
function streamCmdScale( scale )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_SCALE ?>&scale="+scale, onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdPan( x, y )
|
function streamCmdPan( x, y )
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_PAN ?>&x="+x+"&y="+y, onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmdQuery()
|
function streamCmdQuery()
|
||||||
{
|
{
|
||||||
var cmdReq = new Ajax( url, { method: 'post', postBody: cmdParms+"&command=<?= CMD_QUERY ?>", onComplete: getCmdResponse } );
|
var streamCmdReq = new Ajax( url, { method: 'post', postBody: streamCmdParms+"&command=<?= CMD_QUERY ?>", onComplete: getStreamCmdResponse } );
|
||||||
cmdReq.request();
|
streamCmdReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
var evtParms = "view=request&request=status&entity=events&id=<?= $mid ?>&count=<?= MAX_EVENTS ?>&sort=Id%20desc";
|
var alarmCmdParms = "view=request&request=alarm&id=<?= $mid ?>";
|
||||||
var evtTimeoutId = 0;
|
var alarmCmdTimeoutId = 0;
|
||||||
var evtFirst = true;
|
var alarmCmdFirst = true;
|
||||||
|
|
||||||
function getEvtResponse( resp_text, resp_xml )
|
function getAlarmCmdResponse( resp_text )
|
||||||
{
|
{
|
||||||
if ( evtTimeoutId )
|
if ( resp_text == 'Ok' )
|
||||||
|
return;
|
||||||
|
var response = Json.evaluate( resp_text );
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmdDisableAlarms()
|
||||||
|
{
|
||||||
|
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=disableAlarms", onComplete: getAlarmCmdResponse } );
|
||||||
|
alarmCmdReq.request();
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmdEnableAlarms()
|
||||||
|
{
|
||||||
|
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=enableAlarms", onComplete: getAlarmCmdResponse } );
|
||||||
|
alarmCmdReq.request();
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmdForceAlarm()
|
||||||
|
{
|
||||||
|
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=forceAlarm", onComplete: getAlarmCmdResponse } );
|
||||||
|
alarmCmdReq.request();
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmdCancelForcedAlarm()
|
||||||
|
{
|
||||||
|
var alarmCmdReq = new Ajax( url, { method: 'post', postBody: alarmCmdParms+"&command=cancelForcedAlarm", onComplete: getAlarmCmdResponse } );
|
||||||
|
alarmCmdReq.request();
|
||||||
|
}
|
||||||
|
|
||||||
|
var eventCmdParms = "view=request&request=status&entity=events&id=<?= $mid ?>&count=<?= MAX_EVENTS ?>&sort=Id%20desc";
|
||||||
|
var eventCmdTimeoutId = 0;
|
||||||
|
var eventCmdFirst = true;
|
||||||
|
|
||||||
|
function getEventCmdResponse( resp_text )
|
||||||
|
{
|
||||||
|
if ( eventCmdTimeoutId )
|
||||||
{
|
{
|
||||||
window.clearTimeout( evtTimeoutId );
|
window.clearTimeout( eventCmdTimeoutId );
|
||||||
evtTimeoutId = 0;
|
eventCmdTimeoutId = 0;
|
||||||
}
|
}
|
||||||
if ( resp_text == 'Ok' )
|
if ( resp_text == 'Ok' )
|
||||||
return;
|
return;
|
||||||
var resp_func = new Function( "return "+resp_text );
|
var response = Json.evaluate( resp_text );
|
||||||
var resp_obj = resp_func();
|
|
||||||
|
|
||||||
var db_events = resp_obj.events.reverse();
|
var db_events = response.events.reverse();
|
||||||
var eventList = $('eventList');
|
var eventList = $('eventList');
|
||||||
var eventListBody = $(eventList).getElement( 'tbody' );
|
var eventListBody = $(eventList).getElement( 'tbody' );
|
||||||
var eventListRows = $(eventListBody).getElements( 'tr' );
|
var eventListRows = $(eventListBody).getElements( 'tr' );
|
||||||
|
@ -463,7 +530,7 @@ function getEvtResponse( resp_text, resp_xml )
|
||||||
if ( !$(row) )
|
if ( !$(row) )
|
||||||
{
|
{
|
||||||
row = new Element( 'tr', { 'id': 'event'+db_events[i].Id } );
|
row = new Element( 'tr', { 'id': 'event'+db_events[i].Id } );
|
||||||
if ( !evtFirst )
|
if ( !eventCmdFirst )
|
||||||
$(row).addClass( 'highlight' );
|
$(row).addClass( 'highlight' );
|
||||||
var cell = new Element( 'td' );
|
var cell = new Element( 'td' );
|
||||||
$(cell).injectInside( $(row) );
|
$(cell).injectInside( $(row) );
|
||||||
|
@ -522,34 +589,33 @@ function getEvtResponse( resp_text, resp_xml )
|
||||||
$$(rows)[$$(rows).length-1].remove();
|
$$(rows)[$$(rows).length-1].remove();
|
||||||
rows = $(eventListBody).getElements( 'tr' );
|
rows = $(eventListBody).getElements( 'tr' );
|
||||||
}
|
}
|
||||||
var evtTimeout = <?= ZM_WEB_REFRESH_STATUS ?>;
|
var eventCmdTimeout = <?= 1000*ZM_WEB_REFRESH_STATUS ?>;
|
||||||
//if ( state == STATE_ALARM || state == STATE_ALERT )
|
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||||
//{
|
{
|
||||||
//cmdTimeout = 1;
|
eventCmdTimeout = eventCmdTimeout/5;
|
||||||
//}
|
}
|
||||||
evtTimeoutId = window.setTimeout( 'evtQuery()', 1000 * evtTimeout );
|
eventCmdTimeoutId = window.setTimeout( 'eventCmdQuery()', eventCmdTimeout );
|
||||||
evtFirst = false;
|
eventCmdFirst = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function evtQuery()
|
function eventCmdQuery()
|
||||||
{
|
{
|
||||||
var evtReq = new Ajax( url, { method: 'post', postBody: evtParms, onComplete: getEvtResponse } );
|
var eventCmdReq = new Ajax( url, { method: 'post', postBody: eventCmdParms, onComplete: getEventCmdResponse } );
|
||||||
evtReq.request();
|
eventCmdReq.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
var controlParms = "view=request&request=control&id=<?= $mid ?>";
|
var controlParms = "view=request&request=control&id=<?= $mid ?>";
|
||||||
|
|
||||||
function getControlResponse( resp_text, resp_xml )
|
function getControlResponse( resp_text )
|
||||||
{
|
{
|
||||||
if ( !resp_text )
|
if ( !resp_text )
|
||||||
return;
|
return;
|
||||||
//console.log( resp_text );
|
//console.log( resp_text );
|
||||||
var resp_func = new Function( "return "+resp_text );
|
var response = Json.evaluate( resp_text );
|
||||||
var resp_obj = resp_func();
|
result = response.result;
|
||||||
result = resp_obj.result;
|
|
||||||
if ( result != 'Ok' )
|
if ( result != 'Ok' )
|
||||||
{
|
{
|
||||||
alert( "Control response was status = "+resp_obj.status+"\nmessage = "+resp_obj.message );
|
alert( "Control response was status = "+response.status+"\nmessage = "+response.message );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,8 +685,8 @@ elseif ( $monitor['CanMoveCon'] )
|
||||||
}
|
}
|
||||||
function startRequests()
|
function startRequests()
|
||||||
{
|
{
|
||||||
cmdTimeoutId = window.setTimeout( 'cmdQuery()', 1000 );
|
streamCmdTimeoutId = window.setTimeout( 'streamCmdQuery()', 1000 );
|
||||||
evtTimeoutId = window.setTimeout( 'evtQuery()', 1500 );
|
eventCmdTimeoutId = window.setTimeout( 'eventCmdQuery()', 1500 );
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -690,39 +756,32 @@ else
|
||||||
</div>
|
</div>
|
||||||
<div id="monitorStatus">
|
<div id="monitorStatus">
|
||||||
<?php
|
<?php
|
||||||
$refresh = (isset($force)||$forced||isset($disable)||$disabled||(($status>=STATE_PREALARM)&&($status<=STATE_ALERT)))?1:ZM_WEB_REFRESH_STATUS;
|
if ( canEdit( 'Monitors' ) )
|
||||||
$url = "$PHP_SELF?view=watchstatus&mid=$mid&last_status=$status".(($force||$forced)?"&forced=1":"").(($disable||$disabled)?"&disabled=1":"");
|
{
|
||||||
|
?>
|
||||||
|
<span id="enableAlarms"><a id="enableLink" href="javascript: void(0)" class="hidden"> </a></span>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<span id="enableAlarms"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&disable=0"><?= $zmSlangEnableAlarms ?></a></span>
|
|
||||||
<span id="monitorState"><?= $zmSlangState ?>: <span id="stateValue"></span> - <span id="fpsValue"></span> fps</span>
|
<span id="monitorState"><?= $zmSlangState ?>: <span id="stateValue"></span> - <span id="fpsValue"></span> fps</span>
|
||||||
<?php
|
<?php
|
||||||
if ( !($disable || $disabled) )
|
if ( canEdit( 'Monitors' ) )
|
||||||
{
|
{
|
||||||
if ( canEdit( 'Monitors' ) && ($force || $forced) )
|
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<span id="forceAlarm"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&force=0"><?= $zmSlangCancelForcedAlarm ?></a></span>
|
<span id="forceAlarm"><a id="forceLink" href="javascript: void(0)" class="hidden"> </a></span>
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
elseif ( canEdit( 'Monitors' ) && zmaCheck( $mid ) )
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<span id="forceAlarm"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&force=1"><?= $zmSlangForceAlarm ?></a></span>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<p id="dvrControls">
|
<p id="dvrControls">
|
||||||
<input type="button" value="<<" id="fastRevBtn" title="<?= $zmSlangRewind ?>" class="unavail" disabled="disabled" onclick="cmdFastRev( true )"/>
|
<input type="button" value="<<" id="fastRevBtn" title="<?= $zmSlangRewind ?>" class="unavail" disabled="disabled" onclick="streamCmdFastRev( true )"/>
|
||||||
<input type="button" value="<" id="slowRevBtn" title="<?= $zmSlangStepBack ?>" class="unavail" disabled="disabled" onclick="cmdSlowRev( true )"/>
|
<input type="button" value="<" id="slowRevBtn" title="<?= $zmSlangStepBack ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowRev( true )"/>
|
||||||
<input type="button" value="||" id="pauseBtn" title="<?= $zmSlangPause ?>" class="inactive" onclick="cmdPause( true )"/>
|
<input type="button" value="||" id="pauseBtn" title="<?= $zmSlangPause ?>" class="inactive" onclick="streamCmdPause( true )"/>
|
||||||
<input type="button" value="[]" id="stopBtn" title="<?= $zmSlangStop ?>" class="unavail" disabled="disabled" onclick="cmdStop( true )"/>
|
<input type="button" value="[]" id="stopBtn" title="<?= $zmSlangStop ?>" class="unavail" disabled="disabled" onclick="streamCmdStop( true )"/>
|
||||||
<input type="button" value="|>" id="playBtn" title="<?= $zmSlangPlay ?>" class="active" disabled="disabled" onclick="cmdPlay( true )"/>
|
<input type="button" value="|>" id="playBtn" title="<?= $zmSlangPlay ?>" class="active" disabled="disabled" onclick="streamCmdPlay( true )"/>
|
||||||
<input type="button" value=">" id="slowFwdBtn" title="<?= $zmSlangStepForward ?>" class="unavail" disabled="disabled" onclick="cmdSlowFwd( true )"/>
|
<input type="button" value=">" id="slowFwdBtn" title="<?= $zmSlangStepForward ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowFwd( true )"/>
|
||||||
<input type="button" value=">>" id="fastFwdBtn" title="<?= $zmSlangFastForward ?>" class="unavail" disabled="disabled" onclick="cmdFastFwd( true )"/>
|
<input type="button" value=">>" id="fastFwdBtn" title="<?= $zmSlangFastForward ?>" class="unavail" disabled="disabled" onclick="streamCmdFastFwd( true )"/>
|
||||||
<input type="button" value="–" id="zoomOutBtn" title="<?= $zmSlangZoomOut ?>" class="avail" onclick="cmdZoomOut()"/>
|
<input type="button" value="–" id="zoomOutBtn" title="<?= $zmSlangZoomOut ?>" class="avail" onclick="streamCmdZoomOut()"/>
|
||||||
</p>
|
</p>
|
||||||
<div id="replayStatus"><span id="mode">Mode: <span id="modeValue"> </span></span><span id="rate"> – Rate: <span id="rateValue"></span>x</span><span id="delay"> – Delay: <span id="delayValue"></span>s</span><span id="level"> – Buffer: <span id="levelValue"></span>%</span><span id="zoom"> – Zoom: <span id="zoomValue"></span>x</span>
|
<div id="replayStatus"><span id="mode">Mode: <span id="modeValue"> </span></span><span id="rate"> – Rate: <span id="rateValue"></span>x</span><span id="delay"> – Delay: <span id="delayValue"></span>s</span><span id="level"> – Buffer: <span id="levelValue"></span>%</span><span id="zoom"> – Zoom: <span id="zoomValue"></span>x</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -730,7 +789,7 @@ if ( !($disable || $disabled) )
|
||||||
if ( $showControls )
|
if ( $showControls )
|
||||||
{
|
{
|
||||||
require_once( 'zm_control_funcsX.php' );
|
require_once( 'zm_control_funcsX.php' );
|
||||||
$cmds = getControlCommands( $monitor );
|
$streamCmds = getControlCommands( $monitor );
|
||||||
?>
|
?>
|
||||||
<div id="ptzControls"<?= $control?'':' class="hidden"' ?>>
|
<div id="ptzControls"<?= $control?'':' class="hidden"' ?>>
|
||||||
<div id="controlsPanel">
|
<div id="controlsPanel">
|
||||||
|
@ -857,9 +916,9 @@ function handleClick( event )
|
||||||
if ( showMode == "events" || !canMove )
|
if ( showMode == "events" || !canMove )
|
||||||
{
|
{
|
||||||
if ( event.shift )
|
if ( event.shift )
|
||||||
cmdPan( x, y );
|
streamCmdPan( x, y );
|
||||||
else
|
else
|
||||||
cmdZoomIn( x, y );
|
streamCmdZoomIn( x, y );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,7 +158,7 @@ $zmSlangCanAutoIris = 'Can Auto Iris';
|
||||||
$zmSlangCanAutoWhite = 'Can Auto White Bal.';
|
$zmSlangCanAutoWhite = 'Can Auto White Bal.';
|
||||||
$zmSlangCanAutoZoom = 'Can Auto Zoom';
|
$zmSlangCanAutoZoom = 'Can Auto Zoom';
|
||||||
$zmSlangCancel = 'Cancel';
|
$zmSlangCancel = 'Cancel';
|
||||||
$zmSlangCancelForcedAlarm = 'Cancel Forced Alarm';
|
$zmSlangCancelForcedAlarm = 'Cancel Forced Alarm';
|
||||||
$zmSlangCanFocusAbs = 'Can Focus Absolute';
|
$zmSlangCanFocusAbs = 'Can Focus Absolute';
|
||||||
$zmSlangCanFocus = 'Can Focus';
|
$zmSlangCanFocus = 'Can Focus';
|
||||||
$zmSlangCanFocusCon = 'Can Focus Continuous';
|
$zmSlangCanFocusCon = 'Can Focus Continuous';
|
||||||
|
@ -299,7 +299,7 @@ $zmSlangFirst = 'First';
|
||||||
$zmSlangFlippedHori = 'Flipped Horizontally';
|
$zmSlangFlippedHori = 'Flipped Horizontally';
|
||||||
$zmSlangFlippedVert = 'Flipped Vertically';
|
$zmSlangFlippedVert = 'Flipped Vertically';
|
||||||
$zmSlangFocus = 'Focus';
|
$zmSlangFocus = 'Focus';
|
||||||
$zmSlangForceAlarm = 'Force Alarm';
|
$zmSlangForceAlarm = 'Force Alarm';
|
||||||
$zmSlangFormat = 'Format';
|
$zmSlangFormat = 'Format';
|
||||||
$zmSlangFPS = 'fps';
|
$zmSlangFPS = 'fps';
|
||||||
$zmSlangFPSReportInterval = 'FPS Report Interval';
|
$zmSlangFPSReportInterval = 'FPS Report Interval';
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
if ( !canView( 'Stream' ) )
|
||||||
|
{
|
||||||
|
$view = "error";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_reporting( E_ALL );
|
||||||
|
|
||||||
|
define( "MSG_TIMEOUT", 2.0 );
|
||||||
|
define( "MSG_DATA_SIZE", 4+256 );
|
||||||
|
|
||||||
|
header("Content-type: text/plain" );
|
||||||
|
|
||||||
|
if ( canEdit( 'Monitors' ) )
|
||||||
|
{
|
||||||
|
$zmu_command = getZmuCommand( " -m ".$_REQUEST['id'] );
|
||||||
|
|
||||||
|
switch ( $_REQUEST['command'] )
|
||||||
|
{
|
||||||
|
case "disableAlarms" :
|
||||||
|
{
|
||||||
|
$zmu_command .= " -n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "enableAlarms" :
|
||||||
|
{
|
||||||
|
$zmu_command .= " -c";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "forceAlarm" :
|
||||||
|
{
|
||||||
|
$zmu_command .= " -a";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "cancelForcedAlarm" :
|
||||||
|
{
|
||||||
|
$zmu_command .= " -c";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default :
|
||||||
|
{
|
||||||
|
$response['result'] = 'Error';
|
||||||
|
$response['message'] = "Unexpected command '".$_REQUEST['command']."'";
|
||||||
|
echo jsValue( $response );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$response['result'] = 'Ok';
|
||||||
|
error_log( $zmu_command );
|
||||||
|
$response['message'] = exec( escapeshellcmd( $zmu_command ) );
|
||||||
|
echo jsValue( $response );
|
||||||
|
|
||||||
|
?>
|
|
@ -69,7 +69,7 @@ elseif ( $_REQUEST['action'] == "delete" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response['status'] = 'Ok';
|
$response['result'] = 'Ok';
|
||||||
$response['refreshParent'] = $refresh_parent;
|
$response['refreshParent'] = $refresh_parent;
|
||||||
|
|
||||||
header("Content-type: text/plain" );
|
header("Content-type: text/plain" );
|
||||||
|
|
|
@ -248,8 +248,8 @@ switch( $_REQUEST['layout'] )
|
||||||
case 'json' :
|
case 'json' :
|
||||||
{
|
{
|
||||||
header("Content-type: text/plain" );
|
header("Content-type: text/plain" );
|
||||||
$result = array( $_REQUEST['entity'] => $data );
|
$response = array( 'result'=>'Ok', $_REQUEST['entity'] => $data );
|
||||||
echo jsValue( $result );
|
echo jsValue( $response );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'text' :
|
case 'text' :
|
||||||
|
|
|
@ -106,7 +106,7 @@ switch ( $data['type'] )
|
||||||
{
|
{
|
||||||
case MSG_DATA_WATCH :
|
case MSG_DATA_WATCH :
|
||||||
{
|
{
|
||||||
$data = unpack( "ltype/dfps/istate/ilevel/Cdelayed/Cpaused/C/C/irate/ddelay/izoom", $msg );
|
$data = unpack( "ltype/dfps/istate/ilevel/Cdelayed/Cpaused/C/C/irate/ddelay/izoom/Cenabled/Cforced", $msg );
|
||||||
$data['fps'] = sprintf( "%.2f", $data['fps'] );
|
$data['fps'] = sprintf( "%.2f", $data['fps'] );
|
||||||
$data['rate'] /= 100;
|
$data['rate'] /= 100;
|
||||||
$data['delay'] = sprintf( "%.2f", $data['delay'] );
|
$data['delay'] = sprintf( "%.2f", $data['delay'] );
|
||||||
|
@ -123,12 +123,14 @@ switch ( $data['type'] )
|
||||||
}
|
}
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
error_log( "Unexpected received message type $type" );
|
error_log( "Unexpected received message type '$type'" );
|
||||||
|
$response = array( 'result'=>'Error', 'message' => "Unexpected received message type '$type'" );
|
||||||
|
echo jsValue( $response );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = array( 'status' => $data );
|
$response = array( 'result'=>'Ok', 'status' => $data );
|
||||||
echo jsValue( $response );
|
echo jsValue( $response );
|
||||||
|
|
||||||
socket_close( $socket );
|
socket_close( $socket );
|
Loading…
Reference in New Issue