Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2019-01-16 14:39:56 -05:00
commit f49dd93b6a
59 changed files with 523 additions and 369 deletions

View File

@ -130,9 +130,9 @@ CTRL+x to exit
**Step 12:** Please check the configuration **Step 12:** Please check the configuration
Zoneminder 1.32.x Zoneminder 1.32.x
1. Check path of ZM_PATH in '/etc/zm/conf.d/zmcuston.conf' is ZM_PATH_ZMS=/zm/cgi-bin/nph-zms 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/zmcuston.conf 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 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 in ZM_PATH. The part /nph-zms has to be left out of the ScriptAlias

View File

@ -77,8 +77,7 @@ bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) {
//Info( "eft %d > et %d", event_data->frames[i].timestamp, event_time ); //Info( "eft %d > et %d", event_data->frames[i].timestamp, event_time );
if ( event_data->frames[i].timestamp >= event_time ) { if ( event_data->frames[i].timestamp >= event_time ) {
curr_frame_id = i+1; curr_frame_id = i+1;
Debug( 3, "Set cst:%.2f", curr_stream_time ); Debug(3, "Set curr_stream_time:%.2f, curr_frame_id:%d", curr_stream_time, curr_frame_id);
Debug( 3, "Set cfid:%d", curr_frame_id );
break; break;
} }
} }
@ -144,7 +143,7 @@ bool EventStream::loadEventData(uint64_t event_id) {
event_data->storage_id = dbrow[1] ? atoi(dbrow[1]) : 0; event_data->storage_id = dbrow[1] ? atoi(dbrow[1]) : 0;
event_data->frame_count = dbrow[2] == NULL ? 0 : atoi(dbrow[2]); event_data->frame_count = dbrow[2] == NULL ? 0 : atoi(dbrow[2]);
event_data->start_time = atoi(dbrow[3]); event_data->start_time = atoi(dbrow[3]);
event_data->duration = atof(dbrow[4]); event_data->duration = dbrow[4] ? atof(dbrow[4]) : 0.0;
strncpy(event_data->video_file, dbrow[5], sizeof(event_data->video_file)-1); strncpy(event_data->video_file, dbrow[5], sizeof(event_data->video_file)-1);
std::string scheme_str = std::string(dbrow[6]); std::string scheme_str = std::string(dbrow[6]);
if ( scheme_str == "Deep" ) { if ( scheme_str == "Deep" ) {
@ -164,19 +163,30 @@ bool EventStream::loadEventData(uint64_t event_id) {
struct tm *event_time = localtime(&event_data->start_time); struct tm *event_time = localtime(&event_data->start_time);
if ( storage_path[0] == '/' ) if ( storage_path[0] == '/' )
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", snprintf(event_data->path, sizeof(event_data->path),
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 ); "%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 else
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", snprintf(event_data->path, sizeof(event_data->path),
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 ); "%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 ) { } 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] == '/' ) if ( storage_path[0] == '/' )
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%04d-%02d-%02d/%" PRIu64, snprintf(event_data->path, sizeof(event_data->path),
storage_path, event_data->monitor_id, event_time->tm_year+1900, event_time->tm_mon+1, event_time->tm_mday, event_data->event_id ); "%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 else
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%04d-%02d-%02d/%" PRIu64, snprintf(event_data->path, sizeof(event_data->path),
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, "%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); event_data->event_id);
} else { } else {
@ -185,13 +195,14 @@ bool EventStream::loadEventData(uint64_t event_id) {
storage_path, event_data->monitor_id, event_data->event_id); storage_path, event_data->monitor_id, event_data->event_id);
else else
snprintf(event_data->path, sizeof(event_data->path), "%s/%s/%ld/%" PRIu64, 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 ); staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id,
event_data->event_id);
} }
delete storage; storage = NULL; 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) ) { if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn)); Error("Can't run query: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn)); exit(mysql_errno(&dbconn));
@ -494,20 +505,19 @@ void EventStream::processCommand(const CmdMsg *msg) {
} }
void EventStream::checkEventLoaded() { void EventStream::checkEventLoaded() {
bool reload_event = false;
static char sql[ZM_SQL_SML_BUFSIZ]; static char sql[ZM_SQL_SML_BUFSIZ];
if ( curr_frame_id <= 0 ) { 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); 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;
} else if ( (unsigned int)curr_frame_id > event_data->frame_count ) { } 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); 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; } else {
// No event change required
return;
} }
if ( reload_event ) { // Event change required.
if ( forceEventChange || ( mode != MODE_SINGLE && mode != MODE_NONE ) ) { if ( forceEventChange || ( mode != MODE_SINGLE && mode != MODE_NONE ) ) {
//Info( "SQL:%s", sql );
if ( mysql_query(&dbconn, sql) ) { if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn)); Error("Can't run query: %s", mysql_error(&dbconn));
exit(mysql_errno(&dbconn)); exit(mysql_errno(&dbconn));
@ -532,7 +542,7 @@ void EventStream::checkEventLoaded() {
loadEventData(event_id); loadEventData(event_id);
Debug(2, "Current frame id = %d", curr_frame_id); Debug(2, "Current frame id = %d", curr_frame_id);
if ( replay_rate < 0 ) if ( replay_rate < 0 ) //rewind
curr_frame_id = event_data->frame_count; curr_frame_id = event_data->frame_count;
else else
curr_frame_id = 1; curr_frame_id = 1;
@ -543,7 +553,7 @@ void EventStream::checkEventLoaded() {
else else
curr_frame_id = event_data->frame_count; curr_frame_id = event_data->frame_count;
paused = true; paused = true;
} } // end if found a new event or not
mysql_free_result(result); mysql_free_result(result);
forceEventChange = false; forceEventChange = false;
} else { } else {
@ -553,8 +563,7 @@ void EventStream::checkEventLoaded() {
curr_frame_id = event_data->frame_count; curr_frame_id = event_data->frame_count;
paused = true; paused = true;
} }
} } // void EventStream::checkEventLoaded()
}
Image * EventStream::getImage( ) { Image * EventStream::getImage( ) {
static char filepath[PATH_MAX]; static char filepath[PATH_MAX];
@ -683,7 +692,7 @@ Debug(1, "Loading image");
} }
delete image; delete image;
image = NULL; image = NULL;
} } // end if send_raw or not
switch ( type ) { switch ( type ) {
case STREAM_JPEG : case STREAM_JPEG :
@ -709,7 +718,7 @@ Debug(1, "Loading image");
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 */ fclose(fdj); /* Close the file handle */
Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno)); Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno));
return( false ); return false;
} }
} }
#else #else
@ -717,7 +726,7 @@ Debug(1, "Loading image");
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 */ fclose(fdj); /* Close the file handle */
Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno)); Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno));
return( false ); return false;
} }
#endif #endif
fclose(fdj); /* Close the file handle */ fclose(fdj); /* Close the file handle */
@ -726,16 +735,16 @@ Debug(1, "Loading image");
fprintf(stdout, "Content-Length: %d\r\n\r\n", 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 ) { if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) {
Error("Unable to send stream frame: %s", strerror(errno)); Error("Unable to send stream frame: %s", strerror(errno));
return( false ); return false;
}
} }
} // end if send_raw or not
fputs("\r\n\r\n", stdout); fputs("\r\n\r\n", stdout);
fflush(stdout); fflush(stdout);
} } // end if stream MPEG or other
last_frame_sent = TV_2_FLOAT(now); last_frame_sent = TV_2_FLOAT(now);
return true; return true;
} } // bool EventStream::sendFrame( int delta_us )
void EventStream::runStream() { void EventStream::runStream() {
openComms(); openComms();
@ -795,6 +804,7 @@ void EventStream::runStream() {
} }
if ( !in_event ) { if ( !in_event ) {
double actual_delta_time = TV_2_FLOAT(now) - last_frame_sent; double actual_delta_time = TV_2_FLOAT(now) - last_frame_sent;
// > 1 second
if ( actual_delta_time > 1 ) { if ( actual_delta_time > 1 ) {
static char frame_text[64]; static char frame_text[64];
snprintf(frame_text, sizeof(frame_text), "Time to next event = %d seconds", (int)time_to_event); snprintf(frame_text, sizeof(frame_text), "Time to next event = %d seconds", (int)time_to_event);
@ -808,7 +818,7 @@ void EventStream::runStream() {
curr_stream_time += (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; continue;
} } // end if !in_event
// Figure out if we should send this frame // Figure out if we should send this frame
@ -833,7 +843,7 @@ void EventStream::runStream() {
Debug(2, "Sending keepalive frame"); Debug(2, "Sending keepalive frame");
send_frame = true; send_frame = true;
} }
} } // end if streaming stepping or doing nothing
if ( send_frame ) if ( send_frame )
if ( !sendFrame(delta_us) ) if ( !sendFrame(delta_us) )
@ -862,7 +872,8 @@ void EventStream::runStream() {
#endif // HAVE_LIBAVCODEC #endif // HAVE_LIBAVCODEC
closeComms(); closeComms();
} } // void EventStream::runStream()
void EventStream::setStreamStart( uint64_t init_event_id, unsigned int init_frame_id=0 ) { void EventStream::setStreamStart( uint64_t init_event_id, unsigned int init_frame_id=0 ) {
loadInitialEventData(init_event_id, init_frame_id); loadInitialEventData(init_event_id, init_frame_id);
if ( !(monitor = Monitor::Load(event_data->monitor_id, false, Monitor::QUERY)) ) { if ( !(monitor = Monitor::Load(event_data->monitor_id, false, Monitor::QUERY)) ) {
@ -870,6 +881,7 @@ void EventStream::setStreamStart( uint64_t init_event_id, unsigned int init_fram
return; 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); loadInitialEventData(monitor_id, event_time);
if ( !(monitor = Monitor::Load(event_data->monitor_id, false, Monitor::QUERY)) ) { if ( !(monitor = Monitor::Load(event_data->monitor_id, false, Monitor::QUERY)) ) {

View File

@ -88,7 +88,7 @@ bool User::canAccess( int monitor_id ) {
// Function to load a user from username and password // Function to load a user from username and password
// Please note that in auth relay mode = none, password is NULL // Please note that in auth relay mode = none, password is NULL
User *zmLoadUser( const char *username, const char *password ) { 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 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. // According to docs, size of safer_whatever must be 2*length+1 due to unicode conversions + null terminator.
@ -97,9 +97,14 @@ User *zmLoadUser( const char *username, const char *password ) {
if ( password ) { if ( password ) {
char safer_password[129]; // current db password size is 64 char safer_password[129]; // current db password size is 64
mysql_real_escape_string(&dbconn, safer_password, password, strlen( password ) ); 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 { } 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) ) { if ( mysql_query(&dbconn, sql) ) {
@ -117,7 +122,7 @@ User *zmLoadUser( const char *username, const char *password ) {
if ( n_users != 1 ) { if ( n_users != 1 ) {
mysql_free_result(result); mysql_free_result(result);
Warning("Unable to authenticate user %s", username); Warning("Unable to authenticate user %s", username);
return( 0 ); return NULL;
} }
MYSQL_ROW dbrow = mysql_fetch_row(result); MYSQL_ROW dbrow = mysql_fetch_row(result);

View File

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

View File

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

View File

@ -10,7 +10,7 @@ class Server {
'Protocol' => '', 'Protocol' => '',
'Hostname' => '', 'Hostname' => '',
'Port' => null, 'Port' => null,
'PathToIndex' => '/zm/index.php', 'PathToIndex' => null,
'PathToZMS' => ZM_PATH_ZMS, 'PathToZMS' => ZM_PATH_ZMS,
'PathToApi' => '/zm/api', 'PathToApi' => '/zm/api',
'zmaudit' => 1, 'zmaudit' => 1,
@ -214,5 +214,19 @@ class Server {
return $results[0]; 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 } # end class Server
?> ?>

View File

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

View File

@ -35,6 +35,28 @@ function noCacheHeaders() {
header('Pragma: no-cache'); // HTTP/1.0 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() { function CORSHeaders() {
if ( isset($_SERVER['HTTP_ORIGIN']) ) { if ( isset($_SERVER['HTTP_ORIGIN']) ) {
@ -44,6 +66,11 @@ function CORSHeaders() {
if ( sizeof($Servers) < 1 ) { if ( sizeof($Servers) < 1 ) {
# Only need CORSHeaders in the event that there are multiple servers in use. # Only need CORSHeaders in the event that there are multiple servers in use.
# ICON: Might not be true. multi-port? # 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; return;
} }
foreach( $Servers as $Server ) { foreach( $Servers as $Server ) {
@ -400,14 +427,19 @@ function makeLink( $url, $label, $condition=1, $options='' ) {
} }
function makePopupLink( $url, $winName, $winSize, $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 ( $condition ) {
if ( is_array( $winSize ) ) if ( is_array( $winSize ) ) {
$popupParms = "'".$url."', '".$winName."', '".$winSize[0]."', ".$winSize[1].", ".$winSize[2]; $string .= ' data-window-tag="' . htmlspecialchars($winSize[0]) . '"';
else $string .= ' data-window-width="' . htmlspecialchars($winSize[1]) . '"';
$popupParms = "'".$url."', '".$winName."', '".$winSize."'"; $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 { } else {
$string .= '<a>'; $string .= '<a>';
} }
@ -417,11 +449,20 @@ function makePopupLink( $url, $winName, $winSize, $label, $condition=1, $options
} }
function makePopupButton( $url, $winName, $winSize, $buttonValue, $condition=1, $options='' ) { function makePopupButton( $url, $winName, $winSize, $buttonValue, $condition=1, $options='' ) {
if ( is_array( $winSize ) ) $string = '<input type="button" class="popup-link" value="' . htmlspecialchars($buttonValue) . '"';
$popupParms = "'".$url."', '".$winName."', '".$winSize[0]."', ".$winSize[1].", ".$winSize[2]; $string .= ' data-url="' . htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, ini_get("default_charset"), false) . '"';
else $string .= ' data-window-name="' . htmlspecialchars($winName) . '"';
$popupParms = "'".$url."', '".$winName."', '".$winSize."'"; if ( is_array( $winSize ) ) {
$string = '<input type="button" value="'.$buttonValue.'" onclick="createPopup( '.$popupParms.' ); return( false );"'.($condition?'':' disabled="disabled"').($options?(' '.$options):'').'/>'; $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 ); return( $string );
} }
@ -2258,6 +2299,29 @@ function csrf_startup() {
csrf_conf('rewrite-js', 'includes/csrf/csrf-magic.js'); 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() ) { function unparse_url($parsed_url, $substitutions = array() ) {
$fields = array('scheme','host','port','user','pass','path','query','fragment'); $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 // Use relative URL's instead
define('ZM_BASE_URL', ''); define('ZM_BASE_URL', '');
// Check time zone is set // Verify the system, php, and mysql timezones all match
if (!ini_get('date.timezone') || !date_default_timezone_set(ini_get('date.timezone'))) { require_once('includes/functions.php');
date_default_timezone_set('UTC'); check_timezone();
Fatal( "ZoneMinder is not installed properly: php's date.timezone is not set to a valid timezone" );
}
if ( isset($_GET['skin']) ) { if ( isset($_GET['skin']) ) {
$skin = $_GET['skin']; $skin = $_GET['skin'];
@ -155,7 +153,6 @@ if ( ZM_OPT_USE_AUTH ) {
session_write_close(); session_write_close();
require_once('includes/lang.php'); require_once('includes/lang.php');
require_once('includes/functions.php');
# Running is global but only do the daemonCheck if it is actually needed # Running is global but only do the daemonCheck if it is actually needed
$running = null; $running = null;
@ -175,6 +172,10 @@ $view = null;
if ( isset($_REQUEST['view']) ) if ( isset($_REQUEST['view']) )
$view = detaintPath($_REQUEST['view']); $view = detaintPath($_REQUEST['view']);
# Add CSP Headers
$cspNonce = bin2hex(openssl_random_pseudo_bytes(16));
CSPHeaders($view, $cspNonce);
$request = null; $request = null;
if ( isset($_REQUEST['request']) ) if ( isset($_REQUEST['request']) )
$request = detaintPath($_REQUEST['request']); $request = detaintPath($_REQUEST['request']);

View File

@ -287,7 +287,7 @@ function controlPresets( $monitor, $cmds ) {
} }
if ( canEdit('Monitors') && $monitor->CanSetPresets() ) { 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 <?php
} }
?> ?>

View File

@ -270,12 +270,12 @@ function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) {
<div id="imagevideo" align="center"></div> <div id="imagevideo" align="center"></div>
<br> <br>
<div align="center"> <div align="center">
<button type="button" onclick="stepbackward()">&lt; Step</button> <button type="button" data-on-click="stepbackward">&lt; Step</button>
<button type="button" id="btnrwd" onclick="rewind()" >Rwd</button> <button type="button" id="btnrwd" data-on-click="rewind">Rwd</button>
<button type="button" id="btnplay" onclick="playstop()">Stop</button> <button type="button" id="btnplay" data-on-click="playstop">Stop</button>
<button type="button" onclick="stepforward()">Step &gt;</button> <button type="button" data-on-click="stepforward">Step &gt;</button>
<button type="button" id="btnspeedup" onclick="speedup()">speedup</button> <button type="button" id="btnspeedup" data-on-click="speedup">speedup</button>
<button type="button" id="btnspeeddown" onclick="speeddown()">slowdown</button> <button type="button" id="btnspeeddown" data-on-click="speeddown">slowdown</button>
</div> </div>
<div align="center"><div class="horizontal_track" > <div align="center"><div class="horizontal_track" >
<div class="horizontal_slit" >&nbsp;</div> <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="skins/<?php echo $skin; ?>/js/dateTimePicker/jquery-ui-timepicker-addon.js"></script>
<script src="<?php echo cache_bust('js/Server.js'); ?>"></script> <script src="<?php echo cache_bust('js/Server.js'); ?>"></script>
<script> <script nonce="<?php echo $cspNonce; ?>">
jQuery(document).ready(function(){ jQuery(document).ready(function(){
jQuery("#flip").click(function(){ jQuery("#flip").click(function(){
jQuery("#panel").slideToggle("slow"); jQuery("#panel").slideToggle("slow");
@ -150,7 +150,7 @@ echo output_link_if_exists( array(
<?php <?php
if ( $skinJsPhpFile ) { if ( $skinJsPhpFile ) {
?> ?>
<script> <script nonce="<?php echo $cspNonce; ?>">
//<![CDATA[ //<![CDATA[
<!-- <!--
<?php <?php
@ -163,7 +163,7 @@ echo output_link_if_exists( array(
} }
if ( $viewJsPhpFile ) { if ( $viewJsPhpFile ) {
?> ?>
<script> <script nonce="<?php echo $cspNonce; ?>">
//<![CDATA[ //<![CDATA[
<!-- <!--
<?php <?php
@ -397,6 +397,7 @@ if ($reload == 'reload') return ob_get_clean();
} // end function getNavBarHTML() } // end function getNavBarHTML()
function xhtmlFooter() { function xhtmlFooter() {
global $cspNonce;
global $view; global $view;
global $skin; global $skin;
global $running; global $running;
@ -404,8 +405,8 @@ function xhtmlFooter() {
include("skins/$skin/views/state.php"); include("skins/$skin/views/state.php");
} }
?> ?>
<script nonce="<?php echo $cspNonce; ?>">$j('.chosen').chosen();</script>
</body> </body>
<script type="text/javascript">$j('.chosen').chosen();</script>
</html> </html>
<?php <?php
} // end xhtmlFooter } // 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 ) { function createEventPopup( eventId, eventFilter, width, height ) {
var url = '?view=event&eid='+eventId; var url = '?view=event&eid='+eventId;
if ( eventFilter ) if ( eventFilter )
@ -264,6 +304,10 @@ function submitTab( tab ) {
form.submit(); form.submit();
} }
function submitThisForm() {
this.form.submit();
}
function toggleCheckbox( element, name ) { function toggleCheckbox( element, name ) {
var form = element.form; var form = element.form;
var checked = element.checked; 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 focusWindow = <?php echo !empty($focusWindow)?'true':'false' ?>;
var imagePrefix = "<?php echo "?view=image&eid=" ?>"; var imagePrefix = "<?php echo '?view=image&eid=' ?>";
var auth_hash; var auth_hash;
<?php if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) { ?> <?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, $html .= htmlSelect('Function[]', $Functions,
(isset($_SESSION['Function'])?$_SESSION['Function']:''), (isset($_SESSION['Function'])?$_SESSION['Function']:''),
array( array(
'onchange'=>'this.form.submit();', 'data-on-change'=>'submitThisForm',
'class'=>'chosen', 'class'=>'chosen',
'multiple'=>'multiple', 'multiple'=>'multiple',
'data-placeholder'=>'All', 'data-placeholder'=>'All',
@ -118,7 +118,7 @@ if ( count($ServersById) > 1 ) {
$html .= htmlSelect('ServerId[]', $ServersById, $html .= htmlSelect('ServerId[]', $ServersById,
(isset($_SESSION['ServerId'])?$_SESSION['ServerId']:''), (isset($_SESSION['ServerId'])?$_SESSION['ServerId']:''),
array( array(
'onchange'=>'this.form.submit();', 'data-on-change'=>'submitThisForm',
'class'=>'chosen', 'class'=>'chosen',
'multiple'=>'multiple', 'multiple'=>'multiple',
'data-placeholder'=>'All', 'data-placeholder'=>'All',
@ -132,7 +132,7 @@ if ( count($StorageById) > 1 ) {
$html .= htmlSelect('StorageId[]', $StorageById, $html .= htmlSelect('StorageId[]', $StorageById,
(isset($_SESSION['StorageId'])?$_SESSION['StorageId']:''), (isset($_SESSION['StorageId'])?$_SESSION['StorageId']:''),
array( array(
'onchange'=>'this.form.submit();', 'data-on-change'=>'submitThisForm',
'class'=>'chosen', 'class'=>'chosen',
'multiple'=>'multiple', 'multiple'=>'multiple',
'data-placeholder'=>'All', 'data-placeholder'=>'All',
@ -150,7 +150,7 @@ $status_options = array(
$html .= htmlSelect( 'Status[]', $status_options, $html .= htmlSelect( 'Status[]', $status_options,
( isset($_SESSION['Status']) ? $_SESSION['Status'] : '' ), ( isset($_SESSION['Status']) ? $_SESSION['Status'] : '' ),
array( array(
'onchange'=>'this.form.submit();', 'data-on-change'=>'submitThisForm',
'class'=>'chosen', 'class'=>'chosen',
'multiple'=>'multiple', 'multiple'=>'multiple',
'data-placeholder'=>'All' 'data-placeholder'=>'All'
@ -235,7 +235,7 @@ $html .= htmlSelect( 'Status[]', $status_options,
$html .= '<span class="MonitorFilter"><label>'.translate('Monitor').'</label>'; $html .= '<span class="MonitorFilter"><label>'.translate('Monitor').'</label>';
$html .= htmlSelect('MonitorId[]', $monitors_dropdown, $selected_monitor_ids, $html .= htmlSelect('MonitorId[]', $monitors_dropdown, $selected_monitor_ids,
array( array(
'onchange'=>'this.form.submit();', 'data-on-change'=>'submitThisForm',
'class'=>'chosen', 'class'=>'chosen',
'multiple'=>'multiple', 'multiple'=>'multiple',
'data-placeholder'=>'All', 'data-placeholder'=>'All',

View File

@ -49,7 +49,7 @@ xhtmlHeaders(__FILE__, translate('Bandwidth') );
<p><?php echo translate('SetNewBandwidth') ?></p> <p><?php echo translate('SetNewBandwidth') ?></p>
<p><?php echo buildSelect( "newBandwidth", $bandwidth_options ) ?></p> <p><?php echo buildSelect( "newBandwidth", $bandwidth_options ) ?></p>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

@ -178,23 +178,23 @@ getBodyTopHTML();
</div> </div>
<div class="container-fluid"> <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"' ?> <?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
> >
<span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>&nbsp;<?php echo translate('AddNewMonitor') ?> <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>&nbsp;<?php echo translate('AddNewMonitor') ?>
</button> </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"' ?> <?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?>
style="display:none;"> style="display:none;">
<span class="glyphicon glyphicon-copy"></span>&nbsp;<?php echo translate('CloneMonitor') ?> <span class="glyphicon glyphicon-copy"></span>&nbsp;<?php echo translate('CloneMonitor') ?>
</button> </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') ?> <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>&nbsp;<?php echo translate('Edit') ?>
</button> </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') ?> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&nbsp;<?php echo translate('Delete') ?>
</button> </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 <?php
ob_start(); ob_start();
?> ?>
@ -327,7 +327,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
if ( canEdit('Monitors') ) { if ( canEdit('Monitors') ) {
?> ?>
<td class="colMark"> <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> <span class="glyphicon glyphicon-sort" title="Click and drag to change order"></span>
</td> </td>
<?php <?php

View File

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

View File

@ -503,7 +503,7 @@ switch ( $tab )
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

@ -34,7 +34,7 @@ xhtmlHeaders(__FILE__, translate('ControlCaps') );
<div id="page"> <div id="page">
<div id="header"> <div id="header">
<div id="headerButtons"> <div id="headerButtons">
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a> <a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div> </div>
<h2><?php echo translate('ControlCaps') ?></h2> <h2><?php echo translate('ControlCaps') ?></h2>
</div> </div>
@ -63,7 +63,7 @@ foreach( $controls as $control )
{ {
?> ?>
<tr> <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="colType"><?php echo $control['Type'] ?></td>
<td class="colProtocol"><?php echo $control['Protocol'] ?></td> <td class="colProtocol"><?php echo $control['Protocol'] ?></td>
<td class="colCanMove"><?php echo $control['CanMove']?translate('Yes'):translate('No') ?></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="colCanIris"><?php echo $control['CanIris']?translate('Yes'):translate('No') ?></td>
<td class="colCanWhiteBal"><?php echo $control['CanWhite']?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="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> </tr>
<?php <?php
} }
@ -80,7 +80,8 @@ foreach( $controls as $control )
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

@ -61,7 +61,7 @@ xhtmlHeaders(__FILE__, translate('SetPreset') );
</p> </p>
<div id="contentButtons"> <div id="contentButtons">
<input type="submit" value="<?php echo translate('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> </div>
</form> </form>
</div> </div>

View File

@ -58,7 +58,7 @@ xhtmlHeaders( __FILE__, translate('Device')." - ".$newDevice['Name'] );
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

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

View File

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

View File

@ -54,7 +54,7 @@ xhtmlHeaders(__FILE__, translate('Download') );
<div id="page"> <div id="page">
<div id="header"> <div id="header">
<div id="headerButtons"> <div id="headerButtons">
<a href="#" onclick="closeWindow()"><?php echo translate('Close') ?></a> <a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
</div> </div>
<h2><?php echo translate('Download') ?></h2> <h2><?php echo translate('Download') ?></h2>
</div> </div>
@ -95,9 +95,9 @@ if ( !empty($_REQUEST['eid']) ) {
<tr> <tr>
<th scope="row"><?php echo translate('ExportFormat') ?></th> <th scope="row"><?php echo translate('ExportFormat') ?></th>
<td> <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> <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> <label for="exportFormatZip"><?php echo translate('ExportFormatZip') ?></label>
</td> </td>
</tr> </tr>

View File

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

View File

@ -122,22 +122,22 @@ if ( ! $Event->Id() ) {
<div id="menuBar1"> <div id="menuBar1">
<div id="nameControl"> <div id="nameControl">
<input type="text" id="eventName" name="eventName" value="<?php echo validHtmlStr($Event->Name()) ?>" /> <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> <?php echo translate('Rename') ?></button>
</div> </div>
<?php <?php
if ( canEdit('Events') ) { if ( canEdit('Events') ) {
?> ?>
<div id="deleteEvent"><button type="button" onclick="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="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" onclick="editEvent()"><?php echo translate('Edit') ?></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" onclick="archiveEvent()"><?php echo translate('Archive') ?></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" onclick="unarchiveEvent()"><?php echo translate('Unarchive') ?></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 <?php
} // end if can edit Events } // end if can edit Events
?> ?>
<div id="framesEvent"><button type="button" onclick="showEventFrames()"><?php echo translate('Frames') ?></button></div> <div id="framesEvent"><button type="button" data-on-click="showEventFrames"><?php echo translate('Frames') ?></button></div>
<div id="streamEvent" class="hidden"><button onclick="showStream()"><?php echo translate('Stream') ?></button></div> <div id="streamEvent" class="hidden"><button data-on-click="showStream"><?php echo translate('Stream') ?></button></div>
<div id="stillsEvent"><button type="button" onclick="showStills()"><?php echo translate('Stills') ?></button></div> <div id="stillsEvent"><button type="button" data-on-click="showStills"><?php echo translate('Stills') ?></button></div>
<?php <?php
if ( $Event->DefaultVideo() ) { if ( $Event->DefaultVideo() ) {
?> ?>
@ -145,11 +145,11 @@ if ( canEdit('Events') ) {
<?php <?php
} else { } 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 <?php
} // end if Event->DefaultVideo } // 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="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 id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect( "scale", $scales, "changeScale();" ); ?></div>
</div> </div>
@ -191,15 +191,15 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
</div><!--imageFeed--> </div><!--imageFeed-->
<?php } /*end if !DefaultVideo*/ ?> <?php } /*end if !DefaultVideo*/ ?>
<p id="dvrControls"> <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;+" 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" onclick="streamFastRev( true );"/> <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" onclick="streamSlowRev( true );"/> <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" onclick="pauseClicked();"/> <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" onclick="playClicked();"/> <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" onclick="streamSlowFwd( true );"/> <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" onclick="streamFastFwd( true );"/> <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" onclick="streamZoomOut();"/> <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" onclick="streamNext( true );"/> <input type="button" value="+&gt;" id="nextBtn" title="<?php echo translate('Next') ?>" class="inactive" data-on-click-true="streamNext"/>
</p> </p>
<div id="replayStatus"> <div id="replayStatus">
<span id="mode"><?php echo translate('Mode') ?>: <span id="modeValue">Replay</span></span> <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"> <div id="eventImageFrame">
<img id="eventImage" src="graphics/transparent.png" alt=""/> <img id="eventImage" src="graphics/transparent.png" alt=""/>
<div id="eventImageBar"> <div id="eventImageBar">
<div id="eventImageClose"><button type="button" onclick="hideEventImage()"><?php echo translate('Close') ?></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" onclick="showFrameStats()"><?php echo translate('Stats') ?></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 id="eventImageData"><?php echo translate('Frame') ?> <span id="eventImageNo"></span></div>
</div> </div>
</div> </div>
@ -233,12 +233,12 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
</div> </div>
<div id="eventImageButtons"> <div id="eventImageButtons">
<div id="prevButtonsPanel"> <div id="prevButtonsPanel">
<input id="prevEventBtn" type="button" value="&lt;E" onclick="prevEvent()" disabled="disabled"/> <input id="prevEventBtn" type="button" value="&lt;E" data-on-click="prevEvent" disabled="disabled"/>
<input id="prevThumbsBtn" type="button" value="&lt;&lt;" onclick="prevThumbs()" disabled="disabled"/> <input id="prevThumbsBtn" type="button" value="&lt;&lt;" data-on-click="prevThumbs" disabled="disabled"/>
<input id="prevImageBtn" type="button" value="&lt;" onclick="prevImage()" disabled="disabled"/> <input id="prevImageBtn" type="button" value="&lt;" data-on-click="prevImage" disabled="disabled"/>
<input id="nextImageBtn" type="button" value="&gt;" onclick="nextImage()" disabled="disabled"/> <input id="nextImageBtn" type="button" value="&gt;" data-on-click="nextImage" disabled="disabled"/>
<input id="nextThumbsBtn" type="button" value="&gt;&gt;" onclick="nextThumbs()" disabled="disabled"/> <input id="nextThumbsBtn" type="button" value="&gt;&gt;" data-on-click="nextThumbs" disabled="disabled"/>
<input id="nextEventBtn" type="button" value="E&gt;" onclick="nextEvent()" disabled="disabled"/> <input id="nextEventBtn" type="button" value="E&gt;" data-on-click="nextEvent" disabled="disabled"/>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@ -169,29 +169,29 @@ while ( $event_row = dbFetchNext($results) ) {
<tbody> <tbody>
<tr> <tr>
<th scope="row"><?php echo translate('ExportDetails') ?></th> <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>
<tr> <tr>
<th scope="row"><?php echo translate('ExportFrames') ?></th> <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>
<tr> <tr>
<th scope="row"><?php echo translate('ExportImageFiles') ?></th> <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>
<tr> <tr>
<th scope="row"><?php echo translate('ExportVideoFiles') ?></th> <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>
<tr> <tr>
<th scope="row"><?php echo translate('ExportMiscFiles') ?></th> <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>
<tr> <tr>
<th scope="row"><?php echo translate('ExportFormat') ?></th> <th scope="row"><?php echo translate('ExportFormat') ?></th>
<td> <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="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 } ?> onclick="configureExportButton( this )"/><label for="exportFormatZip"><?php echo translate('ExportFormatZip') ?></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> </td>
</tr> </tr>
<tr> <tr>

View File

@ -296,8 +296,8 @@ for ( $i=0; $i < count($terms); $i++ ) {
?> ?>
<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> <td>
<input type="button" onclick="addTerm(this)" value="+"/> <input type="button" data-on-click-this="addTerm" value="+"/>
<input type="button" onclick="delTerm(this)" value="-" <?php echo count($terms) == 1 ? 'disabled' : '' ?>/> <input type="button" data-on-click-this="delTerm" value="-" <?php echo count($terms) == 1 ? 'disabled' : '' ?>/>
</td> </td>
</tr> </tr>
<?php <?php
@ -346,17 +346,17 @@ echo htmlSelect( 'filter[Query][sort_asc]', $sort_dirns, $filter->sort_asc() );
<div id="actionsTable" class="filterTable"> <div id="actionsTable" class="filterTable">
<p> <p>
<label><?php echo translate('FilterArchiveEvents') ?></label> <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>
<p><label><?php echo translate('FilterUpdateDiskSpace') ?></label> <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> </p>
<?php <?php
if ( ZM_OPT_FFMPEG ) { if ( ZM_OPT_FFMPEG ) {
?> ?>
<p> <p>
<label><?php echo translate('FilterVideoEvents') ?></label> <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> </p>
<?php <?php
} }
@ -364,7 +364,7 @@ if ( ZM_OPT_UPLOAD ) {
?> ?>
<p> <p>
<label><?php echo translate('FilterUploadEvents') ?></label> <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> </p>
<?php <?php
} }
@ -372,7 +372,7 @@ if ( ZM_OPT_EMAIL ) {
?> ?>
<p> <p>
<label><?php echo translate('FilterEmailEvents') ?></label> <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> </p>
<?php <?php
} }
@ -380,7 +380,7 @@ if ( ZM_OPT_MESSAGE ) {
?> ?>
<p> <p>
<label><?php echo translate('FilterMessageEvents') ?></label> <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> </p>
<?php <?php
} }
@ -388,11 +388,11 @@ if ( ZM_OPT_MESSAGE ) {
<p> <p>
<label><?php echo translate('FilterExecuteEvents') ?></label> <label><?php echo translate('FilterExecuteEvents') ?></label>
<input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( $filter->AutoExecute() ) { ?> checked="checked"<?php } ?>/> <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="text" name="filter[AutoExecuteCmd]" value="<?php echo (null !==$filter->AutoExecuteCmd())?$filter->AutoExecuteCmd():'' ?>" maxlength="255" data-on-change="updateButtons"/>
</p> </p>
<p> <p>
<label><?php echo translate('FilterDeleteEvents') ?></label> <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>
<p><label><?php echo translate('FilterMoveEvents') ?></label> <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();};"/> <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();};"/>
@ -400,23 +400,23 @@ if ( ZM_OPT_MESSAGE ) {
</p> </p>
<p> <p>
<label for="background"><?php echo translate('BackgroundFilter') ?></label> <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>
<p> <p>
<label for="Concurrent"><?php echo translate('ConcurrentFilter') ?></label> <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> </p>
</div> </div>
<hr/> <hr/>
<div id="contentButtons"> <div id="contentButtons">
<button type="submit" onclick="submitToEvents(this);"><?php echo translate('ListMatches') ?></button> <button type="submit" data-on-click-this="submitToEvents"><?php echo translate('ListMatches') ?></button>
<button type="button" onclick="submitToExport(this);"><?php echo translate('ExportMatches') ?></button> <button type="button" data-on-click-this="submitToExport"><?php echo translate('ExportMatches') ?></button>
<button type="submit" name="executeButton" id="executeButton" onclick="executeFilter(this);"><?php echo translate('Execute') ?></button> <button type="submit" name="executeButton" id="executeButton" data-on-click-this="executeFilter"><?php echo translate('Execute') ?></button>
<?php <?php
if ( canEdit('Events') ) { if ( canEdit('Events') ) {
?> ?>
<button type="submit" name="Save" value="Save" onclick="saveFilter(this);"><?php echo translate('Save') ?></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" onclick="saveFilter(this);"><?php echo translate('SaveAs') ?></button> <button type="submit" name="SaveAs" value="SaveAs" data-on-click-this="saveFilter"><?php echo translate('SaveAs') ?></button>
<?php <?php
if ( $filter->Id() ) { if ( $filter->Id() ) {
?> ?>
@ -425,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> </div>
</form> </form>
</div><!--content--> </div><!--content-->

View File

@ -35,7 +35,7 @@ xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id() );
<body> <body>
<div id="page"> <div id="page">
<div id="header"> <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> <h2><?php echo translate('Frames') ?> - <?php echo $Event->Id() ?></h2>
</div> </div>
<div id="content"> <div id="content">

View File

@ -54,7 +54,7 @@ foreach ( getEnumValues('Monitors', 'Function') as $optFunction ) {
</p> </p>
<div id="contentButtons"> <div id="contentButtons">
<button type="submit" value="Save"><?php echo translate('Save') ?></button> <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> </div>
</form> </form>
</div> </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"'?>> <button type="submit" name="action" value="Save"<?php $newGroup->Id() ? '' : ' disabled="disabled"'?>>
<?php echo translate('Save') ?> <?php echo translate('Save') ?>
</button> </button>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/> <input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/>
</div> </div>
</form> </form>
</div> </div>

View File

@ -72,7 +72,7 @@ function group_line( $Group ) {
$html .= validHtmlStr($Group->Name()); $html .= validHtmlStr($Group->Name());
} }
$html .= '</td><td class="colIds">'. monitorIdsToNames($Group->MonitorIds(), 30).'</td> $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> </tr>
'; ';
if ( isset( $children[$Group->Id()] ) ) { if ( isset( $children[$Group->Id()] ) ) {
@ -89,10 +89,10 @@ if ( isset( $children[null] ) )
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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') ?> <?php echo translate('New') ?>
</button> </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') ?> <?php echo translate('Delete') ?>
</button> </button>
</div> </div>

View File

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

View File

@ -53,6 +53,10 @@ function getFrame( monId, time ) {
continue; continue;
var duration = Event.EndTimeSecs - Event.StartTimeSecs; 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; 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. // Need to get frame by time, not some fun calc that assumes frames have the same mlength.
// Frames are not sorted. // Frames are not sorted.
@ -119,7 +123,7 @@ function getImageSource( monId, time ) {
var storage = Storage[Event.StorageId]; var storage = Storage[Event.StorageId];
// monitorServerId may be 0, which gives us the default Server entry // monitorServerId may be 0, which gives us the default Server entry
var server = storage.ServerId ? Servers[storage.ServerId] : Servers[monitorServerId[monId]]; var server = storage.ServerId ? Servers[storage.ServerId] : Servers[monitorServerId[monId]];
return server.PathToIndex() + return server.PathToIndex +
'?view=image&eid=' + Frame.EventId + '&fid='+Frame.FrameId + '?view=image&eid=' + Frame.EventId + '&fid='+Frame.FrameId +
"&width=" + monitorCanvasObj[monId].width + "&width=" + monitorCanvasObj[monId].width +
"&height=" + monitorCanvasObj[monId].height; "&height=" + monitorCanvasObj[monId].height;

View File

@ -127,7 +127,7 @@ echo "\nvar Servers = [];\n";
$Server = new Server(); $Server = new Server();
echo 'Servers[0] = new Server(' . json_encode($Server). ");\n"; echo 'Servers[0] = new Server(' . json_encode($Server). ");\n";
foreach ( Server::find() as $Server ) { 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"> <tr class="row">
<td class="col text-center"> <td class="col text-center">
<div class="btn-group"> <div class="btn-group">
<button type="button" onclick="expandLog()"><?php echo translate('More') ?></button> <button type="button" data-on-click="expandLog"><?php echo translate('More') ?></button>
<button type="button" onclick="clearLog()"><?php echo translate('Clear') ?></button> <button type="button" data-on-click="clearLog"><?php echo translate('Clear') ?></button>
<button type="button" onclick="refreshLog()"><?php echo translate('Refresh') ?></button> <button type="button" data-on-click="refreshLog"><?php echo translate('Refresh') ?></button>
<button type="button" onclick="exportLog()"><?php echo translate('Export') ?></button> <button type="button" data-on-click="exportLog"><?php echo translate('Export') ?></button>
<button type="button" onclick="closeWindow()"><?php echo translate('Close') ?></button> <button type="button" data-on-click="closeWindow"><?php echo translate('Close') ?></button>
</div> <!--btn--> </div> <!--btn-->
</td> </td>
</tr> </tr>
@ -62,33 +62,33 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
<tr class="row"> <tr class="row">
<td class="col"> <td class="col">
<?php echo translate('Component') ?> <?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>
<td class="col"> <td class="col">
<?php echo translate('Server') ?> <?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>
<td class="col"> <td class="col">
<?php echo translate('Pid') ?> <?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> </td>
</tr> </tr>
<tr class="row"> <tr class="row">
<td class="col"> <td class="col">
<?php echo translate('Level') ?> <?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>
<td class="col"> <td class="col">
<?php echo translate('File') ?> <?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>
<td class="col"> <td class="col">
<?php echo translate('Line') ?> <?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> </td>
</tr> </tr>
</table> </table>
<button type="reset" onclick="resetLog()"><?php echo translate('Reset') ?></button> <button type="reset" data-on-click="resetLog"><?php echo translate('Reset') ?></button>
</div> </div>
<form name="logForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <form name="logForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/> <input type="hidden" name="view" value="<?php echo $view ?>"/>
@ -136,7 +136,7 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
<div id="exportError"> <div id="exportError">
<?php echo translate('ExportFailed') ?>: <span id="exportErrorText"></span> <?php echo translate('ExportFailed') ?>: <span id="exportErrorText"></span>
</div> </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> <button type="button" value="Cancel" class="overlayCloser"><?php echo translate('Cancel') ?></button>
</form> </form>
</div> </div>

View File

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

View File

@ -468,15 +468,13 @@ if ( canEdit( 'Monitors' ) ) {
} }
?> ?>
<div id="headerButtons"> <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 <?php
if ( ZM_HAS_ONVIF ) { if ( ZM_HAS_ONVIF ) {
?> echo makePopupLink('?view=onvifprobe&mid=' . $monitor->Id(), 'zmOnvifProbe' . $monitor->Id(), 'onvifprobe', translate('OnvifProbe'));
<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
} }
?> ?>
<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> </div>
<?php <?php
} // end if canEdit('Monitors') } // end if canEdit('Monitors')
@ -975,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('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('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('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> <tr><td><?php echo translate('AutoStopTimeout') ?></td><td><input type="text" name="newMonitor[AutoStopTimeout]" value="<?php echo validHtmlStr($monitor->AutoStopTimeout()) ?>" size="4"/></td></tr>
@ -1046,7 +1044,7 @@ if ( $monitor->Type() == 'Local' ) {
</table> </table>
<div id="contentButtons"> <div id="contentButtons">
<button type="submit" value="Save"<?php echo canEdit('Monitors') ? '' : ' disabled="disabled"' ?>><?php echo translate('Save') ?></button> <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> </div>
</form> </form>
</div> </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 )' ); ?> <label for="preset"><?php echo translate('Preset') ?></label><?php echo buildSelect( "preset", $presets, 'configureButtons( this )' ); ?>
</p> </p>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

@ -333,9 +333,9 @@ xhtmlHeaders(__FILE__, translate('MonitorProbe') );
<?php echo buildSelect('probe', $cameras, 'configureButtons(this)'); ?> <?php echo buildSelect('probe', $cameras, 'configureButtons(this)'); ?>
</p> </p>
<div id="contentButtons"> <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> <?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> </div>
</form> </form>
</div> </div>

View File

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

View File

@ -140,9 +140,7 @@ xhtmlHeaders(__FILE__, translate('Montage'));
<div id="headerButtons"> <div id="headerButtons">
<?php <?php
if ( $showControl ) { if ( $showControl ) {
?> echo makePopupLink('?view=control', 'zmControl', 'control', translate('Control'));
<a href="#" onclick="createPopup('?view=control', 'zmControl', 'control')"><?php echo translate('Control') ?></a>
<?php
} }
if ( $showZones ) { if ( $showZones ) {
?> ?>
@ -181,11 +179,11 @@ if ( $showZones ) {
<?php echo htmlSelect('zmMontageLayout', $layoutsById, $layout_id, array('onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout')); ?> <?php echo htmlSelect('zmMontageLayout', $layoutsById, $layout_id, array('onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout')); ?>
</span> </span>
<input type="hidden" name="Positions"/> <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;"> <span id="SaveLayout" style="display:none;">
<input type="text" name="Name" placeholder="Enter new name for layout if desired" /> <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="<?php echo translate('Save') ?>" data-on-click-this="save_layout"/>
<input type="button" value="Cancel" onclick="cancel_layout(this);"/> <input type="button" value="Cancel" data-on-click-this="cancel_layout"/>
</span> </span>
</form> </form>
</div> </div>
@ -201,8 +199,12 @@ foreach ( $monitors as $monitor ) {
<div id="monitor<?php echo $monitor->Id() ?>" class="monitor idle"> <div id="monitor<?php echo $monitor->Id() ?>" class="monitor idle">
<div <div
id="imageFeed<?php echo $monitor->Id() ?>" id="imageFeed<?php echo $monitor->Id() ?>"
class="imageFeed" class="imageFeed popup-link"
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() ); ?> );"> 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 <?php
$monitor_options = $options; $monitor_options = $options;
if (0 and $Positions ) { if (0 and $Positions ) {

View File

@ -255,19 +255,19 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span> <span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
</div> </div>
<div id="ButtonsDiv"> <div id="ButtonsDiv">
<button type="button" id="panleft" onclick="click_panleft();" >&lt; <?php echo translate('Pan') ?></button> <button type="button" id="panleft" data-on-click="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="zoomin" data-on-click="click_zoomin" ><?php echo translate('In +') ?></button>
<button type="button" id="zoomout" onclick="click_zoomout();" ><?php echo translate('Out -') ?></button> <button type="button" id="zoomout" data-on-click="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="lasteight" data-on-click="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="lasthour" data-on-click="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="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="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="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 <?php
if ( (!$liveMode) and (count($displayMonitors) != 0) ) { 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 <?php
} }
?> ?>

View File

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

View File

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

View File

@ -70,7 +70,7 @@ if ( $tab == 'skins' ) {
$reload = true; $reload = true;
} }
if ( $reload ) 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 } # 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="colSystem"><?php echo validHtmlStr($row['System']) ?></td>
<td class="colBandwidth"><?php echo $row['MaxBandwidth']?$bandwidth_options[$row['MaxBandwidth']]:'&nbsp;' ?></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="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> </tr>
<?php <?php
} }
@ -193,7 +193,7 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> <button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div> </div>
</form> </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="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="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> </tr>
<?php } #end foreach Server ?> <?php } #end foreach Server ?>
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> <button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div> </div>
</form> </form>
@ -293,13 +293,13 @@ foreach ( array_map('basename', glob('skins/'.$current_skin.'/css/*',GLOB_ONLYDI
<td class="colServer"><?php <td class="colServer"><?php
echo makePopupLink('?view=storage&amp;id='.$Storage->Id(), 'zmStorage', 'storage', validHtmlStr($Storage->Name()), $canEdit ) ?></td> 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="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> </tr>
<?php } #end foreach Server ?> <?php } #end foreach Server ?>
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> <button type="submit" class="btn-danger" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
</div> </div>
</form> </form>

View File

@ -158,7 +158,8 @@ foreach($pluginOptions as $name => $popt)
?> ?>
</tbody> </tbody>
</table> </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> </div>
</form> </form>
</div> </div>

View File

@ -65,7 +65,7 @@ xhtmlHeaders(__FILE__, translate('Privacy') );
<p><?php echo buildSelect( "option", $options ); ?></p> <p><?php echo buildSelect( "option", $options ); ?></p>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

@ -99,7 +99,7 @@ xhtmlHeaders(__FILE__, translate('Server').' - '.$Server->Name());
<div id="contentButtons"> <div id="contentButtons">
<input type="hidden" name="action" value="Save"/> <input type="hidden" name="action" value="Save"/>
<input type="submit" value="<?php echo translate('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> </div>
</form> </form>
</div> </div>

View File

@ -69,7 +69,7 @@ xhtmlHeaders(__FILE__, validHtmlStr($monitor['Name'])." - ".translate('Settings'
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </div>

View File

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

View File

@ -153,7 +153,7 @@ if ( canEdit( 'System' ) )
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <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> </div>
</form> </form>
</div> </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 class="errorText"><?php echo sprintf( $CLANG['VersionMismatch'], ZM_VERSION, ZM_DYN_DB_VERSION ) ?></p>
<p><?php echo translate('RunLocalUpdate') ?></p> <p><?php echo translate('RunLocalUpdate') ?></p>
<div id="contentButtons"> <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> </div>
<?php <?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 sprintf( $CLANG['RunningRecentVer'], ZM_VERSION ) ?></p>
<p><?php echo translate('UpdateNotNecessary') ?></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"> <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> </div>
<?php <?php
} }
@ -80,8 +80,8 @@ else
<p><?php echo sprintf( $CLANG['LatestRelease'], ZM_DYN_LAST_VERSION, ZM_VERSION ) ?></p> <p><?php echo sprintf( $CLANG['LatestRelease'], ZM_DYN_LAST_VERSION, ZM_VERSION ) ?></p>
<p><?php echo buildSelect( "option", $options ); ?></p> <p><?php echo buildSelect( "option", $options ); ?></p>
<div id="contentButtons"> <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"/>
<input type="button" value="<?php echo translate('Close') ?>" onclick="closeWindow()"/> <input type="button" value="<?php echo translate('Close') ?>" data-on-click="closeWindow"/>
</div> </div>
</form> </form>
<?php <?php

View File

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

View File

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

View File

@ -267,7 +267,7 @@ for ( $i = 0; $i < $pointCols; $i++ ) {
</tr> </tr>
</tbody> </tbody>
</table> </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="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();"/> <input type="button" value="<?php echo translate('Cancel') ?>" onclick="refreshParentWindow(); closeWindow();"/>
</div> </div>

View File

@ -48,7 +48,7 @@ xhtmlHeaders(__FILE__, translate('Zones') );
<body> <body>
<div id="page"> <div id="page">
<div id="header"> <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> <h2><?php echo translate('Zones') ?></h2>
</div> </div>
<div id="content" style="width:<?php echo $monitor->Width() ?>px; height:<?php echo $monitor->Height() ?>px; position:relative; margin: 0 auto;"> <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="action" value="delete"/>
<input type="hidden" name="mid" value="<?php echo $mid ?>"/> <input type="hidden" name="mid" value="<?php echo $mid ?>"/>
<div id="contentButtons"> <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"/> <input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
</div> </div>
<table id="contentTable" class="major" cellspacing="0"> <table id="contentTable" class="major" cellspacing="0">
@ -74,10 +74,10 @@ xhtmlHeaders(__FILE__, translate('Zones') );
foreach( $zones as $zone ) { foreach( $zones as $zone ) {
?> ?>
<tr> <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="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="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> </tr>
<?php <?php
} }
@ -90,7 +90,12 @@ foreach( $zones as $zone ) {
<?php <?php
foreach( array_reverse($zones) as $zone ) { 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 <?php
} // end foreach zone } // end foreach zone
?> ?>