Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2019-01-16 14:40:18 -05:00
commit 5eaf0b9ab4
71 changed files with 664 additions and 436 deletions

View File

@ -91,7 +91,7 @@ Adjust permissions to the zm.conf file to allow web account to access it.
**Step 9:** Setup ZoneMinder service
::
::
systemctl enable zoneminder.service
@ -127,7 +127,23 @@ CTRL+o then [Enter] to save
CTRL+x to exit
**Step 12:** Start ZoneMinder
**Step 12:** Please check the configuration
Zoneminder 1.32.x
1. Check path of ZM_PATH in '/etc/zm/conf.d/zmcustom.conf' is ZM_PATH_ZMS=/zm/cgi-bin/nph-zms
::
cat /etc/zm/conf.d/zmcustom.conf
2. Check config of /etc/apache2/conf-enabled/zoneminder.conf has the same ScriptAlias /zm/cgi-bin that is configured
in ZM_PATH. The part /nph-zms has to be left out of the ScriptAlias
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
::
cat /etc/apache2/conf-enabled/zoneminder.conf
**Step 13:** Start ZoneMinder
Reload Apache to enable your changes and then start ZoneMinder.
@ -136,7 +152,7 @@ Reload Apache to enable your changes and then start ZoneMinder.
systemctl reload apache2
systemctl start zoneminder
**Step 13:** Making sure ZoneMinder works
**Step 14:** Making sure ZoneMinder works
1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console

View File

