diff --git a/db/zm_update-1.31.16.sql b/db/zm_update-1.31.16.sql index eedd60119..26cdfe317 100644 --- a/db/zm_update-1.31.16.sql +++ b/db/zm_update-1.31.16.sql @@ -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;", "SELECT 'MonitorIds has already been removed.'" )); - +/* PREPARE stmt FROM @s; EXECUTE stmt; SET @s = (SELECT IF( @@ -93,3 +93,4 @@ SET @s = (SELECT IF( )); PREPARE stmt FROM @s; EXECUTE stmt; +*/ diff --git a/web/skins/classic/includes/export_functions.php b/web/skins/classic/includes/export_functions.php index 604dcba4e..f384594da 100644 --- a/web/skins/classic/includes/export_functions.php +++ b/web/skins/classic/includes/export_functions.php @@ -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 diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index b9afd8503..97041bd65 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -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() { - if ($j('.navbar').length) setInterval(getNavBar, navBarRefresh) -}); + $j(document).ready(function() { + if ($j('.navbar').length) setInterval(getNavBar, navBarRefresh) + }); -function getNavBar () { - $j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar); -} + function getNavBar () { + $j.getJSON(thisUrl + '?view=request&request=status&entity=navBar', setNavBar); + } -function setNavBar (data) { - $j('#reload').replaceWith(data.message); + 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. diff --git a/web/skins/classic/views/download.php b/web/skins/classic/views/download.php index 69e062078..1d37d73f6 100644 --- a/web/skins/classic/views/download.php +++ b/web/skins/classic/views/download.php @@ -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; diff --git a/web/skins/classic/views/js/montagereview.js b/web/skins/classic/views/js/montagereview.js index 07262c3a0..0ffde9b5f 100644 --- a/web/skins/classic/views/js/montagereview.js +++ b/web/skins/classic/views/js/montagereview.js @@ -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); diff --git a/web/skins/classic/views/js/montagereview.js.php b/web/skins/classic/views/js/montagereview.js.php index e8ac13ff5..69d9c3d22 100644 --- a/web/skins/classic/views/js/montagereview.js.php +++ b/web/skins/classic/views/js/montagereview.js.php @@ -1,6 +1,4 @@ -var filterQuery = ''; - var server_utc_offset = 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') ); - + + +