Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
commit
079d1be3b3
|
@ -203,11 +203,10 @@ sub Sql {
|
|||
$self->{Sql} .= "weekday( E.EndTime )";
|
||||
|
||||
#
|
||||
} elsif ( $term->{attr} eq 'EventExists' ) {
|
||||
push @{$self->{PreConditions}}, $term;
|
||||
} elsif ( $term->{attr} eq 'ExistsInFileSystem' ) {
|
||||
push @{$self->{PostSQLConditions}}, $term;
|
||||
} elsif ( $term->{attr} eq 'DiskSpace' ) {
|
||||
$self->{Sql} .= 'E.DiskSpace';
|
||||
push @{$self->{PostConditions}}, $term;
|
||||
} elsif ( $term->{attr} eq 'DiskPercent' ) {
|
||||
$self->{Sql} .= 'zmDiskPercent';
|
||||
$self->{HasDiskPercent} = !undef;
|
||||
|
|
|
@ -50,6 +50,9 @@ class Event extends ZM_Object {
|
|||
public static function clear_cache() {
|
||||
return ZM_Object::_clear_cache(get_class());
|
||||
}
|
||||
public function remove_from_cache() {
|
||||
return ZM_Object::_remove_from_cache(get_class(), $this);
|
||||
}
|
||||
|
||||
public function Storage( $new = null ) {
|
||||
if ( $new ) {
|
||||
|
|
|
@ -40,8 +40,11 @@ class Filter extends ZM_Object {
|
|||
public function sql() {
|
||||
if ( ! isset($this->_sql) ) {
|
||||
foreach ( $this->FilterTerms() as $term ) {
|
||||
if ( ! ($term->is_pre_sql() or $term->is_post_sql()) )
|
||||
if ( ! ($term->is_pre_sql() or $term->is_post_sql()) ) {
|
||||
$this->_sql .= $term->sql();
|
||||
} else {
|
||||
$this->_sql .= '1';
|
||||
}
|
||||
} # end foreach term
|
||||
}
|
||||
return $this->_sql;
|
||||
|
|
|
@ -164,13 +164,13 @@ class FilterTerm {
|
|||
case 'IS' :
|
||||
# Odd will be replaced with 1
|
||||
# Even will be replaced with 0
|
||||
if ( $this->value == 'Odd' or $this->value == 'Even' ) {
|
||||
if ( $this->val == 'Odd' or $this->val == 'Even' ) {
|
||||
return ' % 2 = ';
|
||||
} else {
|
||||
return ' IS ';
|
||||
}
|
||||
case 'IS NOT' :
|
||||
if ( $this->value == 'Odd' or $this->value == 'Even' ) {
|
||||
if ( $this->val == 'Odd' or $this->val == 'Even' ) {
|
||||
return ' % 2 = ';
|
||||
}
|
||||
return ' IS NOT ';
|
||||
|
@ -182,7 +182,7 @@ class FilterTerm {
|
|||
/* Some terms don't have related SQL */
|
||||
public function sql() {
|
||||
if ( $this->attr == 'ExistsInFileSystem' ) {
|
||||
return '';
|
||||
return '1';
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
|
|
|
@ -141,6 +141,11 @@ class ZM_Object {
|
|||
global $object_cache;
|
||||
$object_cache[$class] = array();
|
||||
}
|
||||
public function _remove_from_cache($class, $object) {
|
||||
global $object_cache;
|
||||
unset($object_cache[$class][$object->Id()]);
|
||||
Logger::Debug("Unsset $class " . $object->Id() . " " . count($object_cache[$class]));
|
||||
}
|
||||
|
||||
public static function Objects_Indexed_By_Id($class) {
|
||||
$results = array();
|
||||
|
|
|
@ -95,6 +95,7 @@ if ( isset($_REQUEST['object']) and ( $_REQUEST['object'] == 'filter' ) ) {
|
|||
} else if ( $filter->Background() ) {
|
||||
$filter->control('start');
|
||||
}
|
||||
$redirect = '?view=filter&Id='.$filter->Id();
|
||||
|
||||
} else if ( $action == 'control' ) {
|
||||
if ( $_REQUEST['command'] == 'start'
|
||||
|
|
|
@ -286,10 +286,10 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
|||
$imgHTML='';
|
||||
if ( ZM_WEB_LIST_THUMBS && ($monitor['Status'] == 'Connected') && $running ) {
|
||||
$options = array();
|
||||
$ratio_factor = $Monitor->Height() / $Monitor->Width();
|
||||
$ratio_factor = $Monitor->ViewHeight() / $Monitor->ViewWidth();
|
||||
$options['width'] = ZM_WEB_LIST_THUMB_WIDTH;
|
||||
$options['height'] = ZM_WEB_LIST_THUMB_HEIGHT ? ZM_WEB_LIST_THUMB_HEIGHT : ZM_WEB_LIST_THUMB_WIDTH*$ratio_factor;
|
||||
$options['scale'] = intval(100*ZM_WEB_LIST_THUMB_WIDTH / $Monitor->Width());
|
||||
$options['scale'] = intval(100*ZM_WEB_LIST_THUMB_WIDTH / $Monitor->ViewWidth());
|
||||
$options['mode'] = 'single';
|
||||
|
||||
$stillSrc = $Monitor->getStreamSrc($options);
|
||||
|
|
|
@ -58,7 +58,7 @@ if ( $_POST ) {
|
|||
|
||||
$failed = !$filter->test_pre_sql_conditions();
|
||||
if ( $failed ) {
|
||||
ZM\Logger::Debug("Pre conditions failed, not doing sql");
|
||||
ZM\Logger::Debug('Pre conditions failed, not doing sql');
|
||||
}
|
||||
|
||||
$results = $failed ? null : dbQuery($eventsSql);
|
||||
|
@ -189,14 +189,22 @@ xhtmlHeaders(__FILE__, translate('Events'));
|
|||
$count = 0;
|
||||
$disk_space_total = 0;
|
||||
if ( $results ) {
|
||||
$events = array();
|
||||
|
||||
while ( $event_row = dbFetchNext($results) ) {
|
||||
$event = new ZM\Event($event_row);
|
||||
|
||||
if ( !$filter->test_post_sql_conditions($event) ) {
|
||||
ZM\Logger::Debug("Failed post conditions");
|
||||
$event->remove_from_cache();
|
||||
continue;
|
||||
}
|
||||
$events[] = $event;
|
||||
if ( $limit and (count($events) > $limit) ) {
|
||||
break;
|
||||
}
|
||||
ZM\Logger::Debug("Have " . count($events) . " events, limit $limit");
|
||||
}
|
||||
foreach ( $events as $event ) {
|
||||
|
||||
$scale = max(reScale(SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
|
||||
?>
|
||||
|
@ -280,7 +288,7 @@ if ( $results ) {
|
|||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} # end foreach row
|
||||
?>
|
||||
</tbody>
|
||||
<?php
|
||||
|
|
|
@ -142,6 +142,7 @@ xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id());
|
|||
data-detail-view="true"
|
||||
data-detail-formatter="detailFormatter"
|
||||
data-show-toggle="true"
|
||||
data-show-jump-to="true"
|
||||
class="table-sm table-borderless">
|
||||
|
||||
<thead>
|
||||
|
|
|
@ -53,7 +53,7 @@ function setButtonStates( element ) {
|
|||
}
|
||||
|
||||
function addMonitor(element) {
|
||||
createPopup( '?view=monitor', 'zmMonitor0', 'monitor' );
|
||||
window.location.assign('?view=monitor');
|
||||
}
|
||||
|
||||
function cloneMonitor(element) {
|
||||
|
@ -73,7 +73,7 @@ function cloneMonitor(element) {
|
|||
}
|
||||
} // end foreach element
|
||||
if ( monitorId != -1 ) {
|
||||
createPopup( '?view=monitor&dupId='+monitorId, 'zmMonitor0', 'monitor' );
|
||||
window.location.assign('?view=monitor&dupId='+monitorId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,11 +97,11 @@ function editMonitor( element ) {
|
|||
}
|
||||
} // end foreach checkboxes
|
||||
if ( monitorIds.length == 1 ) {
|
||||
createPopup( '?view=monitor&mid='+monitorIds[0], 'zmMonitor'+monitorIds[0], 'monitor' );
|
||||
window.location.assign('?view=monitor&mid='+monitorIds[0]);
|
||||
} else if ( monitorIds.length > 1 ) {
|
||||
createPopup( '?view=monitors&'+(monitorIds.map(function(mid) {
|
||||
window.location.assign( '?view=monitors&'+(monitorIds.map(function(mid) {
|
||||
return 'mids[]='+mid;
|
||||
}).join('&')), 'zmMonitors', 'monitors' );
|
||||
}).join('&')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ function initPage() {
|
|||
|
||||
reloadWindow.periodical(consoleRefreshTimeout);
|
||||
if ( showVersionPopup ) {
|
||||
createPopup('?view=version', 'zmVersion', 'version');
|
||||
window.location.assign('?view=version');
|
||||
}
|
||||
if ( showDonatePopup ) {
|
||||
$j('#donate').modal('show');
|
||||
|
|
|
@ -68,6 +68,8 @@ function loadLocations( element ) {
|
|||
}
|
||||
|
||||
function initPage() {
|
||||
var backBtn = $j('#backBtn');
|
||||
|
||||
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
|
||||
//if ( $(protocolSelector).getTag() == 'select' )
|
||||
//updateMethods( $(protocolSelector) );
|
||||
|
@ -135,8 +137,22 @@ function initPage() {
|
|||
el.onchange = window['change_WebColour'].bind(el);
|
||||
});
|
||||
|
||||
|
||||
$j('.chosen').chosen();
|
||||
|
||||
// Don't enable the back button if there is no previous zm page to go back to
|
||||
backBtn.prop('disabled', !document.referrer.length);
|
||||
|
||||
// Manage the BACK button
|
||||
document.getElementById("backBtn").addEventListener("click", function onBackClick(evt) {
|
||||
evt.preventDefault();
|
||||
window.history.back();
|
||||
});
|
||||
|
||||
// Manage the REFRESH Button
|
||||
document.getElementById("refreshBtn").addEventListener("click", function onRefreshClick(evt) {
|
||||
evt.preventDefault();
|
||||
window.location.reload(true);
|
||||
});
|
||||
} // end function initPage()
|
||||
|
||||
function change_WebColour() {
|
||||
|
|
|
@ -32,7 +32,7 @@ global $CLANG;
|
|||
<p><?php echo sprintf( $CLANG['CurrentLogin'], $user['Username'] ) ?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<form name="contentForm" id="contentForm" method="post" action="?">
|
||||
<form name="logoutForm" id="logoutForm" method="post" action="?">
|
||||
<input type="hidden" name="view" value="logout"/>
|
||||
<button type="submit" name="action" value="logout"><?php echo translate('Logout') ?></button>
|
||||
<?php if ( ZM_USER_SELF_EDIT ) echo '<button type="submit" name="action" value="config">'.translate('Config').'</button>'.PHP_EOL; ?>
|
||||
|
|
|
@ -381,9 +381,17 @@ $codecs = array(
|
|||
|
||||
xhtmlHeaders(__FILE__, translate('Monitor').' - '.validHtmlStr($monitor->Name()));
|
||||
getBodyTopHTML();
|
||||
echo getNavBarHTML();
|
||||
?>
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<div class="d-flex flex-row justify-content-between px-3 py-1">
|
||||
|
||||
<div class="" id="toolbar" >
|
||||
<button id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
|
||||
<button id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
|
||||
<h2><?php echo translate('Monitor') ?> - <?php echo validHtmlStr($monitor->Name()) ?><?php if ( $monitor->Id() ) { ?> (<?php echo $monitor->Id()?>)<?php } ?></h2>
|
||||
<?php
|
||||
if ( canEdit('Monitors') ) {
|
||||
if ( isset($_REQUEST['dupId']) ) {
|
||||
|
@ -394,19 +402,19 @@ if ( canEdit('Monitors') ) {
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<div id="headerButtons">
|
||||
<?php echo makePopupLink('?view=monitorprobe&mid='.$monitor->Id(), 'zmMonitorProbe'.$monitor->Id(), 'monitorprobe', translate('Probe')); ?>
|
||||
<div id="">
|
||||
<?php echo makeLink('?view=monitorprobe&mid='.$monitor->Id(), translate('Probe')); ?>
|
||||
<?php
|
||||
if ( ZM_HAS_ONVIF ) {
|
||||
echo makePopupLink('?view=onvifprobe&mid='.$monitor->Id(), 'zmOnvifProbe'.$monitor->Id(), 'onvifprobe', translate('OnvifProbe'));
|
||||
echo makeLink('?view=onvifprobe&mid='.$monitor->Id(), translate('OnvifProbe'));
|
||||
}
|
||||
?>
|
||||
<?php echo makePopupLink('?view=monitorpreset&mid=' . $monitor->Id(), 'zmMonitorPreset' . $monitor->Id(), 'monitorpreset', translate('Presets')); ?>
|
||||
<?php echo makeLink('?view=monitorpreset&mid=' . $monitor->Id(), translate('Presets')); ?>
|
||||
</div>
|
||||
<?php
|
||||
} // end if canEdit('Monitors')
|
||||
?>
|
||||
<h2><?php echo translate('Monitor') ?> - <?php echo validHtmlStr($monitor->Name()) ?><?php if ( $monitor->Id() ) { ?> (<?php echo $monitor->Id()?>)<?php } ?></h2>
|
||||
|
||||
</div>
|
||||
<div id="content">
|
||||
<ul class="tabList">
|
||||
|
|
Loading…
Reference in New Issue