Merge branch 'fix_zone_edit' into storageareas
commit
8fabeb78d3
42
docs/api.rst
42
docs/api.rst
|
@ -130,6 +130,28 @@ depend on it.
|
||||||
curl -XDELETE http://server/zm/api/monitors/1.json
|
curl -XDELETE http://server/zm/api/monitors/1.json
|
||||||
|
|
||||||
|
|
||||||
|
Arm/Disarm monitors
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This command will force an alarm on Monitor 1:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
curl http://server/zm/api/monitors/alarm/id:1/command:on.json
|
||||||
|
|
||||||
|
This command will disable the alarm on Monitor 1:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
curl http://server/zm/api/monitors/alarm/id:1/command:off.json
|
||||||
|
|
||||||
|
This command will report the status of the alarm Monitor 1:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
curl http://server/zm/api/monitors/alarm/id:1/command:status.json
|
||||||
|
|
||||||
|
|
||||||
Return a list of all events
|
Return a list of all events
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -216,6 +238,26 @@ Return a list of events for all monitors within a specified date/time range
|
||||||
curl -XGET "http://server/zm/api/events/index/StartTime%20>=:2015-05-15%2018:43:56/EndTime%20<=:208:43:56.json"
|
curl -XGET "http://server/zm/api/events/index/StartTime%20>=:2015-05-15%2018:43:56/EndTime%20<=:208:43:56.json"
|
||||||
|
|
||||||
|
|
||||||
|
Return event count based on times and conditions
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The API also supports a handy mechanism to return a count of events for a period of time.
|
||||||
|
|
||||||
|
This returns number of events per monitor that were recorded in the last one hour
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
curl "http://server/zm/api/events/consoleEvents/1%20hour.json"
|
||||||
|
|
||||||
|
This returns number of events per monitor that were recorded in the last day where there were atleast 10 frames that were alarms"
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
curl "http://server/zm/api/events/consoleEvents/1%20day.json/AlarmFrames >=: 10.json"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Configuration Apis
|
Configuration Apis
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -81,11 +81,6 @@ our @EXPORT = ( @EXPORT_OK );
|
||||||
|
|
||||||
our $VERSION = $ZoneMinder::Base::VERSION;
|
our $VERSION = $ZoneMinder::Base::VERSION;
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
ZoneMinder::Config::zmConfigLoad();
|
|
||||||
ZoneMinder::Database::zmDbConnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ use warnings;
|
||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
require ZoneMinder::Base;
|
require ZoneMinder::Base;
|
||||||
require ZoneMinder::Database;
|
|
||||||
use ZoneMinder::ConfigData qw(:all);
|
use ZoneMinder::ConfigData qw(:all);
|
||||||
|
|
||||||
our @ISA = qw(Exporter ZoneMinder::Base);
|
our @ISA = qw(Exporter ZoneMinder::Base);
|
||||||
|
@ -70,48 +69,39 @@ use constant ZM_CONFIG => "@ZM_CONFIG@"; # Path to the ZoneMinder config file
|
||||||
use Carp;
|
use Carp;
|
||||||
|
|
||||||
# Load the config from the database into the symbol table
|
# Load the config from the database into the symbol table
|
||||||
sub zmConfigLoad {
|
BEGIN
|
||||||
%Config = ();
|
{
|
||||||
|
my $config_file = ZM_CONFIG;
|
||||||
|
open( my $CONFIG, "<", $config_file )
|
||||||
|
or croak( "Can't open config file '$config_file': $!" );
|
||||||
|
foreach my $str ( <$CONFIG> )
|
||||||
|
{
|
||||||
|
next if ( $str =~ /^\s*$/ );
|
||||||
|
next if ( $str =~ /^\s*#/ );
|
||||||
|
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.*?)\s*$/;
|
||||||
|
if ( ! $name ) {
|
||||||
|
print( STDERR "Warning, bad line in $config_file: $str\n" );
|
||||||
|
next;
|
||||||
|
} # end if
|
||||||
|
$name =~ tr/a-z/A-Z/;
|
||||||
|
$Config{$name} = $value;
|
||||||
|
}
|
||||||
|
close( $CONFIG );
|
||||||
|
|
||||||
my $config_file = ZM_CONFIG;
|
use DBI;
|
||||||
open( my $CONFIG, "<", $config_file )
|
my $dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||||
or croak( "Can't open config file '$config_file': $!" );
|
.";host=".$Config{ZM_DB_HOST}
|
||||||
foreach my $str ( <$CONFIG> ) {
|
, $Config{ZM_DB_USER}
|
||||||
next if ( $str =~ /^\s*$/ );
|
, $Config{ZM_DB_PASS}
|
||||||
next if ( $str =~ /^\s*#/ );
|
) or croak( "Can't connect to db" );
|
||||||
my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.*?)\s*$/;
|
my $sql = 'select * from Config';
|
||||||
if ( ! $name ) {
|
my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||||
print( STDERR "Warning, bad line in $config_file: $str\n" );
|
my $res = $sth->execute() or croak( "Can't execute: ".$sth->errstr() );
|
||||||
next;
|
while( my $config = $sth->fetchrow_hashref() ) {
|
||||||
} # end if
|
$Config{$config->{Name}} = $config->{Value};
|
||||||
$name =~ tr/a-z/A-Z/;
|
|
||||||
$Config{$name} = $value;
|
|
||||||
}
|
|
||||||
close( $CONFIG );
|
|
||||||
|
|
||||||
my $dbh = ZoneMinder::Database::zmDbConnect() or croak( "Can't connect to db" );
|
|
||||||
my $sql = 'select * from Config';
|
|
||||||
my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
|
||||||
my $res = $sth->execute() or croak( "Can't execute: ".$sth->errstr() );
|
|
||||||
while( my $config = $sth->fetchrow_hashref() ) {
|
|
||||||
$Config{$config->{Name}} = $config->{Value};
|
|
||||||
}
|
|
||||||
$sth->finish();
|
|
||||||
|
|
||||||
if ( ! exists $Config{ZM_SERVER_ID} ) {
|
|
||||||
$Config{ZM_SERVER_ID} = undef;
|
|
||||||
$sth = $dbh->prepare_cached( 'SELECT * FROM Servers WHERE Name=?' );
|
|
||||||
if ( $Config{ZM_SERVER_NAME} ) {
|
|
||||||
$res = $sth->execute( $Config{ZM_SERVER_NAME} );
|
|
||||||
my $result = $sth->fetchrow_hashref();
|
|
||||||
$Config{ZM_SERVER_ID} = $$result{Id};
|
|
||||||
} elsif ( $Config{ZM_SERVER_HOST} ) {
|
|
||||||
$res = $sth->execute( $Config{ZM_SERVER_HOST} );
|
|
||||||
my $result = $sth->fetchrow_hashref();
|
|
||||||
$Config{ZM_SERVER_ID} = $$result{Id};
|
|
||||||
}
|
}
|
||||||
$sth->finish();
|
$sth->finish();
|
||||||
}
|
#$dbh->disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub loadConfigFromDB {
|
sub loadConfigFromDB {
|
||||||
|
@ -228,8 +218,6 @@ sub saveConfigToDB {
|
||||||
$dbh->{AutoCommit} = $ac;
|
$dbh->{AutoCommit} = $ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
|
||||||
__END__
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,9 @@ package ZoneMinder::Database;
|
||||||
use 5.006;
|
use 5.006;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use DBI;
|
|
||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
require ZoneMinder::Base;
|
require ZoneMinder::Base;
|
||||||
require ZoneMinder::Config;
|
|
||||||
|
|
||||||
our @ISA = qw(Exporter ZoneMinder::Base);
|
our @ISA = qw(Exporter ZoneMinder::Base);
|
||||||
|
|
||||||
|
@ -66,6 +64,7 @@ our $VERSION = $ZoneMinder::Base::VERSION;
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
||||||
use ZoneMinder::Logger qw(:all);
|
use ZoneMinder::Logger qw(:all);
|
||||||
|
use ZoneMinder::Config qw(:all);
|
||||||
|
|
||||||
use Carp;
|
use Carp;
|
||||||
|
|
||||||
|
@ -83,19 +82,19 @@ sub zmDbConnect
|
||||||
|
|
||||||
if ( defined($port) )
|
if ( defined($port) )
|
||||||
{
|
{
|
||||||
$dbh = DBI->connect( "DBI:mysql:database=".$ZoneMinder::Config::Config{ZM_DB_NAME}
|
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||||
.";host=".$host
|
.";host=".$host
|
||||||
.";port=".$port
|
.";port=".$port
|
||||||
, $ZoneMinder::Config::Config{ZM_DB_USER}
|
, $Config{ZM_DB_USER}
|
||||||
, $ZoneMinder::Config::Config{ZM_DB_PASS}
|
, $Config{ZM_DB_PASS}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dbh = DBI->connect( "DBI:mysql:database=".$ZoneMinder::Config::Config{ZM_DB_NAME}
|
$dbh = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||||
.";host=".$ZoneMinder::Config::Config{ZM_DB_HOST}
|
.";host=".$Config{ZM_DB_HOST}
|
||||||
, $ZoneMinder::Config::Config{ZM_DB_USER}
|
, $Config{ZM_DB_USER}
|
||||||
, $ZoneMinder::Config::Config{ZM_DB_PASS}
|
, $Config{ZM_DB_PASS}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$dbh->trace( 0 );
|
$dbh->trace( 0 );
|
||||||
|
|
|
@ -30,9 +30,6 @@ use warnings;
|
||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
require ZoneMinder::Base;
|
require ZoneMinder::Base;
|
||||||
require ZoneMinder::Database;
|
|
||||||
require ZoneMinder::Config;
|
|
||||||
|
|
||||||
|
|
||||||
our @ISA = qw(Exporter ZoneMinder::Base);
|
our @ISA = qw(Exporter ZoneMinder::Base);
|
||||||
|
|
||||||
|
@ -89,6 +86,8 @@ our $VERSION = $ZoneMinder::Base::VERSION;
|
||||||
#
|
#
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
||||||
|
use ZoneMinder::Config qw(:all);
|
||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
use Carp;
|
use Carp;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
|
@ -152,7 +151,7 @@ sub new
|
||||||
$this->{hasTerm} = -t STDERR;
|
$this->{hasTerm} = -t STDERR;
|
||||||
|
|
||||||
( $this->{fileName} = $0 ) =~ s|^.*/||;
|
( $this->{fileName} = $0 ) =~ s|^.*/||;
|
||||||
$this->{logPath} = $ZoneMinder::Config::Config{ZM_PATH_LOGS};
|
$this->{logPath} = $Config{ZM_PATH_LOGS};
|
||||||
$this->{logFile} = $this->{logPath}."/".$this->{id}.".log";
|
$this->{logFile} = $this->{logPath}."/".$this->{id}.".log";
|
||||||
|
|
||||||
$this->{trace} = 0;
|
$this->{trace} = 0;
|
||||||
|
@ -165,7 +164,7 @@ sub BEGIN
|
||||||
{
|
{
|
||||||
# Fake the config variables that are used in case they are not defined yet
|
# Fake the config variables that are used in case they are not defined yet
|
||||||
# Only really necessary to support upgrade from previous version
|
# Only really necessary to support upgrade from previous version
|
||||||
if ( !eval('defined($ZoneMinder::Config::Config{ZM_LOG_DEBUG})') )
|
if ( !eval('defined($Config{ZM_LOG_DEBUG})') )
|
||||||
{
|
{
|
||||||
no strict 'subs';
|
no strict 'subs';
|
||||||
no strict 'refs';
|
no strict 'refs';
|
||||||
|
@ -223,7 +222,7 @@ sub initialise( @ )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tempDatabaseLevel = $ZoneMinder::Config::Config{ZM_LOG_LEVEL_DATABASE};
|
$tempDatabaseLevel = $Config{ZM_LOG_LEVEL_DATABASE};
|
||||||
}
|
}
|
||||||
if ( defined($options{fileLevel}) )
|
if ( defined($options{fileLevel}) )
|
||||||
{
|
{
|
||||||
|
@ -231,7 +230,7 @@ sub initialise( @ )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tempFileLevel = $ZoneMinder::Config::Config{ZM_LOG_LEVEL_FILE};
|
$tempFileLevel = $Config{ZM_LOG_LEVEL_FILE};
|
||||||
}
|
}
|
||||||
if ( defined($options{syslogLevel}) )
|
if ( defined($options{syslogLevel}) )
|
||||||
{
|
{
|
||||||
|
@ -239,7 +238,7 @@ sub initialise( @ )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tempSyslogLevel = $ZoneMinder::Config::Config{ZM_LOG_LEVEL_SYSLOG};
|
$tempSyslogLevel = $Config{ZM_LOG_LEVEL_SYSLOG};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( defined($ENV{'LOG_PRINT'}) )
|
if ( defined($ENV{'LOG_PRINT'}) )
|
||||||
|
@ -255,9 +254,9 @@ sub initialise( @ )
|
||||||
$tempFileLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_FILE')) );
|
$tempFileLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_FILE')) );
|
||||||
$tempSyslogLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_SYSLOG')) );
|
$tempSyslogLevel = $level if ( defined($level = $this->getTargettedEnv('LOG_LEVEL_SYSLOG')) );
|
||||||
|
|
||||||
if ( $ZoneMinder::Config::Config{ZM_LOG_DEBUG} )
|
if ( $Config{ZM_LOG_DEBUG} )
|
||||||
{
|
{
|
||||||
foreach my $target ( split( /\|/, $ZoneMinder::Config::Config{ZM_LOG_DEBUG_TARGET} ) )
|
foreach my $target ( split( /\|/, $Config{ZM_LOG_DEBUG_TARGET} ) )
|
||||||
{
|
{
|
||||||
if ( $target eq $this->{id}
|
if ( $target eq $this->{id}
|
||||||
|| $target eq "_".$this->{id}
|
|| $target eq "_".$this->{id}
|
||||||
|
@ -266,12 +265,12 @@ sub initialise( @ )
|
||||||
|| $target eq ""
|
|| $target eq ""
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( $ZoneMinder::Config::Config{ZM_LOG_DEBUG_LEVEL} > NOLOG )
|
if ( $Config{ZM_LOG_DEBUG_LEVEL} > NOLOG )
|
||||||
{
|
{
|
||||||
$tempLevel = $this->limit( $ZoneMinder::Config::Config{ZM_LOG_DEBUG_LEVEL} );
|
$tempLevel = $this->limit( $Config{ZM_LOG_DEBUG_LEVEL} );
|
||||||
if ( $ZoneMinder::Config::Config{ZM_LOG_DEBUG_FILE} ne "" )
|
if ( $Config{ZM_LOG_DEBUG_FILE} ne "" )
|
||||||
{
|
{
|
||||||
$tempLogFile = $ZoneMinder::Config::Config{ZM_LOG_DEBUG_FILE};
|
$tempLogFile = $Config{ZM_LOG_DEBUG_FILE};
|
||||||
$tempFileLevel = $tempLevel;
|
$tempFileLevel = $tempLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,14 +460,32 @@ sub databaseLevel
|
||||||
{
|
{
|
||||||
if ( !$this->{dbh} )
|
if ( !$this->{dbh} )
|
||||||
{
|
{
|
||||||
$this->{dbh} = ZoneMinder::Database::zmDbConnect();
|
my ( $host, $port ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
|
||||||
|
|
||||||
|
if ( defined($port) )
|
||||||
|
{
|
||||||
|
$this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||||
|
.";host=".$host
|
||||||
|
.";port=".$port
|
||||||
|
, $Config{ZM_DB_USER}
|
||||||
|
, $Config{ZM_DB_PASS}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->{dbh} = DBI->connect( "DBI:mysql:database=".$Config{ZM_DB_NAME}
|
||||||
|
.";host=".$Config{ZM_DB_HOST}
|
||||||
|
, $Config{ZM_DB_USER}
|
||||||
|
, $Config{ZM_DB_PASS}
|
||||||
|
);
|
||||||
|
}
|
||||||
if ( !$this->{dbh} )
|
if ( !$this->{dbh} )
|
||||||
{
|
{
|
||||||
$databaseLevel = NOLOG;
|
$databaseLevel = NOLOG;
|
||||||
Error( "Unable to write log entries to DB, can't connect to database '"
|
Error( "Unable to write log entries to DB, can't connect to database '"
|
||||||
.$ZoneMinder::Config::Config{ZM_DB_NAME}
|
.$Config{ZM_DB_NAME}
|
||||||
."' on host '"
|
."' on host '"
|
||||||
.$ZoneMinder::Config::Config{ZM_DB_HOST}
|
.$Config{ZM_DB_HOST}
|
||||||
."'"
|
."'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -488,8 +505,7 @@ sub databaseLevel
|
||||||
{
|
{
|
||||||
if ( $this->{dbh} )
|
if ( $this->{dbh} )
|
||||||
{
|
{
|
||||||
# $this->dbh is now the global dbh, so don't close it.
|
$this->{dbh}->disconnect();
|
||||||
#$this->{dbh}->disconnect();
|
|
||||||
undef($this->{dbh});
|
undef($this->{dbh});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,8 +582,8 @@ sub openFile
|
||||||
{
|
{
|
||||||
$LOGFILE->autoflush() if ( $this->{autoFlush} );
|
$LOGFILE->autoflush() if ( $this->{autoFlush} );
|
||||||
|
|
||||||
my $webUid = (getpwnam( $ZoneMinder::Config::Config{ZM_WEB_USER} ))[2];
|
my $webUid = (getpwnam( $Config{ZM_WEB_USER} ))[2];
|
||||||
my $webGid = (getgrnam( $ZoneMinder::Config::Config{ZM_WEB_GROUP} ))[2];
|
my $webGid = (getgrnam( $Config{ZM_WEB_GROUP} ))[2];
|
||||||
if ( $> == 0 )
|
if ( $> == 0 )
|
||||||
{
|
{
|
||||||
chown( $webUid, $webGid, $this->{logFile} )
|
chown( $webUid, $webGid, $this->{logFile} )
|
||||||
|
|
|
@ -92,7 +92,7 @@ my @daemons = (
|
||||||
'zmwatch.pl',
|
'zmwatch.pl',
|
||||||
'zmupdate.pl',
|
'zmupdate.pl',
|
||||||
'zmtrack.pl',
|
'zmtrack.pl',
|
||||||
'zmtelemetry.pl',
|
'zmtelemetry.pl'
|
||||||
);
|
);
|
||||||
|
|
||||||
my $command = shift @ARGV;
|
my $command = shift @ARGV;
|
||||||
|
|
|
@ -71,7 +71,7 @@ if ( $Config{ZM_TELEMETRY_DATA} )
|
||||||
{
|
{
|
||||||
print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
|
print( "Update agent starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
|
||||||
|
|
||||||
my $lastCheck = $Config{ZM_TELEMETRY_LAST_CHECK};
|
my $lastCheck = $Config{ZM_TELEMETRY_LAST_UPLOAD};
|
||||||
|
|
||||||
while( 1 ) {
|
while( 1 ) {
|
||||||
my $now = time();
|
my $now = time();
|
||||||
|
|
|
@ -67,7 +67,12 @@ use constant CHECK_INTERVAL => (1*24*60*60); # Interval between version checks
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
||||||
@EXTRA_PERL_LIB@
|
@EXTRA_PERL_LIB@
|
||||||
use ZoneMinder;
|
use ZoneMinder::Base qw(:all);
|
||||||
|
use ZoneMinder::Config qw(:all);
|
||||||
|
use ZoneMinder::Logger qw(:all);
|
||||||
|
use ZoneMinder::General qw(:all);
|
||||||
|
use ZoneMinder::Database qw(:all);
|
||||||
|
use ZoneMinder::ConfigAdmin qw( :functions );
|
||||||
use POSIX;
|
use POSIX;
|
||||||
use DBI;
|
use DBI;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
@ -364,8 +369,8 @@ if ( $interactive ) {
|
||||||
my $sql = "ALTER TABLE $_ ENGINE = InnoDB";
|
my $sql = "ALTER TABLE $_ ENGINE = InnoDB";
|
||||||
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() );
|
||||||
|
$sth->finish();
|
||||||
}
|
}
|
||||||
$sth->finish();
|
|
||||||
$dbh->do(q|SET sql_mode=''|); # Set mode back to default
|
$dbh->do(q|SET sql_mode=''|); # Set mode back to default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ private:
|
||||||
} sdes;
|
} sdes;
|
||||||
|
|
||||||
// BYE
|
// BYE
|
||||||
struct Bye
|
struct
|
||||||
{
|
{
|
||||||
uint32_t srcN[]; // list of sources
|
uint32_t srcN[]; // list of sources
|
||||||
// can't express trailing text for reason (what does this mean? it's not even english!)
|
// can't express trailing text for reason (what does this mean? it's not even english!)
|
||||||
|
|
|
@ -103,7 +103,7 @@ public function beforeFilter() {
|
||||||
|
|
||||||
$this->Monitor->create();
|
$this->Monitor->create();
|
||||||
if ($this->Monitor->save($this->request->data)) {
|
if ($this->Monitor->save($this->request->data)) {
|
||||||
$this->daemonControl($this->Monitor->id, 'start', $this->request->data);
|
$this->daemonControl($this->Monitor->id, 'start');
|
||||||
return $this->flash(__('The monitor has been saved.'), array('action' => 'index'));
|
return $this->flash(__('The monitor has been saved.'), array('action' => 'index'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,11 +357,11 @@ function getHelperStream( $id, $src, $width, $height, $title="" ) {
|
||||||
</applet>';
|
</applet>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputImageStill( $id, $src, $width, $height, $title="" )
|
function outputImageStill( $id, $src, $width, $height, $title="" ) {
|
||||||
{
|
echo getImageStill( $id, $src, $width, $height, $title="" );
|
||||||
?>
|
}
|
||||||
<img id="<?php echo $id ?>" src="<?php echo $src ?>" alt="<?php echo $title ?>" width="<?php echo $width ?>" height="<?php echo $height ?>"/>
|
function getImageStill( $id, $src, $width, $height, $title="" ) {
|
||||||
<?php
|
return '<img id="'.$id.'" src="'.$src.'" alt="'.$title.'" width="'.$width.'" height="'.$height.'"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputControlStill( $src, $width, $height, $monitor, $scale, $target )
|
function outputControlStill( $src, $width, $height, $monitor, $scale, $target )
|
||||||
|
@ -2137,8 +2137,8 @@ function getStreamHTML( $monitor, $scale=100 ) {
|
||||||
return getHelperStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
return getHelperStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
||||||
} else {
|
} else {
|
||||||
$streamSrc = $monitor->getStreamSrc( array( 'mode=single', "scale=".$scale ) );
|
$streamSrc = $monitor->getStreamSrc( array( 'mode=single', "scale=".$scale ) );
|
||||||
outputImageStill( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
|
||||||
Info( "The system has fallen back to single jpeg mode for streaming. Consider enabling Cambozola or upgrading the client browser.");
|
Info( "The system has fallen back to single jpeg mode for streaming. Consider enabling Cambozola or upgrading the client browser.");
|
||||||
|
return getImageStill( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
||||||
}
|
}
|
||||||
} // end function getStreamHTML
|
} // end function getStreamHTML
|
||||||
|
|
||||||
|
|
|
@ -214,9 +214,9 @@ xhtmlHeaders(__FILE__, translate('Zone') );
|
||||||
</div>
|
</div>
|
||||||
<div id="definitionPanel">
|
<div id="definitionPanel">
|
||||||
<div id="imagePanel">
|
<div id="imagePanel">
|
||||||
<div id="imageFrame" style="width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;">
|
<div id="imageFrame" style="position: relative; width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;">
|
||||||
<?php $StreamHTML; ?>
|
<?php echo $StreamHTML; ?>
|
||||||
<svg id="zoneSVG" class="zones" style="width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;margin-top: -<?php echo $monitor->Height ?>px;background: none;">
|
<svg id="zoneSVG" class="zones" style="position: absolute; top: 0; left: 0; width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px; background: none;">
|
||||||
<polygon id="zonePoly" points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type'] ?>"/>
|
<polygon id="zonePoly" points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type'] ?>"/>
|
||||||
Sorry, your browser does not support inline SVG
|
Sorry, your browser does not support inline SVG
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
@ -47,9 +47,9 @@ xhtmlHeaders(__FILE__, translate('Zones') );
|
||||||
<div id="headerButtons"><a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a></div>
|
<div id="headerButtons"><a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a></div>
|
||||||
<h2><?php echo translate('Zones') ?></h2>
|
<h2><?php echo translate('Zones') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content" style="width:<?php echo $monitor->Width() ?>px; height:<?php echo $monitor->Height() ?>px; position:relative; margin: 0 auto;">
|
||||||
<?php echo getStreamHTML( $monitor ); ?>
|
<?php echo getStreamHTML( $monitor ); ?>
|
||||||
<svg class="zones" width="<?php echo $monitor->Width ?>" height="<?php echo $monitor->Height ?>" style="margin-top: -<?php echo $monitor->Height ?>px;background: none;">
|
<svg class="zones" width="<?php echo $monitor->Width() ?>" height="<?php echo $monitor->Height() ?>" style="position:absolute; top: 0; left: 0; background: none;">
|
||||||
<?php
|
<?php
|
||||||
foreach( array_reverse($zones) as $zone ) {
|
foreach( array_reverse($zones) as $zone ) {
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue