Compare commits
11 Commits
1.36.12_he
...
thumbnail_
Author | SHA1 | Date |
---|---|---|
Isaac Connor | ce4ea7d42e | |
Isaac Connor | 2f1e6cbd6b | |
Isaac Connor | 16953c6e2b | |
Isaac Connor | 5c2ee5a1c5 | |
Isaac Connor | c377c96367 | |
Isaac Connor | 010fcec990 | |
Isaac Connor | 51ef83dd94 | |
Isaac Connor | a407f9a0b7 | |
Isaac Connor | 0853f26062 | |
Isaac Connor | e7303ccb08 | |
Isaac Connor | 0d8c16bb56 |
|
@ -2,59 +2,5 @@
|
||||||
-- This updates a 1.29.0 database to 1.29.1
|
-- This updates a 1.29.0 database to 1.29.1
|
||||||
--
|
--
|
||||||
|
|
||||||
SET @s = (SELECT IF(
|
|
||||||
(SELECT COUNT(*)
|
|
||||||
FROM INFORMATION_SCHEMA.TABLES
|
|
||||||
WHERE table_name = 'Storage'
|
|
||||||
AND table_schema = DATABASE()
|
|
||||||
) > 0,
|
|
||||||
"SELECT 'Storage table exists'",
|
|
||||||
"CREATE TABLE `Storage` (
|
|
||||||
`Id` smallint(5) unsigned NOT NULL auto_increment,
|
|
||||||
`Path` varchar(64) NOT NULL default '',
|
|
||||||
`Name` varchar(64) NOT NULL default '',
|
|
||||||
PRIMARY KEY (`Id`)
|
|
||||||
)"
|
|
||||||
));
|
|
||||||
|
|
||||||
PREPARE stmt FROM @s;
|
|
||||||
EXECUTE stmt;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Add StorageId column to Monitors
|
|
||||||
--
|
|
||||||
|
|
||||||
SET @s = (SELECT IF(
|
|
||||||
(SELECT COUNT(*)
|
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
|
||||||
WHERE table_name = 'Monitors'
|
|
||||||
AND table_schema = DATABASE()
|
|
||||||
AND column_name = 'StorageId'
|
|
||||||
) > 0,
|
|
||||||
"SELECT 'Column StorageId exists in Monitors'",
|
|
||||||
"ALTER TABLE Monitors ADD `StorageId` smallint(5) unsigned AFTER `ServerId`"
|
|
||||||
));
|
|
||||||
|
|
||||||
PREPARE stmt FROM @s;
|
|
||||||
EXECUTE stmt;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Add StorageId column to Eventss
|
|
||||||
--
|
|
||||||
|
|
||||||
SET @s = (SELECT IF(
|
|
||||||
(SELECT COUNT(*)
|
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
|
||||||
WHERE table_name = 'Events'
|
|
||||||
AND table_schema = DATABASE()
|
|
||||||
AND column_name = 'StorageId'
|
|
||||||
) > 0,
|
|
||||||
"SELECT 'Column StorageId exists in Events'",
|
|
||||||
"ALTER TABLE Events ADD `StorageId` smallint(5) unsigned AFTER `MonitorId`"
|
|
||||||
));
|
|
||||||
|
|
||||||
PREPARE stmt FROM @s;
|
|
||||||
EXECUTE stmt;
|
|
||||||
|
|
||||||
-- Increase the size of the Pid field for FreeBSD
|
-- Increase the size of the Pid field for FreeBSD
|
||||||
ALTER TABLE Logs MODIFY Pid int(10);
|
ALTER TABLE Logs MODIFY Pid int(10);
|
||||||
|
|
|
@ -108,3 +108,57 @@ SELECT * FROM (SELECT NULL as Id,
|
||||||
WHERE NOT EXISTS (
|
WHERE NOT EXISTS (
|
||||||
SELECT Name FROM Controls WHERE name = 'Vivotek ePTZ'
|
SELECT Name FROM Controls WHERE name = 'Vivotek ePTZ'
|
||||||
) LIMIT 1;
|
) LIMIT 1;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.TABLES
|
||||||
|
WHERE table_name = 'Storage'
|
||||||
|
AND table_schema = DATABASE()
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Storage table exists'",
|
||||||
|
"CREATE TABLE `Storage` (
|
||||||
|
`Id` smallint(5) unsigned NOT NULL auto_increment,
|
||||||
|
`Path` varchar(64) NOT NULL default '',
|
||||||
|
`Name` varchar(64) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`Id`)
|
||||||
|
)"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Add StorageId column to Monitors
|
||||||
|
--
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE table_name = 'Monitors'
|
||||||
|
AND table_schema = DATABASE()
|
||||||
|
AND column_name = 'StorageId'
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Column StorageId exists in Monitors'",
|
||||||
|
"ALTER TABLE Monitors ADD `StorageId` smallint(5) unsigned AFTER `ServerId`"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Add StorageId column to Eventss
|
||||||
|
--
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE table_name = 'Events'
|
||||||
|
AND table_schema = DATABASE()
|
||||||
|
AND column_name = 'StorageId'
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Column StorageId exists in Events'",
|
||||||
|
"ALTER TABLE Events ADD `StorageId` smallint(5) unsigned AFTER `MonitorId`"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
zoneminder (1.30.2-trusty-2016050202) trusty; urgency=medium
|
||||||
|
|
||||||
|
* include thumnbails on console
|
||||||
|
|
||||||
|
-- Isaac Connor <iconnor@connortechnology.com> Mon, 02 May 2016 17:50:37 -0400
|
||||||
|
|
||||||
zoneminder (1.30.2-trusty-2016050201) trusty; urgency=medium
|
zoneminder (1.30.2-trusty-2016050201) trusty; urgency=medium
|
||||||
|
|
||||||
* add Servers support to API
|
* add Servers support to API
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
Installation Guide
|
||||||
|
======================================
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
ubuntu
|
||||||
|
debian
|
||||||
|
fedora
|
||||||
|
centos
|
||||||
|
redhat
|
||||||
|
multiserver
|
2622
src/zm_event.cpp
2622
src/zm_event.cpp
File diff suppressed because it is too large
Load Diff
|
@ -286,8 +286,8 @@ Monitor::Monitor(
|
||||||
storage_id( p_storage_id ),
|
storage_id( p_storage_id ),
|
||||||
function( (Function)p_function ),
|
function( (Function)p_function ),
|
||||||
enabled( p_enabled ),
|
enabled( p_enabled ),
|
||||||
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
|
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
|
||||||
height( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Width():p_camera->Height() ),
|
height( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Width():p_camera->Height() ),
|
||||||
orientation( (Orientation)p_orientation ),
|
orientation( (Orientation)p_orientation ),
|
||||||
deinterlacing( p_deinterlacing ),
|
deinterlacing( p_deinterlacing ),
|
||||||
savejpegspref( p_savejpegs ),
|
savejpegspref( p_savejpegs ),
|
||||||
|
@ -2078,7 +2078,7 @@ void Monitor::ReloadLinkedMonitors( const char *p_linked_monitors )
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L
|
||||||
int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose purpose ) {
|
int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose purpose ) {
|
||||||
std::string sql = "select Id, Name, ServerId, StorageId, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, SaveJPEGs, VideoWriter, EncoderParameters, RecordAudio, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, LabelSize, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour, Exif from Monitors where Function != 'None' and Type = 'Local'";
|
std::string sql = "select Id, Name, ServerId, StorageId, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, SaveJPEGs, VideoWriter, EncoderParameters, RecordAudio, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, LabelSize, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour, Exif from Monitors where Function != 'None' and Type = 'Local'";
|
||||||
;
|
|
||||||
if ( device[0] ) {
|
if ( device[0] ) {
|
||||||
sql += " AND Device='";
|
sql += " AND Device='";
|
||||||
sql += device;
|
sql += device;
|
||||||
|
|
|
@ -298,12 +298,12 @@ class Monitor
|
||||||
#else // ZM_MEM_MAPPED
|
#else // ZM_MEM_MAPPED
|
||||||
int shm_id;
|
int shm_id;
|
||||||
#endif // ZM_MEM_MAPPED
|
#endif // ZM_MEM_MAPPED
|
||||||
off_t mem_size;
|
off_t mem_size;
|
||||||
unsigned char *mem_ptr;
|
unsigned char *mem_ptr;
|
||||||
Storage *storage;
|
Storage *storage;
|
||||||
|
|
||||||
SharedData *shared_data;
|
SharedData *shared_data;
|
||||||
TriggerData *trigger_data;
|
TriggerData *trigger_data;
|
||||||
VideoStoreData *video_store_data;
|
VideoStoreData *video_store_data;
|
||||||
|
|
||||||
Snapshot *image_buffer;
|
Snapshot *image_buffer;
|
||||||
|
|
184
src/zm_zone.cpp
184
src/zm_zone.cpp
|
@ -651,105 +651,105 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
||||||
}
|
}
|
||||||
Debug( 5, "Got %d blob pixels, %d blobs, need %d -> %d, %d -> %d", alarm_blob_pixels, alarm_blobs, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs );
|
Debug( 5, "Got %d blob pixels, %d blobs, need %d -> %d, %d -> %d", alarm_blob_pixels, alarm_blobs, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs );
|
||||||
|
|
||||||
if( alarm_blobs ) {
|
if( alarm_blobs ) {
|
||||||
if( min_blobs && (alarm_blobs < min_blobs) ) {
|
if( min_blobs && (alarm_blobs < min_blobs) ) {
|
||||||
/* Not enough pixels alarmed */
|
/* Not enough pixels alarmed */
|
||||||
return (false);
|
return (false);
|
||||||
} else if(max_blobs && (alarm_blobs > max_blobs) ) {
|
} else if(max_blobs && (alarm_blobs > max_blobs) ) {
|
||||||
/* Too many pixels alarmed */
|
/* Too many pixels alarmed */
|
||||||
overload_count = overload_frames;
|
overload_count = overload_frames;
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No blobs */
|
/* No blobs */
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
score = (100*alarm_blob_pixels)/(polygon.Area());
|
score = (100*alarm_blob_pixels)/(polygon.Area());
|
||||||
if(score < 1)
|
if(score < 1)
|
||||||
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
|
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
|
||||||
Debug( 5, "Current score is %d", score );
|
Debug( 5, "Current score is %d", score );
|
||||||
|
|
||||||
alarm_lo_x = polygon.HiX()+1;
|
alarm_lo_x = polygon.HiX()+1;
|
||||||
alarm_hi_x = polygon.LoX()-1;
|
alarm_hi_x = polygon.LoX()-1;
|
||||||
alarm_lo_y = polygon.HiY()+1;
|
alarm_lo_y = polygon.HiY()+1;
|
||||||
alarm_hi_y = polygon.LoY()-1;
|
alarm_hi_y = polygon.LoY()-1;
|
||||||
for ( int i = 1; i < WHITE; i++ )
|
for ( int i = 1; i < WHITE; i++ )
|
||||||
{
|
{
|
||||||
BlobStats *bs = &blob_stats[i];
|
BlobStats *bs = &blob_stats[i];
|
||||||
if ( bs->count )
|
if ( bs->count )
|
||||||
{
|
{
|
||||||
if ( bs->count == max_blob_size )
|
if ( bs->count == max_blob_size )
|
||||||
{
|
{
|
||||||
if ( config.weighted_alarm_centres )
|
if ( config.weighted_alarm_centres )
|
||||||
{
|
{
|
||||||
unsigned long x_total = 0;
|
unsigned long x_total = 0;
|
||||||
unsigned long y_total = 0;
|
unsigned long y_total = 0;
|
||||||
|
|
||||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||||
{
|
{
|
||||||
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
||||||
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
||||||
{
|
{
|
||||||
if ( *spdiff == bs->tag )
|
if ( *spdiff == bs->tag )
|
||||||
{
|
{
|
||||||
x_total += sx;
|
x_total += sx;
|
||||||
y_total += sy;
|
y_total += sy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alarm_mid_x = int(round(x_total/bs->count));
|
alarm_mid_x = int(round(x_total/bs->count));
|
||||||
alarm_mid_y = int(round(y_total/bs->count));
|
alarm_mid_y = int(round(y_total/bs->count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alarm_mid_x = int((bs->hi_x+bs->lo_x+1)/2);
|
alarm_mid_x = int((bs->hi_x+bs->lo_x+1)/2);
|
||||||
alarm_mid_y = int((bs->hi_y+bs->lo_y+1)/2);
|
alarm_mid_y = int((bs->hi_y+bs->lo_y+1)/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( alarm_lo_x > bs->lo_x ) alarm_lo_x = bs->lo_x;
|
if ( alarm_lo_x > bs->lo_x ) alarm_lo_x = bs->lo_x;
|
||||||
if ( alarm_lo_y > bs->lo_y ) alarm_lo_y = bs->lo_y;
|
if ( alarm_lo_y > bs->lo_y ) alarm_lo_y = bs->lo_y;
|
||||||
if ( alarm_hi_x < bs->hi_x ) alarm_hi_x = bs->hi_x;
|
if ( alarm_hi_x < bs->hi_x ) alarm_hi_x = bs->hi_x;
|
||||||
if ( alarm_hi_y < bs->hi_y ) alarm_hi_y = bs->hi_y;
|
if ( alarm_hi_y < bs->hi_y ) alarm_hi_y = bs->hi_y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alarm_mid_x = int((alarm_hi_x+alarm_lo_x+1)/2);
|
alarm_mid_x = int((alarm_hi_x+alarm_lo_x+1)/2);
|
||||||
alarm_mid_y = int((alarm_hi_y+alarm_lo_y+1)/2);
|
alarm_mid_y = int((alarm_hi_y+alarm_lo_y+1)/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type == INCLUSIVE )
|
if ( type == INCLUSIVE )
|
||||||
{
|
{
|
||||||
// score >>= 1;
|
// score >>= 1;
|
||||||
score /= 2;
|
score /= 2;
|
||||||
}
|
}
|
||||||
else if ( type == EXCLUSIVE )
|
else if ( type == EXCLUSIVE )
|
||||||
{
|
{
|
||||||
// score <<= 1;
|
// score <<= 1;
|
||||||
score *= 2;
|
score *= 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug( 5, "Adjusted score is %d", score );
|
Debug( 5, "Adjusted score is %d", score );
|
||||||
|
|
||||||
// Now outline the changed region
|
// Now outline the changed region
|
||||||
if ( score )
|
if ( score )
|
||||||
{
|
{
|
||||||
alarm_box = Box( Coord( alarm_lo_x, alarm_lo_y ), Coord( alarm_hi_x, alarm_hi_y ) );
|
alarm_box = Box( Coord( alarm_lo_x, alarm_lo_y ), Coord( alarm_hi_x, alarm_hi_y ) );
|
||||||
|
|
||||||
//if ( monitor->followMotion() )
|
//if ( monitor->followMotion() )
|
||||||
if ( true )
|
if ( true )
|
||||||
{
|
{
|
||||||
alarm_centre = Coord( alarm_mid_x, alarm_mid_y );
|
alarm_centre = Coord( alarm_mid_x, alarm_mid_y );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
alarm_centre = alarm_box.Centre();
|
alarm_centre = alarm_box.Centre();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (type < PRECLUSIVE) && check_method >= BLOBS && config.create_analysis_images )
|
if ( (type < PRECLUSIVE) && check_method >= BLOBS && config.create_analysis_images )
|
||||||
{
|
{
|
||||||
|
|
335
src/zmf.cpp
335
src/zmf.cpp
|
@ -138,175 +138,176 @@ void Usage()
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
self = argv[0];
|
self = argv[0];
|
||||||
|
|
||||||
srand( getpid() * time( 0 ) );
|
srand( getpid() * time( 0 ) );
|
||||||
|
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"monitor", 1, 0, 'm'},
|
{"monitor", 1, 0, 'm'},
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
{"version", 0, 0, 'v'},
|
{"version", 0, 0, 'v'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
|
||||||
int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index);
|
int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case 'm':
|
||||||
|
id = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
case '?':
|
||||||
|
Usage();
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
std::cout << ZM_VERSION << "\n";
|
||||||
|
exit(0);
|
||||||
|
default:
|
||||||
|
//fprintf( stderr, "?? getopt returned character code 0%o ??\n", c );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optind < argc)
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Extraneous options, " );
|
||||||
|
while (optind < argc)
|
||||||
|
printf ("%s ", argv[optind++]);
|
||||||
|
printf ("\n");
|
||||||
|
Usage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( id < 0 )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Bogus monitor %d\n", id );
|
||||||
|
Usage();
|
||||||
|
exit( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
char log_id_string[16];
|
||||||
|
snprintf( log_id_string, sizeof(log_id_string), "m%d", id );
|
||||||
|
|
||||||
|
zmLoadConfig();
|
||||||
|
|
||||||
|
logInit( "zmf" );
|
||||||
|
|
||||||
|
ssedetect();
|
||||||
|
|
||||||
|
Monitor *monitor = Monitor::Load( id, false, Monitor::QUERY );
|
||||||
|
|
||||||
|
if ( !monitor )
|
||||||
|
{
|
||||||
|
fprintf( stderr, "Can't find monitor with id of %d\n", id );
|
||||||
|
exit( -1 );
|
||||||
|
}
|
||||||
|
Storage *Storage = monitor->getStorage();
|
||||||
|
|
||||||
|
char capt_path[PATH_MAX];
|
||||||
|
char anal_path[PATH_MAX];
|
||||||
|
snprintf( capt_path, sizeof(capt_path), "%s/%d/%%s/%%0%dd-capture.jpg", Storage->Path(), monitor->Id(), config.event_image_digits );
|
||||||
|
snprintf( anal_path, sizeof(anal_path), "%s/%d/%%s/%%0%dd-analyse.jpg", Storage->Path(), monitor->Id(), config.event_image_digits );
|
||||||
|
zmSetDefaultTermHandler();
|
||||||
|
zmSetDefaultDieHandler();
|
||||||
|
|
||||||
|
sigset_t block_set;
|
||||||
|
sigemptyset( &block_set );
|
||||||
|
|
||||||
|
int sd = OpenSocket( monitor->Id() );
|
||||||
|
|
||||||
|
FrameHeader frame_header = { 0, 0, false, 0 };
|
||||||
|
//unsigned char *image_data = 0;
|
||||||
|
|
||||||
|
fd_set rfds;
|
||||||
|
|
||||||
|
struct timeval timeout;
|
||||||
|
timeout.tv_sec = 1;
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
struct timeval temp_timeout = timeout;
|
||||||
|
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(sd, &rfds);
|
||||||
|
int n_found = select( sd+1, &rfds, NULL, NULL, &temp_timeout );
|
||||||
|
if( n_found == 0 )
|
||||||
|
{
|
||||||
|
Debug( 1, "Select timed out" );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ( n_found < 0)
|
||||||
|
{
|
||||||
|
Error( "Select error: %s", strerror(errno) );
|
||||||
|
ReopenSocket( sd, monitor->Id() );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sigprocmask( SIG_BLOCK, &block_set, 0 );
|
||||||
|
|
||||||
|
int n_bytes = read( sd, &frame_header, sizeof(frame_header) );
|
||||||
|
if ( n_bytes != sizeof(frame_header) )
|
||||||
|
{
|
||||||
|
if ( n_bytes < 0 )
|
||||||
|
{
|
||||||
|
Error( "Can't read frame header: %s", strerror(errno) );
|
||||||
|
}
|
||||||
|
else if ( n_bytes > 0 )
|
||||||
|
{
|
||||||
|
Error( "Incomplete read of frame header, %d bytes only", n_bytes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Warning( "Socket closed at remote end" );
|
||||||
|
}
|
||||||
|
ReopenSocket( sd, monitor->Id() );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Debug( 1, "Read frame header, expecting %ld bytes of image", frame_header.image_length );
|
||||||
|
static unsigned char image_data[ZM_MAX_IMAGE_SIZE];
|
||||||
|
|
||||||
|
// Read for pipe and loop until bytes expected have been read or an error occurs
|
||||||
|
int bytes_read = 0;
|
||||||
|
do
|
||||||
{
|
{
|
||||||
break;
|
n_bytes = read( sd, image_data+bytes_read, frame_header.image_length-bytes_read );
|
||||||
}
|
if (n_bytes < 0) break; // break on error
|
||||||
|
if (n_bytes < (int)frame_header.image_length)
|
||||||
|
{
|
||||||
|
// print some informational messages
|
||||||
|
if (bytes_read == 0)
|
||||||
|
{
|
||||||
|
Debug(4,"Image read : Short read %d bytes of %d expected bytes",n_bytes,frame_header.image_length);
|
||||||
|
}
|
||||||
|
else if (bytes_read+n_bytes == (int)frame_header.image_length)
|
||||||
|
{
|
||||||
|
Debug(5,"Image read : Read rest of short read: %d bytes read total of %d bytes",n_bytes,frame_header.image_length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug(6,"Image read : continuing, read %d bytes (%d so far)", n_bytes, bytes_read+n_bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bytes_read+= n_bytes;
|
||||||
|
} while (n_bytes>0 && (bytes_read < (ssize_t)frame_header.image_length) );
|
||||||
|
|
||||||
switch (c)
|
// Print errors if there was a problem
|
||||||
|
if ( n_bytes < 1 )
|
||||||
{
|
{
|
||||||
case 'm':
|
|
||||||
id = atoi(optarg);
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
case '?':
|
|
||||||
Usage();
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
std::cout << ZM_VERSION << "\n";
|
|
||||||
exit(0);
|
|
||||||
default:
|
|
||||||
//fprintf( stderr, "?? getopt returned character code 0%o ??\n", c );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optind < argc)
|
Error( "Only read %d bytes of %d\n", bytes_read, frame_header.image_length);
|
||||||
{
|
|
||||||
fprintf( stderr, "Extraneous options, " );
|
|
||||||
while (optind < argc)
|
|
||||||
printf ("%s ", argv[optind++]);
|
|
||||||
printf ("\n");
|
|
||||||
Usage();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( id < 0 )
|
|
||||||
{
|
|
||||||
fprintf( stderr, "Bogus monitor %d\n", id );
|
|
||||||
Usage();
|
|
||||||
exit( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
char log_id_string[16];
|
|
||||||
snprintf( log_id_string, sizeof(log_id_string), "m%d", id );
|
|
||||||
|
|
||||||
zmLoadConfig();
|
|
||||||
|
|
||||||
logInit( "zmf" );
|
|
||||||
|
|
||||||
ssedetect();
|
|
||||||
|
|
||||||
Monitor *monitor = Monitor::Load( id, false, Monitor::QUERY );
|
|
||||||
|
|
||||||
if ( !monitor )
|
|
||||||
{
|
|
||||||
fprintf( stderr, "Can't find monitor with id of %d\n", id );
|
|
||||||
exit( -1 );
|
|
||||||
}
|
|
||||||
Storage *Storage = monitor->getStorage();
|
|
||||||
|
|
||||||
char capt_path[PATH_MAX];
|
|
||||||
char anal_path[PATH_MAX];
|
|
||||||
snprintf( capt_path, sizeof(capt_path), "%s/%d/%%s/%%0%dd-capture.jpg", Storage->Path(), monitor->Id(), config.event_image_digits );
|
|
||||||
snprintf( anal_path, sizeof(anal_path), "%s/%d/%%s/%%0%dd-analyse.jpg", Storage->Path(), monitor->Id(), config.event_image_digits );
|
|
||||||
zmSetDefaultTermHandler();
|
|
||||||
zmSetDefaultDieHandler();
|
|
||||||
|
|
||||||
sigset_t block_set;
|
|
||||||
sigemptyset( &block_set );
|
|
||||||
|
|
||||||
int sd = OpenSocket( monitor->Id() );
|
|
||||||
|
|
||||||
FrameHeader frame_header = { 0, 0, false, 0 };
|
|
||||||
//unsigned char *image_data = 0;
|
|
||||||
|
|
||||||
fd_set rfds;
|
|
||||||
|
|
||||||
struct timeval timeout;
|
|
||||||
timeout.tv_sec = 1;
|
|
||||||
timeout.tv_usec = 0;
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
struct timeval temp_timeout = timeout;
|
|
||||||
|
|
||||||
FD_ZERO(&rfds);
|
|
||||||
FD_SET(sd, &rfds);
|
|
||||||
int n_found = select( sd+1, &rfds, NULL, NULL, &temp_timeout );
|
|
||||||
if( n_found == 0 )
|
|
||||||
{
|
|
||||||
Debug( 1, "Select timed out" );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if ( n_found < 0)
|
|
||||||
{
|
|
||||||
Error( "Select error: %s", strerror(errno) );
|
|
||||||
ReopenSocket( sd, monitor->Id() );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sigprocmask( SIG_BLOCK, &block_set, 0 );
|
|
||||||
|
|
||||||
int n_bytes = read( sd, &frame_header, sizeof(frame_header) );
|
|
||||||
if ( n_bytes != sizeof(frame_header) )
|
|
||||||
{
|
|
||||||
if ( n_bytes < 0 )
|
if ( n_bytes < 0 )
|
||||||
{
|
{
|
||||||
Error( "Can't read frame header: %s", strerror(errno) );
|
Error( "Can't read frame image data: %s", strerror(errno) );
|
||||||
}
|
|
||||||
else if ( n_bytes > 0 )
|
|
||||||
{
|
|
||||||
Error( "Incomplete read of frame header, %d bytes only", n_bytes );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Warning( "Socket closed at remote end" );
|
|
||||||
}
|
|
||||||
ReopenSocket( sd, monitor->Id() );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Debug( 1, "Read frame header, expecting %ld bytes of image", frame_header.image_length );
|
|
||||||
static unsigned char image_data[ZM_MAX_IMAGE_SIZE];
|
|
||||||
|
|
||||||
// Read for pipe and loop until bytes expected have been read or an error occurs
|
|
||||||
int bytes_read = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
n_bytes = read( sd, image_data+bytes_read, frame_header.image_length-bytes_read );
|
|
||||||
if (n_bytes < 0) break; // break on error
|
|
||||||
if (n_bytes < (int)frame_header.image_length)
|
|
||||||
{
|
|
||||||
// print some informational messages
|
|
||||||
if (bytes_read == 0)
|
|
||||||
{
|
|
||||||
Debug(4,"Image read : Short read %d bytes of %d expected bytes",n_bytes,frame_header.image_length);
|
|
||||||
}
|
|
||||||
else if (bytes_read+n_bytes == (int)frame_header.image_length)
|
|
||||||
{
|
|
||||||
Debug(5,"Image read : Read rest of short read: %d bytes read total of %d bytes",n_bytes,frame_header.image_length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug(6,"Image read : continuing, read %d bytes (%d so far)", n_bytes, bytes_read+n_bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bytes_read+= n_bytes;
|
|
||||||
} while (n_bytes>0 && (bytes_read < (ssize_t)frame_header.image_length) );
|
|
||||||
|
|
||||||
// Print errors if there was a problem
|
|
||||||
if ( n_bytes < 1 )
|
|
||||||
{
|
|
||||||
Error( "Only read %d bytes of %d\n", bytes_read, frame_header.image_length);
|
|
||||||
if ( n_bytes < 0 )
|
|
||||||
{
|
|
||||||
Error( "Can't read frame image data: %s", strerror(errno) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -317,15 +318,15 @@ int main( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
static char subpath[PATH_MAX] = "";
|
static char subpath[PATH_MAX] = "";
|
||||||
if ( config.use_deep_storage )
|
if ( config.use_deep_storage )
|
||||||
{
|
{
|
||||||
struct tm *time = localtime( &frame_header.event_time );
|
struct tm *time = localtime( &frame_header.event_time );
|
||||||
snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec );
|
snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
|
snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
static char path[PATH_MAX] = "";
|
static char path[PATH_MAX] = "";
|
||||||
snprintf( path, sizeof(path), frame_header.alarm_frame?anal_path:capt_path, subpath, frame_header.frame_id );
|
snprintf( path, sizeof(path), frame_header.alarm_frame?anal_path:capt_path, subpath, frame_header.frame_id );
|
||||||
|
|
|
@ -474,22 +474,3 @@ input[type=submit]:disabled {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Console table for the main event table
|
|
||||||
*/
|
|
||||||
|
|
||||||
#consoleTable td, #consoleTable th {
|
|
||||||
padding: 5px;
|
|
||||||
border-bottom: 2px solid #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
#consoleTable input[type=button] {
|
|
||||||
margin-right: 3px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#consoleTable tfoot {
|
|
||||||
background-color: #f2f2f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,97 +1,180 @@
|
||||||
#systemTime {
|
#systemTime {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#title {
|
#title {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#systemStats {
|
#systemStats {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
#monitorSummary {
|
#monitorSummary {
|
||||||
float: left;
|
float: left;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#devices {
|
#devices {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#loginBandwidth {
|
#loginBandwidth {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cycleMontage {
|
#cycleMontage {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
#options {
|
#options {
|
||||||
float: right;
|
float: right;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable {
|
#consoleTable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
display: table;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable tr.highlight {
|
#consoleTable div.highlight {
|
||||||
background-color: #eeeeee;
|
background-color: #eeeeee;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable thead th {
|
#consoleTable .thead .tr div {
|
||||||
padding-bottom: 4px;
|
vertical-align: middle;
|
||||||
vertical-align: middle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable tfoot td {
|
#consoleTable .MonitorInfo {
|
||||||
padding-top: 4px;
|
display: table-cell;
|
||||||
vertical-align: middle;
|
width: auto;
|
||||||
|
}
|
||||||
|
#consoleTable .MonitorInfo div {
|
||||||
|
display: inline-block;
|
||||||
|
text-align: left;
|
||||||
|
width: 19%;
|
||||||
|
padding: 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable th,td {
|
#consoleTable .Events {
|
||||||
height: 16px;
|
display: table-cell;
|
||||||
text-align: left;
|
width: 381px;
|
||||||
|
}
|
||||||
|
#consoleTable .Events .Events {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable .Events div {
|
||||||
|
display: inline-block;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable .tfoot .tr {
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
#consoleTable .tfoot .tr div {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable .tr div {
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colOrder {
|
#consoleTable .colOrder {
|
||||||
text-align: center;
|
width: 47px;
|
||||||
|
text-align: center;
|
||||||
|
display: table-cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colMark {
|
#consoleTable .colMark {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
display: table-cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colEvents {
|
#consoleTable .colEvents {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
}
|
||||||
|
#consoleTable .Hour {
|
||||||
|
width: 35px;
|
||||||
|
}
|
||||||
|
#consoleTable .Day {
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
#consoleTable .Week {
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
#consoleTable .Month {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
#consoleTable .Archived {
|
||||||
|
width: 62px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colZones {
|
#consoleTable .colZones {
|
||||||
text-align: right;
|
width: 40px;
|
||||||
|
text-align: right;
|
||||||
|
display: table-cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colLeftButtons {
|
#consoleTable .colLeftButtons {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
min-width:400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colLeftButtons input {
|
#consoleTable .colLeftButtons input {
|
||||||
margin-right: 24px;
|
margin-right: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colRightButtons {
|
#consoleTable .colRightButtons {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding-right: 8px;
|
min-width: 158px;
|
||||||
|
margin-right: -32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#consoleTable .colRightButtons input {
|
#consoleTable .colRightButtons input {
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Console table for the main event table
|
||||||
|
*/
|
||||||
|
|
||||||
|
#consoleTable .tr {
|
||||||
|
display: table-row;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable .Monitor {
|
||||||
|
display: table-row;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable .tr {
|
||||||
|
padding: 5px 0;
|
||||||
|
border-bottom: 2px solid #f2f2f2;
|
||||||
|
line-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable input[type=button] {
|
||||||
|
margin-right: 3px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleTable .tfoot {
|
||||||
|
display: table-footer-group;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
#consoleTable .tbody {
|
||||||
|
display: table-row-group;
|
||||||
|
}
|
||||||
|
#consoleTable .thead {
|
||||||
|
display: table-header-group;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('includes/Server.php');
|
|
||||||
$servers = Server::find_all();
|
$servers = Server::find_all();
|
||||||
require_once('includes/Storage.php');
|
require_once('includes/Storage.php');
|
||||||
$storage_areas = Storage::find_all();
|
$storage_areas = Storage::find_all();
|
||||||
|
@ -11,72 +10,75 @@ xhtmlHeaders( __FILE__, translate('Console') );
|
||||||
<form name="monitorForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
<form name="monitorForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||||
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
||||||
<input type="hidden" name="action" value=""/>
|
<input type="hidden" name="action" value=""/>
|
||||||
|
|
||||||
<?php include("skins/$skin/views/header.php") ?>
|
<?php include("skins/$skin/views/header.php") ?>
|
||||||
|
<div id="content" class="container-fluid">
|
||||||
<div class="container-fluid">
|
<div id="consoleTable" cellspacing="0">
|
||||||
<table id="consoleTable" cellspacing="0">
|
<div class="thead">
|
||||||
<thead>
|
<div class="tr">
|
||||||
<tr>
|
<div class="MonitorInfo">
|
||||||
<th class="colName"><?php echo translate('Name') ?></th>
|
<div class="colName"><?php echo translate('Name') ?></div>
|
||||||
<th class="colFunction"><?php echo translate('Function') ?></th>
|
<div class="colFunction"><?php echo translate('Function') ?></div>
|
||||||
<?php if ( count($servers) ) { ?>
|
<?php if ( count($servers) ) { ?>
|
||||||
<th class="colServer"><?php echo translate('Server') ?></th>
|
<div class="colServer"><?php echo translate('Server') ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th class="colSource"><?php echo translate('Source') ?></th>
|
<div class="colSource"><?php echo translate('Source') ?></div>
|
||||||
<?php if ( $show_storage_areas ) { ?>
|
<?php if ( $show_storage_areas ) { ?>
|
||||||
<th class="colStorage"><?php echo translate('Storage') ?></th>
|
<div class="colStorage"><?php echo translate('Storage') ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<div class="Events">
|
||||||
<?php
|
<?php
|
||||||
for ( $i = 0; $i < count($eventCounts); $i++ )
|
for ( $i = 0; $i < count($eventCounts); $i++ )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<th class="colEvents"><?php echo $eventCounts[$i]['title'] ?></th>
|
<div class="colEvents <?php echo $eventCounts[$i]['title'] ?>"><?php echo $eventCounts[$i]['title'] ?></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<th class="colZones"><?php echo translate('Zones') ?></th>
|
</div>
|
||||||
|
<div class="colZones"><?php echo translate('Zones') ?></div>
|
||||||
<?php
|
<?php
|
||||||
if ( canEdit('Monitors') )
|
if ( canEdit('Monitors') )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<th class="colOrder"><?php echo translate('Order') ?></th>
|
<div class="colOrder"><?php echo translate('Order') ?></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<th class="colMark"><?php echo translate('Mark') ?></th>
|
<div class="colMark"><?php echo translate('Mark') ?></div>
|
||||||
</tr>
|
</div>
|
||||||
</thead>
|
</div>
|
||||||
<tfoot>
|
<div class="tfoot">
|
||||||
<tr>
|
<div class="tr">
|
||||||
<td class="colLeftButtons" colspan="<?php $columns = 3;
|
<div class="colLeftButtons" colspan="<?php $columns = 3;
|
||||||
if ( count($servers) > 1 ) { $columns += 1; }
|
if ( count($servers) > 1 ) { $columns += 1; }
|
||||||
if ( $show_storage_areas ) { $columns += 1; }
|
if ( $show_storage_areas ) { $columns += 1; }
|
||||||
echo $columns;
|
echo $columns;
|
||||||
?>">
|
?>">
|
||||||
<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
|
<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
|
||||||
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
|
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
|
||||||
|
</div>
|
||||||
</td>
|
<div class="Events">
|
||||||
<?php
|
<?php
|
||||||
for ( $i = 0; $i < count($eventCounts); $i++ )
|
for ( $i = 0; $i < count($eventCounts); $i++ )
|
||||||
{
|
{
|
||||||
parseFilter( $eventCounts[$i]['filter'] );
|
parseFilter( $eventCounts[$i]['filter'] );
|
||||||
?>
|
?>
|
||||||
<td class="colEvents"><?php echo makePopupLink( '?view='.$eventsView.'&page=1'.$eventCounts[$i]['filter']['query'], $eventsWindow, $eventsView, $eventCounts[$i]['total'], canView( 'Events' ) ) ?></td>
|
<div class="colEvents <?php echo $eventCounts[$i]['title'] ?>"><?php echo makePopupLink( '?view='.$eventsView.'&page=1'.$eventCounts[$i]['filter']['query'], $eventsWindow, $eventsView, $eventCounts[$i]['total'], canView( 'Events' ) ) ?></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="colZones"><?php echo $zoneCount ?></td>
|
</div>
|
||||||
<td class="colRightButtons" colspan="<?php echo canEdit('Monitors')?2:1 ?>"><input class="btn btn-default" type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/><input class="btn btn-default" type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/></td>
|
<div class="colZones"><?php echo $zoneCount ?></div>
|
||||||
</tr>
|
<div class="colRightButtons" colspan="<?php echo canEdit('Monitors')?2:1 ?>"><input class="btn btn-default" type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/><input class="btn btn-default" type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/></div>
|
||||||
</tfoot>
|
</div>
|
||||||
<tbody>
|
</div>
|
||||||
|
<div class="tbody">
|
||||||
<?php
|
<?php
|
||||||
foreach( $displayMonitors as $monitor )
|
foreach( $displayMonitors as $monitor )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<tr title="<?php echo $monitor['Id'] ?>">
|
<div class="tr" title="<?php echo $monitor['Id'] ?>">
|
||||||
<?php
|
<?php
|
||||||
if ( !$monitor['zmc'] )
|
if ( !$monitor['zmc'] )
|
||||||
$dclass = "errorText";
|
$dclass = "errorText";
|
||||||
|
@ -98,20 +100,21 @@ foreach( $displayMonitors as $monitor )
|
||||||
$fclass .= " disabledText";
|
$fclass .= " disabledText";
|
||||||
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||||
?>
|
?>
|
||||||
<td class="colName"><?php echo makePopupLink( '?view=watch&mid='.$monitor['Id'], 'zmWatch'.$monitor['Id'], array( 'watch', reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) ), $monitor['Name'], $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></td>
|
<div class="MonitorInfo">
|
||||||
<td class="colFunction"><?php echo makePopupLink( '?view=function&mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$fclass.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<div class="colName"><?php echo makePopupLink( '?view=watch&mid='.$monitor['Id'], 'zmWatch'.$monitor['Id'], array( 'watch', reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) ), $monitor['Name'], $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></div>
|
||||||
|
<div class="colFunction"><?php echo makePopupLink( '?view=function&mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$fclass.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'</span>', canEdit( 'Monitors' ) ) ?></div>
|
||||||
<?php if ( count($servers) ) { ?>
|
<?php if ( count($servers) ) { ?>
|
||||||
<td class="colServer"><?php
|
<div class="colServer"><?php
|
||||||
$Server = new Server( $monitor['ServerId'] );
|
$Server = new Server( $monitor['ServerId'] );
|
||||||
echo $Server->Name();
|
echo $Server->Name();
|
||||||
?></td>
|
?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( $monitor['Type'] == "Local" ) { ?>
|
<?php if ( $monitor['Type'] == "Local" ) { ?>
|
||||||
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$monitor['Device'].' ('.$monitor['Channel'].')</span>', canEdit( 'Monitors' ) ) ?></td>
|
<div class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$monitor['Device'].' ('.$monitor['Channel'].')</span>', canEdit( 'Monitors' ) ) ?></div>
|
||||||
<?php } elseif ( $monitor['Type'] == "Remote" ) { ?>
|
<?php } elseif ( $monitor['Type'] == "Remote" ) { ?>
|
||||||
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*@/', '', $monitor['Host'] ).'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<div class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*@/', '', $monitor['Host'] ).'</span>', canEdit( 'Monitors' ) ) ?></div>
|
||||||
<?php } elseif ( $monitor['Type'] == "File" ) { ?>
|
<?php } elseif ( $monitor['Type'] == "File" ) { ?>
|
||||||
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<div class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></div>
|
||||||
<?php } elseif ( $monitor['Type'] == "Ffmpeg" || $monitor['Type'] == "Libvlc" ) {
|
<?php } elseif ( $monitor['Type'] == "Ffmpeg" || $monitor['Type'] == "Libvlc" ) {
|
||||||
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
|
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
|
||||||
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
|
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
|
||||||
|
@ -119,42 +122,41 @@ echo $Server->Name();
|
||||||
$shortpath = 'Monitor ' . $monitor['Id'];
|
$shortpath = 'Monitor ' . $monitor['Id'];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<div class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></div>
|
||||||
<?php } elseif ( $monitor['Type'] == "cURL" ) { ?>
|
<?php } elseif ( $monitor['Type'] == "cURL" ) { ?>
|
||||||
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<div class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.preg_replace( '/^.*\//', '', $monitor['Path'] ).'</span>', canEdit( 'Monitors' ) ) ?></div>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td class="colSource"> </td>
|
<div class="colSource"> </div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( $show_storage_areas ) { ?>
|
<?php if ( $show_storage_areas ) { ?>
|
||||||
<td class="colStorage"><?php
|
<div class="colStorage"><?php $Storage = new Storage( $monitor['StorageId'] ); echo $Storage->Name(); ?></div>
|
||||||
$Storage = new Storage( $monitor['StorageId'] );
|
|
||||||
echo $Storage->Name();
|
|
||||||
?></td>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
</div><div class="Events">
|
||||||
<?php
|
<?php
|
||||||
for ( $i = 0; $i < count($eventCounts); $i++ )
|
for ( $i = 0; $i < count($eventCounts); $i++ )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<td class="colEvents"><?php echo makePopupLink( '?view='.$eventsView.'&page=1'.$monitor['eventCounts'][$i]['filter']['query'], $eventsWindow, $eventsView, $monitor['EventCount'.$i], canView( 'Events' ) ) ?></td>
|
<div class="colEvents <?php echo $eventCounts[$i]['title'] ?>"><?php echo makePopupLink( '?view='.$eventsView.'&page=1'.$monitor['eventCounts'][$i]['filter']['query'], $eventsWindow, $eventsView, $monitor['EventCount'.$i], canView( 'Events' ) ) ?></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="colZones"><?php echo makePopupLink( '?view=zones&mid='.$monitor['Id'], 'zmZones', array( 'zones', $monitor['Width'], $monitor['Height'] ), $monitor['ZoneCount'], canView( 'Monitors' ) ) ?></td>
|
</div>
|
||||||
|
<div class="colZones"><?php echo makePopupLink( '?view=zones&mid='.$monitor['Id'], 'zmZones', array( 'zones', $monitor['Width'], $monitor['Height'] ), $monitor['ZoneCount'], canView( 'Monitors' ) ) ?></div>
|
||||||
<?php
|
<?php
|
||||||
if ( canEdit('Monitors') )
|
if ( canEdit('Monitors') )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<td class="colOrder"><?php echo makeLink( '?view='.$view.'&action=sequence&mid='.$monitor['Id'].'&smid='.$seqIdUpList[$monitor['Id']], '<img src="'.$seqUpFile.'" alt="Up"/>', $monitor['Sequence']>$minSequence ) ?><?php echo makeLink( '?view='.$view.'&action=sequence&mid='.$monitor['Id'].'&smid='.$seqIdDownList[$monitor['Id']], '<img src="'.$seqDownFile.'" alt="Down"/>', $monitor['Sequence']<$maxSequence ) ?></td>
|
<div class="colOrder"><?php echo makeLink( '?view='.$view.'&action=sequence&mid='.$monitor['Id'].'&smid='.$seqIdUpList[$monitor['Id']], '<img src="'.$seqUpFile.'" alt="Up"/>', $monitor['Sequence']>$minSequence ) ?><?php echo makeLink( '?view='.$view.'&action=sequence&mid='.$monitor['Id'].'&smid='.$seqIdDownList[$monitor['Id']], '<img src="'.$seqDownFile.'" alt="Down"/>', $monitor['Sequence']<$maxSequence ) ?></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this )"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
|
<div class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></div>
|
||||||
</tr>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
|
|
|
@ -1,22 +1,27 @@
|
||||||
var jsTranslatedAddText;
|
var jsTranslatedAddText;
|
||||||
var jsTranslatedCloneText;
|
var jsTranslatedCloneText;
|
||||||
|
|
||||||
function setButtonStates( element )
|
function setButtonStates( element ) {
|
||||||
{
|
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
var checked = 0;
|
var checked = 0;
|
||||||
for ( var i = 0; i < form.elements.length; i++ )
|
for ( var i = 0, i_length=form.elements.length; i < i_length; i++ ) {
|
||||||
{
|
if ( form.elements[i].type == "checkbox" ) {
|
||||||
if ( form.elements[i].type == "checkbox" )
|
if ( form.elements[i].checked ) {
|
||||||
{
|
|
||||||
if ( form.elements[i].checked )
|
|
||||||
{
|
|
||||||
if ( checked++ > 1 )
|
if ( checked++ > 1 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else if ( form.elements[i].length ) {
|
||||||
}
|
for( var j = 0, j_length = form.elements[i].length; j < j_length; j += 1 ) {
|
||||||
$(element).getParent( 'tr' ).toggleClass( 'highlight' );
|
if ( form.elements[j].type == "checkbox" ) {
|
||||||
|
if ( form.elements[j].checked ) {
|
||||||
|
if ( checked++ > 1 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end foreach element
|
||||||
|
}
|
||||||
|
} /// end for each element
|
||||||
|
$(element).getParent( '.tr' ).toggleClass( 'highlight' );
|
||||||
form.editBtn.disabled = (checked!=1);
|
form.editBtn.disabled = (checked!=1);
|
||||||
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
|
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
|
||||||
|
|
||||||
|
|
|
@ -670,7 +670,7 @@ switch ( $tab )
|
||||||
?>
|
?>
|
||||||
<tr><td><?php echo translate('Name') ?></td><td><input type="text" name="newMonitor[Name]" value="<?php echo validHtmlStr($monitor->Name) ?>" size="16"/></td></tr>
|
<tr><td><?php echo translate('Name') ?></td><td><input type="text" name="newMonitor[Name]" value="<?php echo validHtmlStr($monitor->Name) ?>" size="16"/></td></tr>
|
||||||
<tr><td><?php echo translate('Server') ?></td><td>
|
<tr><td><?php echo translate('Server') ?></td><td>
|
||||||
<?php
|
<?php
|
||||||
$servers = array(''=>'None');
|
$servers = array(''=>'None');
|
||||||
$result = dbQuery( 'SELECT * FROM Servers ORDER BY Name');
|
$result = dbQuery( 'SELECT * FROM Servers ORDER BY Name');
|
||||||
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Server' );
|
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Server' );
|
||||||
|
|
Loading…
Reference in New Issue