Merge branch 'storageareas' of github.com:ZoneMinder/ZoneMinder into storageareas
This commit is contained in:
commit
37c559ba3d
|
@ -139,16 +139,25 @@ if ( !empty($action) ) {
|
||||||
{
|
{
|
||||||
if ( !empty($_REQUEST['execute']) )
|
if ( !empty($_REQUEST['execute']) )
|
||||||
$tempFilterName = "_TempFilter".time();
|
$tempFilterName = "_TempFilter".time();
|
||||||
if ( isset($tempFilterName) )
|
if ( isset($tempFilterName) ) {
|
||||||
$filterName = $tempFilterName;
|
$filterName = $tempFilterName;
|
||||||
elseif ( !empty($_REQUEST['newFilterName']) )
|
}
|
||||||
|
elseif ( !empty($_REQUEST['newFilterName']) ) {
|
||||||
$filterName = $_REQUEST['newFilterName'];
|
$filterName = $_REQUEST['newFilterName'];
|
||||||
if ( !empty($filterName) )
|
$sql = "replace into Filters set Name = ".dbEscape($filterName).",";
|
||||||
|
$endSql = '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$doUpdate = 1;
|
||||||
|
$sql = "update Filters set";
|
||||||
|
$endSql = "where Id = ".$_REQUEST['filterId'];
|
||||||
|
}
|
||||||
|
if ( !empty($filterName) || $doUpdate )
|
||||||
{
|
{
|
||||||
$_REQUEST['filter']['sort_field'] = validStr($_REQUEST['sort_field']);
|
$_REQUEST['filter']['sort_field'] = validStr($_REQUEST['sort_field']);
|
||||||
$_REQUEST['filter']['sort_asc'] = validStr($_REQUEST['sort_asc']);
|
$_REQUEST['filter']['sort_asc'] = validStr($_REQUEST['sort_asc']);
|
||||||
$_REQUEST['filter']['limit'] = validInt($_REQUEST['limit']);
|
$_REQUEST['filter']['limit'] = validInt($_REQUEST['limit']);
|
||||||
$sql = "replace into Filters set Name = ".dbEscape($filterName).", Query = ".dbEscape(jsonEncode($_REQUEST['filter']));
|
$sql .= " Query = ".dbEscape(jsonEncode($_REQUEST['filter']));
|
||||||
if ( !empty($_REQUEST['AutoArchive']) )
|
if ( !empty($_REQUEST['AutoArchive']) )
|
||||||
$sql .= ", AutoArchive = ".dbEscape($_REQUEST['AutoArchive']);
|
$sql .= ", AutoArchive = ".dbEscape($_REQUEST['AutoArchive']);
|
||||||
if ( !empty($_REQUEST['AutoVideo']) )
|
if ( !empty($_REQUEST['AutoVideo']) )
|
||||||
|
@ -167,6 +176,7 @@ if ( !empty($action) ) {
|
||||||
$sql .= ", Background = ".dbEscape($_REQUEST['background']);
|
$sql .= ", Background = ".dbEscape($_REQUEST['background']);
|
||||||
if ( !empty($_REQUEST['concurrent']) )
|
if ( !empty($_REQUEST['concurrent']) )
|
||||||
$sql .= ", Concurrent = ".dbEscape($_REQUEST['concurrent']);
|
$sql .= ", Concurrent = ".dbEscape($_REQUEST['concurrent']);
|
||||||
|
$sql .= $endSql;
|
||||||
dbQuery( $sql );
|
dbQuery( $sql );
|
||||||
$refreshParent = true;
|
$refreshParent = true;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +232,7 @@ if ( !empty($action) ) {
|
||||||
}
|
}
|
||||||
if ( !empty($_REQUEST['fid']) )
|
if ( !empty($_REQUEST['fid']) )
|
||||||
{
|
{
|
||||||
dbQuery( 'DELETE FROM Filters WHERE Name=?', array( $_REQUEST['fid'] ) );
|
dbQuery( 'DELETE FROM Filters WHERE Id=?', array( $_REQUEST['filterId'] ) );
|
||||||
//$refreshParent = true;
|
//$refreshParent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,15 @@ if ( !canView( 'Events' ) ) {
|
||||||
$view = "error";
|
$view = "error";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$selectName = "filterName";
|
$selectName = "filterId";
|
||||||
$filterNames = array( ''=>translate('ChooseFilter') );
|
$filterNames = array( ''=>translate('ChooseFilter') );
|
||||||
foreach ( dbFetchAll( "select * from Filters order by Name" ) as $row ) {
|
foreach ( dbFetchAll( "select * from Filters order by Name" ) as $row ) {
|
||||||
$filterNames[$row['Name']] = $row['Name'];
|
$filterNames[$row['Id']] = $row['Name'];
|
||||||
if ( $row['Background'] )
|
if ( $row['Background'] )
|
||||||
$filterNames[$row['Name']] .= "*";
|
$filterNames[$row['Id']] .= "*";
|
||||||
if ( $row['Concurrent'] )
|
if ( $row['Concurrent'] )
|
||||||
$filterNames[$row['Name']] .= "&";
|
$filterNames[$row['Id']] .= "&";
|
||||||
if ( !empty($_REQUEST['reload']) && isset($_REQUEST['filterName']) && $_REQUEST['filterName'] == $row['Name'] )
|
if ( !empty($_REQUEST['reload']) && isset($_REQUEST['filterId']) && $_REQUEST['filterId'] == $row['Id'] )
|
||||||
$dbFilter = $row;
|
$dbFilter = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ if ( isset( $_REQUEST['reload'] ) and ! $_REQUEST['reload'] ) {
|
||||||
$dbFilter['AutoUpload'] = isset( $_REQUEST['AutoUpload'] );
|
$dbFilter['AutoUpload'] = isset( $_REQUEST['AutoUpload'] );
|
||||||
$dbFilter['AutoVideo'] = isset( $_REQUEST['AutoVideo'] );
|
$dbFilter['AutoVideo'] = isset( $_REQUEST['AutoVideo'] );
|
||||||
$dbFilter['AutoDelete'] = isset( $_REQUEST['AutoDelete'] );
|
$dbFilter['AutoDelete'] = isset( $_REQUEST['AutoDelete'] );
|
||||||
$dbFilter['Name'] = $_REQUEST['filterName'];
|
$dbFilter['Name'] = $_REQUEST['filterId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$conjunctionTypes = array(
|
$conjunctionTypes = array(
|
||||||
|
@ -328,7 +328,7 @@ if ( ZM_OPT_MESSAGE ) {
|
||||||
<input type="button" value="<?php echo translate('Save') ?>" onclick="saveFilter( this );"/>
|
<input type="button" value="<?php echo translate('Save') ?>" onclick="saveFilter( this );"/>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( canEdit( 'Events' ) && isset($dbFilter) && $dbFilter['Name'] ) { ?>
|
<?php if ( canEdit( 'Events' ) && isset($dbFilter) && $dbFilter['Name'] ) { ?>
|
||||||
<input type="button" value="<?php echo translate('Delete') ?>" onclick="deleteFilter( this, '<?php echo $dbFilter['Name'] ?>' );"/>
|
<input type="button" value="<?php echo translate('Delete') ?>" onclick="deleteFilter( this, <?php echo $dbFilter['Id'] ?>, '<?php echo $dbFilter['Name'] ?>' );"/>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<input type="button" value="<?php echo translate('Reset') ?>" onclick="submitToFilter( this, 1 );"/>
|
<input type="button" value="<?php echo translate('Reset') ?>" onclick="submitToFilter( this, 1 );"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,12 +24,12 @@ if ( !canEdit( 'Events' ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$selectName = "filterName";
|
$selectName = "filterId";
|
||||||
$newSelectName = "new".ucfirst($selectName);
|
$newSelectName = "newFilterName";
|
||||||
foreach ( dbFetchAll( "select * from Filters order by Name" ) as $row )
|
foreach ( dbFetchAll( "select * from Filters order by Id" ) as $row )
|
||||||
{
|
{
|
||||||
$filterNames[$row['Name']] = $row['Name'];
|
$filterNames[$row['Id']] = $row['Name'];
|
||||||
if ( $_REQUEST['filterName'] == $row['Name'] )
|
if ( $_REQUEST['filterId'] == $row['Id'] )
|
||||||
{
|
{
|
||||||
$filterData = $row;
|
$filterData = $row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,13 +79,13 @@ function saveFilter( element )
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFilter( element, name )
|
function deleteFilter( element, id, name )
|
||||||
{
|
{
|
||||||
if ( confirm( deleteSavedFilterString+" '"+name+"'" ) )
|
if ( confirm( deleteSavedFilterString+" '"+name+"'" ) )
|
||||||
{
|
{
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
form.action.value = 'delete';
|
form.action.value = 'delete';
|
||||||
form.fid.value = name;
|
form.fid.value = id;
|
||||||
submitToFilter( element, 1 );
|
submitToFilter( element, 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue