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
|
||||
--
|
||||
|
||||
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
|
||||
ALTER TABLE Logs MODIFY Pid int(10);
|
||||
|
|
|
@ -108,3 +108,57 @@ SELECT * FROM (SELECT NULL as Id,
|
|||
WHERE NOT EXISTS (
|
||||
SELECT Name FROM Controls WHERE name = 'Vivotek ePTZ'
|
||||
) 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
|
||||
|
||||
* 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 ),
|
||||
function( (Function)p_function ),
|
||||
enabled( p_enabled ),
|
||||
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() ),
|
||||
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() ),
|
||||
orientation( (Orientation)p_orientation ),
|
||||
deinterlacing( p_deinterlacing ),
|
||||
savejpegspref( p_savejpegs ),
|
||||
|
@ -2078,7 +2078,7 @@ void Monitor::ReloadLinkedMonitors( const char *p_linked_monitors )
|
|||
#if ZM_HAS_V4L
|
||||
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'";
|
||||
;
|
||||
|
||||
if ( device[0] ) {
|
||||
sql += " AND Device='";
|
||||
sql += device;
|
||||
|
|
|
@ -298,12 +298,12 @@ class Monitor
|
|||
#else // ZM_MEM_MAPPED
|
||||
int shm_id;
|
||||
#endif // ZM_MEM_MAPPED
|
||||
off_t mem_size;
|
||||
unsigned char *mem_ptr;
|
||||
Storage *storage;
|
||||
off_t mem_size;
|
||||
unsigned char *mem_ptr;
|
||||
Storage *storage;
|
||||
|
||||
SharedData *shared_data;
|
||||
TriggerData *trigger_data;
|
||||
SharedData *shared_data;
|
||||
TriggerData *trigger_data;
|
||||
VideoStoreData *video_store_data;
|
||||
|
||||
Snapshot *image_buffer;
|
||||
|
|
180
src/zm_zone.cpp
180
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 );
|
||||
|
||||
if( alarm_blobs ) {
|
||||
if( min_blobs && (alarm_blobs < min_blobs) ) {
|
||||
/* Not enough pixels alarmed */
|
||||
return (false);
|
||||
} else if(max_blobs && (alarm_blobs > max_blobs) ) {
|
||||
/* Too many pixels alarmed */
|
||||
overload_count = overload_frames;
|
||||
return (false);
|
||||
}
|
||||
} else {
|
||||
/* No blobs */
|
||||
return (false);
|
||||
}
|
||||
if( alarm_blobs ) {
|
||||
if( min_blobs && (alarm_blobs < min_blobs) ) {
|
||||
/* Not enough pixels alarmed */
|
||||
return (false);
|
||||
} else if(max_blobs && (alarm_blobs > max_blobs) ) {
|
||||
/* Too many pixels alarmed */
|
||||
overload_count = overload_frames;
|
||||
return (false);
|
||||
}
|
||||
} else {
|
||||
/* No blobs */
|
||||
return (false);
|
||||
}
|
||||
|
||||
score = (100*alarm_blob_pixels)/(polygon.Area());
|
||||
if(score < 1)
|
||||
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 );
|
||||
score = (100*alarm_blob_pixels)/(polygon.Area());
|
||||
if(score < 1)
|
||||
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 );
|
||||
|
||||
alarm_lo_x = polygon.HiX()+1;
|
||||
alarm_hi_x = polygon.LoX()-1;
|
||||
alarm_lo_y = polygon.HiY()+1;
|
||||
alarm_hi_y = polygon.LoY()-1;
|
||||
for ( int i = 1; i < WHITE; i++ )
|
||||
{
|
||||
BlobStats *bs = &blob_stats[i];
|
||||
if ( bs->count )
|
||||
{
|
||||
if ( bs->count == max_blob_size )
|
||||
{
|
||||
if ( config.weighted_alarm_centres )
|
||||
{
|
||||
unsigned long x_total = 0;
|
||||
unsigned long y_total = 0;
|
||||
alarm_lo_x = polygon.HiX()+1;
|
||||
alarm_hi_x = polygon.LoX()-1;
|
||||
alarm_lo_y = polygon.HiY()+1;
|
||||
alarm_hi_y = polygon.LoY()-1;
|
||||
for ( int i = 1; i < WHITE; i++ )
|
||||
{
|
||||
BlobStats *bs = &blob_stats[i];
|
||||
if ( bs->count )
|
||||
{
|
||||
if ( bs->count == max_blob_size )
|
||||
{
|
||||
if ( config.weighted_alarm_centres )
|
||||
{
|
||||
unsigned long x_total = 0;
|
||||
unsigned long y_total = 0;
|
||||
|
||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||
{
|
||||
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
||||
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
||||
{
|
||||
if ( *spdiff == bs->tag )
|
||||
{
|
||||
x_total += sx;
|
||||
y_total += sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
alarm_mid_x = int(round(x_total/bs->count));
|
||||
alarm_mid_y = int(round(y_total/bs->count));
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_mid_x = int((bs->hi_x+bs->lo_x+1)/2);
|
||||
alarm_mid_y = int((bs->hi_y+bs->lo_y+1)/2);
|
||||
}
|
||||
}
|
||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||
{
|
||||
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
||||
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
||||
{
|
||||
if ( *spdiff == bs->tag )
|
||||
{
|
||||
x_total += sx;
|
||||
y_total += sy;
|
||||
}
|
||||
}
|
||||
}
|
||||
alarm_mid_x = int(round(x_total/bs->count));
|
||||
alarm_mid_y = int(round(y_total/bs->count));
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_mid_x = int((bs->hi_x+bs->lo_x+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_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_y < bs->hi_y ) alarm_hi_y = bs->hi_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_mid_x = int((alarm_hi_x+alarm_lo_x+1)/2);
|
||||
alarm_mid_y = int((alarm_hi_y+alarm_lo_y+1)/2);
|
||||
}
|
||||
}
|
||||
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_hi_x < bs->hi_x ) alarm_hi_x = bs->hi_x;
|
||||
if ( alarm_hi_y < bs->hi_y ) alarm_hi_y = bs->hi_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_mid_x = int((alarm_hi_x+alarm_lo_x+1)/2);
|
||||
alarm_mid_y = int((alarm_hi_y+alarm_lo_y+1)/2);
|
||||
}
|
||||
}
|
||||
|
||||
if ( type == INCLUSIVE )
|
||||
{
|
||||
// score >>= 1;
|
||||
score /= 2;
|
||||
}
|
||||
else if ( type == EXCLUSIVE )
|
||||
{
|
||||
// score <<= 1;
|
||||
score *= 2;
|
||||
if ( type == INCLUSIVE )
|
||||
{
|
||||
// score >>= 1;
|
||||
score /= 2;
|
||||
}
|
||||
else if ( type == EXCLUSIVE )
|
||||
{
|
||||
// score <<= 1;
|
||||
score *= 2;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Debug( 5, "Adjusted score is %d", score );
|
||||
Debug( 5, "Adjusted score is %d", score );
|
||||
|
||||
// Now outline the changed region
|
||||
if ( score )
|
||||
{
|
||||
alarm_box = Box( Coord( alarm_lo_x, alarm_lo_y ), Coord( alarm_hi_x, alarm_hi_y ) );
|
||||
// Now outline the changed region
|
||||
if ( score )
|
||||
{
|
||||
alarm_box = Box( Coord( alarm_lo_x, alarm_lo_y ), Coord( alarm_hi_x, alarm_hi_y ) );
|
||||
|
||||
//if ( monitor->followMotion() )
|
||||
if ( true )
|
||||
{
|
||||
alarm_centre = Coord( alarm_mid_x, alarm_mid_y );
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_centre = alarm_box.Centre();
|
||||
}
|
||||
//if ( monitor->followMotion() )
|
||||
if ( true )
|
||||
{
|
||||
alarm_centre = Coord( alarm_mid_x, alarm_mid_y );
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_centre = alarm_box.Centre();
|
||||
}
|
||||
|
||||
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[] )
|
||||
{
|
||||
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[] = {
|
||||
{"monitor", 1, 0, 'm'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'v'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
static struct option long_options[] = {
|
||||
{"monitor", 1, 0, 'm'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, 'v'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
while (1)
|
||||
{
|
||||
int option_index = 0;
|
||||
while (1)
|
||||
{
|
||||
int option_index = 0;
|
||||
|
||||
int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index);
|
||||
if (c == -1)
|
||||
int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index);
|
||||
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)
|
||||
{
|
||||
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) )
|
||||
{
|
||||
Error( "Only read %d bytes of %d\n", bytes_read, frame_header.image_length);
|
||||
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
|
||||
{
|
||||
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) );
|
||||
Error( "Can't read frame image data: %s", strerror(errno) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -317,15 +318,15 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
static char subpath[PATH_MAX] = "";
|
||||
if ( config.use_deep_storage )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
|
||||
}
|
||||
if ( config.use_deep_storage )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
|
||||
}
|
||||
|
||||
static char path[PATH_MAX] = "";
|
||||
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 {
|
||||
float: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#title {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#systemStats {
|
||||
float: right;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#monitorSummary {
|
||||
float: left;
|
||||
text-align: left;
|
||||
width: 20%;
|
||||
float: left;
|
||||
text-align: left;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
#devices {
|
||||
float: left;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#loginBandwidth {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
width: 40%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#cycleMontage {
|
||||
float: right;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#options {
|
||||
float: right;
|
||||
text-align: right;
|
||||
width: 20%;
|
||||
float: right;
|
||||
text-align: right;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
#consoleTable {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#consoleTable tr.highlight {
|
||||
background-color: #eeeeee;
|
||||
#consoleTable div.highlight {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
#consoleTable thead th {
|
||||
padding-bottom: 4px;
|
||||
vertical-align: middle;
|
||||
#consoleTable .thead .tr div {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#consoleTable tfoot td {
|
||||
padding-top: 4px;
|
||||
vertical-align: middle;
|
||||
#consoleTable .MonitorInfo {
|
||||
display: table-cell;
|
||||
width: auto;
|
||||
}
|
||||
#consoleTable .MonitorInfo div {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
width: 19%;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
#consoleTable th,td {
|
||||
height: 16px;
|
||||
text-align: left;
|
||||
#consoleTable .Events {
|
||||
display: table-cell;
|
||||
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 {
|
||||
text-align: center;
|
||||
width: 47px;
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
#consoleTable .colMark {
|
||||
width: 32px;
|
||||
text-align: center;
|
||||
width: 32px;
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
#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 {
|
||||
text-align: right;
|
||||
width: 40px;
|
||||
text-align: right;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
#consoleTable .colLeftButtons {
|
||||
text-align: left;
|
||||
text-align: left;
|
||||
min-width:400px;
|
||||
}
|
||||
|
||||
#consoleTable .colLeftButtons input {
|
||||
margin-right: 24px;
|
||||
margin-right: 24px;
|
||||
}
|
||||
|
||||
#consoleTable .colRightButtons {
|
||||
text-align: right;
|
||||
padding-right: 8px;
|
||||
text-align: right;
|
||||
min-width: 158px;
|
||||
margin-right: -32px;
|
||||
}
|
||||
|
||||
#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
|
||||
require_once('includes/Server.php');
|
||||
$servers = Server::find_all();
|
||||
require_once('includes/Storage.php');
|
||||
$storage_areas = Storage::find_all();
|
||||
|
@ -11,72 +10,75 @@ xhtmlHeaders( __FILE__, translate('Console') );
|
|||
<form name="monitorForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
||||
<input type="hidden" name="action" value=""/>
|
||||
|
||||
<?php include("skins/$skin/views/header.php") ?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<table id="consoleTable" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="colName"><?php echo translate('Name') ?></th>
|
||||
<th class="colFunction"><?php echo translate('Function') ?></th>
|
||||
<div id="content" class="container-fluid">
|
||||
<div id="consoleTable" cellspacing="0">
|
||||
<div class="thead">
|
||||
<div class="tr">
|
||||
<div class="MonitorInfo">
|
||||
<div class="colName"><?php echo translate('Name') ?></div>
|
||||
<div class="colFunction"><?php echo translate('Function') ?></div>
|
||||
<?php if ( count($servers) ) { ?>
|
||||
<th class="colServer"><?php echo translate('Server') ?></th>
|
||||
<div class="colServer"><?php echo translate('Server') ?></div>
|
||||
<?php } ?>
|
||||
<th class="colSource"><?php echo translate('Source') ?></th>
|
||||
<div class="colSource"><?php echo translate('Source') ?></div>
|
||||
<?php if ( $show_storage_areas ) { ?>
|
||||
<th class="colStorage"><?php echo translate('Storage') ?></th>
|
||||
<div class="colStorage"><?php echo translate('Storage') ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="Events">
|
||||
<?php
|
||||
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
|
||||
}
|
||||
?>
|
||||
<th class="colZones"><?php echo translate('Zones') ?></th>
|
||||
</div>
|
||||
<div class="colZones"><?php echo translate('Zones') ?></div>
|
||||
<?php
|
||||
if ( canEdit('Monitors') )
|
||||
{
|
||||
?>
|
||||
<th class="colOrder"><?php echo translate('Order') ?></th>
|
||||
<div class="colOrder"><?php echo translate('Order') ?></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<th class="colMark"><?php echo translate('Mark') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="colLeftButtons" colspan="<?php $columns = 3;
|
||||
<div class="colMark"><?php echo translate('Mark') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tfoot">
|
||||
<div class="tr">
|
||||
<div class="colLeftButtons" colspan="<?php $columns = 3;
|
||||
if ( count($servers) > 1 ) { $columns += 1; }
|
||||
if ( $show_storage_areas ) { $columns += 1; }
|
||||
echo $columns;
|
||||
?>">
|
||||
<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']) ) ?> -->
|
||||
|
||||
</td>
|
||||
</div>
|
||||
<div class="Events">
|
||||
<?php
|
||||
for ( $i = 0; $i < count($eventCounts); $i++ )
|
||||
{
|
||||
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
|
||||
}
|
||||
?>
|
||||
<td class="colZones"><?php echo $zoneCount ?></td>
|
||||
<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>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
</div>
|
||||
<div class="colZones"><?php echo $zoneCount ?></div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tbody">
|
||||
<?php
|
||||
foreach( $displayMonitors as $monitor )
|
||||
{
|
||||
?>
|
||||
<tr title="<?php echo $monitor['Id'] ?>">
|
||||
<div class="tr" title="<?php echo $monitor['Id'] ?>">
|
||||
<?php
|
||||
if ( !$monitor['zmc'] )
|
||||
$dclass = "errorText";
|
||||
|
@ -98,20 +100,21 @@ foreach( $displayMonitors as $monitor )
|
|||
$fclass .= " disabledText";
|
||||
$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>
|
||||
<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="MonitorInfo">
|
||||
<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) ) { ?>
|
||||
<td class="colServer"><?php
|
||||
<div class="colServer"><?php
|
||||
$Server = new Server( $monitor['ServerId'] );
|
||||
echo $Server->Name();
|
||||
?></td>
|
||||
?></div>
|
||||
<?php } ?>
|
||||
<?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" ) { ?>
|
||||
<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" ) { ?>
|
||||
<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" ) {
|
||||
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
|
||||
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
|
||||
|
@ -119,42 +122,41 @@ echo $Server->Name();
|
|||
$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" ) { ?>
|
||||
<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 { ?>
|
||||
<td class="colSource"> </td>
|
||||
<div class="colSource"> </div>
|
||||
<?php } ?>
|
||||
<?php if ( $show_storage_areas ) { ?>
|
||||
<td class="colStorage"><?php
|
||||
$Storage = new Storage( $monitor['StorageId'] );
|
||||
echo $Storage->Name();
|
||||
?></td>
|
||||
<div class="colStorage"><?php $Storage = new Storage( $monitor['StorageId'] ); echo $Storage->Name(); ?></div>
|
||||
<?php } ?>
|
||||
</div><div class="Events">
|
||||
<?php
|
||||
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
|
||||
}
|
||||
?>
|
||||
<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
|
||||
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
|
||||
}
|
||||
?>
|
||||
<td class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this )"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
|
||||
</tr>
|
||||
<div class="colMark"><input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
var jsTranslatedAddText;
|
||||
var jsTranslatedCloneText;
|
||||
|
||||
function setButtonStates( element )
|
||||
{
|
||||
function setButtonStates( element ) {
|
||||
var form = element.form;
|
||||
var checked = 0;
|
||||
for ( var i = 0; i < form.elements.length; i++ )
|
||||
{
|
||||
if ( form.elements[i].type == "checkbox" )
|
||||
{
|
||||
if ( form.elements[i].checked )
|
||||
{
|
||||
for ( var i = 0, i_length=form.elements.length; i < i_length; i++ ) {
|
||||
if ( form.elements[i].type == "checkbox" ) {
|
||||
if ( form.elements[i].checked ) {
|
||||
if ( checked++ > 1 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$(element).getParent( 'tr' ).toggleClass( 'highlight' );
|
||||
} else if ( form.elements[i].length ) {
|
||||
for( var j = 0, j_length = form.elements[i].length; j < j_length; j += 1 ) {
|
||||
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.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('Server') ?></td><td>
|
||||
<?php
|
||||
<?php
|
||||
$servers = array(''=>'None');
|
||||
$result = dbQuery( 'SELECT * FROM Servers ORDER BY Name');
|
||||
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Server' );
|
||||
|
|
Loading…
Reference in New Issue