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

pull/3867/head
Isaac Connor 2024-03-14 12:43:47 -04:00
commit 0c49884956
4 changed files with 40 additions and 36 deletions

View File

@ -2534,15 +2534,10 @@ our @options = (
the events may be shorter than the section length if an alarm the events may be shorter than the section length if an alarm
has occurred. has occurred.
`, `,
type => $types{boolean},
type => { type => {
db_type =>'string', db_type =>'string',
hint =>'time|idle|alarm', hint =>'time|duration|idle|alarm',
pattern =>qr|^([tia])|i, pattern =>qr/^(time|duration|idle|alarm)/,
format =>q( ($1 =~ /^t/)
? 'time'
: ($1 =~ /^i/ ? 'idle' : 'time' )
)
}, },
category => 'config', category => 'config',
}, },

View File

@ -1995,6 +1995,8 @@ bool Monitor::Analyse() {
// Need to guard around event creation/deletion from Reload() // Need to guard around event creation/deletion from Reload()
std::lock_guard<std::mutex> lck(event_mutex); std::lock_guard<std::mutex> lck(event_mutex);
int score = 0; int score = 0;
// Track this separately as alarm_frame_count messes with the logic
int motion_score = -1;
// if we have been told to be OFF, then we are off and don't do any processing. // if we have been told to be OFF, then we are off and don't do any processing.
if (trigger_data->trigger_state != TriggerState::TRIGGER_OFF) { if (trigger_data->trigger_state != TriggerState::TRIGGER_OFF) {
@ -2139,7 +2141,6 @@ bool Monitor::Analyse() {
Event::StringSet zoneSet; Event::StringSet zoneSet;
if (snap->image) { if (snap->image) {
int motion_score = 0;
// decoder may not have been able to provide an image // decoder may not have been able to provide an image
if (!ref_image.Buffer()) { if (!ref_image.Buffer()) {
Debug(1, "Assigning instead of Detecting"); Debug(1, "Assigning instead of Detecting");
@ -2152,6 +2153,7 @@ bool Monitor::Analyse() {
} else { } else {
// didn't assign, do motion detection maybe and blending definitely // didn't assign, do motion detection maybe and blending definitely
if (!(analysis_image_count % (motion_frame_skip+1))) { if (!(analysis_image_count % (motion_frame_skip+1))) {
motion_score = 0;
Debug(1, "Detecting motion on image %d, image %p", snap->image_index, snap->image); Debug(1, "Detecting motion on image %d, image %p", snap->image_index, snap->image);
// Get new score. // Get new score.
if ((analysis_image == ANALYSISIMAGE_YCHANNEL) && snap->y_image) { if ((analysis_image == ANALYSISIMAGE_YCHANNEL) && snap->y_image) {
@ -2177,7 +2179,7 @@ bool Monitor::Analyse() {
if (zone.AlarmImage()) if (zone.AlarmImage())
snap->analysis_image->Overlay(*(zone.AlarmImage())); snap->analysis_image->Overlay(*(zone.AlarmImage()));
} }
Debug(1, "Setting zone score %d to %d", zone_index, zone.Score()); Debug(4, "Setting score for zone %d to %d", zone_index, zone.Score());
zone_scores[zone_index] = zone.Score(); zone_index ++; zone_scores[zone_index] = zone.Score(); zone_index ++;
} }
//alarm_image.Assign(*(snap->analysis_image)); //alarm_image.Assign(*(snap->analysis_image));
@ -2258,7 +2260,7 @@ bool Monitor::Analyse() {
} else { } else {
Debug(1, "!score state=%s, snap->score %d", State_Strings[state].c_str(), snap->score); Debug(1, "!score state=%s, snap->score %d", State_Strings[state].c_str(), snap->score);
// We only go out of alarm if we actually did motion detection or aren't doing any. // We only go out of alarm if we actually did motion detection or aren't doing any.
if ((snap->score >= 0) or (shared_data->analysing != ANALYSING_ALWAYS)) { if ((motion_score >= 0) or (shared_data->analysing != ANALYSING_ALWAYS)) {
alert_to_alarm_frame_count = alarm_frame_count; // load same value configured for alarm_frame_count alert_to_alarm_frame_count = alarm_frame_count; // load same value configured for alarm_frame_count
if (state == ALARM) { if (state == ALARM) {

View File

@ -31,18 +31,27 @@ input.large {
} }
#sidebar { #sidebar {
overflow-y: auto;
min-width: 160px; min-width: 160px;
height: 100vh;
} }
#optionsContainer { #optionsContainer {
} }
#options { #options {
margin-right: -15px; /* margin-right: -15px;*/ /* you shouldn't do this for the sake of shifting the scrool bar, it breaks the style in different places. done differently*/
overflow-y: auto; width: 100%;
height: 100%;
} }
body.sticky #options {
height: calc(100% - 50px); /* It's bad, but it's temporary */
overflow-y: auto;
}
body.sticky #sidebar {
height: 100%;
overflow-y: auto;
}
#options div.col-md { #options div.col-md {
text-align: left; text-align: left;
} }
@ -97,14 +106,10 @@ input[name="newStorage[Url]"] {
} }
form { form {
/* height: 100% is to make scrollbars work in #options */ /* display: flex;*/
display: flex; /* flex-direction: column;*/
flex-direction: column;
height: 100%; height: 100%;
/*
* Why extra padding at top?
padding-top: 2rem; padding-top: 2rem;
*/
} }
@media screen and (max-width:767px) { @media screen and (max-width:767px) {

View File

@ -310,14 +310,15 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $
<input type="hidden" name="view" value="<?php echo $view ?>"/> <input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="tab" value="<?php echo $tab ?>"/> <input type="hidden" name="tab" value="<?php echo $tab ?>"/>
<input type="hidden" name="action" value="options"/> <input type="hidden" name="action" value="options"/>
<div class="row"> <div class="row pb-2">
<div class="col"> <div class="col">
<div id="contentButtons"> <div id="contentButtons">
<button type="submit" <?php echo $canEdit?'':' disabled="disabled"' ?>><?php echo translate('Save') ?></button> <button type="submit" <?php echo $canEdit?'':' disabled="disabled"' ?>><?php echo translate('Save') ?></button>
</div> </div>
</div> </div>
</div> </div>
<div id="options"> <div class="row h-100">
<div id="options">
<?php <?php
if (!isset($configCats[$tab])) { if (!isset($configCats[$tab])) {
echo 'There are no config entries for category '.$tab.'.<br/>'; echo 'There are no config entries for category '.$tab.'.<br/>';
@ -327,9 +328,9 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $
$optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt']; $optionPromptText = !empty($OLANG[$shortName])?$OLANG[$shortName]['Prompt']:$value['Prompt'];
$optionCanEdit = $canEdit && !$value['System']; $optionCanEdit = $canEdit && !$value['System'];
?> ?>
<div class="form-group form-row <?php echo $name ?>"> <div class="form-group form-row <?php echo $name ?>">
<label for="<?php echo $name ?>" class="col-md-4 control-label text-md-right"><?php echo $shortName ?></label> <label for="<?php echo $name ?>" class="col-md-4 control-label text-md-right"><?php echo $shortName ?></label>
<div class="col-md"> <div class="col-md">
<?php <?php
if ($value['Type'] == 'boolean') { if ($value['Type'] == 'boolean') {
echo '<input type="checkbox" id="'.$name.'" name="newConfig['.$name.']" value="1"'. echo '<input type="checkbox" id="'.$name.'" name="newConfig['.$name.']" value="1"'.
@ -362,10 +363,10 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $
$optionLabel = $optionValue = $option; $optionLabel = $optionValue = $option;
} }
?> ?>
<label class="font-weight-bold form-control-sm"> <label class="font-weight-bold form-control-sm">
<input type="radio" id="<?php echo $name.'_'.preg_replace('/[^a-zA-Z0-9]/', '', $optionValue) ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo $optionValue ?>"<?php if ( $value['Value'] == $optionValue ) { ?> checked="checked"<?php } ?><?php echo $optionCanEdit?'':' disabled="disabled"' ?>/> <input type="radio" id="<?php echo $name.'_'.preg_replace('/[^a-zA-Z0-9]/', '', $optionValue) ?>" name="newConfig[<?php echo $name ?>]" value="<?php echo $optionValue ?>"<?php if ( $value['Value'] == $optionValue ) { ?> checked="checked"<?php } ?><?php echo $optionCanEdit?'':' disabled="disabled"' ?>/>
<?php echo htmlspecialchars($optionLabel) ?> <?php echo htmlspecialchars($optionLabel) ?>
</label> </label>
<?php <?php
} # end foreach option } # end foreach option
} # end if count options > 3 } # end if count options > 3
@ -387,14 +388,15 @@ foreach (array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as $
echo '<p class="warning">Note: This value has been overriden via configuration files in '.ZM_CONFIG. ' or ' . ZM_CONFIG_SUBDIR.'.<br/>The overriden value is: '.constant($name).'</p>'.PHP_EOL; echo '<p class="warning">Note: This value has been overriden via configuration files in '.ZM_CONFIG. ' or ' . ZM_CONFIG_SUBDIR.'.<br/>The overriden value is: '.constant($name).'</p>'.PHP_EOL;
} }
?> ?>
<span class="form-text form-control-sm"><?php echo validHtmlStr($optionPromptText); echo makeHelpLink($name) ?></span> <span class="form-text form-control-sm"><?php echo validHtmlStr($optionPromptText); echo makeHelpLink($name) ?></span>
</div><!-- End .col-md --> </div><!-- End .col-md -->
</div><!-- End .form-group --> </div><!-- End .form-group -->
<?php <?php
} # end foreach config entry in the category } # end foreach config entry in the category
} # end if category exists } # end if category exists
?> ?>
</div><!--options--> </div><!--options-->
</div><!-- .row h-100 -->
</form> </form>
<?php <?php
} }