mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-21 05:54:22 -04:00
More filter UI fixes
This commit is contained in:
1 parent
25acf1756c
commit
375e4a3e9c
2 files changed
+12
-18
No files matched your search
+10
-16
@@ -128,24 +128,16 @@ if ( !empty($action) ) {
|
||||
dbQuery( 'DELETE FROM Filters WHERE Id=?', array( $_REQUEST['Id'] ) );
|
||||
}
|
||||
} else if ( ( $action == 'save' ) or ( $action == 'execute' ) or ( $action == 'submit' ) ) {
|
||||
|
||||
$sql = '';
|
||||
$endSql = '';
|
||||
if ( $action == 'execute' or $action == 'submit' ) {
|
||||
# Replace will teplace any filter with the same Id
|
||||
# Since we aren't specifying the Id , this is effectively an insert
|
||||
$sql = 'REPLACE INTO Filters SET Name = \'_TempFilter'.time().'\',';
|
||||
} else if ( $_REQUEST['Id'] ) {
|
||||
$sql = 'UPDATE Filters SET';
|
||||
$endSql = ' WHERE Id = '.$_REQUEST['Id'];
|
||||
} else {
|
||||
$sql = 'INSERT INTO Filters SET';
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
$_REQUEST['filter']['sort_field'] = validStr($_REQUEST['filter']['sort_field']);
|
||||
$_REQUEST['filter']['sort_asc'] = validStr($_REQUEST['filter']['sort_asc']);
|
||||
$_REQUEST['filter']['limit'] = validInt($_REQUEST['filter']['limit']);
|
||||
$sql .= ' Name = '.dbEscape($_REQUEST['filter']['Name']);
|
||||
if ( $action == 'execute' or $action == 'submit' ) {
|
||||
$sql .= ' Name = \'_TempFilter'.time().'\'';
|
||||
} else {
|
||||
$sql .= ' Name = '.dbEscape($_REQUEST['filter']['Name']);
|
||||
}
|
||||
$sql .= ', Query = '.dbEscape(jsonEncode($_REQUEST['filter']['terms']));
|
||||
$sql .= ', AutoArchive = '.(!empty($_REQUEST['filter']['AutoArchive']) ? 1 : 0);
|
||||
$sql .= ', AutoVideo = '. ( !empty($_REQUEST['filter']['AutoVideo']) ? 1 : 0);
|
||||
@@ -158,8 +150,10 @@ if ( !empty($action) ) {
|
||||
$sql .= ', Background = '. ( !empty($_REQUEST['filter']['Background']) ? 1 : 0);
|
||||
$sql .= ', Concurrent = '. ( !empty($_REQUEST['filter']['Concurrent']) ? 1 : 0);
|
||||
|
||||
dbQuery( $sql. $endSql );
|
||||
if ( ! $_REQUEST['Id'] ) {
|
||||
if ( $_REQUEST['Id'] ) {
|
||||
dbQuery( 'UPDATE Filters SET ' . $sql. ' WHERE Id=?', array($_REQUEST['Id']) );
|
||||
} else {
|
||||
dbQuery( 'INSERT INTO Filters SET' . $sql );
|
||||
$_REQUEST['Id'] = dbInsertId();
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ if ( (null !== $filter->Concurrent()) and $filter->Concurrent() )
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?view=filter">
|
||||
<input type="hidden" name="Id" value="<?php echo $filter->Id() ?>"/>
|
||||
<input type="hidden" name="action" value=""/>
|
||||
<input type="hidden" name="line" value=""/>
|
||||
@@ -196,7 +196,7 @@ for ( $i = 0; $i < count($terms); $i++ ) {
|
||||
}
|
||||
?>
|
||||
<td><?php if ( count($terms) > 2 ) { echo htmlSelect( "filter[terms][$i][obr]", $obracketTypes, $term['obr'] ); } else { ?> <?php } ?></td>
|
||||
<td><?php echo htmlSelect( "filter[terms][$i][attr]", $attrTypes, $term['attr'], "clearValue( this, $i ); submitToFilter( this, 0 );" ); ?></td>
|
||||
<td><?php echo htmlSelect( "filter[terms][$i][attr]", $attrTypes, $term['attr'], "clearValue( this, $i ); this.form.submit();" ); ?></td>
|
||||
<?php
|
||||
if ( isset($term['attr']) ) {
|
||||
if ( $term['attr'] == 'Archived' ) {
|
||||
|
||||
Reference in new issue
Block a user