@ -54,13 +54,13 @@ bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) {
MYSQL_RES *result = mysql_store_result(&dbconn);
if ( !result ) {
Error("Can't use query result: %s", mysql_error(&dbconn));
exit( mysql_errno( &dbconn ) );
exit(mysql_errno(&dbconn));
}
MYSQL_ROW dbrow = mysql_fetch_row(result);
if ( mysql_errno(&dbconn) ) {
Error("Can't fetch row: %s", mysql_error(&dbconn));
exit( mysql_errno(&dbconn));
exit(mysql_errno(&dbconn));
}
uint64_t init_event_id = atoll(dbrow[0]);
@ -77,12 +77,11 @@ bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) {
//Info( "eft %d > et %d", event_data->frames[i].timestamp, event_time );
if ( event_data->frames[i].timestamp >= event_time ) {
curr_frame_id = i+1;
Debug( 3, "Set cst:%.2f", curr_stream_time );
Debug( 3, "Set cfid:%d", curr_frame_id );
Debug(3, "Set curr_stream_time:%.2f, curr_frame_id:%d", curr_stream_time, curr_frame_id);
break;
}
}
Debug( 3, "Skipping %ld frames", event_data->frame_count );
Debug(3, "Skipping %ld frames", event_data->frame_count);
}
}
return true;
@ -93,7 +92,7 @@ bool EventStream::loadInitialEventData( uint64_t init_event_id, unsigned int ini
if ( init_frame_id ) {
if ( init_frame_id >= event_data->frame_count ) {
Error("Invalid frame id specified. %d > %d", init_frame_id, event_data->frame_count );
Error("Invalid frame id specified. %d > %d", init_frame_id, event_data->frame_count);
curr_stream_time = event_data->start_time;
} else {
curr_stream_time = event_data->frames[init_frame_id-1].timestamp;
@ -140,12 +139,12 @@ bool EventStream::loadEventData(uint64_t event_id) {
event_data = new EventData;
event_data->event_id = event_id;
event_data->monitor_id = atoi( dbrow[0] );
event_data->storage_id = dbrow[1] ? atoi( dbrow[1] ) : 0;
event_data->monitor_id = atoi(dbrow[0]);
event_data->storage_id = dbrow[1] ? atoi(dbrow[1]) : 0;
event_data->frame_count = dbrow[2] == NULL ? 0 : atoi(dbrow[2]);
event_data->start_time = atoi(dbrow[3]);
event_data->duration = atof(dbrow[4]);
strncpy( event_data->video_file, dbrow[5], sizeof(event_data->video_file)-1 );
event_data->duration = dbrow[4] ? atof(dbrow[4]) : 0.0;
strncpy(event_data->video_file, dbrow[5], sizeof(event_data->video_file)-1);
std::string scheme_str = std::string(dbrow[6]);
if ( scheme_str == "Deep" ) {
event_data->scheme = Storage::DEEP;
@ -164,34 +163,46 @@ bool EventStream::loadEventData(uint64_t event_id) {
struct tm *event_time = localtime(&event_data->start_time);
if ( storage_path[0] == '/' )
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d",
storage_path, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec );
snprintf(event_data->path, sizeof(event_data->path),
"%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d",
storage_path, event_data->monitor_id,
event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday,
event_time->tm_hour, event_time->tm_min, event_time->tm_sec);
else
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d",
staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec );
snprintf(event_data->path, sizeof(event_data->path),
"%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d",
staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id,
event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday,
event_time->tm_hour, event_time->tm_min, event_time->tm_sec);
} else if ( event_data->scheme == Storage::MEDIUM ) {
struct tm *event_time = localtime( &event_data->start_time );
struct tm *event_time = localtime(&event_data->start_time);
if ( storage_path[0] == '/' )
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%04d-%02d-%02d/%" PRIu64,
storage_path, event_data->monitor_id, event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday, event_data->event_id );
snprintf(event_data->path, sizeof(event_data->path),
"%s/%ld/%04d-%02d-%02d/%" PRIu64,
storage_path, event_data->monitor_id,
event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday,
event_data->event_id);
else
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%04d-%02d-%02d/%" PRIu64,
staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday,
event_data->event_id );
snprintf(event_data->path, sizeof(event_data->path),
"%s/%s/%ld/%04d-%02d-%02d/%" PRIu64,
staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id,
event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday,
event_data->event_id);
} else {
if ( storage_path[0] == '/' )
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%" PRIu64,
storage_path, event_data->monitor_id, event_data->event_id );
snprintf(event_data->path, sizeof(event_data->path), "%s/%ld/%" PRIu64,
storage_path, event_data->monitor_id, event_data->event_id);
else
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%" PRIu64,
staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_data->event_id );
snprintf(event_data->path, sizeof(event_data->path), "%s/%s/%ld/%" PRIu64,
staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id,
event_data->event_id);
}
delete storage; storage = NULL;
updateFrameRate( (double)event_data->frame_count/event_data->duration );
updateFrameRate((double)event_data->frame_count/event_data->duration);
snprintf(sql, sizeof(sql), "SELECT FrameId, unix_timestamp( `TimeStamp` ), Delta FROM Frames where EventId = %" PRIu64 " ORDER BY FrameId ASC", event_id);
snprintf(sql, sizeof(sql), "SELECT FrameId, unix_timestamp( `TimeStamp` ), Delta FROM Frames WHERE EventId = %" PRIu64 " ORDER BY FrameId ASC", event_id);
if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
@ -270,15 +281,15 @@ void EventStream::processCommand(const CmdMsg *msg) {
// Check for incoming command
switch( (MsgCommand)msg->msg_data[0] ) {
case CMD_PAUSE :
Debug( 1, "Got PAUSE command" );
Debug(1, "Got PAUSE command");
// Set paused flag
paused = true;
replay_rate = ZM_RATE_BASE;
last_frame_sent = TV_2_FLOAT( now );
last_frame_sent = TV_2_FLOAT(now);
break;
case CMD_PLAY :
Debug( 1, "Got PLAY command" );
Debug(1, "Got PLAY command");
if ( paused ) {
paused = false;
}
@ -294,18 +305,18 @@ void EventStream::processCommand(const CmdMsg *msg) {
replay_rate = ZM_RATE_BASE;
break;
case CMD_VARPLAY :
Debug( 1, "Got VARPLAY command" );
Debug(1, "Got VARPLAY command");
if ( paused ) {
paused = false;
}
replay_rate = ntohs(((unsigned char)msg->msg_data[2]<<8)|(unsigned char)msg->msg_data[1])-32768;
break;
case CMD_STOP :
Debug( 1, "Got STOP command" );
Debug(1, "Got STOP command");
paused = false;
break;
case CMD_FASTFWD :
Debug( 1, "Got FAST FWD command" );
Debug(1, "Got FAST FWD command");
if ( paused ) {
paused = false;
}
@ -330,19 +341,19 @@ void EventStream::processCommand(const CmdMsg *msg) {
}
break;
case CMD_SLOWFWD :
Debug( 1, "Got SLOW FWD command" );
Debug(1, "Got SLOW FWD command");
paused = true;
replay_rate = ZM_RATE_BASE;
step = 1;
break;
case CMD_SLOWREV :
Debug( 1, "Got SLOW REV command" );
Debug(1, "Got SLOW REV command");
paused = true;
replay_rate = ZM_RATE_BASE;
step = -1;
break;
case CMD_FASTREV :
Debug( 1, "Got FAST REV command" );
Debug(1, "Got FAST REV command");
paused = false;
// Set play rate
switch ( replay_rate ) {
@ -367,7 +378,7 @@ void EventStream::processCommand(const CmdMsg *msg) {
case CMD_ZOOMIN :
x = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2];
y = ((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4];
Debug( 1, "Got ZOOM IN command, to %d,%d", x, y );
Debug(1, "Got ZOOM IN command, to %d,%d", x, y);
switch ( zoom ) {
case 100:
zoom = 150;
@ -389,7 +400,7 @@ void EventStream::processCommand(const CmdMsg *msg) {
send_frame = true;
break;
case CMD_ZOOMOUT :
Debug( 1, "Got ZOOM OUT command" );
Debug(1, "Got ZOOM OUT command");
switch ( zoom ) {
case 500:
zoom = 400;
@ -413,14 +424,14 @@ void EventStream::processCommand(const CmdMsg *msg) {
case CMD_PAN :
x = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2];
y = ((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4];
Debug( 1, "Got PAN command, to %d,%d", x, y );
Debug(1, "Got PAN command, to %d,%d", x, y);
break;
case CMD_SCALE :
scale = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2];
Debug( 1, "Got SCALE command, to %d", scale );
Debug(1, "Got SCALE command, to %d", scale);
break;
case CMD_PREV :
Debug( 1, "Got PREV command" );
Debug(1, "Got PREV command");
if ( replay_rate >= 0 )
curr_frame_id = 0;
else
@ -429,7 +440,7 @@ void EventStream::processCommand(const CmdMsg *msg) {
forceEventChange = true;
break;
case CMD_NEXT :
Debug( 1, "Got NEXT command" );
Debug(1, "Got NEXT command");
if ( replay_rate >= 0 )
curr_frame_id = event_data->frame_count+1;
else
@ -441,12 +452,12 @@ void EventStream::processCommand(const CmdMsg *msg) {
{
int offset = ((unsigned char)msg->msg_data[1]<<24)|((unsigned char)msg->msg_data[2]<<16)|((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4];
curr_frame_id = (int)(event_data->frame_count*offset/event_data->duration);
Debug( 1, "Got SEEK command, to %d (new cfid: %d)", offset, curr_frame_id );
Debug(1, "Got SEEK command, to %d (new cfid: %d)", offset, curr_frame_id);
send_frame = true;
break;
}
case CMD_QUERY :
Debug( 1, "Got QUERY command, sending STATUS" );
Debug(1, "Got QUERY command, sending STATUS");
break;
case CMD_QUIT :
Info("User initiated exit - CMD_QUIT");
@ -468,7 +479,7 @@ void EventStream::processCommand(const CmdMsg *msg) {
status_data.rate = replay_rate;
status_data.zoom = zoom;
status_data.paused = paused;
Debug( 2, "Event:%" PRIu64 ", Paused:%d, progress:%d Rate:%d, Zoom:%d",
Debug(2, "Event:%" PRIu64 ", Paused:%d, progress:%d Rate:%d, Zoom:%d",
status_data.event_id,
status_data.paused,
status_data.progress,
@ -494,80 +505,78 @@ void EventStream::processCommand(const CmdMsg *msg) {
}
void EventStream::checkEventLoaded() {
bool reload_event = false;
static char sql[ZM_SQL_SML_BUFSIZ];
if ( curr_frame_id <= 0 ) {
snprintf( sql, sizeof(sql), "SELECT Id FROM Events WHERE MonitorId = %ld AND Id < %" PRIu64 " ORDER BY Id DESC LIMIT 1", event_data->monitor_id, event_data->event_id );
reload_event = true;
snprintf(sql, sizeof(sql), "SELECT Id FROM Events WHERE MonitorId = %ld AND Id < %" PRIu64 " ORDER BY Id DESC LIMIT 1", event_data->monitor_id, event_data->event_id);
} else if ( (unsigned int)curr_frame_id > event_data->frame_count ) {
snprintf( sql, sizeof(sql), "SELECT Id FROM Events WHERE MonitorId = %ld AND Id > %" PRIu64 " ORDER BY Id ASC LIMIT 1", event_data->monitor_id, event_data->event_id );
reload_event = true;
snprintf(sql, sizeof(sql), "SELECT Id FROM Events WHERE MonitorId = %ld AND Id > %" PRIu64 " ORDER BY Id ASC LIMIT 1", event_data->monitor_id, event_data->event_id);
} else {
// No event change required
return;
}
if ( reload_event ) {
if ( forceEventChange || ( mode != MODE_SINGLE && mode != MODE_NONE ) ) {
//Info( "SQL:%s", sql );
if ( mysql_query( &dbconn, sql ) ) {
Error( "Can't run query: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
// Event change required.
if ( forceEventChange || ( mode != MODE_SINGLE && mode != MODE_NONE ) ) {
if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
}
MYSQL_RES *result = mysql_store_result( &dbconn );
if ( !result ) {
Error( "Can't use query result: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
MYSQL_ROW dbrow = mysql_fetch_row( result );
MYSQL_RES *result = mysql_store_result(&dbconn);
if ( !result ) {
Error("Can't use query result: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
}
MYSQL_ROW dbrow = mysql_fetch_row(result);
if ( mysql_errno( &dbconn ) ) {
Error( "Can't fetch row: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
if ( mysql_errno(&dbconn)) {
Error("Can't fetch row: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
}
if ( dbrow ) {
uint64_t event_id = atoll(dbrow[0]);
Debug( 1, "Loading new event %" PRIu64, event_id );
if ( dbrow ) {
uint64_t event_id = atoll(dbrow[0]);
Debug(1, "Loading new event %" PRIu64, event_id);
loadEventData(event_id);
loadEventData(event_id);
Debug( 2, "Current frame id = %d", curr_frame_id );
if ( replay_rate < 0 )
curr_frame_id = event_data->frame_count;
else
curr_frame_id = 1;
Debug( 2, "New frame id = %d", curr_frame_id );
} else {
if ( curr_frame_id <= 0 )
curr_frame_id = 1;
else
curr_frame_id = event_data->frame_count;
paused = true;
}
mysql_free_result( result );
forceEventChange = false;
Debug(2, "Current frame id = %d", curr_frame_id);
if ( replay_rate < 0 ) //rewind
curr_frame_id = event_data->frame_count;
else
curr_frame_id = 1;
Debug(2, "New frame id = %d", curr_frame_id);
} else {
if ( curr_frame_id <= 0 )
curr_frame_id = 1;
else
curr_frame_id = event_data->frame_count;
paused = true;
}
} // end if found a new event or not
mysql_free_result(result);
forceEventChange = false;
} else {
if ( curr_frame_id <= 0 )
curr_frame_id = 1;
else
curr_frame_id = event_data->frame_count;
paused = true;
}
}
} // void EventStream::checkEventLoaded()
Image * EventStream::getImage( ) {
static char filepath[PATH_MAX];
Debug(2, "EventStream::getImage path(%s) frame(%d)", event_data->path, curr_frame_id);
snprintf( filepath, sizeof(filepath), staticConfig.capture_file_format, event_data->path, curr_frame_id);
snprintf(filepath, sizeof(filepath), staticConfig.capture_file_format, event_data->path, curr_frame_id);
Debug(2, "EventStream::getImage path(%s) ", filepath, curr_frame_id);
Image *image = new Image(filepath);
return image;
}
bool EventStream::sendFrame( int delta_us ) {
Debug( 2, "Sending frame %d", curr_frame_id );
Debug(2, "Sending frame %d", curr_frame_id);
static char filepath[PATH_MAX];
static struct stat filestat;
@ -576,27 +585,27 @@ bool EventStream::sendFrame( int delta_us ) {
// This needs to be abstracted. If we are saving jpgs, then load the capture file. If we are only saving analysis frames, then send that.
// // This is also wrong, need to have this info stored in the event! FIXME
if ( event_data->SaveJPEGs & 1 ) {
snprintf( filepath, sizeof(filepath), staticConfig.capture_file_format, event_data->path, curr_frame_id );
snprintf(filepath, sizeof(filepath), staticConfig.capture_file_format, event_data->path, curr_frame_id);
} else if ( event_data->SaveJPEGs & 2 ) {
snprintf( filepath, sizeof(filepath), staticConfig.analyse_file_format, event_data->path, curr_frame_id );
if ( stat( filepath, &filestat ) < 0 ) {
snprintf(filepath, sizeof(filepath), staticConfig.analyse_file_format, event_data->path, curr_frame_id);
if ( stat(filepath, &filestat ) < 0 ) {
Debug(1, "analyze file %s not found will try to stream from other", filepath);
snprintf( filepath, sizeof(filepath), staticConfig.capture_file_format, event_data->path, curr_frame_id );
if ( stat( filepath, &filestat ) < 0 ) {
snprintf(filepath, sizeof(filepath), staticConfig.capture_file_format, event_data->path, curr_frame_id);
if ( stat(filepath, &filestat ) < 0 ) {
Debug(1, "capture file %s not found either", filepath);
filepath[0] = 0;
}
}
} else if ( ! ffmpeg_input ) {
Fatal("JPEGS not saved.zms is not capable of streaming jpegs from mp4 yet");
} else if ( !ffmpeg_input ) {
Fatal("JPEGS not saved. zms is not capable of streaming jpegs from mp4 yet");
return false;
}
#if HAVE_LIBAVCODEC
if ( type == STREAM_MPEG ) {
Debug(2,"Streaming MPEG");
Image image( filepath );
Image image(filepath);
Image *send_image = prepareImage(&image);
@ -605,7 +614,7 @@ Debug(2,"Streaming MPEG");
fprintf(stdout, "Content-type: %s\r\n\r\n", vid_stream->MimeType());
vid_stream->OpenStream();
}
/* double pts = */ vid_stream->EncodeFrame( send_image->Buffer(), send_image->Size(), config.mpeg_timed_frames, delta_us*1000 );
/* double pts = */ vid_stream->EncodeFrame(send_image->Buffer(), send_image->Size(), config.mpeg_timed_frames, delta_us*1000);
} else
#endif // HAVE_LIBAVCODEC
{
@ -616,7 +625,7 @@ Debug(2,"Streaming MPEG");
bool send_raw = ((scale>=ZM_SCALE_BASE)&&(zoom==ZM_SCALE_BASE)) && filepath[0];
fprintf( stdout, "--ZoneMinderFrame\r\n" );
fprintf(stdout, "--ZoneMinderFrame\r\n");
if ( (type != STREAM_JPEG) || (!filepath[0]) )
send_raw = false;
@ -628,8 +637,8 @@ Debug(2,"Streaming MPEG");
return false;
}
#if HAVE_SENDFILE
if( fstat(fileno(fdj),&filestat) < 0 ) {
Error( "Failed getting information about file %s: %s", filepath, strerror(errno) );
if ( fstat(fileno(fdj),&filestat) < 0 ) {
Error("Failed getting information about file %s: %s", filepath, strerror(errno));
return false;
}
#else
@ -644,7 +653,7 @@ Debug(1, "Loading image");
} else if ( ffmpeg_input ) {
// Get the frame from the mp4 input
Debug(1,"Getting frame from ffmpeg");
AVFrame *frame = ffmpeg_input->get_frame( ffmpeg_input->get_video_stream_id() );
AVFrame *frame = ffmpeg_input->get_frame(ffmpeg_input->get_video_stream_id());
if ( frame ) {
image = new Image(frame);
av_frame_free(&frame);
@ -659,7 +668,7 @@ Debug(1, "Loading image");
Image *send_image = prepareImage(image);
switch( type ) {
switch ( type ) {
case STREAM_JPEG :
send_image->EncodeJpeg(img_buffer, &img_buffer_size);
break;
@ -678,22 +687,22 @@ Debug(1, "Loading image");
img_buffer_size = send_image->Size();
break;
default:
Fatal( "Unexpected frame type %d", type );
Fatal("Unexpected frame type %d", type);
break;
}
delete image;
image = NULL;
}
} // end if send_raw or not
switch( type ) {
switch ( type ) {
case STREAM_JPEG :
fputs( "Content-Type: image/jpeg\r\n", stdout );
fputs("Content-Type: image/jpeg\r\n", stdout);
break;
case STREAM_RAW :
fputs( "Content-Type: image/x-rgb\r\n", stdout );
fputs("Content-Type: image/x-rgb\r\n", stdout);
break;
case STREAM_ZIP :
fputs( "Content-Type: image/x-rgbz\r\n", stdout );
fputs("Content-Type: image/x-rgbz\r\n", stdout);
break;
default :
Fatal("Unexpected frame type %d", type);
@ -702,40 +711,40 @@ Debug(1, "Loading image");
if ( send_raw ) {
#if HAVE_SENDFILE
fprintf( stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size );
fprintf(stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size);
if ( zm_sendfile(fileno(stdout), fileno(fdj), 0, (int)filestat.st_size) != (int)filestat.st_size ) {
/* sendfile() failed, use standard way instead */
img_buffer_size = fread( img_buffer, 1, sizeof(temp_img_buffer), fdj );
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) {
if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) {
fclose(fdj); /* Close the file handle */
Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno));
return( false );
return false;
}
}
#else
fprintf( stdout, "Content-Length: %d\r\n\r\n", img_buffer_size );
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) {
fprintf(stdout, "Content-Length: %d\r\n\r\n", img_buffer_size);
if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) {
fclose(fdj); /* Close the file handle */
Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno));
return( false );
return false;
}
#endif
fclose(fdj); /* Close the file handle */
} else {
Debug(3, "Content length: %d", img_buffer_size );
fprintf( stdout, "Content-Length: %d\r\n\r\n", img_buffer_size );
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) {
Error( "Unable to send stream frame: %s", strerror(errno) );
return( false );
Debug(3, "Content length: %d", img_buffer_size);
fprintf(stdout, "Content-Length: %d\r\n\r\n", img_buffer_size);
if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) {
Error("Unable to send stream frame: %s", strerror(errno));
return false;
}
}
} // end if send_raw or not
fputs("\r\n\r\n", stdout);
fflush(stdout);
}
} // end if stream MPEG or other
last_frame_sent = TV_2_FLOAT(now);
return true;
}
} // bool EventStream::sendFrame( int delta_us )
void EventStream::runStream() {
openComms();
@ -754,7 +763,7 @@ void EventStream::runStream() {
Debug(3, "frame rate is: (%f)", (double)event_data->frame_count/event_data->duration);
updateFrameRate((double)event_data->frame_count/event_data->duration);
while( !zm_terminate ) {
while ( !zm_terminate ) {
gettimeofday(&now, NULL);
unsigned int delta_us = 0;
@ -795,6 +804,7 @@ void EventStream::runStream() {
}
if ( !in_event ) {
double actual_delta_time = TV_2_FLOAT(now) - last_frame_sent;
// > 1 second
if ( actual_delta_time > 1 ) {
static char frame_text[64];
snprintf(frame_text, sizeof(frame_text), "Time to next event = %d seconds", (int)time_to_event);
@ -803,12 +813,12 @@ void EventStream::runStream() {
}
//else
//{
usleep( STREAM_PAUSE_WAIT );
usleep(STREAM_PAUSE_WAIT);
//curr_stream_time += (replay_rate>0?1:-1) * ((1.0L * replay_rate * STREAM_PAUSE_WAIT)/(ZM_RATE_BASE * 1000000));
curr_stream_time += (1.0L * replay_rate * STREAM_PAUSE_WAIT)/(ZM_RATE_BASE * 1000000);
//}
continue;
}
} // end if !in_event
// Figure out if we should send this frame
@ -833,7 +843,7 @@ void EventStream::runStream() {
Debug(2, "Sending keepalive frame");
send_frame = true;
}
}
} // end if streaming stepping or doing nothing
if ( send_frame )
if ( !sendFrame(delta_us) )
@ -848,12 +858,12 @@ void EventStream::runStream() {
curr_frame_id = 1;
}
if ( send_frame && type != STREAM_MPEG ) {
Debug( 3, "dUs: %d", delta_us );
Debug(3, "dUs: %d", delta_us);
if ( delta_us )
usleep( delta_us );
usleep(delta_us);
}
} else {
usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) );
usleep((unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))));
}
} // end while ! zm_terminate
#if HAVE_LIBAVCODEC
@ -862,15 +872,17 @@ void EventStream::runStream() {
#endif // HAVE_LIBAVCODEC
closeComms();
}
} // void EventStream::runStream()
void EventStream::setStreamStart( uint64_t init_event_id, unsigned int init_frame_id=0 ) {
loadInitialEventData( init_event_id, init_frame_id );
if ( !(monitor = Monitor::Load( event_data->monitor_id, false, Monitor::QUERY )) ) {
Fatal( "Unable to load monitor id %d for streaming", event_data->monitor_id );
loadInitialEventData(init_event_id, init_frame_id);
if ( !(monitor = Monitor::Load(event_data->monitor_id, false, Monitor::QUERY)) ) {
Fatal("Unable to load monitor id %d for streaming", event_data->monitor_id);
return;
}
}
void EventStream::setStreamStart( int monitor_id, time_t event_time ) {
void EventStream::setStreamStart(int monitor_id, time_t event_time) {
loadInitialEventData(monitor_id, event_time);
if ( !(monitor = Monitor::Load(event_data->monitor_id, false, Monitor::QUERY)) ) {
Fatal("Unable to load monitor id %d for streaming", monitor_id);

View File

@ -278,6 +278,18 @@ static void zm_log_fps(double d, const char *postfix) {
}
}
void zm_dump_frame(const AVFrame *frame,const char *text) {
Debug(1, "%s: format %d %s sample_rate %" PRIu32 " nb_samples %d channels %d layout %d",
text,
frame->format,
av_get_sample_fmt_name((AVSampleFormat)frame->format),
frame->sample_rate,
frame->nb_samples,
frame->channels,
frame->channel_layout
);
}
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
void zm_dump_codecpar ( const AVCodecParameters *par ) {
Debug(1, "Dumping codecpar codec_type(%d) codec_id(%d) codec_tag(%d) width(%d) height(%d) bit_rate(%d) format(%d = %s)",

View File

@ -294,10 +294,11 @@ static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, in
#endif
void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output);
void zm_dump_codec ( const AVCodecContext *codec );
void zm_dump_codec(const AVCodecContext *codec);
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
void zm_dump_codecpar ( const AVCodecParameters *par );
void zm_dump_codecpar(const AVCodecParameters *par);
#endif
void zm_dump_frame(const AVFrame *frame, const char *text="Frame");
#if LIBAVCODEC_VERSION_CHECK(56, 8, 0, 60, 100)
#define zm_av_packet_unref( packet ) av_packet_unref( packet )

View File

@ -100,12 +100,13 @@ class FfmpegCamera : public Camera {
void Initialise();
void Terminate();
static int FfmpegInterruptCallback(void*ctx);
int PrimeCapture();
int PreCapture();
int Capture( Image &image );
int CaptureAndRecord( Image &image, timeval recording, char* event_directory );
int PostCapture();
private:
static int FfmpegInterruptCallback(void*ctx);
};
#endif // ZM_FFMPEG_CAMERA_H

View File

@ -186,6 +186,8 @@ int LibvlcCamera::PrimeCapture() {
Error("Unable to create libvlc instance due to: %s", libvlc_errmsg());
return -1;
}
libvlc_log_set(mLibvlcInstance, LibvlcCamera::log_callback, NULL);
mLibvlcMedia = libvlc_media_new_location(mLibvlcInstance, mPath.c_str());
if ( mLibvlcMedia == NULL ) {
@ -214,6 +216,7 @@ int LibvlcCamera::PrimeCapture() {
return 0;
}
int LibvlcCamera::PreCapture() {
return 0;
}
@ -244,4 +247,28 @@ int LibvlcCamera::PostCapture() {
return 0;
}
void LibvlcCamera::log_callback(void *ptr, int level, const libvlc_log_t *ctx, const char *fmt, va_list vargs) {
Logger *log = Logger::fetch();
int log_level = Logger::NOLOG;
if ( level == LIBVLC_ERROR ) {
log_level = Logger::WARNING; // ffmpeg outputs a lot of errors that don't really affect anything.
//log_level = Logger::ERROR;
} else if ( level == LIBVLC_WARNING ) {
log_level = Logger::INFO;
//log_level = Logger::WARNING;
} else if ( level == LIBVLC_NOTICE ) {
log_level = Logger::DEBUG1;
//log_level = Logger::INFO;
} else if ( level == LIBVLC_DEBUG ) {
log_level = Logger::DEBUG3;
} else {
Error("Unknown log level %d", level);
}
if ( log ) {
char logString[8192];
vsnprintf(logString, sizeof(logString)-1, fmt, vargs);
log->logPrint(false, __FILE__, __LINE__, log_level, logString);
}
}
#endif // HAVE_LIBVLC

View File

@ -42,6 +42,8 @@ struct LibvlcPrivateData
};
class LibvlcCamera : public Camera {
private:
static void log_callback( void *ptr, int level, const libvlc_log_t *ctx, const char *format, va_list vargs );
protected:
std::string mPath;
std::string mMethod;
@ -59,9 +61,9 @@ public:
LibvlcCamera( int p_id, const std::string &path, const std::string &p_method, const std::string &p_options, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture, bool p_record_audio );
~LibvlcCamera();
const std::string &Path() const { return( mPath ); }
const std::string &Options() const { return( mOptions ); }
const std::string &Method() const { return( mMethod ); }
const std::string &Path() const { return mPath; }
const std::string &Options() const { return mOptions; }
const std::string &Method() const { return mMethod; }
void Initialise();
void Terminate();

View File

@ -942,6 +942,7 @@ void LocalCamera::Initialise() {
v4l2_std_id stdId;
memset(&input, 0, sizeof(input));
input.index = channel;
if ( vidioctl(vid_fd, VIDIOC_ENUMINPUT, &input) < 0 ) {
Fatal("Failed to enumerate input %d: %s", channel, strerror(errno));
@ -952,8 +953,8 @@ void LocalCamera::Initialise() {
}
stdId = standard;
if ( (input.std != V4L2_STD_UNKNOWN) && vidioctl( vid_fd, VIDIOC_S_STD, &stdId ) < 0 ) {
Fatal("Failed to set video standard %d: %s", standard, strerror(errno));
if ( (input.std != V4L2_STD_UNKNOWN) && (vidioctl(vid_fd, VIDIOC_S_STD, &stdId) < 0) ) {
Fatal("Failed to set video standard %d: %d %s", standard, errno, strerror(errno));
}
Contrast(contrast);

View File

@ -338,7 +338,11 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
{
AVFormatContext *formatContext = avformat_alloc_context();
strncpy( formatContext->filename, mUrl.c_str(), sizeof(formatContext->filename) );
#if (LIBAVFORMAT_VERSION_CHECK(58, 12, 0, 0, 100))
formatContext->url = av_strdup(mUrl.c_str());
#else
strncpy(formatContext->filename, mUrl.c_str(), sizeof(formatContext->filename));
#endif
/*
if ( mName.length() )
strncpy( formatContext->title, mName.c_str(), sizeof(formatContext->title) );

View File

@ -88,7 +88,7 @@ bool User::canAccess( int monitor_id ) {
// Function to load a user from username and password
// Please note that in auth relay mode = none, password is NULL
User *zmLoadUser( const char *username, const char *password ) {
char sql[ZM_SQL_SML_BUFSIZ] = "";
char sql[ZM_SQL_MED_BUFSIZ] = "";
char safer_username[65]; // current db username size is 32
// According to docs, size of safer_whatever must be 2*length+1 due to unicode conversions + null terminator.
@ -97,35 +97,40 @@ User *zmLoadUser( const char *username, const char *password ) {
if ( password ) {
char safer_password[129]; // current db password size is 64
mysql_real_escape_string(&dbconn, safer_password, password, strlen( password ) );
snprintf( sql, sizeof(sql), "select Id, Username, Password, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds from Users where Username = '%s' and Password = password('%s') and Enabled = 1", safer_username, safer_password );
snprintf(sql, sizeof(sql),
"SELECT Id, Username, Password, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds"
" FROM Users WHERE Username = '%s' AND Password = password('%s') AND Enabled = 1",
safer_username, safer_password );
} else {
snprintf( sql, sizeof(sql), "select Id, Username, Password, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds from Users where Username = '%s' and Enabled = 1", safer_username );
snprintf(sql, sizeof(sql),
"SELECT Id, Username, Password, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds"
" FROM Users where Username = '%s' and Enabled = 1", safer_username );
}
if ( mysql_query( &dbconn, sql ) ) {
Error( "Can't run query: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
}
MYSQL_RES *result = mysql_store_result( &dbconn );
MYSQL_RES *result = mysql_store_result(&dbconn);
if ( !result ) {
Error( "Can't use query result: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
Error("Can't use query result: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn));
}
int n_users = mysql_num_rows( result );
int n_users = mysql_num_rows(result);
if ( n_users != 1 ) {
mysql_free_result( result );
Warning( "Unable to authenticate user %s", username );
return( 0 );
mysql_free_result(result);
Warning("Unable to authenticate user %s", username);
return NULL;
}
MYSQL_ROW dbrow = mysql_fetch_row( result );
MYSQL_ROW dbrow = mysql_fetch_row(result);
User *user = new User( dbrow );
Info( "Authenticated user '%s'", user->getUsername() );
User *user = new User(dbrow);
Info("Authenticated user '%s'", user->getUsername());
mysql_free_result( result );
mysql_free_result(result);
return user;
}

View File

@ -422,7 +422,7 @@ void touch(const char *pathname) {
0666);
if ( fd < 0 ) {
// Couldn't open that path.
Error("Couldn't open() path \"%s in touch", pathname);
Error("Couldn't open() path %s in touch", pathname);
return;
}
int rc = utimensat(AT_FDCWD,

View File

@ -554,7 +554,7 @@ bool VideoStore::setup_resampler() {
#else
audio_out_ctx->refcounted_frames = 1;
#endif
if ( ! audio_out_ctx->channel_layout ) {
if ( !audio_out_ctx->channel_layout ) {
Debug(3, "Correcting channel layout from (%d) to (%d)",
audio_out_ctx->channel_layout,
av_get_default_channel_layout(audio_out_ctx->channels)
@ -696,7 +696,9 @@ bool VideoStore::setup_resampler() {
out_frame->nb_samples = audio_out_ctx->frame_size;
out_frame->format = audio_out_ctx->sample_fmt;
out_frame->channels = audio_out_ctx->channels;
out_frame->channel_layout = audio_out_ctx->channel_layout;
out_frame->sample_rate = audio_out_ctx->sample_rate;
// The codec gives us the frame size, in samples, we calculate the size of the
// samples buffer in bytes
@ -717,7 +719,7 @@ bool VideoStore::setup_resampler() {
if ( avcodec_fill_audio_frame(out_frame, audio_out_ctx->channels,
audio_out_ctx->sample_fmt,
(const uint8_t *)converted_in_samples,
audioSampleBuffer_size, 0) < 0) {
audioSampleBuffer_size, 0) < 0 ) {
Error("Could not allocate converted in sample pointers");
return false;
}
@ -920,11 +922,10 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
return 0;
}
#endif
int frame_size = out_frame->nb_samples;
// Resample the in into the audioSampleBuffer until we proceed the whole
// decoded data
Debug(2, "Converting %d to %d samples", in_frame->nb_samples, out_frame->nb_samples);
zm_dump_frame(in_frame, "In frame");
zm_dump_frame(out_frame, "Out frame before resample");
if (
#if defined(HAVE_LIBSWRESAMPLE)
#if 0
@ -958,7 +959,6 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
return 0;
}
Debug(3, "Output_frame samples (%d)", out_frame->nb_samples);
// Read a frame audio data from the resample fifo
if ( avresample_read(resample_ctx, out_frame->data, frame_size) !=
frame_size) {
@ -966,10 +966,7 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
return 0;
}
#endif
Debug(2,
"Frame: samples(%d), format(%d), sample_rate(%d), channel layout(%d)",
out_frame->nb_samples, out_frame->format,
out_frame->sample_rate, out_frame->channel_layout);
zm_dump_frame(out_frame,"Out frame after resample");
av_init_packet(&opkt);
Debug(5, "after init packet");

View File

@ -188,7 +188,7 @@ class Group {
session_write_close();
return htmlSelect( 'Group[]', Group::get_dropdown_options(), isset($_SESSION['Group'])?$_SESSION['Group']:null, array(
'onchange' => 'this.form.submit();',
'data-on-change' => 'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',

View File

@ -9,8 +9,8 @@ class Server {
'Name' => '',
'Protocol' => '',
'Hostname' => '',
'Port' => null,
'PathToIndex' => '/zm/index.php',
'Port' => null,
'PathToIndex' => null,
'PathToZMS' => ZM_PATH_ZMS,
'PathToApi' => '/zm/api',
'zmaudit' => 1,
@ -214,5 +214,19 @@ class Server {
return $results[0];
}
public function to_json() {
$json = array();
foreach ($this->defaults as $key => $value) {
if ( is_callable(array($this, $key)) ) {
$json[$key] = $this->$key();
} else if ( array_key_exists($key, $this) ) {
$json[$key] = $this->{$key};
} else {
$json[$key] = $this->defaults{$key};
}
}
return json_encode($json);
}
} # end class Server
?>

View File

@ -45,5 +45,6 @@ if ( !empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid']) ) {
$refreshParent = true;
}
} // end if action
$view = 'none';
} // end if $mid and canEdit($mid)
?>

View File

@ -150,24 +150,25 @@ function csrf_ob_handler($buffer, $flags) {
return $buffer;
}
}
global $cspNonce;
$tokens = csrf_get_tokens();
$name = $GLOBALS['csrf']['input-name'];
$endslash = $GLOBALS['csrf']['xhtml'] ? ' /' : '';
$input = "<input type='hidden' name='$name' value=\"$tokens\"$endslash>";
$buffer = preg_replace('#(<form[^>]*method\s*=\s*["\']post["\'][^>]*>)#i', '$1' . $input, $buffer);
if ($GLOBALS['csrf']['frame-breaker']) {
$buffer = str_ireplace('</head>', '<script type="text/javascript">if (top != self) {top.location.href = self.location.href;}</script></head>', $buffer);
$buffer = str_ireplace('</head>', '<script nonce="'.$cspNonce.'">if (top != self) {top.location.href = self.location.href;}</script></head>', $buffer);
}
if ($js = $GLOBALS['csrf']['rewrite-js']) {
$buffer = str_ireplace(
'</head>',
'<script type="text/javascript">'.
'<script nonce="'.$cspNonce.'">'.
'var csrfMagicToken = "'.$tokens.'";'.
'var csrfMagicName = "'.$name.'";</script>'.
'<script src="'.$js.'" type="text/javascript"></script></head>',
'<script src="'.$js.'"></script></head>',
$buffer
);
$script = '<script type="text/javascript">CsrfMagic.end();</script>';
$script = '<script nonce="'.$cspNonce.'">CsrfMagic.end();</script>';
$buffer = str_ireplace('</body>', $script . '</body>', $buffer, $count);
if (!$count) {
$buffer .= $script;
@ -183,6 +184,7 @@ function csrf_ob_handler($buffer, $flags) {
*/
function csrf_check($fatal = true) {
if ($_SERVER['REQUEST_METHOD'] !== 'POST') return true;
global $cspNonce;
csrf_start();
$name = $GLOBALS['csrf']['input-name'];
$ok = false;

View File

@ -35,6 +35,28 @@ function noCacheHeaders() {
header('Pragma: no-cache'); // HTTP/1.0
}
function CSPHeaders($view, $nonce) {
switch ($view) {
case 'bandwidth':
case 'function':
case 'log':
case 'logout':
case 'options':
case 'version': {
// Enforce script-src on pages where inline scripts and event handlers have been fixed.
// 'unsafe-inline' is only for backwards compatibility with browsers which
// only support CSP 1 (with no nonce-* support).
header("Content-Security-Policy: script-src 'unsafe-inline' 'self' 'nonce-$nonce'");
break;
}
default: {
// Use Report-Only mode on all other pages.
header("Content-Security-Policy-Report-Only: script-src 'unsafe-inline' 'self' 'nonce-$nonce'");
break;
}
}
}
function CORSHeaders() {
if ( isset($_SERVER['HTTP_ORIGIN']) ) {
@ -44,6 +66,11 @@ function CORSHeaders() {
if ( sizeof($Servers) < 1 ) {
# Only need CORSHeaders in the event that there are multiple servers in use.
# ICON: Might not be true. multi-port?
if ( ZM_MIN_STREAMING_PORT ) {
Logger::Debug("Setting default Access-Control-Allow-Origin from " . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Headers: x-requested-with,x-request');
}
return;
}
foreach( $Servers as $Server ) {
@ -400,14 +427,19 @@ function makeLink( $url, $label, $condition=1, $options='' ) {
}
function makePopupLink( $url, $winName, $winSize, $label, $condition=1, $options='' ) {
$string = '';
// Avoid double-encoding since some consumers incorrectly pass a pre-escaped URL.
$string = '<a class="popup-link" href="' . htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, ini_get("default_charset"), false) . '"';
$string .= ' data-window-name="' . htmlspecialchars($winName) . '"';
if ( $condition ) {
if ( is_array( $winSize ) )
$popupParms = "'".$url."', '".$winName."', '".$winSize[0]."', ".$winSize[1].", ".$winSize[2];
else
$popupParms = "'".$url."', '".$winName."', '".$winSize."'";
if ( is_array( $winSize ) ) {
$string .= ' data-window-tag="' . htmlspecialchars($winSize[0]) . '"';
$string .= ' data-window-width="' . htmlspecialchars($winSize[1]) . '"';
$string .= ' data-window-height="' . htmlspecialchars($winSize[2]) . '"';
} else {
$string .= ' data-window-tag="' . htmlspecialchars($winSize) . '"';
}
$string .= '<a href="'.$url.'" onclick="createPopup( '.$popupParms.' ); return( false );"'.($options?(' '.$options):'').'>';
$string .= ($options ? (' ' . $options ) : '') . '>';
} else {
$string .= '<a>';
}
@ -417,11 +449,20 @@ function makePopupLink( $url, $winName, $winSize, $label, $condition=1, $options
}
function makePopupButton( $url, $winName, $winSize, $buttonValue, $condition=1, $options='' ) {
if ( is_array( $winSize ) )
$popupParms = "'".$url."', '".$winName."', '".$winSize[0]."', ".$winSize[1].", ".$winSize[2];
else
$popupParms = "'".$url."', '".$winName."', '".$winSize."'";
$string = '<input type="button" value="'.$buttonValue.'" onclick="createPopup( '.$popupParms.' ); return( false );"'.($condition?'':' disabled="disabled"').($options?(' '.$options):'').'/>';
$string = '<input type="button" class="popup-link" value="' . htmlspecialchars($buttonValue) . '"';
$string .= ' data-url="' . htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, ini_get("default_charset"), false) . '"';
$string .= ' data-window-name="' . htmlspecialchars($winName) . '"';
if ( is_array( $winSize ) ) {
$string .= ' data-window-tag="' . htmlspecialchars($winSize[0]) . '"';
$string .= ' data-window-width="' . htmlspecialchars($winSize[1]) . '"';
$string .= ' data-window-height="' . htmlspecialchars($winSize[2]) . '"';
} else {
$string .= ' data-window-tag="' . htmlspecialchars($winSize) . '"';
}
if ($condition) {
$string .= ' disabled="disabled"';
}
$string .= ($options ? (' ' . $options) : '') . '/>';
return( $string );
}
@ -2258,6 +2299,29 @@ function csrf_startup() {
csrf_conf('rewrite-js', 'includes/csrf/csrf-magic.js');
}
function check_timezone() {
$now = new DateTime();
$sys_tzoffset = trim(shell_exec('date "+%z"'));
$php_tzoffset = trim($now->format('O'));
$mysql_tzoffset = trim(dbFetchOne("SELECT TIME_FORMAT(TIMEDIFF(NOW(), UTC_TIMESTAMP),'%H%i');",'TIME_FORMAT(TIMEDIFF(NOW(), UTC_TIMESTAMP),\'%H%i\')'));
#Logger::Debug("System timezone offset determine to be: $sys_tzoffset,\x20
#PHP timezone offset determine to be: $php_tzoffset,\x20
#Mysql timezone offset determine to be: $mysql_tzoffset
#");
if ( $sys_tzoffset != $php_tzoffset )
Fatal("ZoneMinder is not installed properly: php's date.timezone does not match the system timezone!");
if ( $sys_tzoffset != $mysql_tzoffset )
Error("ZoneMinder is not installed properly: mysql's timezone does not match the system timezone! Event lists will display incorrect times.");
if (!ini_get('date.timezone') || !date_default_timezone_set(ini_get('date.timezone')))
Fatal( "ZoneMinder is not installed properly: php's date.timezone is not set to a valid timezone" );
}
function unparse_url($parsed_url, $substitutions = array() ) {
$fields = array('scheme','host','port','user','pass','path','query','fragment');

View File

@ -69,11 +69,9 @@ define('ZM_BASE_PROTOCOL', $protocol);
// Use relative URL's instead
define('ZM_BASE_URL', '');
// Check time zone is set
if (!ini_get('date.timezone') || !date_default_timezone_set(ini_get('date.timezone'))) {
date_default_timezone_set('UTC');
Fatal( "ZoneMinder is not installed properly: php's date.timezone is not set to a valid timezone" );
}
// Verify the system, php, and mysql timezones all match
require_once('includes/functions.php');
check_timezone();
if ( isset($_GET['skin']) ) {
$skin = $_GET['skin'];
@ -155,7 +153,6 @@ if ( ZM_OPT_USE_AUTH ) {
session_write_close();
require_once('includes/lang.php');
require_once('includes/functions.php');
# Running is global but only do the daemonCheck if it is actually needed
$running = null;
@ -175,6 +172,10 @@ $view = null;
if ( isset($_REQUEST['view']) )
$view = detaintPath($_REQUEST['view']);
# Add CSP Headers
$cspNonce = bin2hex(openssl_random_pseudo_bytes(16));
CSPHeaders($view, $cspNonce);
$request = null;
if ( isset($_REQUEST['request']) )
$request = detaintPath($_REQUEST['request']);

View File

@ -61,7 +61,7 @@ span.noneCue {
}
#menuBar1 #replayControl {
margin: 0 4px 0 auto;
margin: auto 5px auto auto;
}
#menuBar1 div {

View File

@ -3,3 +3,8 @@
margin-left: 3px;
padding: 0px;
}
.SourceOptions input,
.SourcePath input {
width: 100%;
}

View File

@ -287,7 +287,7 @@ function controlPresets( $monitor, $cmds ) {
}
if ( canEdit('Monitors') && $monitor->CanSetPresets() ) {
?>
<input type="button" class="ptzTextBtn" value="<?php echo translate('Set') ?>" onclick="createPopup('?view=controlpreset&amp;mid=<?php echo $monitor->Id() ?>', 'zmPreset', 'preset');"/>
<input type="button" class="ptzTextBtn popup-link" value="<?php echo translate('Set') ?>" data-url="?view=controlpreset&amp;mid=<?php echo $monitor->Id() ?>" data-window-name="zmPreset" data-window-tag="preset"/>
<?php
}
?>

View File

@ -270,12 +270,12 @@ function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) {
<div id="imagevideo" align="center"></div>
<br>
<div align="center">
<button type="button" onclick="stepbackward()">&lt; Step</button>
<button type="button" id="btnrwd" onclick="rewind()" >Rwd</button>
<button type="button" id="btnplay" onclick="playstop()">Stop</button>
<button type="button" onclick="stepforward()">Step &gt;</button>
<button type="button" id="btnspeedup" onclick="speedup()">speedup</button>
<button type="button" id="btnspeeddown" onclick="speeddown()">slowdown</button>
<button type="button" data-on-click="stepbackward">&lt; Step</button>
<button type="button" id="btnrwd" data-on-click="rewind">Rwd</button>
<button type="button" id="btnplay" data-on-click="playstop">Stop</button>
<button type="button" data-on-click="stepforward">Step &gt;</button>
<button type="button" id="btnspeedup" data-on-click="speedup">speedup</button>
<button type="button" id="btnspeeddown" data-on-click="speeddown">slowdown</button>
</div>
<div align="center"><div class="horizontal_track" >
<div class="horizontal_slit" >&nbsp;</div>

View File

@ -120,7 +120,7 @@ echo output_link_if_exists( array(
<script src="skins/<?php echo $skin; ?>/js/dateTimePicker/jquery-ui-timepicker-addon.js"></script>
<script src="<?php echo cache_bust('js/Server.js'); ?>"></script>
<script>
<script nonce="<?php echo $cspNonce; ?>">
jQuery(document).ready(function(){
jQuery("#flip").click(function(){
jQuery("#panel").slideToggle("slow");
@ -150,7 +150,7 @@ echo output_link_if_exists( array(
<?php
if ( $skinJsPhpFile ) {
?>
<script>
<script nonce="<?php echo $cspNonce; ?>">
//<![CDATA[
<!--
<?php
@ -163,7 +163,7 @@ echo output_link_if_exists( array(
}
if ( $viewJsPhpFile ) {
?>
<script>
<script nonce="<?php echo $cspNonce; ?>">
//<![CDATA[
<!--
<?php
@ -397,6 +397,7 @@ if ($reload == 'reload') return ob_get_clean();
} // end function getNavBarHTML()
function xhtmlFooter() {
global $cspNonce;
global $view;
global $skin;
global $running;
@ -404,8 +405,8 @@ function xhtmlFooter() {
include("skins/$skin/views/state.php");
}
?>
<script nonce="<?php echo $cspNonce; ?>">$j('.chosen').chosen();</script>
</body>
<script type="text/javascript">$j('.chosen').chosen();</script>
</html>
<?php
} // end xhtmlFooter

View File

@ -118,6 +118,46 @@ function createPopup( url, name, tag, width, height ) {
}
}
$j(document).ready(function() {
$j(".popup-link").click(function onClick(evt) {
var el = this;
var url;
if (el.hasAttribute("href")) {
// <a>
url = el.getAttribute("href");
} else {
// buttons
url = el.getAttribute("data-url");
}
var name = el.getAttribute("data-window-name");
var tag = el.getAttribute("data-window-tag");
var width = el.getAttribute("data-window-width");
var height = el.getAttribute("data-window-height");
createPopup(url, name, tag, width, height);
evt.preventDefault();
});
// 'data-on-click-this' calls the global function in the attribute value with the element when a click happens.
document.querySelectorAll("a[data-on-click-this], button[data-on-click-this], input[data-on-click-this]").forEach(function attachOnClick(el) {
var fnName = el.getAttribute("data-on-click-this");
el.onclick = window[fnName].bind(el, el);
});
// 'data-on-click' calls the global function in the attribute value with no arguments when a click happens.
document.querySelectorAll("a[data-on-click], button[data-on-click], input[data-on-click]").forEach(function attachOnClick(el) {
var fnName = el.getAttribute("data-on-click");
el.onclick = function() {
window[fnName]();
};
});
// 'data-on-change' adds an event listener for the global function in the attribute value when a change happens.
document.querySelectorAll("select[data-on-change], input[data-on-change]").forEach(function attachOnChange(el) {
var fnName = el.getAttribute("data-on-change");
el.onchange = window[fnName];
});
});
function createEventPopup( eventId, eventFilter, width, height ) {
var url = '?view=event&eid='+eventId;
if ( eventFilter )
@ -264,6 +304,10 @@ function submitTab( tab ) {
form.submit();
}
function submitThisForm() {
this.form.submit();
}
function toggleCheckbox( element, name ) {
var form = element.form;
var checked = element.checked;

View File

@ -64,7 +64,7 @@ if ( ( ! empty($closePopup) ) and ( $closePopup == true ) ) {
var focusWindow = <?php echo !empty($focusWindow)?'true':'false' ?>;
var imagePrefix = "<?php echo "?view=image&eid=" ?>";
var imagePrefix = "<?php echo '?view=image&eid=' ?>";
var auth_hash;
<?php if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) { ?>

View File

@ -105,7 +105,7 @@ $html .= '<span class="FunctionFilter"><label>'.translate('Function').'</label>'
$html .= htmlSelect('Function[]', $Functions,
(isset($_SESSION['Function'])?$_SESSION['Function']:''),
array(
'onchange'=>'this.form.submit();',
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',
@ -118,7 +118,7 @@ if ( count($ServersById) > 1 ) {
$html .= htmlSelect('ServerId[]', $ServersById,
(isset($_SESSION['ServerId'])?$_SESSION['ServerId']:''),
array(
'onchange'=>'this.form.submit();',
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',
@ -132,7 +132,7 @@ if ( count($StorageById) > 1 ) {
$html .= htmlSelect('StorageId[]', $StorageById,
(isset($_SESSION['StorageId'])?$_SESSION['StorageId']:''),
array(
'onchange'=>'this.form.submit();',
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',
@ -150,7 +150,7 @@ $status_options = array(
$html .= htmlSelect( 'Status[]', $status_options,
( isset($_SESSION['Status']) ? $_SESSION['Status'] : '' ),
array(
'onchange'=>'this.form.submit();',
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All'
@ -235,7 +235,7 @@ $html .= htmlSelect( 'Status[]', $status_options,
$html .= '<span class="MonitorFilter"><label>'.translate('Monitor').'</label>';
$html .= htmlSelect('MonitorId[]', $monitors_dropdown, $selected_monitor_ids,
array(
'onchange'=>'this.form.submit();',
'data-on-change'=>'submitThisForm',
'class'=>'chosen',
'multiple'=>'multiple',
'data-placeholder'=>'All',

View File

@ -49,7 +49,7 @@ xhtmlHeaders(__FILE__, translate('Bandwidth') );
<p><?php echo translate('SetNewBandwidth') ?></p>
<p><?php echo buildSelect( "newBandwidth", $bandwidth_options ) ?></p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -178,23 +178,23 @@ getBodyTopHTML();
</div>
<div class="container-fluid">
<button type="button" name="addBtn" onclick="addMonitor(this);"
<button type="button" name="addBtn" data-on-click-this="addMonitor"
<?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
>
<span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>&nbsp;<?php echo translate('AddNewMonitor') ?>
</button>
<button type="button" name="cloneBtn" onclick="cloneMonitor(this);"
<button type="button" name="cloneBtn" data-on-click-this="cloneMonitor"
<?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
style="display:none;">
<span class="glyphicon glyphicon-copy"></span>&nbsp;<?php echo translate('CloneMonitor') ?>
</button>
<button type="button" name="editBtn" onclick="editMonitor(this);" disabled="disabled">
<button type="button" name="editBtn" data-on-click-this="editMonitor" disabled="disabled">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>&nbsp;<?php echo translate('Edit') ?>
</button>
<button type="button" name="deleteBtn" onclick="deleteMonitor(this);" disabled="disabled">
<button type="button" name="deleteBtn" data-on-click-this="deleteMonitor" disabled="disabled">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&nbsp;<?php echo translate('Delete') ?>
</button>
<button type="button" name="selectBtn" onclick="selectMonitor(this);" disabled="disabled"><?php echo translate('Select')?></button>
<button type="button" name="selectBtn" data-on-click-this="selectMonitor" disabled="disabled"><?php echo translate('Select')?></button>
<?php
ob_start();
?>
@ -327,7 +327,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
if ( canEdit('Monitors') ) {
?>
<td class="colMark">
<input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" onclick="setButtonStates( this )"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/>
<input type="checkbox" name="markMids[]" value="<?php echo $monitor['Id'] ?>" data-on-click-this="setButtonStates"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/>
<span class="glyphicon glyphicon-sort" title="Click and drag to change order"></span>
</td>
<?php

View File

@ -55,7 +55,7 @@ xhtmlHeaders(__FILE__, translate('Control') );
<div id="page">
<div id="header">
<div id="headerButtons">
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('Control') ?></h2>
<div id="headerControl">

View File

@ -503,7 +503,7 @@ switch ( $tab )
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Control' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Control' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -34,7 +34,7 @@ xhtmlHeaders(__FILE__, translate('ControlCaps') );
<div id="page">
<div id="header">
<div id="headerButtons">
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('ControlCaps') ?></h2>
</div>
@ -63,7 +63,7 @@ foreach( $controls as $control )
{
?>
<tr>
<td class="colName"><?php echo makePopupLink( '?view=controlcap&amp;cid='.$control['Id'], 'zmControlCap', 'controlcap', $control['Name'], canView( 'Control' ) ) ?></td>
<td class="colName"><?php echo makePopupLink( '?view=controlcap&cid='.$control['Id'], 'zmControlCap', 'controlcap', $control['Name'], canView( 'Control' ) ) ?></td>
<td class="colType"><?php echo $control['Type'] ?></td>
<td class="colProtocol"><?php echo $control['Protocol'] ?></td>
<td class="colCanMove"><?php echo $control['CanMove']?translate('Yes'):translate('No') ?></td>
@ -72,7 +72,7 @@ foreach( $controls as $control )
<td class="colCanIris"><?php echo $control['CanIris']?translate('Yes'):translate('No') ?></td>
<td class="colCanWhiteBal"><?php echo $control['CanWhite']?translate('Yes'):translate('No') ?></td>
<td class="colHasPresets"><?php echo $control['HasHomePreset']?'H':'' ?><?php echo $control['HasPresets']?$control['NumPresets']:'0' ?></td>
<td class="colMark"><input type="checkbox" name="markCids[]" value="<?php echo $control['Id'] ?>" onclick="configureDeleteButton( this );"<?php if ( !canEdit( 'Control' ) ) {?> disabled="disabled"<?php } ?>/></td>
<td class="colMark"><input type="checkbox" name="markCids[]" value="<?php echo $control['Id'] ?>" data-on-click-this="configureDeleteButton"<?php if ( !canEdit( 'Control' ) ) {?> disabled="disabled"<?php } ?>/></td>
</tr>
<?php
}
@ -80,7 +80,8 @@ foreach( $controls as $control )
</tbody>
</table>
<div id="contentButtons">
<input type="button" value="<?php echo translate('AddNewControl') ?>" onclick="createPopup( '?view=controlcap', 'zmControlCap', 'controlcap' );"<?php if ( !canEdit( 'Control' ) ) {?> disabled="disabled"<?php } ?>/><input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
<?php echo makePopupButton('?view=controlcap', 'zmControlCap', 'controlcap', translate('AddNewControl'), canEdit( 'Control' )); ?>
<input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
</div>
</form>
</div>

View File

@ -61,7 +61,7 @@ xhtmlHeaders(__FILE__, translate('SetPreset') );
</p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -58,7 +58,7 @@ xhtmlHeaders( __FILE__, translate('Device')." - ".$newDevice['Name'] );
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Devices' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Devices' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -75,9 +75,9 @@ foreach( $devices as $device )
</tbody>
</table>
<div id="contentButtons">
<input type="button" value="<?php echo translate('New') ?>" onclick="createPopup( '?view=device&amp;did=0', 'zmDevice', 'device' )"<?php echo canEdit('Devices')?'':' disabled="disabled"' ?>/>
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteDevice( this )" disabled="disabled"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
<?php echo makePopupButton('?view=device&did=0', 'zmDevice', 'device', translate('New'), canEdit( 'Devices' )); ?>
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" data-on-click-this="deleteDevice" disabled="disabled"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -55,8 +55,8 @@ xhtmlHeaders(__FILE__, translate('Donate') );
<?php echo buildSelect( "option", $options ); ?>
</p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Apply') ?>" onclick="submitForm( this )">
<input type="button" value="<?php echo translate('Close') ?>" onclick="closeWindow()">
<input type="submit" value="<?php echo translate('Apply') ?>" data-on-click-this="submitForm">
<input type="button" value="<?php echo translate('Close') ?>" data-on-click="closeWindow">
</div>
</form>
</div>

View File

@ -54,7 +54,7 @@ xhtmlHeaders(__FILE__, translate('Download') );
<div id="page">
<div id="header">
<div id="headerButtons">
<a href="#" onclick="closeWindow()"><?php echo translate('Close') ?></a>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('Download') ?></h2>
</div>
@ -95,9 +95,9 @@ if ( !empty($_REQUEST['eid']) ) {
<tr>
<th scope="row"><?php echo translate('ExportFormat') ?></th>
<td>
<input type="radio" id="exportFormatTar" name="exportFormat" value="tar" onclick="configureExportButton(this)"/>
<input type="radio" id="exportFormatTar" name="exportFormat" value="tar" data-on-click-this="configureExportButton"/>
<label for="exportFormatTar"><?php echo translate('ExportFormatTar') ?></label>
<input type="radio" id="exportFormatZip" name="exportFormat" value="zip" checked="checked" onclick="configureExportButton(this);"/>
<input type="radio" id="exportFormatZip" name="exportFormat" value="zip" checked="checked" data-on-click-this="configureExportButton"/>
<label for="exportFormatZip"><?php echo translate('ExportFormatZip') ?></label>
</td>
</tr>

View File

@ -35,7 +35,7 @@ xhtmlHeaders(__FILE__, translate('Error') );
<?php echo translate('ContactAdmin') ?>
</p>
<p>
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</p>
</div>
</div>

View File

@ -122,22 +122,22 @@ if ( ! $Event->Id() ) {
<div id="menuBar1">
<div id="nameControl">
<input type="text" id="eventName" name="eventName" value="<?php echo validHtmlStr($Event->Name()) ?>" />
<button value="Rename" type="button" onclick="renameEvent()"<?php if ( !canEdit('Events') ) { ?> disabled="disabled"<?php } ?>>
<button value="Rename" type="button" data-on-click="renameEvent"<?php if ( !canEdit('Events') ) { ?> disabled="disabled"<?php } ?>>
<?php echo translate('Rename') ?></button>
</div>
<?php
if ( canEdit('Events') ) {
?>
<div id="deleteEvent"><button type="button" onclick="deleteEvent()"><?php echo translate('Delete') ?></button></div>
<div id="editEvent"><button type="button" onclick="editEvent()"><?php echo translate('Edit') ?></button></div>
<div id="archiveEvent"<?php echo $Event->Archived == 1 ? ' class="hidden"' : '' ?>><button type="button" onclick="archiveEvent()"><?php echo translate('Archive') ?></button></div>
<div id="unarchiveEvent"<?php echo $Event->Archived == 0 ? ' class="hidden"' : '' ?>><button type="button" onclick="unarchiveEvent()"><?php echo translate('Unarchive') ?></button></div>
<div id="deleteEvent"><button type="button" data-on-click="deleteEvent" <?php echo $Event->Archived == 1 ? ' disabled="disabled" title="You cannot delete an archived event. Unarchive it first."' : '' ?>><?php echo translate('Delete') ?></button></div>
<div id="editEvent"><button type="button" data-on-click="editEvent"><?php echo translate('Edit') ?></button></div>
<div id="archiveEvent"<?php echo $Event->Archived == 1 ? ' class="hidden"' : '' ?>><button type="button" data-on-click="archiveEvent"><?php echo translate('Archive') ?></button></div>
<div id="unarchiveEvent"<?php echo $Event->Archived == 0 ? ' class="hidden"' : '' ?>><button type="button" data-on-click="unarchiveEvent"><?php echo translate('Unarchive') ?></button></div>
<?php
} // end if can edit Events
?>
<div id="framesEvent"><button type="button" onclick="showEventFrames()"><?php echo translate('Frames') ?></button></div>
<div id="streamEvent" class="hidden"><button onclick="showStream()"><?php echo translate('Stream') ?></button></div>
<div id="stillsEvent"><button type="button" onclick="showStills()"><?php echo translate('Stills') ?></button></div>
<div id="framesEvent"><button type="button" data-on-click="showEventFrames"><?php echo translate('Frames') ?></button></div>
<div id="streamEvent" class="hidden"><button data-on-click="showStream"><?php echo translate('Stream') ?></button></div>
<div id="stillsEvent"><button type="button" data-on-click="showStills"><?php echo translate('Stills') ?></button></div>
<?php
if ( $Event->DefaultVideo() ) {
?>
@ -145,11 +145,11 @@ if ( canEdit('Events') ) {
<?php
} else {
?>
<div id="videoEvent"><button type="button" onclick="videoEvent();"><?php echo translate('Video') ?></button></div>
<div id="videoEvent"><button type="button" data-on-click="videoEvent"><?php echo translate('Video') ?></button></div>
<?php
} // end if Event->DefaultVideo
?>
<div id="exportEvent"><button type="button" onclick="exportEvent();"><?php echo translate('Export') ?></button></div>
<div id="exportEvent"><button type="button" data-on-click="exportEvent"><?php echo translate('Export') ?></button></div>
<div id="replayControl"><label for="replayMode"><?php echo translate('Replay') ?></label><?php echo buildSelect( "replayMode", $replayModes, "changeReplayMode();" ); ?></div>
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect( "scale", $scales, "changeScale();" ); ?></div>
</div>
@ -191,15 +191,15 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
</div><!--imageFeed-->
<?php } /*end if !DefaultVideo*/ ?>
<p id="dvrControls">
<input type="button" value="&lt;+" id="prevBtn" title="<?php echo translate('Prev') ?>" class="inactive" onclick="streamPrev( true );"/>
<input type="button" value="&lt;&lt;" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="inactive" onclick="streamFastRev( true );"/>
<input type="button" value="&lt;" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" onclick="streamSlowRev( true );"/>
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" onclick="pauseClicked();"/>
<input type="button" value="|>" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" onclick="playClicked();"/>
<input type="button" value="&gt;" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" onclick="streamSlowFwd( true );"/>
<input type="button" value="&gt;&gt;" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="inactive" onclick="streamFastFwd( true );"/>
<input type="button" value="&ndash;" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="unavail" disabled="disabled" onclick="streamZoomOut();"/>
<input type="button" value="+&gt;" id="nextBtn" title="<?php echo translate('Next') ?>" class="inactive" onclick="streamNext( true );"/>
<input type="button" value="&lt;+" id="prevBtn" title="<?php echo translate('Prev') ?>" class="inactive" data-on-click-true="streamPrev"/>
<input type="button" value="&lt;&lt;" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="inactive" data-on-click-true="streamFastRev"/>
<input type="button" value="&lt;" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" data-on-click-true="streamSlowRev"/>
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" data-on-click="pauseClicked"/>
<input type="button" value="|>" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" data-on-click="playClicked"/>
<input type="button" value="&gt;" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" data-on-click-true="streamSlowFwd"/>
<input type="button" value="&gt;&gt;" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="inactive" data-on-click-true="streamFastFwd"/>
<input type="button" value="&ndash;" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="unavail" disabled="disabled" data-on-click="streamZoomOut"/>
<input type="button" value="+&gt;" id="nextBtn" title="<?php echo translate('Next') ?>" class="inactive" data-on-click-true="streamNext"/>
</p>
<div id="replayStatus">
<span id="mode"><?php echo translate('Mode') ?>: <span id="modeValue">Replay</span></span>
@ -217,8 +217,8 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
<div id="eventImageFrame">
<img id="eventImage" src="graphics/transparent.png" alt=""/>
<div id="eventImageBar">
<div id="eventImageClose"><button type="button" onclick="hideEventImage()"><?php echo translate('Close') ?></button></div>
<div id="eventImageStats" class="hidden"><button type="button" onclick="showFrameStats()"><?php echo translate('Stats') ?></button></div>
<div id="eventImageClose"><button type="button" data-on-click="hideEventImage"><?php echo translate('Close') ?></button></div>
<div id="eventImageStats" class="hidden"><button type="button" data-on-click="showFrameStats"><?php echo translate('Stats') ?></button></div>
<div id="eventImageData"><?php echo translate('Frame') ?> <span id="eventImageNo"></span></div>
</div>
</div>
@ -233,12 +233,12 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
</div>
<div id="eventImageButtons">
<div id="prevButtonsPanel">
<input id="prevEventBtn" type="button" value="&lt;E" onclick="prevEvent()" disabled="disabled"/>
<input id="prevThumbsBtn" type="button" value="&lt;&lt;" onclick="prevThumbs()" disabled="disabled"/>
<input id="prevImageBtn" type="button" value="&lt;" onclick="prevImage()" disabled="disabled"/>
<input id="nextImageBtn" type="button" value="&gt;" onclick="nextImage()" disabled="disabled"/>
<input id="nextThumbsBtn" type="button" value="&gt;&gt;" onclick="nextThumbs()" disabled="disabled"/>
<input id="nextEventBtn" type="button" value="E&gt;" onclick="nextEvent()" disabled="disabled"/>
<input id="prevEventBtn" type="button" value="&lt;E" data-on-click="prevEvent" disabled="disabled"/>
<input id="prevThumbsBtn" type="button" value="&lt;&lt;" data-on-click="prevThumbs" disabled="disabled"/>
<input id="prevImageBtn" type="button" value="&lt;" data-on-click="prevImage" disabled="disabled"/>
<input id="nextImageBtn" type="button" value="&gt;" data-on-click="nextImage" disabled="disabled"/>
<input id="nextThumbsBtn" type="button" value="&gt;&gt;" data-on-click="nextThumbs" disabled="disabled"/>
<input id="nextEventBtn" type="button" value="E&gt;" data-on-click="nextEvent" disabled="disabled"/>
</div>
</div>
</div>

View File

@ -108,7 +108,7 @@ if ( $mode == 'single' ) {
<button type="submit" value="Save" <?php echo !canEdit('Events') ? ' disabled="disabled"' : '' ?>>
<?php echo translate('Save') ?>
</button>
<button type="button" onclick="closeWindow()"><?php echo translate('Cancel') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>

View File

@ -169,29 +169,29 @@ while ( $event_row = dbFetchNext($results) ) {
<tbody>
<tr>
<th scope="row"><?php echo translate('ExportDetails') ?></th>
<td><input type="checkbox" name="exportDetail" value="1"<?php if ( !empty($_REQUEST['exportDetail']) ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/></td>
<td><input type="checkbox" name="exportDetail" value="1"<?php if ( !empty($_REQUEST['exportDetail']) ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ExportFrames') ?></th>
<td><input type="checkbox" name="exportFrames" value="1"<?php if ( !empty($_REQUEST['exportFrames']) ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/></td>
<td><input type="checkbox" name="exportFrames" value="1"<?php if ( !empty($_REQUEST['exportFrames']) ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ExportImageFiles') ?></th>
<td><input type="checkbox" name="exportImages" value="1"<?php if ( !empty($_REQUEST['exportImages']) ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/></td>
<td><input type="checkbox" name="exportImages" value="1"<?php if ( !empty($_REQUEST['exportImages']) ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ExportVideoFiles') ?></th>
<td><input type="checkbox" name="exportVideo" value="1"<?php if ( !empty($_REQUEST['exportVideo']) ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/></td>
<td><input type="checkbox" name="exportVideo" value="1"<?php if ( !empty($_REQUEST['exportVideo']) ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ExportMiscFiles') ?></th>
<td><input type="checkbox" name="exportMisc" value="1"<?php if ( !empty($_REQUEST['exportMisc']) ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/></td>
<td><input type="checkbox" name="exportMisc" value="1"<?php if ( !empty($_REQUEST['exportMisc']) ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/></td>
</tr>
<tr>
<th scope="row"><?php echo translate('ExportFormat') ?></th>
<td>
<input type="radio" id="exportFormatTar" name="exportFormat" value="tar"<?php if ( isset($_REQUEST['exportFormat']) && $_REQUEST['exportFormat'] == "tar" ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/><label for="exportFormatTar"><?php echo translate('ExportFormatTar') ?></label>
<input type="radio" id="exportFormatZip" name="exportFormat" value="zip"<?php if ( isset($_REQUEST['exportFormat']) && $_REQUEST['exportFormat'] == "zip" ) { ?> checked="checked"<?php } ?> onclick="configureExportButton( this )"/><label for="exportFormatZip"><?php echo translate('ExportFormatZip') ?></label>
<input type="radio" id="exportFormatTar" name="exportFormat" value="tar"<?php if ( isset($_REQUEST['exportFormat']) && $_REQUEST['exportFormat'] == "tar" ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/><label for="exportFormatTar"><?php echo translate('ExportFormatTar') ?></label>
<input type="radio" id="exportFormatZip" name="exportFormat" value="zip"<?php if ( isset($_REQUEST['exportFormat']) && $_REQUEST['exportFormat'] == "zip" ) { ?> checked="checked"<?php } ?> data-on-click-this="configureExportButton"/><label for="exportFormatZip"><?php echo translate('ExportFormatZip') ?></label>
</td>
</tr>
<tr>

View File

@ -36,7 +36,7 @@ foreach ( dbFetchAll('SELECT * FROM Filters ORDER BY Name') as $row ) {
$filterNames[$row['Id']] .= '&';
if ( isset($_REQUEST['Id']) && $_REQUEST['Id'] == $row['Id'] ) {
$filter = new Filter( $row );
$filter = new Filter($row);
}
}
if ( ! $filter ) {
@ -69,8 +69,8 @@ if (count($filter->terms()) > 0) {
if ( count($terms) ) {
for ( $i = 0; $i <= count($terms)-2; $i++ ) {
$obracketTypes[$i] = str_repeat( '(', $i );
$cbracketTypes[$i] = str_repeat( ')', $i );
$obracketTypes[$i] = str_repeat('(', $i);
$cbracketTypes[$i] = str_repeat(')', $i);
}
}
@ -130,28 +130,28 @@ $archiveTypes = array(
$focusWindow = true;
$storageareas = array( '' => 'All' );
$storageareas = array('' => 'All');
//$storageareas[0] = 'Default ' . ZM_DIR_EVENTS;
foreach ( dbFetchAll( 'SELECT Id,Name FROM Storage ORDER BY lower(Name) ASC' ) as $storage ) {
foreach ( dbFetchAll('SELECT Id,Name FROM Storage ORDER BY lower(Name) ASC') as $storage ) {
$storageareas[$storage['Id']] = $storage['Name'];
}
$weekdays = array();
for ( $i = 0; $i < 7; $i++ ) {
$weekdays[$i] = strftime( '%A', mktime( 12, 0, 0, 1, $i+1, 2001 ) );
$weekdays[$i] = strftime('%A', mktime(12, 0, 0, 1, $i+1, 2001));
}
$states = array();
foreach ( dbFetchAll( 'SELECT Id,Name FROM States ORDER BY lower(Name) ASC' ) as $state_row ) {
foreach ( dbFetchAll('SELECT Id,Name FROM States ORDER BY lower(Name) ASC') as $state_row ) {
$states[$state_row['Id']] = $state_row['Name'];
}
$servers = array();
$servers['ZM_SERVER_ID'] = 'Current Server';
$servers['NULL'] = 'No Server';
foreach ( dbFetchAll( 'SELECT Id,Name FROM Servers ORDER BY lower(Name) ASC' ) as $server ) {
foreach ( dbFetchAll('SELECT Id,Name FROM Servers ORDER BY lower(Name) ASC') as $server ) {
$servers[$server['Id']] = $server['Name'];
}
$monitors = array();
foreach ( dbFetchAll( 'select Id,Name from Monitors order by Name asc' ) as $monitor ) {
if ( visibleMonitor( $monitor['Id'] ) ) {
foreach ( dbFetchAll('SELECT Id,Name FROM Monitors ORDER BY Name ASC') as $monitor ) {
if ( visibleMonitor($monitor['Id']) ) {
$monitors[$monitor['Name']] = $monitor['Name'];
}
}
@ -168,7 +168,7 @@ xhtmlHeaders(__FILE__, translate('EventFilter') );
<div id="filterSelector"><label for="<?php echo 'Id' ?>"><?php echo translate('UseFilter') ?></label>
<?php
if ( count($filterNames) > 1 ) {
echo htmlSelect( 'Id', $filterNames, $filter->Id(), 'this.form.submit();' );
echo htmlSelect('Id', $filterNames, $filter->Id(), 'this.form.submit();');
} else {
?><select disabled="disabled"><option><?php echo translate('NoSavedFilters') ?></option></select>
<?php
@ -219,36 +219,36 @@ for ( $i=0; $i < count($terms); $i++ ) {
<?php
} else {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][cnj]", $conjunctionTypes, $term['cnj'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][cnj]", $conjunctionTypes, $term['cnj']); ?></td>
<?php
}
?>
<td><?php if ( count($terms) > 2 ) { echo htmlSelect( "filter[Query][terms][$i][obr]", $obracketTypes, $term['obr'] ); } else { ?>&nbsp;<?php } ?></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][attr]", $attrTypes, $term['attr'], "checkValue( this );" ); ?></td>
<td><?php if ( count($terms) > 2 ) { echo htmlSelect("filter[Query][terms][$i][obr]", $obracketTypes, $term['obr']); } else { ?>&nbsp;<?php } ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][attr]", $attrTypes, $term['attr'], 'checkValue(this);'); ?></td>
<?php
if ( isset($term['attr']) ) {
if ( $term['attr'] == 'Archived' ) {
?>
<td><?php echo translate('OpEq') ?><input type="hidden" name="filter[Query][terms][<?php echo $i ?>][op]" value="="/></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $archiveTypes, $term['val'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $archiveTypes, $term['val']); ?></td>
<?php
} elseif ( $term['attr'] == 'DateTime' || $term['attr'] == 'StartDateTime' || $term['attr'] == 'EndDateTime') {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false}); </script>
</td>
<?php
} elseif ( $term['attr'] == 'Date' || $term['attr'] == 'StartDate' || $term['attr'] == 'EndDate') {
} elseif ( $term['attr'] == 'Date' || $term['attr'] == 'StartDate' || $term['attr'] == 'EndDate' ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr($term['val']):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false}); </script>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});</script>
</td>
<?php
} elseif ( $term['attr'] == 'StartTime' || $term['attr'] == 'EndTime') {
} elseif ( $term['attr'] == 'StartTime' || $term['attr'] == 'EndTime' ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td>
@ -258,46 +258,46 @@ for ( $i=0; $i < count($terms); $i++ ) {
<?php
} elseif ( $term['attr'] == 'StateId' ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $states, $term['val'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $states, $term['val']); ?></td>
<?php
} elseif ( strpos($term['attr'], 'Weekday') !== false ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $weekdays, $term['val'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $weekdays, $term['val']); ?></td>
<?php
} elseif ( $term['attr'] == 'MonitorName' ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $monitors, $term['val'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $monitors, $term['val']); ?></td>
<?php
} elseif ( $term['attr'] == 'ServerId' || $term['attr'] == 'MonitorServerId' || $term['attr'] == 'StorageServerId' || $term['attr'] == 'FilterServerId' ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $servers, $term['val'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $servers, $term['val']); ?></td>
<?php
} elseif ( $term['attr'] == 'StorageId' ) {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect( "filter[Query][terms][$i][val]", $storageareas, $term['val'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][val]", $storageareas, $term['val']); ?></td>
<?php
} else {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo $term['val'] ?>"/></td>
<?php
}
} else {
?>
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td><?php echo htmlSelect("filter[Query][terms][$i][op]", $opTypes, $term['op']); ?></td>
<td><input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?$term['val']:'' ?>"/></td>
<?php
}
?>
<td><?php if ( count($terms) > 2 ) { echo htmlSelect( "filter[Query][terms][$i][cbr]", $cbracketTypes, $term['cbr'] ); } else { ?>&nbsp;<?php } ?></td>
<td><?php if ( count($terms) > 2 ) { echo htmlSelect("filter[Query][terms][$i][cbr]", $cbracketTypes, $term['cbr']); } else { ?>&nbsp;<?php } ?></td>
<td>
<input type="button" onclick="addTerm( this )" value="+"/>
<input type="button" onclick="delTerm( this )" value="-" <?php echo count($terms) == 1 ? 'disabled' : '' ?>/>
<input type="button" data-on-click-this="addTerm" value="+"/>
<input type="button" data-on-click-this="delTerm" value="-" <?php echo count($terms) == 1 ? 'disabled' : '' ?>/>
</td>
</tr>
<?php
@ -346,17 +346,17 @@ echo htmlSelect( 'filter[Query][sort_asc]', $sort_dirns, $filter->sort_asc() );
<div id="actionsTable" class="filterTable">
<p>
<label><?php echo translate('FilterArchiveEvents') ?></label>
<input type="checkbox" name="filter[AutoArchive]" value="1"<?php if ( $filter->AutoArchive() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
<input type="checkbox" name="filter[AutoArchive]" value="1"<?php if ( $filter->AutoArchive() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<p><label><?php echo translate('FilterUpdateDiskSpace') ?></label>
<input type="checkbox" name="filter[UpdateDiskSpace]" value="1"<?php echo !$filter->UpdateDiskSpace() ? '' : ' checked="checked"' ?> onclick="updateButtons(this);"/>
<input type="checkbox" name="filter[UpdateDiskSpace]" value="1"<?php echo !$filter->UpdateDiskSpace() ? '' : ' checked="checked"' ?> data-on-click-this="updateButtons"/>
</p>
<?php
if ( ZM_OPT_FFMPEG ) {
?>
<p>
<label><?php echo translate('FilterVideoEvents') ?></label>
<input type="checkbox" name="filter[AutoVideo]" value="1"<?php if ( $filter->AutoVideo() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
<input type="checkbox" name="filter[AutoVideo]" value="1"<?php if ( $filter->AutoVideo() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<?php
}
@ -364,7 +364,7 @@ if ( ZM_OPT_UPLOAD ) {
?>
<p>
<label><?php echo translate('FilterUploadEvents') ?></label>
<input type="checkbox" name="filter[AutoUpload]" value="1"<?php if ( $filter->AutoUpload() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
<input type="checkbox" name="filter[AutoUpload]" value="1"<?php if ( $filter->AutoUpload() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<?php
}
@ -372,7 +372,7 @@ if ( ZM_OPT_EMAIL ) {
?>
<p>
<label><?php echo translate('FilterEmailEvents') ?></label>
<input type="checkbox" name="filter[AutoEmail]" value="1"<?php if ( $filter->AutoEmail() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
<input type="checkbox" name="filter[AutoEmail]" value="1"<?php if ( $filter->AutoEmail() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<?php
}
@ -380,20 +380,19 @@ if ( ZM_OPT_MESSAGE ) {
?>
<p>
<label><?php echo translate('FilterMessageEvents') ?></label>
<input type="checkbox" name="filter[AutoMessage]" value="1"<?php if ( $filter->AutoMessage() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
<input type="checkbox" name="filter[AutoMessage]" value="1"<?php if ( $filter->AutoMessage() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<?php
}
?>
<p>
<label><?php echo translate('FilterExecuteEvents') ?></label>
<input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( $filter->AutoExecute() ) { ?> checked="checked"<?php } ?>/>
<input type="text" name="filter[AutoExecuteCmd]" value="<?php echo (null !==$filter->AutoExecuteCmd())?$filter->AutoExecuteCmd():'' ?>" maxlength="255" onchange="updateButtons( this )"/>
<input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( $filter->AutoExecute() ) { ?> checked="checked"<?php } ?>/>
<input type="text" name="filter[AutoExecuteCmd]" value="<?php echo (null !==$filter->AutoExecuteCmd())?$filter->AutoExecuteCmd():'' ?>" maxlength="255" data-on-change="updateButtons"/>
</p>
<p>
<label><?php echo translate('FilterDeleteEvents') ?></label>
<input type="checkbox" name="filter[AutoDelete]" value="1"<?php if ( $filter->AutoDelete() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this)"/>
<input type="checkbox" name="filter[AutoDelete]" value="1"<?php if ( $filter->AutoDelete() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<p><label><?php echo translate('FilterMoveEvents') ?></label>
<input type="checkbox" name="filter[AutoMove]" value="1"<?php if ( $filter->AutoMove() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);if(this.checked){$j(this.form.elements['filter[AutoMoveTo]']).css('display','inline');}else{this.form.elements['filter[AutoMoveTo]'].hide();};"/>
@ -401,23 +400,23 @@ if ( ZM_OPT_MESSAGE ) {
</p>
<p>
<label for="background"><?php echo translate('BackgroundFilter') ?></label>
<input type="checkbox" id="filter[Background]" name="filter[Background]" value="1"<?php if ( $filter->Background() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
<input type="checkbox" id="filter[Background]" name="filter[Background]" value="1"<?php if ( $filter->Background() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
<p>
<label for="Concurrent"><?php echo translate('ConcurrentFilter') ?></label>
<input type="checkbox" id="filter[Concurrent]" name="filter[Concurrent]" value="1"<?php if ( $filter->Concurrent() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
<input type="checkbox" id="filter[Concurrent]" name="filter[Concurrent]" value="1"<?php if ( $filter->Concurrent() ) { ?> checked="checked"<?php } ?> data-on-click-this="updateButtons"/>
</p>
</div>
<hr/>
<div id="contentButtons">
<button type="submit" onclick="submitToEvents(this);"><?php echo translate('ListMatches') ?></button>
<button type="button" onclick="submitToExport(this);"><?php echo translate('ExportMatches') ?></button>
<button type="submit" name="executeButton" id="executeButton" onclick="executeFilter(this);"><?php echo translate('Execute') ?></button>
<button type="submit" data-on-click-this="submitToEvents"><?php echo translate('ListMatches') ?></button>
<button type="button" data-on-click-this="submitToExport"><?php echo translate('ExportMatches') ?></button>
<button type="submit" name="executeButton" id="executeButton" data-on-click-this="executeFilter"><?php echo translate('Execute') ?></button>
<?php
if ( canEdit('Events') ) {
?>
<button type="submit" name="Save" value="Save" onclick="saveFilter(this);"><?php echo translate('Save') ?></button>
<button type="submit" name="SaveAs" value="SaveAs" onclick="saveFilter(this);"><?php echo translate('SaveAs') ?></button>
<button type="submit" name="Save" value="Save" data-on-click-this="saveFilter"><?php echo translate('Save') ?></button>
<button type="submit" name="SaveAs" value="SaveAs" data-on-click-this="saveFilter"><?php echo translate('SaveAs') ?></button>
<?php
if ( $filter->Id() ) {
?>
@ -426,7 +425,7 @@ if ( canEdit('Events') ) {
}
}
?>
<button type="button" value="Reset" onclick="resetFilter(this);"><?php echo translate('Reset') ?></button>
<button type="button" value="Reset" data-on-click-this="resetFilter"><?php echo translate('Reset') ?></button>
</div>
</form>
</div><!--content-->

View File

@ -35,7 +35,7 @@ xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id() );
<body>
<div id="page">
<div id="header">
<div id="headerButtons"><a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a></div>
<div id="headerButtons"><a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a></div>
<h2><?php echo translate('Frames') ?> - <?php echo $Event->Id() ?></h2>
</div>
<div id="content">

View File

@ -18,42 +18,43 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canEdit( 'Monitors' ) ) {
if ( !canEdit('Monitors') ) {
$view = 'error';
return;
}
$monitor = dbFetchMonitor( $_REQUEST['mid'] );
$monitor = dbFetchMonitor($_REQUEST['mid']);
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Function')." - ".validHtmlStr($monitor['Name']) );
xhtmlHeaders(__FILE__, translate('Function').' - '.validHtmlStr($monitor['Name']));
?>
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('Function')." - ".validHtmlStr($monitor['Name']) ?></h2>
<h2><?php echo translate('Function').' - '.validHtmlStr($monitor['Name']) ?></h2>
</div>
<div id="content">
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="none"/>
<input type="hidden" name="view" value="function"/>
<input type="hidden" name="action" value="function"/>
<input type="hidden" name="mid" value="<?php echo $monitor['Id'] ?>"/>
<p>
<select name="newFunction">
<?php
foreach ( getEnumValues( 'Monitors', 'Function' ) as $optFunction ) {
foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) {
?>
<option value="<?php echo $optFunction ?>"<?php if ( $optFunction == $monitor['Function'] ) { ?> selected="selected"<?php } ?>><?php echo translate('Fn'.$optFunction) ?></option>
<?php
}
?>
</select>
<label for="newEnabled"><?php echo translate('Enabled') ?></label><input type="checkbox" name="newEnabled" id="newEnabled" value="1"<?php if ( !empty($monitor['Enabled']) ) { ?> checked="checked"<?php } ?>/>
<label for="newEnabled"><?php echo translate('Enabled') ?></label>
<input type="checkbox" name="newEnabled" id="newEnabled" value="1"<?php if ( !empty($monitor['Enabled']) ) { ?> checked="checked"<?php } ?>/>
</p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>

View File

@ -121,7 +121,7 @@ echo htmlSelect('newGroup[ParentId]', $options, $newGroup->ParentId(), array('on
<button type="submit" name="action" value="Save"<?php $newGroup->Id() ? '' : ' disabled="disabled"'?>>
<?php echo translate('Save') ?>
</button>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -72,7 +72,7 @@ function group_line( $Group ) {
$html .= validHtmlStr($Group->Name());
}
$html .= '</td><td class="colIds">'. monitorIdsToNames($Group->MonitorIds(), 30).'</td>
<td class="colSelect"><input type="checkbox" name="gid[]" value="'. $Group->Id() .'" onclick="configureButtons(this);"/></td>
<td class="colSelect"><input type="checkbox" name="gid[]" value="'. $Group->Id() .'" data-on-click-this="configureButtons"/></td>
</tr>
';
if ( isset( $children[$Group->Id()] ) ) {
@ -89,10 +89,10 @@ if ( isset( $children[null] ) )
</tbody>
</table>
<div id="contentButtons">
<button type="button" value="New" onclick="newGroup();"<?php echo canEdit('Groups')?'':' disabled="disabled"' ?>>
<button type="button" value="New" data-on-click="newGroup"<?php echo canEdit('Groups')?'':' disabled="disabled"' ?>>
<?php echo translate('New') ?>
</button>
<button type="button" name="deleteBtn" value="Delete" onclick="deleteGroup(this);" disabled="disabled">
<button type="button" name="deleteBtn" value="Delete" data-on-click-this="deleteGroup" disabled="disabled">
<?php echo translate('Delete') ?>
</button>
</div>

View File

@ -24,7 +24,8 @@ function validateForm ( form ) {
return true;
}
function updateButtons( element ) {
function updateButtons() {
var element = this;
var form = element.form;
if ( element.type == 'checkbox' && element.checked ) {

View File

@ -53,6 +53,10 @@ function getFrame( monId, time ) {
continue;
var duration = Event.EndTimeSecs - Event.StartTimeSecs;
if ( ! Event.FramesById ) {
console.log("No FramesById for event " + event_id);
return;
}
var frame = parseInt((time - Event.StartTimeSecs)/(duration)*Object.keys(Event.FramesById).length)+1;
// Need to get frame by time, not some fun calc that assumes frames have the same mlength.
// Frames are not sorted.
@ -119,7 +123,7 @@ function getImageSource( monId, time ) {
var storage = Storage[Event.StorageId];
// monitorServerId may be 0, which gives us the default Server entry
var server = storage.ServerId ? Servers[storage.ServerId] : Servers[monitorServerId[monId]];
return server.PathToIndex() +
return server.PathToIndex +
'?view=image&eid=' + Frame.EventId + '&fid='+Frame.FrameId +
"&width=" + monitorCanvasObj[monId].width +
"&height=" + monitorCanvasObj[monId].height;

View File

@ -127,7 +127,7 @@ echo "\nvar Servers = [];\n";
$Server = new Server();
echo 'Servers[0] = new Server(' . json_encode($Server). ");\n";
foreach ( Server::find() as $Server ) {
echo 'Servers[' . $Server->Id() . '] = new Server(' . json_encode($Server). ");\n";
echo 'Servers[' . $Server->Id() . '] = new Server(' . $Server->to_json(). ");\n";
}

View File

@ -45,11 +45,11 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
<tr class="row">
<td class="col text-center">
<div class="btn-group">
<button type="button" onclick="expandLog()"><?php echo translate('More') ?></button>
<button type="button" onclick="clearLog()"><?php echo translate('Clear') ?></button>
<button type="button" onclick="refreshLog()"><?php echo translate('Refresh') ?></button>
<button type="button" onclick="exportLog()"><?php echo translate('Export') ?></button>
<button type="button" onclick="closeWindow()"><?php echo translate('Close') ?></button>
<button type="button" data-on-click="expandLog"><?php echo translate('More') ?></button>
<button type="button" data-on-click="clearLog"><?php echo translate('Clear') ?></button>
<button type="button" data-on-click="refreshLog"><?php echo translate('Refresh') ?></button>
<button type="button" data-on-click="exportLog"><?php echo translate('Export') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Close') ?></button>
</div> <!--btn-->
</td>
</tr>
@ -62,33 +62,33 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
<tr class="row">
<td class="col">
<?php echo translate('Component') ?>
<select class="form-control chosen" id="filter[Component]" onchange="filterLog(this)"><option value="">-----</option></select>
<select class="form-control chosen" id="filter[Component]" data-on-change="filterLog"><option value="">-----</option></select>
</td>
<td class="col">
<?php echo translate('Server') ?>
<select class="form-control chosen" id="filter[ServerId]" onchange="filterLog(this)"><option value="">-----</option></select>
<select class="form-control chosen" id="filter[ServerId]" data-on-change="filterLog"><option value="">-----</option></select>
</td>
<td class="col">
<?php echo translate('Pid') ?>
<select class="form-control chosen" id="filter[Pid]" onchange="filterLog(this)"><option value="">-----</option></select>
<select class="form-control chosen" id="filter[Pid]" data-on-change="filterLog"><option value="">-----</option></select>
</td>
</tr>
<tr class="row">
<td class="col">
<?php echo translate('Level') ?>
<select class="form-control chosen" id="filter[Level]" onchange="filterLog(this)"><option value="">---</option></select>
<select class="form-control chosen" id="filter[Level]" data-on-change="filterLog"><option value="">---</option></select>
</td>
<td class="col">
<?php echo translate('File') ?>
<select class="form-control chosen" id="filter[File]" onchange="filterLog(this)"><option value="">------</option></select>
<select class="form-control chosen" id="filter[File]" data-on-change="filterLog"><option value="">------</option></select>
</td>
<td class="col">
<?php echo translate('Line') ?>
<select class="form-control chosen" id="filter[Line]" onchange="filterLog(this)"><option value="">----</option></select>
<select class="form-control chosen" id="filter[Line]" data-on-change="filterLog"><option value="">----</option></select>
</td>
</tr>
</table>
<button type="reset" onclick="resetLog()"><?php echo translate('Reset') ?></button>
<button type="reset" data-on-click="resetLog"><?php echo translate('Reset') ?></button>
</div>
<form name="logForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
@ -136,7 +136,7 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
<div id="exportError">
<?php echo translate('ExportFailed') ?>: <span id="exportErrorText"></span>
</div>
<button type="button" id="exportButton" value="Export" onclick="exportRequest()"><?php echo translate('Export') ?></button>
<button type="button" id="exportButton" value="Export" data-on-click="exportRequest"><?php echo translate('Export') ?></button>
<button type="button" value="Cancel" class="overlayCloser"><?php echo translate('Cancel') ?></button>
</form>
</div>

View File

@ -30,18 +30,16 @@ xhtmlHeaders(__FILE__, translate('Logout') );
<div id="content">
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="logout"/>
<input type="hidden" name="view" value="login"/>
<input type="hidden" name="view" value="logout"/>
<p><?php echo sprintf( $CLANG['CurrentLogin'], $user['Username'] ) ?></p>
<p>
<input type="submit" value="<?php echo translate('Logout') ?>"/>
<?php
if ( ZM_USER_SELF_EDIT ) {
?>
<input type="button" value="<?php echo translate('Config') ?>" onclick="createPopup( '?view=user&amp;uid=<?php echo $user['Id'] ?>', 'zmUser', 'user' );"/>
<?php
echo makePopupButton('?view=user&uid=' . $user['Id'], 'zmUser', 'user', translate('Config'));
}
?>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</p>
</form>
</div>

View File

@ -468,15 +468,13 @@ if ( canEdit( 'Monitors' ) ) {
}
?>
<div id="headerButtons">
<a href="#" onclick="createPopup( '?view=monitorprobe&amp;mid=<?php echo $monitor->Id()?>', 'zmMonitorProbe<?php echo $monitor->Id()?>', 'monitorprobe' ); return( false );"><?php echo translate('Probe') ?></a>
<?php echo makePopupLink('?view=monitorprobe&mid=' . $monitor->Id(), 'zmMonitorProbe' . $monitor->Id(), 'monitorprobe', translate('Probe')); ?>
<?php
if ( ZM_HAS_ONVIF ) {
?>
<a href="#" onclick="createPopup( '?view=onvifprobe&amp;mid=<?php echo $monitor->Id()?>', 'zmOnvifProbe<?php echo $monitor->Id()?>', 'onvifprobe' ); return( false );"><?php echo translate('OnvifProbe') ?></a>
<?php
echo makePopupLink('?view=onvifprobe&mid=' . $monitor->Id(), 'zmOnvifProbe' . $monitor->Id(), 'onvifprobe', translate('OnvifProbe'));
}
?>
<a href="#" onclick="createPopup( '?view=monitorpreset&amp;mid=<?php echo $monitor->Id()?>', 'zmMonitorPreset<?php echo $monitor->Id()?>', 'monitorpreset' ); return( false );"><?php echo translate('Presets') ?></a>
<?php echo makePopupLink('?view=monitorpreset&mid=' . $monitor->Id(), 'zmMonitorPreset' . $monitor->Id(), 'monitorpreset', translate('Presets')); ?>
</div>
<?php
} // end if canEdit('Monitors')
@ -879,9 +877,12 @@ include('_monitor_source_nvsocket.php');
<?php
} elseif ( $monitor->Type() == 'Ffmpeg' || $monitor->Type() == 'Libvlc' ) {
?>
<tr><td><?php echo translate('SourcePath') ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>" size="36"/></td></tr>
<tr class="SourcePath"><td><?php echo translate('SourcePath') ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>" /></td></tr>
<tr><td><?php echo translate('RemoteMethod') ?>&nbsp;(<?php echo makePopupLink('?view=optionhelp&amp;option=OPTIONS_RTSPTrans', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><?php echo htmlSelect( "newMonitor[Method]", $rtspFFMpegMethods, $monitor->Method() ); ?></td></tr>
<tr><td><?php echo translate('Options') ?>&nbsp;(<?php echo makePopupLink( '?view=optionhelp&amp;option=OPTIONS_'.strtoupper($monitor->Type()), 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" name="newMonitor[Options]" value="<?php echo validHtmlStr($monitor->Options()) ?>" size="36"/></td></tr>
<tr class="SourceOptions">
<td><?php echo translate('Options') ?>&nbsp;(<?php echo makePopupLink( '?view=optionhelp&amp;option=OPTIONS_'.strtoupper($monitor->Type()), 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td>
<td><input type="text" name="newMonitor[Options]" value="<?php echo validHtmlStr($monitor->Options()) ?>"/></td>
</tr>
<?php
}
if ( $monitor->Type() != 'NVSocket' && $monitor->Type() != 'WebSite' ) {
@ -972,7 +973,7 @@ if ( $monitor->Type() == 'Local' ) {
{
?>
<tr><td><?php echo translate('Controllable') ?></td><td><input type="checkbox" name="newMonitor[Controllable]" value="1"<?php if ( $monitor->Controllable() ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><td><?php echo translate('ControlType') ?></td><td><?php echo buildSelect( "newMonitor[ControlId]", $controlTypes, 'loadLocations( this )' ); ?><?php if ( canEdit( 'Control' ) ) { ?>&nbsp;<a href="#" onclick="createPopup( '?view=controlcaps', 'zmControlCaps', 'controlcaps' );"><?php echo translate('Edit') ?></a><?php } ?></td></tr>
<tr><td><?php echo translate('ControlType') ?></td><td><?php echo buildSelect( "newMonitor[ControlId]", $controlTypes, 'loadLocations( this )' ); ?><?php if ( canEdit( 'Control' ) ) { ?>&nbsp;<?php echo makePopupLink('?view=controlcaps', 'zmControlCaps', 'controlcaps', translate('Edit')); ?></a><?php } ?></td></tr>
<tr><td><?php echo translate('ControlDevice') ?></td><td><input type="text" name="newMonitor[ControlDevice]" value="<?php echo validHtmlStr($monitor->ControlDevice()) ?>" size="32"/></td></tr>
<tr><td><?php echo translate('ControlAddress') ?></td><td><input type="text" name="newMonitor[ControlAddress]" value="<?php echo validHtmlStr($monitor->ControlAddress()) ?>" size="32"/></td></tr>
<tr><td><?php echo translate('AutoStopTimeout') ?></td><td><input type="text" name="newMonitor[AutoStopTimeout]" value="<?php echo validHtmlStr($monitor->AutoStopTimeout()) ?>" size="4"/></td></tr>
@ -1043,7 +1044,7 @@ if ( $monitor->Type() == 'Local' ) {
</table>
<div id="contentButtons">
<button type="submit" value="Save"<?php echo canEdit('Monitors') ? '' : ' disabled="disabled"' ?>><?php echo translate('Save') ?></button>
<button onclick="closeWindow()"><?php echo translate('Cancel') ?></button>
<button data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>

View File

@ -51,7 +51,8 @@ xhtmlHeaders(__FILE__, translate('MonitorPreset') );
<label for="preset"><?php echo translate('Preset') ?></label><?php echo buildSelect( "preset", $presets, 'configureButtons( this )' ); ?>
</p>
<div id="contentButtons">
<input type="submit" name="saveBtn" value="<?php echo translate('Save') ?>" onclick="submitPreset( this )" disabled="disabled"/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" name="saveBtn" value="<?php echo translate('Save') ?>" data-on-click-this="submitPreset" disabled="disabled"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -333,9 +333,9 @@ xhtmlHeaders(__FILE__, translate('MonitorProbe') );
<?php echo buildSelect('probe', $cameras, 'configureButtons(this)'); ?>
</p>
<div id="contentButtons">
<button type="button" name="saveBtn" value="Save" onclick="submitCamera(this);" disabled="disabled">
<button type="button" name="saveBtn" value="Save" data-on-click-this="submitCamera" disabled="disabled">
<?php echo translate('Save') ?></button>
<button type="button" onclick="closeWindow();"><?php echo translate('Cancel') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>

View File

@ -88,7 +88,7 @@ The following monitors will have these settings update when you click Save:<br/>
</p>
<div id="contentButtons">
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" onclick="closeWindow()"><?php echo translate('Cancel') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>

View File

@ -140,9 +140,7 @@ xhtmlHeaders(__FILE__, translate('Montage'));
<div id="headerButtons">
<?php
if ( $showControl ) {
?>
<a href="#" onclick="createPopup('?view=control', 'zmControl', 'control')"><?php echo translate('Control') ?></a>
<?php
echo makePopupLink('?view=control', 'zmControl', 'control', translate('Control'));
}
if ( $showZones ) {
?>
@ -181,11 +179,11 @@ if ( $showZones ) {
<?php echo htmlSelect('zmMontageLayout', $layoutsById, $layout_id, array('onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout')); ?>
</span>
<input type="hidden" name="Positions"/>
<input type="button" id="EditLayout" value="<?php echo translate('EditLayout') ?>" onclick="edit_layout(this);"/>
<input type="button" id="EditLayout" value="<?php echo translate('EditLayout') ?>" data-on-click-this="edit_layout"/>
<span id="SaveLayout" style="display:none;">
<input type="text" name="Name" placeholder="Enter new name for layout if desired" />
<input type="button" value="<?php echo translate('Save') ?>" onclick="save_layout(this);"/>
<input type="button" value="Cancel" onclick="cancel_layout(this);"/>
<input type="button" value="<?php echo translate('Save') ?>" data-on-click-this="save_layout"/>
<input type="button" value="Cancel" data-on-click-this="cancel_layout"/>
</span>
</form>
</div>
@ -201,9 +199,13 @@ foreach ( $monitors as $monitor ) {
<div id="monitor<?php echo $monitor->Id() ?>" class="monitor idle">
<div
id="imageFeed<?php echo $monitor->Id() ?>"
class="imageFeed"
onclick="createPopup('?view=watch&amp;mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );">
<?php
class="imageFeed popup-link"
data-url="?view=watch&amp;mid=<?php echo $monitor->Id() ?>"
data-name="zmWatch<?php echo $monitor->Id() ?>"
data-tag="watch"
data-width="<?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>"
data-height="<?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?>">
<?php
$monitor_options = $options;
if (0 and $Positions ) {
$monitor_options['width'] = '100%';

View File

@ -255,19 +255,19 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
</div>
<div id="ButtonsDiv">
<button type="button" id="panleft" onclick="click_panleft();" >&lt; <?php echo translate('Pan') ?></button>
<button type="button" id="zoomin" onclick="click_zoomin();" ><?php echo translate('In +') ?></button>
<button type="button" id="zoomout" onclick="click_zoomout();" ><?php echo translate('Out -') ?></button>
<button type="button" id="lasteight" onclick="click_lastEight();" ><?php echo translate('8 Hour') ?></button>
<button type="button" id="lasthour" onclick="click_lastHour();" ><?php echo translate('1 Hour') ?></button>
<button type="button" id="allof" onclick="click_all_events();" ><?php echo translate('All Events') ?></button>
<button type="button" id="panleft" data-on-click="click_panleft" >&lt; <?php echo translate('Pan') ?></button>
<button type="button" id="zoomin" data-on-click="click_zoomin" ><?php echo translate('In +') ?></button>
<button type="button" id="zoomout" data-on-click="click_zoomout" ><?php echo translate('Out -') ?></button>
<button type="button" id="lasteight" data-on-click="click_lastEight" ><?php echo translate('8 Hour') ?></button>
<button type="button" id="lasthour" data-on-click="click_lastHour" ><?php echo translate('1 Hour') ?></button>
<button type="button" id="allof" data-on-click="click_all_events" ><?php echo translate('All Events') ?></button>
<button type="button" id="liveButton" onclick="setLive(1-liveMode); console.log('live');return false;"><?php echo translate('Live') ?></button>
<button type="button" id="fit" onclick="setFit(1-fitMode);" ><?php echo translate('Fit') ?></button>
<button type="button" id="panright" onclick="click_panright();" ><?php echo translate('Pan') ?> &gt;</button>
<button type="button" id="panright" data-on-click="click_panright" ><?php echo translate('Pan') ?> &gt;</button>
<?php
if ( (!$liveMode) and (count($displayMonitors) != 0) ) {
?>
<button type="button" id="downloadVideo" onclick="click_download();"><?php echo translate('Download Video') ?></button>
<button type="button" id="downloadVideo" data-on-click="click_download"><?php echo translate('Download Video') ?></button>
<?php
}
?>

View File

@ -193,8 +193,8 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
<input type="password" name="password" value=""onChange="configureButtons(this)"/>
</p>
<div id="contentButtons">
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" name="nextBtn" value="<?php echo translate('Next') ?>" onclick="gotoStep2(this)" disabled="disabled"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
<input type="submit" name="nextBtn" value="<?php echo translate('Next') ?>" data-on-click-this="gotoStep2" disabled="disabled"/>
</div>
</form>
</div>
@ -260,9 +260,9 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
<?php echo htmlSelect('probe', $profiles, null, array('onchange'=>'configureButtons(this)')); ?>
</p>
<div id="contentButtons">
<input type="button" name="prevBtn" value="<?php echo translate('Prev') ?>" onclick="gotoStep1(this)"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" name="saveBtn" value="<?php echo translate('Save') ?>" onclick="submitCamera(this)" disabled="disabled"/>
<input type="button" name="prevBtn" value="<?php echo translate('Prev') ?>" data-on-click-this="gotoStep1"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
<input type="submit" name="saveBtn" value="<?php echo translate('Save') ?>" data-on-click-this="submitCamera" disabled="disabled"/>
</div>
</form>
</div>

View File

@ -19,7 +19,11 @@
//
$optionHelpIndex = preg_replace( '/^ZM_/', '', $_REQUEST['option'] );
$optionHelpText = !empty($OLANG[$optionHelpIndex])?$OLANG[$optionHelpIndex]['Help']:$config[$_REQUEST['option']]['Help'];
if ( !empty($OLANG[$optionHelpIndex]) ) {
$optionHelpText = $OLANG[$optionHelpIndex]['Help'];
} else {
$optionHelpText = dbFetchOne('SELECT Help FROM Config WHERE Name=?', 'Help', array($_REQUEST['option']) );
}
$optionHelpText = validHtmlStr($optionHelpText);
$optionHelpText = preg_replace( "/~~/", "<br/>", $optionHelpText );
$optionHelpText = preg_replace( "/\[(.+)\]\((.+)\)/", "<a href=\"$2\" target=\"_blank\">$1</a>", $optionHelpText );
@ -32,7 +36,7 @@ xhtmlHeaders(__FILE__, translate('OptionHelp') );
<div id="page">
<div id="header">
<div id="headerButtons">
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('OptionHelp') ?></h2>
</div>

View File

@ -70,7 +70,7 @@ if ( $tab == 'skins' ) {
$reload = true;
}
if ( $reload )
echo "<script type=\"text/javascript\">if(window.opener){window.opener.location.reload();}window.location.href=\"{$_SERVER['PHP_SELF']}?view={$view}&tab={$tab}\"</script>";
echo "<script nonce=\"$cspNonce\">if(window.opener){window.opener.location.reload();}window.location.href=\"{$_SERVER['PHP_SELF']}?view={$view}&tab={$tab}\"</script>";
} # end if tab == skins
?>
@ -185,7 +185,7 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
<td class="colSystem"><?php echo validHtmlStr($row['System']) ?></td>
<td class="colBandwidth"><?php echo $row['MaxBandwidth']?$bandwidth_options[$row['MaxBandwidth']]:'&nbsp;' ?></td>
<td class="colMonitor"><?php echo $row['MonitorIds']?(join( ", ", $userMonitors )):"&nbsp;" ?></td>
<td class="colMark"><input type="checkbox" name="markUids[]" value="<?php echo $row['Id'] ?>" onclick="configureDeleteButton( this );"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
<td class="colMark"><input type="checkbox" name="markUids[]" value="<?php echo $row['Id'] ?>" data-on-click-this="configureDeleteButton"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
</tr>
<?php
}
@ -193,7 +193,7 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
</tbody>
</table>
<div id="contentButtons">
<button type="button" value="Add New User" onclick="createPopup('?view=user&amp;uid=0', 'zmUser', 'user');"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>><?php echo translate('AddNewUser') ?></button>
<?php echo makePopupButton('?view=user&uid=0', 'zmUser', 'user', translate("AddNewUser"), canEdit('System')); ?>
<button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div>
</form>
@ -252,13 +252,13 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
<td class="colAudit"><?php echo makePopupLink('?view=server&amp;id='.$Server->Id(), 'zmServer', 'server', $Server->zmaudit() ? 'yes' : 'no', $canEdit) ?></td>
<td class="colTrigger"><?php echo makePopupLink('?view=server&amp;id='.$Server->Id(), 'zmServer', 'server', $Server->zmtrigger() ? 'yes' : 'no', $canEdit) ?></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Server->Id() ?>" onclick="configureDeleteButton(this);"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Server->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
</tr>
<?php } #end foreach Server ?>
</tbody>
</table>
<div id="contentButtons">
<button type="button" value="Add New Server" onclick="createPopup('?view=server&amp;id=0','zmServer','server');"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>><?php echo translate('AddNewServer') ?></button>
<?php echo makePopupButton('?view=server&id=0', 'zmServer', 'server', translate('AddNewServer'), canEdit('System')); ?>
<button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div>
</form>
@ -293,13 +293,13 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
<td class="colServer"><?php
echo makePopupLink('?view=storage&amp;id='.$Storage->Id(), 'zmStorage', 'storage', validHtmlStr($Storage->Name()), $canEdit ) ?></td>
<td class="colDiskSpace"><?php echo human_filesize($Storage->disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space()) ?></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" onclick="configureDeleteButton(this);"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( !$canEdit ) { ?> disabled="disabled"<?php } ?>/></td>
</tr>
<?php } #end foreach Server ?>
</tbody>
</table>
<div id="contentButtons">
<button type="button" value="Add New Storage" onclick="createPopup('?view=storage&amp;id=0','zmStorage','storage');"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>><?php echo translate('AddNewStorage') ?></button>
<?php echo makePopupButton('?view=storage&id=0', 'zmStorage', 'storage', translate('AddNewStorage'), canEdit('System')); ?>
<button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div>
</form>

View File

@ -158,7 +158,8 @@ foreach($pluginOptions as $name => $popt)
?>
</tbody>
</table>
<input type="submit" id="submitBtn" name="submitBtn" value="<?php echo translate('Save') ?>" onclick="return saveChanges( this )"<?php if (!canEdit( 'Monitors' ) || (false && $selfIntersecting)) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" id="submitBtn" name="submitBtn" value="<?php echo translate('Save') ?>" onclick="return saveChanges( this )"<?php if (!canEdit( 'Monitors' ) || (false && $selfIntersecting)) { ?> disabled="disabled"<?php } ?>/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -65,7 +65,7 @@ xhtmlHeaders(__FILE__, translate('Privacy') );
<p><?php echo buildSelect( "option", $options ); ?></p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Apply') ?>" onclick="submitForm( this )">
<input type="submit" value="<?php echo translate('Apply') ?>" data-on-click-this="submitForm">
</div>
</form>
</div>

View File

@ -99,7 +99,7 @@ xhtmlHeaders(__FILE__, translate('Server').' - '.$Server->Name());
<div id="contentButtons">
<input type="hidden" name="action" value="Save"/>
<input type="submit" value="<?php echo translate('Save') ?>"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
<input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -69,7 +69,7 @@ xhtmlHeaders(__FILE__, validHtmlStr($monitor['Name'])." - ".translate('Settings'
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canView( 'Control' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Close') ?>" onclick="closeWindow()"/>
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canView( 'Control' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Close') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -104,7 +104,7 @@ xhtmlHeaders(__FILE__, translate('Storage')." - ".$newStorage['Name'] );
</table>
<div id="contentButtons">
<button name="action" type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" onclick="closeWindow();"><?php echo translate('Cancel') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>

View File

@ -153,7 +153,7 @@ if ( canEdit( 'System' ) )
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div>
</form>
</div>

View File

@ -55,7 +55,7 @@ if ( ZM_DYN_DB_VERSION && (ZM_DYN_DB_VERSION != ZM_VERSION) )
<p class="errorText"><?php echo sprintf( $CLANG['VersionMismatch'], ZM_VERSION, ZM_DYN_DB_VERSION ) ?></p>
<p><?php echo translate('RunLocalUpdate') ?></p>
<div id="contentButtons">
<input type="button" value="<?php echo translate('Close') ?>" onclick="closeWindow()"/>
<input type="button" value="<?php echo translate('Close') ?>" data-on-click="closeWindow"/>
</div>
<?php
}
@ -64,9 +64,9 @@ elseif ( verNum( ZM_DYN_LAST_VERSION ) <= verNum( ZM_VERSION ) )
?>
<p><?php echo sprintf( $CLANG['RunningRecentVer'], ZM_VERSION ) ?></p>
<p><?php echo translate('UpdateNotNecessary') ?></p>
<p><input type="button" value="<?php echo translate('GoToZoneMinder') ?>" onclick="zmWindow()"/></p>
<p><input type="button" value="<?php echo translate('GoToZoneMinder') ?>" data-on-click="zmWindow"/></p>
<div id="contentButtons">
<input type="button" value="<?php echo translate('Close') ?>" onclick="closeWindow()"/>
<input type="button" value="<?php echo translate('Close') ?>" data-on-click="closeWindow"/>
</div>
<?php
}
@ -80,8 +80,8 @@ else
<p><?php echo sprintf( $CLANG['LatestRelease'], ZM_DYN_LAST_VERSION, ZM_VERSION ) ?></p>
<p><?php echo buildSelect( "option", $options ); ?></p>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Apply') ?>" onclick="submitForm( this )"/>
<input type="button" value="<?php echo translate('Close') ?>" onclick="closeWindow()"/>
<input type="submit" value="<?php echo translate('Apply') ?>" data-on-click-this="submitForm"/>
<input type="button" value="<?php echo translate('Close') ?>" data-on-click="closeWindow"/>
</div>
</form>
<?php

View File

@ -106,7 +106,7 @@ xhtmlHeaders(__FILE__, translate('Video'));
<div id="page">
<div id="header">
<div id="headerButtons">
<a href="#" onclick="closeWindow()"><?php echo translate('Close') ?></a>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('Video') ?></h2>
</div>

View File

@ -93,8 +93,8 @@ if ( canView('Control') && $monitor->Type() == 'Local' ) {
if ( canEdit('Monitors') ) {
?>
<div id="forceCancelAlarm">
<a id="forceAlarmLink" href="#" onclick="cmdForceAlarm();"><?php echo translate('ForceAlarm') ?></a>
<a id="cancelAlarmLink" href="#" onclick="cmdCancelForcedAlarm();" class="hidden"><?php echo translate('CancelForcedAlarm') ?></a>
<a id="forceAlarmLink" href="#" data-on-click="cmdForceAlarm"><?php echo translate('ForceAlarm') ?></a>
<a id="cancelAlarmLink" href="#" data-on-click="cmdCancelForcedAlarm" class="hidden"><?php echo translate('CancelForcedAlarm') ?></a>
</div>
<?php
}
@ -106,23 +106,23 @@ if ( canEdit('Monitors') ) {
if ( $streamMode == 'jpeg' ) {
if ( $monitor->StreamReplayBuffer() != 0 ) {
?>
<input type="button" value="&lt;&lt;" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="unavail" disabled="disabled" onclick="streamCmdFastRev(true)"/>
<input type="button" value="&lt;" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowRev(true)"/>
<input type="button" value="&lt;&lt;" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="unavail" disabled="disabled" data-on-click-true="streamCmdFastRev"/>
<input type="button" value="&lt;" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" data-on-click-true="streamCmdSlowRev"/>
<?php
}
?>
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" onclick="streamCmdPause(true)"/>
<input type="button" value="[]" id="stopBtn" title="<?php echo translate('Stop') ?>" class="unavail" disabled="disabled" onclick="streamCmdStop(true)"/>
<input type="button" value="|&gt;" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" onclick="streamCmdPlay(true)"/>
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" data-on-click-true="streamCmdPause"/>
<input type="button" value="[]" id="stopBtn" title="<?php echo translate('Stop') ?>" class="unavail" disabled="disabled" data-on-click-true="streamCmdStop"/>
<input type="button" value="|&gt;" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" data-on-click-true="streamCmdPlay"/>
<?php
if ( $monitor->StreamReplayBuffer() != 0 ) {
?>
<input type="button" value="&gt;" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowFwd(true)"/>
<input type="button" value="&gt;&gt;" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="unavail" disabled="disabled" onclick="streamCmdFastFwd(true)"/>
<input type="button" value="&gt;" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" data-on-click-true="streamCmdSlowFwd"/>
<input type="button" value="&gt;&gt;" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="unavail" disabled="disabled" data-on-click-true="streamCmdFastFwd"/>
<?php
}
?>
<input type="button" value="&ndash;" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="avail" onclick="streamCmdZoomOut()"/>
<input type="button" value="&ndash;" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="avail" data-on-click="streamCmdZoomOut"/>
<?php
} // end if streamMode==jpeg
?>

View File

@ -267,7 +267,7 @@ for ( $i = 0; $i < $pointCols; $i++ ) {
</tr>
</tbody>
</table>
<input id="pauseBtn" type="button" value="<?php echo translate('Pause') ?>" onclick="streamCmdPauseToggle()"/>
<input id="pauseBtn" type="button" value="<?php echo translate('Pause') ?>" data-on-click="streamCmdPauseToggle"/>
<input type="submit" id="submitBtn" name="submitBtn" value="<?php echo translate('Save') ?>" onclick="return saveChanges( this )"<?php if (!canEdit( 'Monitors' ) || (false && $selfIntersecting)) { ?> disabled="disabled"<?php } ?>/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="refreshParentWindow(); closeWindow();"/>
</div>

View File

@ -48,7 +48,7 @@ xhtmlHeaders(__FILE__, translate('Zones') );
<body>
<div id="page">
<div id="header">
<div id="headerButtons"><a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a></div>
<div id="headerButtons"><a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a></div>
<h2><?php echo translate('Zones') ?></h2>
</div>
<div id="content" style="width:<?php echo $monitor->Width() ?>px; height:<?php echo $monitor->Height() ?>px; position:relative; margin: 0 auto;">
@ -57,7 +57,7 @@ xhtmlHeaders(__FILE__, translate('Zones') );
<input type="hidden" name="action" value="delete"/>
<input type="hidden" name="mid" value="<?php echo $mid ?>"/>
<div id="contentButtons">
<input type="button" value="<?php echo translate('AddNewZone') ?>" onclick="createPopup( '?view=zone&amp;mid=<?php echo $mid ?>&amp;zid=0', 'zmZone', 'zone', <?php echo $monitor->Width() ?>, <?php echo $monitor->Height() ?> );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/>
<?php echo makePopupButton('?view=zone&mid=' . $mid . '&zid=0', 'zmZone', array('zone', $monitor->Width(), $monitor->Height()), translate('AddNewZone'), canEdit('Monitors')); ?>
<input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
</div>
<table id="contentTable" class="major" cellspacing="0">
@ -74,10 +74,10 @@ xhtmlHeaders(__FILE__, translate('Zones') );
foreach( $zones as $zone ) {
?>
<tr>
<td class="colName"><a href="#" onclick="streamCmdQuit( true ); createPopup( '?view=zone&amp;mid=<?php echo $mid ?>&amp;zid=<?php echo $zone['Id'] ?>', 'zmZone', 'zone', <?php echo $monitor->Width() ?>, <?php echo $monitor->Height() ?> ); return( false );"><?php echo $zone['Name'] ?></a></td>
<td class="colName"><?php echo makePopupLink('?view=zone&mid=' . $mid . '&zid=' . $zone['Id'], 'zmZone', array('zone', $monitor->Width(), $monitor->Height()), $zone['Name'], true, 'onclick="streamCmdQuit( true ); return( false );"'); ?></td>
<td class="colType"><?php echo $zone['Type'] ?></td>
<td class="colUnits"><?php echo $zone['Area'] ?>&nbsp;/&nbsp;<?php echo sprintf( "%.2f", ($zone['Area']*100)/($monitor->Width()*$monitor->Height()) ) ?></td>
<td class="colMark"><input type="checkbox" name="markZids[]" value="<?php echo $zone['Id'] ?>" onclick="configureDeleteButton( this );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
<td class="colMark"><input type="checkbox" name="markZids[]" value="<?php echo $zone['Id'] ?>" data-on-click-this="configureDeleteButton"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
</tr>
<?php
}
@ -90,7 +90,12 @@ foreach( $zones as $zone ) {
<?php
foreach( array_reverse($zones) as $zone ) {
?>
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type']?>" onclick="streamCmdQuit( true ); createPopup( '?view=zone&amp;mid=<?php echo $mid ?>&amp;zid=<?php echo $zone['Id'] ?>', 'zmZone', 'zone', <?php echo $monitor->Width ?>, <?php echo $monitor->Height ?> ); return( false );"/>
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="popup-link <?php echo $zone['Type']?>" onclick="streamCmdQuit( true ); return( false );"
data-url="?view=zone&amp;mid=<?php echo $mid ?>&amp;zid=<?php echo $zone['Id'] ?>"
data-window-name="zmZone"
data-window-tag="zone"
data-window-width="<?php echo $monitor->Width ?>"
data-window-height="<?php echo $monitor->Height ?>"/>
<?php
} // end foreach zone
?>