From 01fad8a0dcfa68641cef06ccadae8af50840676c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Feb 2022 11:21:16 -0500 Subject: [PATCH] Replace Function monitor filter with Capturing, Analysing, Recording filters. --- web/skins/classic/views/_monitor_filters.php | 45 +++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/web/skins/classic/views/_monitor_filters.php b/web/skins/classic/views/_monitor_filters.php index 6fdde8be1..52d241ccc 100644 --- a/web/skins/classic/views/_monitor_filters.php +++ b/web/skins/classic/views/_monitor_filters.php @@ -21,14 +21,14 @@ require_once('includes/Monitor.php'); zm_session_start(); -foreach ( array('GroupId','Function','ServerId','StorageId','Status','MonitorId','MonitorName','Source') as $var ) { - if ( isset($_REQUEST[$var]) ) { - if ( $_REQUEST[$var] != '' ) { +foreach (array('GroupId','Capturing','Analysing','Recording','ServerId','StorageId','Status','MonitorId','MonitorName','Source') as $var) { + if (isset($_REQUEST[$var])) { + if ($_REQUEST[$var] != '') { $_SESSION[$var] = $_REQUEST[$var]; } else { unset($_SESSION[$var]); } - } else if ( isset($_REQUEST['filtering']) ) { + } else if (isset($_REQUEST['filtering'])) { unset($_SESSION[$var]); } } @@ -36,7 +36,7 @@ session_write_close(); $storage_areas = ZM\Storage::find(); $StorageById = array(); -foreach ( $storage_areas as $S ) { +foreach ($storage_areas as $S) { $StorageById[$S->Id()] = $S; } $servers = ZM\Server::find(null, array('order'=>'lower(Name)')); @@ -81,7 +81,7 @@ $values = array(); if ( $groupSql ) $conditions[] = $groupSql; -foreach ( array('ServerId','StorageId','Status','Function') as $filter ) { +foreach ( array('ServerId','StorageId','Status','Capturing','Analysing','Recording') as $filter ) { if ( isset($_SESSION[$filter]) ) { if ( is_array($_SESSION[$filter]) ) { $conditions[] = '`'.$filter . '` IN ('.implode(',', array_map(function(){return '?';}, $_SESSION[$filter])). ')'; @@ -101,23 +101,26 @@ if ( !empty($user['MonitorIds']) ) { $html .= ''; $html .= ''; -$html .= ' -'; +$html .= ''.PHP_EOL; -$Functions = ZM\GetMonitorFunctionTypes(); +function addFilterSelect($name, $options) { + $html .= ''; + $html .= htmlSelect($name.'[]', $options, + (isset($_SESSION[$name])?$_SESSION[$name]:''), + array( + 'data-on-change'=>'submitThisForm', + 'class'=>'chosen', + 'multiple'=>'multiple', + 'data-placeholder'=>'All', + ) + ); + $html .= ''.PHP_EOL; + return $html; +} -$html .= ''; -$html .= htmlSelect('Function[]', $Functions, - (isset($_SESSION['Function'])?$_SESSION['Function']:''), - array( - 'data-on-change'=>'submitThisForm', - 'class'=>'chosen', - 'multiple'=>'multiple', - 'data-placeholder'=>'All', - ) - ); -$html .= ' -'; +$html .= addFilterSelect('Capturing', array('None'=>translate('None'), 'OnDemand'=>translate('On Demand'))); +$html .= addFilterSelect('Analysing', array('None'=>translate('None'), 'Always'=>translate('Always'))); +$html .= addFilterSelect('Recording', array('None'=>translate('None'), 'OnMotion'=>translate('On Motion'),'Always'=>translate('Always'))); if ( count($ServersById) > 1 ) { $html .= '';