Merge branch 'storageareas' of github.com:ZoneMinder/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2016-09-14 12:49:55 -04:00
commit 37c559ba3d
4 changed files with 29 additions and 19 deletions

View File

@ -139,16 +139,25 @@ if ( !empty($action) ) {
{
if ( !empty($_REQUEST['execute']) )
$tempFilterName = "_TempFilter".time();
if ( isset($tempFilterName) )
if ( isset($tempFilterName) ) {
$filterName = $tempFilterName;
elseif ( !empty($_REQUEST['newFilterName']) )
}
elseif ( !empty($_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_asc'] = validStr($_REQUEST['sort_asc']);
$_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']) )
$sql .= ", AutoArchive = ".dbEscape($_REQUEST['AutoArchive']);
if ( !empty($_REQUEST['AutoVideo']) )
@ -167,6 +176,7 @@ if ( !empty($action) ) {
$sql .= ", Background = ".dbEscape($_REQUEST['background']);
if ( !empty($_REQUEST['concurrent']) )
$sql .= ", Concurrent = ".dbEscape($_REQUEST['concurrent']);
$sql .= $endSql;
dbQuery( $sql );
$refreshParent = true;
}
@ -222,7 +232,7 @@ if ( !empty($action) ) {
}
if ( !empty($_REQUEST['fid']) )
{
dbQuery( 'DELETE FROM Filters WHERE Name=?', array( $_REQUEST['fid'] ) );
dbQuery( 'DELETE FROM Filters WHERE Id=?', array( $_REQUEST['filterId'] ) );
//$refreshParent = true;
}
}

View File

@ -22,15 +22,15 @@ if ( !canView( 'Events' ) ) {
$view = "error";
return;
}
$selectName = "filterName";
$selectName = "filterId";
$filterNames = array( ''=>translate('ChooseFilter') );
foreach ( dbFetchAll( "select * from Filters order by Name" ) as $row ) {
$filterNames[$row['Name']] = $row['Name'];
$filterNames[$row['Id']] = $row['Name'];
if ( $row['Background'] )
$filterNames[$row['Name']] .= "*";
$filterNames[$row['Id']] .= "*";
if ( $row['Concurrent'] )
$filterNames[$row['Name']] .= "&";
if ( !empty($_REQUEST['reload']) && isset($_REQUEST['filterName']) && $_REQUEST['filterName'] == $row['Name'] )
$filterNames[$row['Id']] .= "&";
if ( !empty($_REQUEST['reload']) && isset($_REQUEST['filterId']) && $_REQUEST['filterId'] == $row['Id'] )
$dbFilter = $row;
}
@ -57,7 +57,7 @@ if ( isset( $_REQUEST['reload'] ) and ! $_REQUEST['reload'] ) {
$dbFilter['AutoUpload'] = isset( $_REQUEST['AutoUpload'] );
$dbFilter['AutoVideo'] = isset( $_REQUEST['AutoVideo'] );
$dbFilter['AutoDelete'] = isset( $_REQUEST['AutoDelete'] );
$dbFilter['Name'] = $_REQUEST['filterName'];
$dbFilter['Name'] = $_REQUEST['filterId'];
}
$conjunctionTypes = array(
@ -328,7 +328,7 @@ if ( ZM_OPT_MESSAGE ) {
<input type="button" value="<?php echo translate('Save') ?>" onclick="saveFilter( this );"/>
<?php } ?>
<?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 } ?>
<input type="button" value="<?php echo translate('Reset') ?>" onclick="submitToFilter( this, 1 );"/>
</div>

View File

@ -24,12 +24,12 @@ if ( !canEdit( 'Events' ) )
return;
}
$selectName = "filterName";
$newSelectName = "new".ucfirst($selectName);
foreach ( dbFetchAll( "select * from Filters order by Name" ) as $row )
$selectName = "filterId";
$newSelectName = "newFilterName";
foreach ( dbFetchAll( "select * from Filters order by Id" ) as $row )
{
$filterNames[$row['Name']] = $row['Name'];
if ( $_REQUEST['filterName'] == $row['Name'] )
$filterNames[$row['Id']] = $row['Name'];
if ( $_REQUEST['filterId'] == $row['Id'] )
{
$filterData = $row;
}

View File

@ -79,13 +79,13 @@ function saveFilter( element )
form.submit();
}
function deleteFilter( element, name )
function deleteFilter( element, id, name )
{
if ( confirm( deleteSavedFilterString+" '"+name+"'" ) )
{
var form = element.form;
form.action.value = 'delete';
form.fid.value = name;
form.fid.value = id;
submitToFilter( element, 1 );
}
}