Corrected some Mootools issues, autoCancel => link: cancel and onComplete => onSuccess. Also fixed montage alarm state class handling

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2986 e3e1d417-86f3-4887-817a-d78f3d33393f
pull/27/merge
stan 2009-10-16 17:13:16 +00:00
parent c2e251405e
commit 97ba7a6684
5 changed files with 29 additions and 11 deletions

View File

@ -37,7 +37,7 @@ function exportEvent( form )
{ {
var parms = 'view=request&request=event&action=export'; var parms = 'view=request&request=event&action=export';
parms += '&'+$(form).toQueryString(); parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onComplete: exportResponse } ); var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse } );
query.send(); query.send();
$('exportProgress').removeClass( 'hidden' ); $('exportProgress').removeClass( 'hidden' );
$('exportProgress').setProperty( 'class', 'warnText' ); $('exportProgress').setProperty( 'class', 'warnText' );

View File

@ -14,6 +14,20 @@ function Monitor( index, id, connKey )
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this ); this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
} }
this.setStateClass = function( element, stateClass )
{
if ( !element.hasClass( stateClass ) )
{
if ( stateClass != 'alarm' )
element.removeClass( 'alarm' );
if ( stateClass != 'alert' )
element.removeClass( 'alert' );
if ( stateClass != 'idle' )
element.removeClass( 'idle' );
element.addClass( stateClass );
}
}
this.getStreamCmdResponse = function( respObj, respText ) this.getStreamCmdResponse = function( respObj, respText )
{ {
if ( this.streamCmdTimer ) if ( this.streamCmdTimer )
@ -23,6 +37,7 @@ function Monitor( index, id, connKey )
{ {
this.status = respObj.status; this.status = respObj.status;
this.alarmState = this.status.state; this.alarmState = this.status.state;
var stateClass = ""; var stateClass = "";
if ( this.alarmState == STATE_ALARM ) if ( this.alarmState == STATE_ALARM )
stateClass = "alarm"; stateClass = "alarm";
@ -35,9 +50,10 @@ function Monitor( index, id, connKey )
{ {
$('fpsValue'+this.index).set( 'text', this.status.fps ); $('fpsValue'+this.index).set( 'text', this.status.fps );
$('stateValue'+this.index).set( 'text', stateStrings[this.alarmState] ); $('stateValue'+this.index).set( 'text', stateStrings[this.alarmState] );
$('monitorState'+this.index).setProperty( 'class', stateClass ); this.setStateClass( $('monitorState'+this.index), stateClass );
} }
$('monitor'+this.index).setProperty( 'class', stateClass ); this.setStateClass( $('monitor'+this.index), stateClass );
/*Stream could be an applet so can't use moo tools*/ /*Stream could be an applet so can't use moo tools*/
var stream = document.getElementById( "liveStream"+this.id ); var stream = document.getElementById( "liveStream"+this.id );
stream.className = stateClass; stream.className = stateClass;
@ -80,13 +96,15 @@ function Monitor( index, id, connKey )
this.lastAlarmState = this.alarmState; this.lastAlarmState = this.alarmState;
} }
this.streamCmdQuery = function() this.streamCmdQuery = function( resent )
{ {
//if ( resent )
//console.log( this.connKey+": Resending" );
//this.streamCmdReq.cancel(); //this.streamCmdReq.cancel();
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, onComplete: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this ), autoCancel: true } ); 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' } );
} }
function selectLayout( element ) function selectLayout( element )

View File

@ -75,8 +75,8 @@ function frameDataResponse( respObj, respText )
loadEventImage( frame.Image.imagePath, event.Id, frame.FrameId, event.Width, event.Height ); loadEventImage( frame.Image.imagePath, event.Id, frame.FrameId, event.Width, event.Height );
} }
var eventQuery = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, autoCancel: true, onComplete: eventDataResponse } ); var eventQuery = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: eventDataResponse } );
var frameQuery = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, autoCancel: true, onComplete: frameDataResponse } ); var frameQuery = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: frameDataResponse } );
function requestFrameData( eventId, frameId ) function requestFrameData( eventId, frameId )
{ {

View File

@ -28,7 +28,7 @@ function generateVideo( form )
{ {
var parms = 'view=request&request=event&action=video'; var parms = 'view=request&request=event&action=video';
parms += '&'+$(form).toQueryString(); parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onComplete: generateVideoResponse } ); var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: generateVideoResponse } );
query.send(); query.send();
$('videoProgress').removeClass( 'hidden' ); $('videoProgress').removeClass( 'hidden' );
$('videoProgress').setProperty( 'class', 'warnText' ); $('videoProgress').setProperty( 'class', 'warnText' );

View File

@ -341,7 +341,7 @@ function getCoordString()
function updateZoneImage() function updateZoneImage()
{ {
var parms = "view=request&request=zone&action=zoneImage&mid="+zone.MonitorId+"&zid="+zone.Id+"&coords="+getCoordString(); var parms = "view=request&request=zone&action=zoneImage&mid="+zone.MonitorId+"&zid="+zone.Id+"&coords="+getCoordString();
var query = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, data: parms, onComplete: updateZoneImageResponse } ); var query = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, data: parms, onSuccess: updateZoneImageResponse } );
query.send(); query.send();
} }
@ -439,7 +439,7 @@ function drawZonePoints()
div.addEvent( 'mouseover', highlightOn.pass( i ) ); div.addEvent( 'mouseover', highlightOn.pass( i ) );
div.addEvent( 'mouseout', highlightOff.pass( i ) ); div.addEvent( 'mouseout', highlightOff.pass( i ) );
div.injectInside( $('imageFrame') ); div.injectInside( $('imageFrame') );
div.makeDraggable( { 'container': $('imageFrame'), 'onStart': setActivePoint.pass( i ), 'onComplete': fixActivePoint.pass( i ), 'onDrag': updateActivePoint.pass( i ) } ); div.makeDraggable( { 'container': $('imageFrame'), 'onStart': setActivePoint.pass( i ), 'onSuccess': fixActivePoint.pass( i ), 'onDrag': updateActivePoint.pass( i ) } );
} }
var tables = $('zonePoints').getElements( 'table' ); var tables = $('zonePoints').getElements( 'table' );