Merge pull request #56 from digital-gnome/storageareas-fixMontageReviewFilter

Montagereview filter respect groups setting
This commit is contained in:
Isaac Connor 2017-12-04 17:08:51 -05:00 committed by GitHub
commit 72a50910e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 26 deletions

View File

@ -908,9 +908,9 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
$archive = ZM_DIR_EXPORTS."/".$export_root.".tar.gz";
@unlink( $archive );
if ($exportStructure == 'flat') { //strip file paths if we choose
$command = "tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile)." --xform='s#^.+/##x'";
$command = "nice -10 tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile)." --xform='s#^.+/##x'";
} else {
$command = "tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile);
$command = "nice -10 tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile);
}
exec( $command, $output, $status );
if ( $status )
@ -926,9 +926,9 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
$archive = ZM_DIR_EXPORTS."/".$export_root.".zip";
@unlink( $archive );
if ($exportStructure == 'flat') {
$command = "cat ".escapeshellarg($listFile)." | zip -q -j ".escapeshellarg($archive)." -@";
$command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q -j ".escapeshellarg($archive)." -@";
} else {
$command = "cat ".escapeshellarg($listFile)." | zip -q ".escapeshellarg($archive)." -@";
$command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q ".escapeshellarg($archive)." -@";
}
//cat zmFileList.txt | zip -q zm_export.zip -@
//-bash: zip: command not found

View File

@ -182,18 +182,20 @@ function refreshParentWindow() {
}
}
$j.ajaxSetup ({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
if (currentView !='none') {
$j.ajaxSetup ({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
$j(document).ready(function() {
$j(document).ready(function() {
if ($j('.navbar').length) setInterval(getNavBar, navBarRefresh)
});
});
function getNavBar () {
function getNavBar () {
$j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar);
}
}
function setNavBar (data) {
function setNavBar (data) {
$j('#reload').replaceWith(data.message);
}
}
//Shows a message if there is an error in the streamObj or the stream doesn't exist. Returns true if error, false otherwise.

View File

@ -23,16 +23,18 @@ if ( !canView('Events') ) {
return;
}
if (isset($_REQUEST['filter'])) { //Handles montageReview filter
if (isset($_SESSION['montageReviewFilter'])) { //Handles montageReview filter
$eventsSql = 'SELECT E.Id FROM Events as E WHERE 1';
parseFilter($_REQUEST['filter']);
$eventsSql .= $_REQUEST['filter']['sql'];
$eventsSql .= $_SESSION['montageReviewFilter']['sql'];
$results = dbQuery($eventsSql);
$eids = [];
while ( $event_row = dbFetchNext( $results ) ) {
array_push($eids, 'eids[]='.$event_row['Id']);
}
$_REQUEST['eids'] = $eids;
session_start();
unset($_SESSION['montageReviewFilter']);
session_write_close();
}
$focusWindow = true;

View File

@ -335,7 +335,7 @@ function redrawScreen() {
$('zoomout').style.display="none";
$('panleft').style.display="none";
$('panright').style.display="none";
$('downloadVideo').style.display="none";
if ($('downloadVideo')) $('downloadVideo').style.display="none";
} else {
// switch out of liveview mode
@ -352,7 +352,7 @@ function redrawScreen() {
$('panleft').style.display="inline-flex";
$('panright').style.display="inline";
$('panright').style.display="inline-flex";
$('downloadVideo').style.display="inline";
if ($('downloadVideo')) $('downloadVideo').style.display="inline";
}
if ( fitMode == 1 ) {
@ -556,7 +556,7 @@ function click_panright() {
clicknav(minTimeSecs,maxTimeSecs,0);
}
function click_download() {
createPopup( '?view=download'+filterQuery, 'zmDownload', 'download' );
createPopup( '?view=download', 'zmDownload', 'download' );
}
function click_all_events() {
clicknav(0,0,0);

View File

@ -1,6 +1,4 @@
var filterQuery = '<?php echo isset($filterQuery)?htmlspecialchars_decode($filterQuery):'' ?>';
var server_utc_offset = <?php
$TimeZone = new DateTimeZone( ini_get('date.timezone') );
$now = new DateTime('now', $TimeZone);

View File

@ -59,17 +59,33 @@ include('_monitor_filters.php');
$filter_bar = ob_get_contents();
ob_end_clean();
if (isset($_REQUEST['minTime']) || isset($_REQUEST['maxTime'])) {
if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($displayMonitors) != 0) {
$filter = array(
'Query' => array(
'terms' => array(
array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime']),
array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and'),
array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'obr' => '1'),
array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and', 'cbr' => '1'),
)
),
);
if (isset($_SESSION['MonitorId'])) {
$filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => '=', 'val' => $_SESSION['MonitorId'], 'cnj' => 'and'));
}
if (( $group_id != 0 || isset($_SESSION['ServerFilter']) || isset($_SESSION['StorageFilter']) || isset($_SESSION['StatusFilter']) ) && !isset($_SESSION['MonitorId'])) {
for ($i=0; $i < count($displayMonitors); $i++) {
if ($i == '0') {
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'and', 'obr' => '1');
} else if ($i == (count($displayMonitors)-1)) {
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or', 'cbr' => '1');
} else {
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or');
}
}
}
parseFilter( $filter );
$filterQuery = $filter['query'];
session_start();
$_SESSION['montageReviewFilter'] = $filter;
session_write_close();
}
// Note that this finds incomplete events as well, and any frame records written, but still cannot "see" to the end frame
@ -224,7 +240,13 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
<button type="button" id="live" onclick="setLive(1-liveMode);"><?php echo translate('Live') ?></button>
<button type="button" id="fit" onclick="setFit(1-fitMode);" ><?php echo translate('Fit') ?></button>
<button type="button" id="panright" onclick="click_panright();" ><?php echo translate('Pan') ?> &gt;</button>
<button type="button" id="downloadVideo" onclick="click_download();" ><?php echo translate('Download Video') ?></button>
<?php
if (count($displayMonitors) != 0) {
?>
<button type="button" id="downloadVideo" onclick="click_download();"><?php echo translate('Download Video') ?></button>
<?php
}
?>
</div>
<div id="timelinediv">
<canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas>