Added archive filter.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@517 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
435040ad69
commit
46121b4d5d
|
@ -5,6 +5,7 @@ alter table Monitors change column Colours Palette tinyint(3) unsigned NOT NULL
|
||||||
update Monitors set Palette = 1 where Palette = 8;
|
update Monitors set Palette = 1 where Palette = 8;
|
||||||
update Monitors set Palette = 4 where Palette = 24;
|
update Monitors set Palette = 4 where Palette = 24;
|
||||||
alter table Zones modify column Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive') not null default 'Active';
|
alter table Zones modify column Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive') not null default 'Active';
|
||||||
|
alter table Filters add column AutoArchive tinyint unsigned not null default 0 after Query;
|
||||||
-- These are optional, it just seemed a good time...
|
-- These are optional, it just seemed a good time...
|
||||||
optimize table Frames;
|
optimize table Frames;
|
||||||
optimize table Events;
|
optimize table Events;
|
||||||
|
|
|
@ -49,6 +49,7 @@ CREATE TABLE Filters (
|
||||||
MonitorId int(10) unsigned NOT NULL default '0',
|
MonitorId int(10) unsigned NOT NULL default '0',
|
||||||
Name varchar(64) NOT NULL default '',
|
Name varchar(64) NOT NULL default '',
|
||||||
Query text NOT NULL,
|
Query text NOT NULL,
|
||||||
|
AutoArchive tinyint(3) unsigned NOT NULL default '0',
|
||||||
AutoDelete tinyint(3) unsigned NOT NULL default '0',
|
AutoDelete tinyint(3) unsigned NOT NULL default '0',
|
||||||
AutoUpload tinyint(3) unsigned NOT NULL default '0',
|
AutoUpload tinyint(3) unsigned NOT NULL default '0',
|
||||||
AutoEmail tinyint(3) unsigned NOT NULL default '0',
|
AutoEmail tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
|
|
@ -223,6 +223,7 @@ while( 1 )
|
||||||
foreach my $filter ( @$filters )
|
foreach my $filter ( @$filters )
|
||||||
{
|
{
|
||||||
print( "Checking filter '$filter->{Name}'".
|
print( "Checking filter '$filter->{Name}'".
|
||||||
|
($filter->{AutoArchive}?", archive":"").
|
||||||
($filter->{AutoDelete}?", delete":"").
|
($filter->{AutoDelete}?", delete":"").
|
||||||
($filter->{AutoUpload}?", upload":"").
|
($filter->{AutoUpload}?", upload":"").
|
||||||
($filter->{AutoEmail}?", email":"").
|
($filter->{AutoEmail}?", email":"").
|
||||||
|
@ -261,6 +262,14 @@ while( 1 )
|
||||||
|
|
||||||
uploadArchFile( $filter, $event );
|
uploadArchFile( $filter, $event );
|
||||||
}
|
}
|
||||||
|
if ( $filter->{AutoArchive} )
|
||||||
|
{
|
||||||
|
print( "Archiving event $event->{Id}\n" );
|
||||||
|
# Do it individually to avoid locking up the table for new events
|
||||||
|
my $sql = "update Events set Archived = 1 where Id = ?";
|
||||||
|
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||||
|
my $res = $sth->execute( $event->{Id} ) or die( "Can't execute: ".$sth->errstr() );
|
||||||
|
}
|
||||||
if ( $filter->{AutoDelete} )
|
if ( $filter->{AutoDelete} )
|
||||||
{
|
{
|
||||||
print( "Deleting event $event->{Id}\n" );
|
print( "Deleting event $event->{Id}\n" );
|
||||||
|
@ -290,7 +299,7 @@ sub GetFilters
|
||||||
my $monitor = shift;
|
my $monitor = shift;
|
||||||
|
|
||||||
my @filters;
|
my @filters;
|
||||||
my $sql = "select Filters.*,Monitors.Name as MonitorName from Filters inner join Monitors on Filters.MonitorId = Monitors.Id where Monitors.Id = '$monitor' and (AutoDelete = 1 or AutoUpload = 1 or AutoEmail = 1 or AutoMessage = 1) order by Name";
|
my $sql = "select Filters.*,Monitors.Name as MonitorName from Filters inner join Monitors on Filters.MonitorId = Monitors.Id where Monitors.Id = '$monitor' and (AutoArchive = 1 or AutoDelete = 1 or AutoUpload = 1 or AutoEmail = 1 or AutoMessage = 1) order by Name";
|
||||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||||
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
|
||||||
FILTER: while( my $filter_data = $sth->fetchrow_hashref() )
|
FILTER: while( my $filter_data = $sth->fetchrow_hashref() )
|
||||||
|
|
|
@ -331,7 +331,7 @@ if ( $action )
|
||||||
}
|
}
|
||||||
$filter_query_string = join( '&', $filter_parms );
|
$filter_query_string = join( '&', $filter_parms );
|
||||||
//$filter_query_string = serialize( $filter_query );
|
//$filter_query_string = serialize( $filter_query );
|
||||||
$sql = "replace into Filters set MonitorId = '$mid', Name = '$filter_name', Query = '$filter_query_string', AutoDelete = '$auto_delete', AutoUpload = '$auto_upload', AutoEmail = '$auto_email', AutoMessage = '$auto_message'";
|
$sql = "replace into Filters set MonitorId = '$mid', Name = '$filter_name', Query = '$filter_query_string', AutoArchive = '$auto_archive', AutoDelete = '$auto_delete', AutoUpload = '$auto_upload', AutoEmail = '$auto_email', AutoMessage = '$auto_message'";
|
||||||
#echo "<html>$sql</html>";
|
#echo "<html>$sql</html>";
|
||||||
$result = mysql_query( $sql );
|
$result = mysql_query( $sql );
|
||||||
if ( !$result )
|
if ( !$result )
|
||||||
|
|
|
@ -152,7 +152,7 @@ $jws = array(
|
||||||
'events' => array( 'w'=>720, 'h'=>480 ),
|
'events' => array( 'w'=>720, 'h'=>480 ),
|
||||||
'event' => array( 'w'=>420, 'h'=>500 ),
|
'event' => array( 'w'=>420, 'h'=>500 ),
|
||||||
'filter' => array( 'w'=>560, 'h'=>250 ),
|
'filter' => array( 'w'=>560, 'h'=>250 ),
|
||||||
'filtersave' => array( 'w'=>520, 'h'=>180 ),
|
'filtersave' => array( 'w'=>520, 'h'=>200 ),
|
||||||
'zones' => array( 'w'=>72, 'h'=>232 ),
|
'zones' => array( 'w'=>72, 'h'=>232 ),
|
||||||
'zone' => array( 'w'=>360, 'h'=>480 ),
|
'zone' => array( 'w'=>360, 'h'=>480 ),
|
||||||
'video' => array( 'w'=>100, 'h'=>80 ),
|
'video' => array( 'w'=>100, 'h'=>80 ),
|
||||||
|
|
|
@ -1532,6 +1532,10 @@ window.focus();
|
||||||
<td align="right" colspan="2" class="text"> </td>
|
<td align="right" colspan="2" class="text"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td align="left" class="text">Automatically archive all matching events: </td>
|
||||||
|
<td align="left" class="text"><input type="checkbox" name="auto_archive" value="1"<?php if ( $filter_data[AutoArchive] ) { echo " checked"; } ?>></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td align="left" class="text">Automatically delete all matching events: </td>
|
<td align="left" class="text">Automatically delete all matching events: </td>
|
||||||
<td align="left" class="text"><input type="checkbox" name="auto_delete" value="1"<?php if ( $filter_data[AutoDelete] ) { echo " checked"; } ?>></td>
|
<td align="left" class="text"><input type="checkbox" name="auto_delete" value="1"<?php if ( $filter_data[AutoDelete] ) { echo " checked"; } ?>></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue