Bug 214 - Separet auto execute flag from command.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1622 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
b79f7e6c53
commit
51e3885c94
|
@ -9,6 +9,9 @@ alter table Filters add column Temp tinyint unsigned not null default 0;
|
|||
update Filters set Temp = AutoDelete;
|
||||
alter table Filters drop column AutoDelete;
|
||||
alter table Filters change column Temp AutoDelete tinyint unsigned not null default 0;
|
||||
alter table Filters change column AutoExecute AutoExecuteCmd tinytext;
|
||||
alter table Filters add column AutoExecute tinyint unsigned not null default 0 after AutoMessage;
|
||||
update Filters set AutoExecute = if(isnull(AutoExecuteCmd)||AutoExecuteCmd='', 0, 1 );
|
||||
--
|
||||
-- These are optional, but we might as well do it now
|
||||
--
|
||||
|
|
|
@ -184,7 +184,8 @@ CREATE TABLE Filters (
|
|||
AutoUpload tinyint(3) unsigned NOT NULL default '0',
|
||||
AutoEmail tinyint(3) unsigned NOT NULL default '0',
|
||||
AutoMessage tinyint(3) unsigned NOT NULL default '0',
|
||||
AutoExecute tinytext,
|
||||
AutoExecute tinyint(3) unsigned NOT NULL default '0',
|
||||
AutoExecuteCmd tinytext,
|
||||
AutoDelete tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (Name)
|
||||
) TYPE=MyISAM;
|
||||
|
|
|
@ -330,7 +330,7 @@ sub getDiskBlocks
|
|||
sub getFilters
|
||||
{
|
||||
my @filters;
|
||||
my $sql = "select * from Filters where (AutoDelete = 1 or AutoArchive = 1 or AutoVideo = 1 or AutoUpload = 1 or AutoEmail = 1 or AutoMessage = 1 or AutoExecute != '') order by Name";
|
||||
my $sql = "select * from Filters where (AutoArchive = 1 or AutoVideo = 1 or AutoUpload = 1 or AutoEmail = 1 or AutoMessage = 1 or AutoExecute = 1 or AutoDelete = 1) order by Name";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
my $res = $sth->execute() or die( "Can't execute '$sql': ".$sth->errstr() );
|
||||
FILTER: while( my $filter_data = $sth->fetchrow_hashref() )
|
||||
|
@ -579,7 +579,8 @@ sub getFilters
|
|||
$filter_data->{Sql} = $sql;
|
||||
if ( $filter_data->{AutoExecute} )
|
||||
{
|
||||
my $script = $filter_data->{AutoExecute};
|
||||
my $script = $filter_data->{AutoExecuteCmd};
|
||||
$script ~= s/\s.*$//;
|
||||
if ( !-e $script )
|
||||
{
|
||||
Error( "Auto execute script '$script' not found, skipping filter '$filter_data->{Name}'\n" );
|
||||
|
@ -1165,7 +1166,7 @@ sub executeCommand
|
|||
|
||||
my $event_path = "$event->{MonitorId}/$event->{Id}";
|
||||
|
||||
my $command = $filter->{AutoExecute};
|
||||
my $command = $filter->{AutoExecuteCmd};
|
||||
$command .= " $event_path";
|
||||
|
||||
Info( "Executing '$command'\n" );
|
||||
|
|
|
@ -90,17 +90,17 @@ while ( $row = mysql_fetch_assoc( $result ) )
|
|||
}
|
||||
?>
|
||||
<?php if ( count($filter_names) ) { ?>
|
||||
<td align="left" colspan="2" class="text"><?= $zmSlangSaveAs ?>: <?= buildSelect( $select_name, $filter_names, "submitToFilter( document.filter_form );" ); ?> <?= $zmSlangOrEnterNewName ?>: <input type="text" size="32" name="new_<?= $select_name ?>" value="<?= $filter_name ?>" class="form"></td>
|
||||
<td align="left" colspan="3" class="text"><?= $zmSlangSaveAs ?>: <?= buildSelect( $select_name, $filter_names, "submitToFilter( document.filter_form );" ); ?> <?= $zmSlangOrEnterNewName ?>: <input type="text" size="32" name="new_<?= $select_name ?>" value="<?= $filter_name ?>" class="form"></td>
|
||||
<?php } else { ?>
|
||||
<td align="left" colspan="2" class="text"><?= $zmSlangEnterNewFilterName ?>: <input type="text" size="32" name="new_<?= $select_name ?>" value="" class="form"></td>
|
||||
<td align="left" colspan="3" class="text"><?= $zmSlangEnterNewFilterName ?>: <input type="text" size="32" name="new_<?= $select_name ?>" value="" class="form"></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2" class="text"> </td>
|
||||
<td align="right" colspan="3" class="text"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoArchiveEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_archive" value="1"<?php if ( $filter_data['AutoArchive'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text" colspan="2"><input type="checkbox" name="auto_archive" value="1"<?php if ( $filter_data['AutoArchive'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ( ZM_OPT_MPEG != "no" )
|
||||
|
@ -108,7 +108,7 @@ if ( ZM_OPT_MPEG != "no" )
|
|||
?>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoVideoEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_video" value="1"<?php if ( $filter_data['AutoVideo'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text" colspan="2"><input type="checkbox" name="auto_video" value="1"<?php if ( $filter_data['AutoVideo'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ if ( ZM_OPT_UPLOAD )
|
|||
?>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoUploadEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_upload" value="1"<?php if ( $filter_data['AutoUpload'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text" colspan="2"><input type="checkbox" name="auto_upload" value="1"<?php if ( $filter_data['AutoUpload'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ if ( ZM_OPT_EMAIL )
|
|||
?>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoEmailEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_email" value="1"<?php if ( $filter_data['AutoEmail'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text" colspan="2"><input type="checkbox" name="auto_email" value="1"<?php if ( $filter_data['AutoEmail'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
@ -135,24 +135,25 @@ if ( ZM_OPT_MESSAGE )
|
|||
?>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoMessageEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_message" value="1"<?php if ( $filter_data['AutoMessage'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text" colspan="2"><input type="checkbox" name="auto_message" value="1"<?php if ( $filter_data['AutoMessage'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoExecuteEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="text" name="auto_execute" value="<?= $filter_data['AutoExecute'] ?>" size="32" maxlength="255" class="form"></td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_execute" value="1"<?php if ( $filter_data['AutoExecute'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text"><input type="text" name="auto_execute_cmd" value="<?= $filter_data['AutoExecuteCmd'] ?>" size="32" maxlength="255" class="form"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" class="text"><?= $zmSlangAutoDeleteEvents ?>: </td>
|
||||
<td align="left" class="text"><input type="checkbox" name="auto_delete" value="1"<?php if ( $filter_data['AutoDelete'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
<td align="left" class="text" colspan="2"><input type="checkbox" name="auto_delete" value="1"<?php if ( $filter_data['AutoDelete'] ) { echo " checked"; } ?> class="form-noborder"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2" class="text"> </td>
|
||||
<td align="right" colspan="3" class="text"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2" class="text"><input type="submit" value="<?= $zmSlangSave ?>" class="form"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow();"></td>
|
||||
<td align="right" colspan="3" class="text"><input type="submit" value="<?= $zmSlangSave ?>" class="form"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow();"></td>
|
||||
</tr>
|
||||
</table></center>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue