Merge branch 'master' of github.com:ZoneMinder/zoneminder

This commit is contained in:
Isaac Connor 2020-09-04 14:58:48 -04:00
commit 62f78bfeb7
10 changed files with 74 additions and 116 deletions

View File

@ -61,10 +61,10 @@ function MonitorStream(monitorData) {
};
this.pause = function() {
this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_PAUSE);
}
};
this.play = function() {
this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_PLAY);
}
};
this.eventHandler = function(event) {
console.log(event);
@ -91,8 +91,9 @@ function MonitorStream(monitorData) {
};
this.setStateClass = function(element, stateClass) {
if ( !element )
if ( !element ) {
return;
}
if ( !element.hasClass( stateClass ) ) {
if ( stateClass != 'alarm' ) {
element.removeClass('alarm');
@ -158,21 +159,23 @@ function MonitorStream(monitorData) {
}
if ( (
(typeof COMPACT_MONTAGE === 'undefined')
||
!COMPACT_MONTAGE)
&& (this.type != 'WebSite')
(typeof COMPACT_MONTAGE === 'undefined') ||
!COMPACT_MONTAGE) &&
(this.type != 'WebSite')
) {
fpsValue = $('fpsValue'+this.id);
if ( fpsValue )
if ( fpsValue ) {
fpsValue.set('text', this.status.fps);
}
stateValue = $('stateValue'+this.id);
if ( stateValue )
if ( stateValue ) {
stateValue.set('text', stateStrings[this.alarmState]);
}
monitorState = $('monitorState'+this.id);
if ( monitorState )
if ( monitorState ) {
this.setStateClass(monitorState, stateClass);
}
}
this.setStateClass($('monitor'+this.id), stateClass);

View File

@ -154,7 +154,7 @@ if ( !$Event->Id() ) {
human_filesize($Event->DiskSpace(null)) . ' on ' . validHtmlStr($Event->Storage()->Name()).
( $Event->SecondaryStorageId() ? ', '.validHtmlStr($Event->SecondaryStorage()->Name()) : '' )
?></span>
<div id="closeWindow"><a href="#" data-on-click="<?php echo $popup ? 'window.close()' : 'window.history.back();return false;' ?>"><?php echo $popup ? translate('Close') : translate('Back') ?></a></div>
<div id="closeWindow"><a href="#" data-on-click="<?php echo $popup ? 'closeWindow' : 'backWindow' ?>"><?php echo $popup ? translate('Close') : translate('Back') ?></a></div>
</div>
<div id="menuBar1">
<div id="nameControl">

View File

@ -22,8 +22,7 @@ function setButtonStates( element ) {
var checked = 0;
for ( var i=0; i < form.elements.length; i++ ) {
if (
form.elements[i].type=="checkbox"
&&
form.elements[i].type=="checkbox" &&
form.elements[i].name=="markMids[]"
) {
var tr = $j(form.elements[i]).closest("tr");
@ -62,10 +61,8 @@ function cloneMonitor(element) {
// get the value of the first checkbox
for ( var i = 0; i < form.elements.length; i++ ) {
if (
form.elements[i].type == "checkbox"
&&
form.elements[i].name == "markMids[]"
&&
form.elements[i].type == "checkbox" &&
form.elements[i].name == "markMids[]" &&
form.elements[i].checked
) {
monitorId = form.elements[i].value;
@ -83,10 +80,8 @@ function editMonitor( element ) {
for ( var i = 0; i < form.elements.length; i++ ) {
if (
form.elements[i].type == "checkbox"
&&
form.elements[i].name == "markMids[]"
&&
form.elements[i].type == "checkbox" &&
form.elements[i].name == "markMids[]" &&
form.elements[i].checked
) {
monitorIds.push( form.elements[i].value );
@ -118,10 +113,8 @@ function selectMonitor(element) {
var url = thisUrl+'?view=console';
for ( var i = 0; i < form.elements.length; i++ ) {
if (
form.elements[i].type == 'checkbox'
&&
form.elements[i].name == 'markMids[]'
&&
form.elements[i].type == 'checkbox' &&
form.elements[i].name == 'markMids[]' &&
form.elements[i].checked
) {
url += '&MonitorId[]='+form.elements[i].value;
@ -135,7 +128,6 @@ function reloadWindow() {
}
function initPage() {
reloadWindow.periodical(consoleRefreshTimeout);
if ( showVersionPopup ) {
window.location.assign('?view=version');
@ -177,7 +169,7 @@ function initPage() {
function_form.elements['newFunction'].value = monitor.Function;
function_form.elements['newEnabled'].checked = monitor.Enabled;
function_form.elements['mid'].value = mid;
document.getElementById('function_monitor_name').innerHTML = monitor.Name;;
document.getElementById('function_monitor_name').innerHTML = monitor.Name;
$j('#modalFunction').modal('show');
});

View File

@ -4,12 +4,9 @@ function validateForm( form ) {
// If "Can Move" is enabled, then the end user must also select at least one of the other check boxes (excluding Can Move Diagonally)
if ( form.elements['newControl[CanMove]'].checked ) {
if ( !(
form.elements['newControl[CanMoveCon]'].checked
||
form.elements['newControl[CanMoveRel]'].checked
||
form.elements['newControl[CanMoveAbs]'].checked
||
form.elements['newControl[CanMoveCon]'].checked ||
form.elements['newControl[CanMoveRel]'].checked ||
form.elements['newControl[CanMoveAbs]'].checked ||
form.elements['newControl[CanMoveMap]'].checked
) ) {
errors[errors.length] = 'In addition to "Can Move", you also must select at least one of: "Can Move Mapped", "Can Move Absolute", "Can Move Relative", or "Can Move Continuous"';
@ -17,14 +14,10 @@ function validateForm( form ) {
} else {
// Now lets check for the opposite condition. If any of the boxes below Can Move are checked, but Can Move is not checked then signal an error
if ( form.elements['newControl[CanMoveCon]'].checked
||
form.elements['newControl[CanMoveRel]'].checked
||
form.elements['newControl[CanMoveAbs]'].checked
||
form.elements['newControl[CanMoveMap]'].checked
||
if ( form.elements['newControl[CanMoveCon]'].checked ||
form.elements['newControl[CanMoveRel]'].checked ||
form.elements['newControl[CanMoveAbs]'].checked ||
form.elements['newControl[CanMoveMap]'].checked ||
form.elements['newControl[CanMoveDiag]'].checked
) {
errors[errors.length] = '"Can Move" must also be selected if any one of the movement types are selected.';
@ -33,10 +26,8 @@ function validateForm( form ) {
// If "Can Zoom" is enabled, then the end user must also select at least one of the other check boxes
if ( form.elements['newControl[CanZoom]'].checked ) {
if ( !(
form.elements['newControl[CanZoomCon]'].checked
||
form.elements['newControl[CanZoomRel]'].checked
||
form.elements['newControl[CanZoomCon]'].checked ||
form.elements['newControl[CanZoomRel]'].checked ||
form.elements['newControl[CanZoomAbs]'].checked
) ) {
errors[errors.length] = 'In addition to "Can Zoom", you also must select at least one of: "Can Zoom Absolute", "Can Zoom Relative", or "Can Zoom Continuous"';
@ -44,10 +35,8 @@ function validateForm( form ) {
} else {
// Now lets check for the opposite condition. If any of the boxes below Can Zoom are checked, but Can Zoom is not checked then signal an error
if ( form.elements['newControl[CanZoomCon]'].checked
||
form.elements['newControl[CanZoomRel]'].checked
||
if ( form.elements['newControl[CanZoomCon]'].checked ||
form.elements['newControl[CanZoomRel]'].checked ||
form.elements['newControl[CanZoomAbs]'].checked
) {
errors[errors.length] = '"Can Move" must also be selected if any one of the zoom types are selected.';
@ -56,10 +45,8 @@ function validateForm( form ) {
// If "Can Zoom" is enabled, then the end user must also select at least one of the other check boxes
if ( form.elements['newControl[CanFocus]'].checked ) {
if ( !(
form.elements['newControl[CanFocusCon]'].checked
||
form.elements['newControl[CanFocusRel]'].checked
||
form.elements['newControl[CanFocusCon]'].checked ||
form.elements['newControl[CanFocusRel]'].checked ||
form.elements['newControl[CanFocusAbs]'].checked
) ) {
errors[errors.length] = 'In addition to "Can Focus", you also must select at least one of: "Can Focus Absolute", "Can Focus Relative", or "Can Focus Continuous"';
@ -67,10 +54,8 @@ function validateForm( form ) {
} else {
// Now lets check for the opposite condition. If any of the boxes below Can Zoom are checked, but Can Zoom is not checked then signal an error
if ( form.elements['newControl[CanFocusCon]'].checked
||
form.elements['newControl[CanFocusRel]'].checked
||
if ( form.elements['newControl[CanFocusCon]'].checked ||
form.elements['newControl[CanFocusRel]'].checked ||
form.elements['newControl[CanFocusAbs]'].checked
) {
errors[errors.length] = '"Can Focus" must also be selected if any one of the focus types are selected.';
@ -79,10 +64,8 @@ function validateForm( form ) {
// If "Can White" is enabled, then the end user must also select at least one of the other check boxes
if ( form.elements['newControl[CanWhite]'].checked ) {
if ( !(
form.elements['newControl[CanWhiteCon]'].checked
||
form.elements['newControl[CanWhiteRel]'].checked
||
form.elements['newControl[CanWhiteCon]'].checked ||
form.elements['newControl[CanWhiteRel]'].checked ||
form.elements['newControl[CanWhiteAbs]'].checked
) ) {
errors[errors.length] = 'In addition to "Can White Balance", you also must select at least one of: "Can White Bal Absolute", "Can White Bal Relative", or "Can White Bal Continuous"';
@ -90,10 +73,8 @@ function validateForm( form ) {
} else {
// Now lets check for the opposite condition. If any of the boxes below Can Zoom are checked, but Can Zoom is not checked then signal an error
if ( form.elements['newControl[CanWhiteCon]'].checked
||
form.elements['newControl[CanWhiteRel]'].checked
||
if ( form.elements['newControl[CanWhiteCon]'].checked ||
form.elements['newControl[CanWhiteRel]'].checked ||
form.elements['newControl[CanWhiteAbs]'].checked
) {
errors[errors.length] = '"Can White Balance" must also be selected if any one of the white balance types are selected.';
@ -103,10 +84,8 @@ function validateForm( form ) {
// If "Can Iris" is enabled, then the end user must also select at least one of the other check boxes
if ( form.elements['newControl[CanIris]'].checked ) {
if ( !(
form.elements['newControl[CanIrisCon]'].checked
||
form.elements['newControl[CanIrisRel]'].checked
||
form.elements['newControl[CanIrisCon]'].checked ||
form.elements['newControl[CanIrisRel]'].checked ||
form.elements['newControl[CanIrisAbs]'].checked
) ) {
errors[errors.length] = 'In addition to "Can Iris", you also must select at least one of: "Can Iris Absolute", "Can Iris Relative", or "Can Iris Continuous"';
@ -114,10 +93,8 @@ function validateForm( form ) {
} else {
// Now lets check for the opposite condition. If any of the boxes below Can Zoom are checked, but Can Zoom is not checked then signal an error
if ( form.elements['newControl[CanIrisCon]'].checked
||
form.elements['newControl[CanIrisRel]'].checked
||
if ( form.elements['newControl[CanIrisCon]'].checked ||
form.elements['newControl[CanIrisRel]'].checked ||
form.elements['newControl[CanIrisAbs]'].checked
) {
errors[errors.length] = '"Can Iris" must also be selected if any one of the iris types are selected.';

View File

@ -29,11 +29,11 @@ function exportProgress() {
function exportResponse(respObj, respText) {
console.log(respObj);
window.location.replace(
thisUrl+'?view='+currentView+'&'+eidParm
+'&exportFormat='+respObj.exportFormat
+'&exportFile='+respObj.exportFile
+'&generated='+((respObj.result=='Ok')?1:0)
+'&connkey='+connkey
thisUrl+'?view='+currentView+'&'+eidParm+
'&exportFormat='+respObj.exportFormat+
'&exportFile='+respObj.exportFile+
'&generated='+((respObj.result=='Ok')?1:0)+
'&connkey='+connkey
);
}

View File

@ -18,10 +18,8 @@ function configureExportButton(element) {
form.elements['exportImages'].checked ||
form.elements['exportVideo'].checked ||
form.elements['exportMisc'].checked
)
&&
( form.elements['exportFormat'][0].checked || form.elements['exportFormat'][1].checked )
&&
) &&
( form.elements['exportFormat'][0].checked || form.elements['exportFormat'][1].checked ) &&
( form.elements['exportCompress'][0].checked || form.elements['exportCompress'][1].checked )
);
}

View File

@ -48,22 +48,14 @@ function validateForm(form) {
}
} else if ( form.elements['filter[Background]'].checked ) {
if ( ! (
form.elements['filter[AutoArchive]'].checked
||
form.elements['filter[UpdateDiskSpace]'].checked
||
form.elements['filter[AutoVideo]'].checked
||
form.elements['filter[AutoEmail]'].checked
||
form.elements['filter[AutoMessage]'].checked
||
form.elements['filter[AutoExecute]'].checked
||
form.elements['filter[AutoDelete]'].checked
||
form.elements['filter[AutoCopy]'].checked
||
form.elements['filter[AutoArchive]'].checked ||
form.elements['filter[UpdateDiskSpace]'].checked ||
form.elements['filter[AutoVideo]'].checked ||
form.elements['filter[AutoEmail]'].checked ||
form.elements['filter[AutoMessage]'].checked ||
form.elements['filter[AutoExecute]'].checked ||
form.elements['filter[AutoDelete]'].checked ||
form.elements['filter[AutoCopy]'].checked ||
form.elements['filter[AutoMove]'].checked
) ) {
alert('You have chosen to run this filter in the background but not selected any actions.');

View File

@ -48,8 +48,7 @@ function evaluateLoadTimes() {
function getFrame(monId, time, last_Frame) {
if ( last_Frame ) {
if (
(last_Frame.TimeStampSecs <= time)
&&
(last_Frame.TimeStampSecs <= time) &&
(last_Frame.EndTimeStampSecs >= time)
) {
return last_Frame;
@ -104,12 +103,11 @@ function getFrame(monId, time, last_Frame) {
continue;
}
if (
e.FramesById[frame_id].TimeStampSecs == time
|| (
e.FramesById[frame_id].TimeStampSecs < time
&& (
(!e.FramesById[frame_id].NextTimeStampSecs) // only if event.EndTime is null
||
e.FramesById[frame_id].TimeStampSecs == time ||
(
e.FramesById[frame_id].TimeStampSecs < time &&
(
(!e.FramesById[frame_id].NextTimeStampSecs) || // only if event.EndTime is null
(e.FramesById[frame_id].NextTimeStampSecs > time)
)
)

View File

@ -290,8 +290,6 @@ function getCoordString() {
function updateZoneImage() {
var imageFrame = $('imageFrame');
var style = imageFrame.currentStyle || window.getComputedStyle(imageFrame);
var padding_left = style.paddingLeft.toInt();
var padding_top = style.paddingTop.toInt();
scale = (imageFrame.clientWidth - ( style.paddingLeft.toInt() + style.paddingRight.toInt() )) / maxX;
var SVG = $('zoneSVG');
@ -301,7 +299,7 @@ function updateZoneImage() {
var Point = SVG.createSVGPoint();
Point.x = zone['Points'][i].x;
//+ 2*padding_left;
Point.y = zone['Points'][i].y;// + 2*padding_top;
Point.y = zone['Points'][i].y;// + 2*padding_top;
Poly.points.appendItem(Point);
}
}
@ -444,7 +442,7 @@ function drawZonePoints() {
console.log("Scale = width: " + imageFrame.clientWidth);
for ( var i = 0; i < zone['Points'].length; i++ ) {
console.log("scale: " + scale + " x " + zone['Points'][i].x + " = " + Math.round(zone['Points'][i].x * scale));
console.log("scale: " + scale + " x " + zone['Points'][i].x + " = " + Math.round(zone['Points'][i].x * scale));
var div = new Element('div', {
'id': 'point'+i,
'data-point-index': i,
@ -474,8 +472,8 @@ function drawZonePoints() {
for ( var i = 0; i < zone['Points'].length; i++ ) {
var row;
row = new Element('tr', {'id': 'row'+i});
row.addEvent('mouseover', highlightOn.pass(i));
row.addEvent('mouseout', highlightOff.pass(i));
row.addEvent('mouseover', highlightOn.pass(i));
row.addEvent('mouseout', highlightOff.pass(i));
//row.onmouseover = highlightOn.pass(i)
//row.onmouseout = window['highlightOff'].bind(div, div);
var cell = new Element('td');
@ -664,16 +662,16 @@ function initPage() {
}
document.querySelectorAll('#imageFrame img').forEach(function(el) {
el.addEventListener("load", imageLoadEvent, { passive: true });
el.addEventListener("load", imageLoadEvent, {passive: true});
});
window.addEventListener("resize", drawZonePoints, { passive: true });
window.addEventListener("resize", drawZonePoints, {passive: true});
} // initPage
function imageLoadEvent() {
// We only need this event on the first image load to set dimensions.
// Turn it off after it has been called.
document.querySelectorAll('#imageFrame img').forEach(function(el) {
el.removeEventListener("load", imageLoadEvent, { passive: true });
el.removeEventListener("load", imageLoadEvent, {passive: true});
});
drawZonePoints();
}

View File

@ -12,7 +12,7 @@ function streamCmdQuit( ) {
var monitors = new Array();
function initPage() {
for ( var i = 0, length = monitorData.length; i < length; i++ ) {
for ( var i = 0, length = monitorData.length; i < length; i++ ) {
monitors[i] = new MonitorStream(monitorData[i]);
// Start the fps and status updates. give a random delay so that we don't assault the server