Merge branch 'storageareas' into zma_to_thread

This commit is contained in:
Isaac Connor 2017-12-04 17:11:46 -05:00
commit a27374b827
7 changed files with 52 additions and 27 deletions

View File

@ -80,7 +80,7 @@ SET @s = (SELECT IF(
"REPLACE INTO Groups_Monitors (GroupId,MonitorId) SELECT Id,SUBSTRING_INDEX(SUBSTRING_INDEX(t.MonitorIds, ',', n.n), ',', -1) value FROM Groups t CROSS JOIN ( SELECT a.N + b.N * 10 + 1 n FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a ,(SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b ORDER BY n ) n WHERE t.MonitorIds != '' AND n.n <= 1 + (LENGTH(t.MonitorIds) - LENGTH(REPLACE(t.MonitorIds, ',', ''))) ORDER BY value;", "REPLACE INTO Groups_Monitors (GroupId,MonitorId) SELECT Id,SUBSTRING_INDEX(SUBSTRING_INDEX(t.MonitorIds, ',', n.n), ',', -1) value FROM Groups t CROSS JOIN ( SELECT a.N + b.N * 10 + 1 n FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a ,(SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b ORDER BY n ) n WHERE t.MonitorIds != '' AND n.n <= 1 + (LENGTH(t.MonitorIds) - LENGTH(REPLACE(t.MonitorIds, ',', ''))) ORDER BY value;",
"SELECT 'MonitorIds has already been removed.'" "SELECT 'MonitorIds has already been removed.'"
)); ));
/*
PREPARE stmt FROM @s; PREPARE stmt FROM @s;
EXECUTE stmt; EXECUTE stmt;
SET @s = (SELECT IF( SET @s = (SELECT IF(
@ -93,3 +93,4 @@ SET @s = (SELECT IF(
)); ));
PREPARE stmt FROM @s; PREPARE stmt FROM @s;
EXECUTE stmt; EXECUTE stmt;
*/

View File

@ -908,9 +908,9 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
$archive = ZM_DIR_EXPORTS."/".$export_root.".tar.gz"; $archive = ZM_DIR_EXPORTS."/".$export_root.".tar.gz";
@unlink( $archive ); @unlink( $archive );
if ($exportStructure == 'flat') { //strip file paths if we choose 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 { } 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 ); exec( $command, $output, $status );
if ( $status ) if ( $status )
@ -926,9 +926,9 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
$archive = ZM_DIR_EXPORTS."/".$export_root.".zip"; $archive = ZM_DIR_EXPORTS."/".$export_root.".zip";
@unlink( $archive ); @unlink( $archive );
if ($exportStructure == 'flat') { if ($exportStructure == 'flat') {
$command = "cat ".escapeshellarg($listFile)." | zip -q -j ".escapeshellarg($archive)." -@"; $command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q -j ".escapeshellarg($archive)." -@";
} else { } 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 -@ //cat zmFileList.txt | zip -q zm_export.zip -@
//-bash: zip: command not found //-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) if ($j('.navbar').length) setInterval(getNavBar, navBarRefresh)
}); });
function getNavBar () { function getNavBar () {
$j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar); $j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar);
} }
function setNavBar (data) { function setNavBar (data) {
$j('#reload').replaceWith(data.message); $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. //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; 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'; $eventsSql = 'SELECT E.Id FROM Events as E WHERE 1';
parseFilter($_REQUEST['filter']); $eventsSql .= $_SESSION['montageReviewFilter']['sql'];
$eventsSql .= $_REQUEST['filter']['sql'];
$results = dbQuery($eventsSql); $results = dbQuery($eventsSql);
$eids = []; $eids = [];
while ( $event_row = dbFetchNext( $results ) ) { while ( $event_row = dbFetchNext( $results ) ) {
array_push($eids, 'eids[]='.$event_row['Id']); array_push($eids, 'eids[]='.$event_row['Id']);
} }
$_REQUEST['eids'] = $eids; $_REQUEST['eids'] = $eids;
session_start();
unset($_SESSION['montageReviewFilter']);
session_write_close();
} }
$focusWindow = true; $focusWindow = true;

View File

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

View File

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

View File

@ -59,17 +59,33 @@ include('_monitor_filters.php');
$filter_bar = ob_get_contents(); $filter_bar = ob_get_contents();
ob_end_clean(); ob_end_clean();
if (isset($_REQUEST['minTime']) || isset($_REQUEST['maxTime'])) { if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($displayMonitors) != 0) {
$filter = array( $filter = array(
'Query' => array( 'Query' => array(
'terms' => array( 'terms' => array(
array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime']), array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'obr' => '1'),
array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and'), 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 ); 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 // 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="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="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="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>
<div id="timelinediv"> <div id="timelinediv">
<canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas> <canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas>