Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2019-01-21 13:52:38 -05:00
commit 7260f823cb
65 changed files with 5051 additions and 5300 deletions

View File

@ -2,7 +2,7 @@
# libraries
web/api/lib
web/includes/csrf/csrf-magic.js
web/includes/csrf/
web/js/videojs.zoomrotate.js
web/skins/classic/js/bootstrap.js
web/skins/classic/js/chosen
@ -13,3 +13,7 @@ web/skins/classic/js/jquery.js
web/skins/classic/js/moment.js
web/skins/classic/js/video.js
web/tools/mootools
# Cannot be parsed as JS
web/skins/classic/includes/export_functions.php
web/skins/classic/views/events.php

View File

@ -5,26 +5,46 @@ module.exports = {
"browser": true,
},
"extends": ["google"],
"overrides": [{
// eslint-plugin-html handles eol-last slightly different - it applies to
// each set of script tags, so we turn it off here.
"files": "**/*.*php",
"rules": {
"eol-last": "off",
"indent": "off",
},
}],
"plugins": [
"html",
"php-markup",
],
"rules": {
"brace-style": "off",
"camelcase": "off",
"comma-dangle": "off",
"guard-for-in": "off",
"key-spacing": "off",
"max-len": "off",
"new-cap": ["error", {
capIsNewExceptions: ["Error", "Warning", "Debug", "Polygon_calcArea", "Play", "Stop"],
newIsCapExceptionPattern: "^Asset\.."
}],
"no-array-constructor": "off",
"no-caller": "off",
"no-new-object": "off",
"no-unused-vars": "off",
"no-unused-vars": ["error", {
"vars": "local",
"args": "none",
"ignoreRestSiblings": false
}],
"no-var": "off",
"object-curly-spacing": "off",
"prefer-rest-params": "off",
"quotes": "off",
"require-jsdoc": "off",
"spaced-comment": "off",
},
"settings": {
"php/php-extensions": [".php"],
"php/markup-replacement": {"php": "", "=": "0"},
"php/keep-eol": false,
"php/remove-whitespace": false,
"php/remove-empty-line": false,
"php/remove-php-lint": false
},
};

4
.github/support.yml vendored
View File

@ -11,8 +11,10 @@ supportComment: >
attempts to ask a question.
Please use our support channels to get help with or discuss this project:
- The [ZoneMinder-Chat Slack channel](https://zoneminder-chat.herokuapp.com/)
- The [ZoneMinder Forum](https://forums.zoneminder.com/)
- The [ZoneMinder USer Forum](https://forums.zoneminder.com/)
# Close issues marked as support requests
close: true

View File

@ -32,24 +32,28 @@ install:
- update-binfmts --enable qemu-arm
env:
global:
- SMPFLAGS=-j4
matrix:
- OS=el DIST=7
- OS=fedora DIST=27 DOCKER_REPO=knnniggett/packpack
- OS=fedora DIST=28 DOCKER_REPO=knnniggett/packpack
- OS=fedora DIST=29 DOCKER_REPO=knnniggett/packpack
- OS=ubuntu DIST=trusty
- OS=ubuntu DIST=xenial
- OS=ubuntu DIST=trusty ARCH=i386
- OS=ubuntu DIST=xenial ARCH=i386
- OS=raspbian DIST=stretch ARCH=armhf DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=el DIST=7
- SMPFLAGS=-j4 OS=fedora DIST=27 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=28 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=29 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=trusty
- SMPFLAGS=-j4 OS=ubuntu DIST=xenial
- SMPFLAGS=-j4 OS=ubuntu DIST=trusty ARCH=i386
- SMPFLAGS=-j4 OS=ubuntu DIST=xenial ARCH=i386
- SMPFLAGS=-j4 OS=raspbian DIST=stretch ARCH=armhf DOCKER_REPO=knnniggett/packpack
compiler:
- gcc
services:
- mysql
- docker
jobs:
include:
- name: eslint
install: npm install -g eslint@5.12.0 eslint-config-google@0.11.0 eslint-plugin-html@5.0.0 eslint-plugin-php-markup@0.2.5
script: eslint --ext .php,.js .
script:
- utils/packpack/startpackpack.sh
@ -65,4 +69,3 @@ deploy:
script: utils/packpack/rsync_xfer.sh
on:
branch: master

View File

@ -770,7 +770,9 @@ void EventStream::runStream() {
send_frame = false;
// commands may set send_frame to true
while(checkCommandQueue());
while ( checkCommandQueue() && !zm_terminate ) {
// The idea is to loop here processing all commands before proceeding.
}
// Update modified time of the socket .lock file so that we can tell which ones are stale.
if ( now.tv_sec - last_comm_update.tv_sec > 3600 ) {

View File

@ -869,6 +869,10 @@ double Monitor::GetFPS() const {
struct timeval time2 = *snap2->timestamp;
double time_diff = tvDiffSec( time2, time1 );
if ( ! time_diff ) {
Error( "No diff between time_diff = %lf (%d:%ld.%ld - %d:%ld.%ld), ibc: %d", time_diff, index2, time2.tv_sec, time2.tv_usec, index1, time1.tv_sec, time1.tv_usec, image_buffer_count );
return 0.0;
}
double curr_fps = image_count/time_diff;
if ( curr_fps < 0.0 ) {

View File

@ -527,8 +527,9 @@ void MonitorStream::runStream() {
bool was_paused = paused;
if ( connkey ) {
while(checkCommandQueue()) {
Debug(2, "Have checking command Queue for connkey: %d", connkey );
while ( checkCommandQueue() && !zm_terminate ) {
// Loop in here until all commands are processed.
Debug(2, "Have checking command Queue for connkey: %d", connkey);
got_command = true;
}
// Update modified time of the socket .lock file so that we can tell which ones are stale.
@ -536,8 +537,7 @@ Debug(2, "Have checking command Queue for connkey: %d", connkey );
touch(sock_path_lock);
last_comm_update = now;
}
}
} // end if connkey
if ( paused ) {
if ( !was_paused ) {

View File

@ -62,8 +62,13 @@ bool StreamBase::checkInitialised() {
void StreamBase::updateFrameRate(double fps) {
base_fps = fps;
effective_fps = (base_fps*abs(replay_rate))/ZM_RATE_BASE;
frame_mod = 1;
if ( !fps ) {
Debug(1, "Zero fps in updateFrameRate. Setting frame_mod=1 and effective_fps=0.0");
effective_fps = 0.0;
return;
}
effective_fps = (base_fps*abs(replay_rate))/ZM_RATE_BASE;
Debug(3, "FPS:%.2f, MXFPS:%.2f, BFPS:%.2f, EFPS:%.2f, FM:%d", fps, maxfps, base_fps, effective_fps, frame_mod);
// Min frame repeat?
while( effective_fps > maxfps ) {

View File

@ -13,7 +13,7 @@ switch ( $_REQUEST['task'] ) {
$string = $_POST['message'];
$file = !empty($_POST['file']) ? preg_replace( '/\w+:\/\/\w+\//', '', $_POST['file'] ) : '';
$file = !empty($_POST['file']) ? preg_replace( '/\w+:\/\/[\w.:]+\//', '', $_POST['file'] ) : '';
if ( !empty( $_POST['line'] ) )
$line = $_POST['line'];
else

View File

@ -259,13 +259,14 @@ function collectData() {
$index = 0;
$where = array();
$values = array();
foreach( $entitySpec['selector'] as $selector ) {
foreach( $entitySpec['selector'] as $selIndex => $selector ) {
$selectorParamName = ':selector' . $selIndex;
if ( is_array( $selector ) ) {
$where[] = $selector['selector'].' = ?';
$values[] = validInt($id[$index]);
$where[] = $selector['selector'].' = '.$selectorParamName;
$values[$selectorParamName] = validInt($id[$index]);
} else {
$where[] = $selector.' = ?';
$values[] = validInt($id[$index]);
$where[] = $selector.' = '.$selectorParamName;
$values[$selectorParamName] = validInt($id[$index]);
}
$index++;
}
@ -273,8 +274,10 @@ function collectData() {
}
if ( $groupSql )
$sql .= ' GROUP BY '.join( ',', array_unique( $groupSql ) );
if ( !empty($_REQUEST['sort']) )
$sql .= ' order by '.$_REQUEST['sort'];
if ( !empty($_REQUEST['sort']) ) {
$sql .= ' order by :sort';
$values[':sort'] = $_REQUEST['sort'];
}
if ( !empty($entitySpec['limit']) )
$limit = $entitySpec['limit'];
elseif ( !empty($_REQUEST['count']) )

View File

@ -28,7 +28,7 @@ if ( $action == 'login' && isset($_REQUEST['username']) && ( ZM_AUTH_TYPE == 're
if ( !$user ) {
$view = 'login';
} else {
$view = 'console';
$view = 'postlogin';
$redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=console';
}
}

View File

@ -36,25 +36,37 @@ function noCacheHeaders() {
}
function CSPHeaders($view, $nonce) {
$additionalScriptSrc = "";
switch ($view) {
case 'login': {
if (defined('ZM_OPT_USE_GOOG_RECAPTCHA')
&& defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY')
&& defined('ZM_OPT_GOOG_RECAPTCHA_SECRETKEY')
&& ZM_OPT_USE_GOOG_RECAPTCHA && ZM_OPT_GOOG_RECAPTCHA_SITEKEY && ZM_OPT_GOOG_RECAPTCHA_SECRETKEY) {
$additionalScriptSrc = "https://www.google.com";
}
// fall through
}
case 'bandwidth':
case 'blank':
case 'console':
case 'controlcap':
case 'function':
case 'log':
case 'login':
case 'logout':
case 'options':
case 'privacy':
case 'storage':
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'");
header("Content-Security-Policy: script-src 'unsafe-inline' 'self' 'nonce-$nonce' $additionalScriptSrc");
break;
}
default: {
// Use Report-Only mode on all other pages.
header("Content-Security-Policy-Report-Only: script-src 'unsafe-inline' 'self' 'nonce-$nonce'");
header("Content-Security-Policy-Report-Only: script-src 'unsafe-inline' 'self' 'nonce-$nonce' $additionalScriptSrc");
break;
}
}
@ -462,7 +474,7 @@ function makePopupButton( $url, $winName, $winSize, $buttonValue, $condition=1,
} else {
$string .= ' data-window-tag="' . htmlspecialchars($winSize) . '"';
}
if ($condition) {
if (!$condition) {
$string .= ' disabled="disabled"';
}
$string .= ($options ? (' ' . $options) : '') . '/>';
@ -2434,4 +2446,8 @@ function getAffectedIds( $name ) {
return $ids;
}
function format_duration($time, $separator=':') {
return sprintf('%02d%s%02d%s%02d', floor($time/3600), $separator, ($time/60)%60, $separator, $time%60);
}
?>

View File

@ -1,8 +1,20 @@
'use strict';
var _createClass = function() { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function(Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _createClass = function() {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor);
}
} return function(Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor;
};
}();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var Server = function() {
function Server(json) {

View File

@ -17,105 +17,112 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !window.console )
{
window.console =
if ( !window.console ) {
window.console =
{
init:function() {},
log:function() {},
debug:function() {},
info:function() {},
warn:function() {},
error:function() {}
init: function() {},
log: function() {},
debug: function() {},
info: function() {},
warn: function() {},
error: function() {}
};
}
if ( !console.debug )//IE8 has console but doesn't have console.debug so lets alias it.
console.debug = console.log;
if ( !console.debug ) {
// IE8 has console but doesn't have console.debug so lets alias it.
console.debug = console.log;
}
var reportLogs = true;
var debugParms;
var debugReq;
function logReport( level, message, file, line )
{
if ( !reportLogs )
return;
function logReport( level, message, file, line ) {
if ( !reportLogs ) {
return;
}
if ( typeof(MooTools) == "undefined" )
return;
if ( typeof(MooTools) == "undefined" ) {
return;
}
/* eslint-disable no-caller */
if ( arguments && arguments.callee && arguments.callee.caller && arguments.callee.caller.caller && arguments.callee.caller.caller.name ) {
message += ' - '+arguments.callee.caller.caller.name+'()';
}
/* eslint-enable no-caller */
if ( arguments && arguments.callee && arguments.callee.caller && arguments.callee.caller.name )
message += ' - '+arguments.callee.caller.caller.name+'()';
if ( !debugReq )
{
if ( Browser )
debugParms = "view=request&request=log&task=create&browser[name]="+Browser.name+"&browser[version]="+Browser.version+"&browser[platform]="+(Browser.Platform?Browser.Platform.name:'unknown');
else
debugParms = "view=request&request=log&task=create&browser[name]=unknown&browser[version]=unknown&browser[platform]=unknown";
debugReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'chain' } );
if ( !debugReq ) {
if ( Browser ) {
debugParms = "view=request&request=log&task=create&browser[name]="+Browser.name+"&browser[version]="+Browser.version+"&browser[platform]="+(Browser.Platform?Browser.Platform.name:'unknown');
} else {
debugParms = "view=request&request=log&task=create&browser[name]=unknown&browser[version]=unknown&browser[platform]=unknown";
}
var requestParms = debugParms;
requestParms += "&level="+level+"&message="+encodeURIComponent(message);
if ( file )
requestParms += "&file="+file;
else if ( location.search ) {
//location.search is the querystring part, so ?blah=blah but there is almost never any value to this
requestParms += "&file="+location.search;
}
if ( line )
requestParms += "&line="+line;
debugReq.send( requestParms );
debugReq = new Request.JSON( {url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'chain'} );
}
var requestParms = debugParms;
requestParms += "&level="+level+"&message="+encodeURIComponent(message);
if ( file ) {
requestParms += "&file="+file;
} else if ( location.search ) {
//location.search is the querystring part, so ?blah=blah but there is almost never any value to this
requestParms += "&file="+location.search;
}
if ( line ) {
requestParms += "&line="+line;
}
debugReq.send( requestParms );
}
function Panic( message )
{
console.error( message );
logReport( "PNC", message );
alert( "PANIC: "+message );
function Panic( message ) {
console.error( message );
logReport( "PNC", message );
alert( "PANIC: "+message );
}
function Fatal( message )
{
console.error( message );
logReport( "FAT", message );
alert( "FATAL: "+message );
function Fatal( message ) {
console.error( message );
logReport( "FAT", message );
alert( "FATAL: "+message );
}
function Error( message )
{
console.error( message );
logReport( "ERR", message );
function Error( message ) {
console.error( message );
logReport( "ERR", message );
}
function Warning( message )
{
console.warn( message );
logReport( "WAR", message );
function Warning( message ) {
console.warn( message );
logReport( "WAR", message );
}
function Info( message )
{
console.info( message );
logReport( "INF", message );
function Info( message ) {
console.info( message );
logReport( "INF", message );
}
function Debug( message )
{
console.debug( message );
//logReport( "DBG", message );
function Debug( message ) {
console.debug( message );
//logReport( "DBG", message );
}
function Dump( value, label )
{
if ( label )
console.debug( label+" => " );
console.debug( value );
function Dump( value, label ) {
if ( label ) {
console.debug( label+" => " );
}
console.debug( value );
}
window.onerror =
function( message, url, line )
{
logReport( "ERR", message, url, line );
function( message, url, line ) {
logReport( "ERR", message, url, line );
};
window.addEventListener("securitypolicyviolation", function logCSP(evt) {
var level = evt.disposition == "enforce" ? "ERR" : "DBG";
var message = evt.blockedURI + " violated CSP " + evt.violatedDirective;
if (evt.sample) {
message += " (Sample: " + evt.sample + ")";
}
logReport(level, message, evt.sourceFile, evt.lineNumber);
});

View File

@ -6,15 +6,11 @@ var zmMooToolsVersion = '1.3.2';
/*
* Firstly, lets check that mootools has been included and thus is present
*/
if ( typeof(MooTools) == "undefined" )
{
alert( "MooTools not found! Please check that it was installed correctly in ZoneMinder web root." );
}
else
{
/* Version check */
if ( MooTools.version < zmMooToolsVersion )
{
alert( "MooTools version "+MooTools.version+" found.\nVersion "+zmMooToolsVersion+" required, please check that it was installed correctly in ZoneMinder web root." );
}
if ( typeof(MooTools) == "undefined" ) {
alert( "MooTools not found! Please check that it was installed correctly in ZoneMinder web root." );
} else {
/* Version check */
if ( MooTools.version < zmMooToolsVersion ) {
alert( "MooTools version "+MooTools.version+" found.\nVersion "+zmMooToolsVersion+" required, please check that it was installed correctly in ZoneMinder web root." );
}
}

View File

@ -1,133 +1,118 @@
var Overlay = new Class({
Implements: [Options, Events],
initialize: function( id, options )
{
this.setOptions( options );
Implements: [Options, Events],
initialize: function( id, options ) {
this.setOptions( options );
this.mask = new Mask( document.body, { 'maskMargins': false, 'class': 'overlayMask' } );
this.mask = new Mask( document.body, {'maskMargins': false, 'class': 'overlayMask'} );
this.id = id?id:'overlay';
if ( typeOf(this.id) == 'string' )
{
if ( $(this.id) )
this.element = $(this.id);
}
else
{
this.element = this.id;
this.id = this.element.get('id');
}
if ( !this.element )
{
this.element = new Element( 'div', { 'id': this.id, 'class': 'overlay', 'styles': { 'display': 'none' } } );
if ( this.options.title || this.options.buttons )
{
var overlayHeader = new Element( 'div', { 'class': 'overlayHeader' } );
if ( this.options.title )
{
var overlayTitle = new Element( 'div', { 'class': 'overlayTitle', 'text': this.options.title } );
overlayHeader.grab( overlayTitle );
}
if ( this.options.buttons )
{
var overlayToolbar = new Element( 'div', { 'class': 'overlayToolbar' } );
this.options.buttons.each(
function( button )
{
var overlayButton = new Element( 'button', { 'text': button.text } );
if ( button.id )
overlayButton.setProperty( 'id', button.id );
if ( button.events )
overlayButton.set( 'events', events );
overlayToolbar.grab( overlayButton );
}
);
overlayHeader.grab( overlayTitle );
}
this.element.grab( overlayHeader );
var overlayBody = new Element( 'div', { 'class': 'overlayBody' } );
var overlayContent = new Element( 'div', { 'class': 'overlayContent' } );
overlayContent.grab( this.options.content );
overlayBody.grab( overlayContent );
this.element.grab( overlayBody );
}
this.target = document.id(this.options.target) || document.id(document.body);
this.element.inject( this.target );
}
},
show: function()
{
this.mask.show();
$(window).addEvent( 'resize', this.update.bind(this) );
$(window).addEvent( 'scroll', this.update.bind(this) );
this.element.tween( 'opacity', [0, 1.0] );
this.element.show();
this.element.position();
this.mask.position();
},
hideComplete: function()
{
$(window).removeEvent( 'resize', this.update.bind(this) );
$(window).removeEvent( 'scroll', this.update.bind(this) );
this.element.hide();
this.mask.hide();
},
hide: function()
{
new Fx.Tween( this.element, { duration: 400, transition: Fx.Transitions.Sine, onComplete: this.hideComplete.bind(this) } ).start( 'opacity', 1.0, 0 );
},
update: function()
{
this.element.position();
this.mask.position();
},
showAnimation:function()
{
showOverlay();
//console.log( "Showing overlay loading" );
if ( !this.loading )
{
this.loading = new Element( 'div', { 'id': 'loading'+this.key, 'styles': { 'display':'none' } } );
this.loading.grab( this.loadingImage );
document.body.grab( this.loading );
}
updateOverlayLoading();
this.loading.setStyle( 'display', 'block' );
$(window).addEvent( 'resize', this.update.bind(this) );
$(window).addEvent( 'scroll', this.update.bind(this) );
},
hideAnimation:function()
{
$(window).removeEvent( 'resize', this.update.bind(this) );
$(window).removeEvent( 'scroll', this.update.bind(this) );
if ( this.loading )
this.loading.setStyle( 'display', 'none' );
this.id = id?id:'overlay';
if ( typeOf(this.id) == 'string' ) {
if ( $(this.id) ) {
this.element = $(this.id);
}
} else {
this.element = this.id;
this.id = this.element.get('id');
}
if ( !this.element ) {
this.element = new Element( 'div', {'id': this.id, 'class': 'overlay', 'styles': {'display': 'none'}} );
if ( this.options.title || this.options.buttons ) {
var overlayHeader = new Element( 'div', {'class': 'overlayHeader'} );
if ( this.options.title ) {
var overlayTitle = new Element( 'div', {'class': 'overlayTitle', 'text': this.options.title} );
overlayHeader.grab( overlayTitle );
}
if ( this.options.buttons ) {
var overlayToolbar = new Element( 'div', {'class': 'overlayToolbar'} );
this.options.buttons.each(
function( button ) {
var overlayButton = new Element( 'button', {'text': button.text} );
if ( button.id ) {
overlayButton.setProperty( 'id', button.id );
}
if ( button.events ) {
overlayButton.set( 'events', events );
}
overlayToolbar.grab( overlayButton );
}
);
overlayHeader.grab( overlayTitle );
}
this.element.grab( overlayHeader );
var overlayBody = new Element( 'div', {'class': 'overlayBody'} );
var overlayContent = new Element( 'div', {'class': 'overlayContent'} );
overlayContent.grab( this.options.content );
overlayBody.grab( overlayContent );
this.element.grab( overlayBody );
}
this.target = document.id(this.options.target) || document.id(document.body);
this.element.inject( this.target );
}
},
show: function() {
this.mask.show();
window.addEventListener( 'resize', this.update.bind(this) );
window.addEventListener( 'scroll', this.update.bind(this) );
this.element.tween( 'opacity', [0, 1.0] );
this.element.show();
this.element.position();
this.mask.position();
},
hideComplete: function() {
this.element.hide();
this.mask.hide();
},
hide: function() {
new Fx.Tween( this.element, {duration: 400, transition: Fx.Transitions.Sine, onComplete: this.hideComplete.bind(this)} ).start( 'opacity', 1.0, 0 );
},
update: function() {
this.element.position();
this.mask.position();
},
showAnimation: function() {
showOverlay();
//console.log( "Showing overlay loading" );
if ( !this.loading ) {
this.loading = new Element( 'div', {'id': 'loading'+this.key, 'styles': {'display': 'none'}} );
this.loading.grab( this.loadingImage );
document.body.grab( this.loading );
}
updateOverlayLoading();
this.loading.setStyle( 'display', 'block' );
window.addEventListener( 'resize', this.update.bind(this) );
window.addEventListener( 'scroll', this.update.bind(this) );
},
hideAnimation: function() {
if ( this.loading ) {
this.loading.setStyle( 'display', 'none' );
}
}
});
function setupOverlays()
{
try {
function setupOverlays() {
try {
$$('.overlay').each(
function( overlay )
{
overlay.element = new Overlay( overlay.get('id') );
overlay.getElements('.overlayCloser').each(
function( closer )
{
closer.addEvent( 'click', function() { overlay.element.hide(); } );
}
);
overlay.overlayShow = function() { overlay.element.show(); };
overlay.overlayHide = function() { overlay.element.hide(); };
function( overlay ) {
overlay.element = new Overlay( overlay.get('id') );
overlay.getElements('.overlayCloser').each(
function( closer ) {
closer.addEvent( 'click', function() {
overlay.element.hide();
} );
}
);
overlay.overlayShow = function() {
overlay.element.show();
};
overlay.overlayHide = function() {
overlay.element.hide();
};
}
);
}
catch ( e )
{
alert( e );
}
} catch ( e ) {
alert( e );
}
}
window.addEvent( 'domready', setupOverlays );
window.addEventListener( 'DOMContentLoaded', setupOverlays );

View File

@ -293,9 +293,9 @@ function exportEventImages($event, $exportDetail, $exportFrames, $myfilelist) {
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var eventWidth = <?php echo $event->Width()?>;
var eventHeight = <?php echo $event->Height()?>;
var variableslide=[<?php echo $slides?>];
var eventWidth = <?php echo $event->Width(); ?>;
var eventHeight = <?php echo $event->Height(); ?>;
var variableslide=[<?php echo $slides; ?>];
//configure the below 3 variables to set the dimension/background color of the slideshow

View File

@ -121,11 +121,11 @@ echo output_link_if_exists( array(
<script src="<?php echo cache_bust('js/Server.js'); ?>"></script>
<script nonce="<?php echo $cspNonce; ?>">
jQuery(document).ready(function(){
jQuery("#flip").click(function(){
jQuery(document).ready(function() {
jQuery("#flip").click(function() {
jQuery("#panel").slideToggle("slow");
jQuery("#flip").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
Cookie.write( 'zmHeaderFlip', jQuery('#flip').hasClass('glyphicon-menu-up') ? 'up' : 'down', { duration: 10*365 } );
Cookie.write( 'zmHeaderFlip', jQuery('#flip').hasClass('glyphicon-menu-up') ? 'up' : 'down', {duration: 10*365} );
});
});
var $j = jQuery.noConflict();

View File

@ -23,51 +23,53 @@
//
// Javascript window sizes
/* eslint-disable key-spacing */
var popupSizes = {
'bandwidth': { 'width': 300, 'height': 200 },
'console': { 'width': 750, 'height': 312 },
'control': { 'width': 380, 'height': 480 },
'controlcaps': { 'width': 780, 'height': 320 },
'controlcap': { 'width': 400, 'height': 400 },
'cycle': { 'addWidth': 32, 'minWidth': 384, 'addHeight': 62 },
'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 },
'download': { 'width': 350, 'height': 315 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 420 },
'events': { 'width': 1220, 'height': 780 },
'export': { 'width': 400, 'height': 340 },
'filter': { 'width': 900, 'height': 700 },
'frame': { 'addWidth': 32, 'minWidth': 384, 'addHeight': 200 },
'frames': { 'addWidth': 600, 'addHeight': 600 },
'function': { 'width': 350, 'height': 260 },
'group': { 'width': 760, 'height': 600 },
'groups': { 'width': 540, 'height': 420 },
'image': { 'addWidth': 48, 'addHeight': 80 },
'log': { 'width': 1080, 'height': 720 },
'login': { 'width': 720, 'height': 480 },
'logout': { 'width': 260, 'height': 150 },
'monitor': { 'width': 800, 'height': 780 },
'monitorpreset':{ 'width': 440, 'height': 210 },
'monitorprobe': { 'width': 500, 'height': 275 },
'monitorselect':{ 'width': 160, 'height': 200 },
'montage': { 'width': -1, 'height': -1 },
'onvifprobe': { 'width': 700, 'height': 550 },
'optionhelp': { 'width': 400, 'height': 400 },
'options': { 'width': 1000, 'height': 660 },
'preset': { 'width': 300, 'height': 220 },
'server': { 'width': 600, 'height': 405 },
'settings': { 'width': 220, 'height': 235 },
'state': { 'width': 400, 'height': 170 },
'stats': { 'width': 840, 'height': 200 },
'storage': { 'width': 600, 'height': 405 },
'timeline': { 'width': 760, 'height': 540 },
'user': { 'width': 360, 'height': 720 },
'version': { 'width': 360, 'height': 185 },
'video': { 'width': 420, 'height': 360 },
'videoview': { 'addWidth': 48, 'addHeight': 80 },
'watch': { 'addWidth': 96, 'minWidth': 420, 'addHeight': 384 },
'zone': { 'addWidth': 520, 'addHeight': 260, 'minHeight': 600 },
'zones': { 'addWidth': 72, 'addHeight': 232 }
'bandwidth': {'width': 300, 'height': 200},
'console': {'width': 750, 'height': 312},
'control': {'width': 380, 'height': 480},
'controlcaps': {'width': 780, 'height': 320},
'controlcap': {'width': 400, 'height': 400},
'cycle': {'addWidth': 32, 'minWidth': 384, 'addHeight': 62},
'device': {'width': 260, 'height': 150},
'devices': {'width': 400, 'height': 240},
'donate': {'width': 500, 'height': 280},
'download': {'width': 350, 'height': 315},
'event': {'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540},
'eventdetail': {'width': 600, 'height': 420},
'events': {'width': 1220, 'height': 780},
'export': {'width': 400, 'height': 340},
'filter': {'width': 900, 'height': 700},
'frame': {'addWidth': 32, 'minWidth': 384, 'addHeight': 200},
'frames': {'addWidth': 600, 'addHeight': 600},
'function': {'width': 350, 'height': 260},
'group': {'width': 760, 'height': 600},
'groups': {'width': 540, 'height': 420},
'image': {'addWidth': 48, 'addHeight': 80},
'log': {'width': 1080, 'height': 720},
'login': {'width': 720, 'height': 480},
'logout': {'width': 260, 'height': 150},
'monitor': {'width': 800, 'height': 780},
'monitorpreset':{'width': 440, 'height': 210},
'monitorprobe': {'width': 500, 'height': 275},
'monitorselect':{'width': 160, 'height': 200},
'montage': {'width': -1, 'height': -1},
'onvifprobe': {'width': 700, 'height': 550},
'optionhelp': {'width': 400, 'height': 400},
'options': {'width': 1000, 'height': 660},
'preset': {'width': 300, 'height': 220},
'server': {'width': 600, 'height': 405},
'settings': {'width': 220, 'height': 235},
'state': {'width': 400, 'height': 170},
'stats': {'width': 840, 'height': 200},
'storage': {'width': 600, 'height': 405},
'timeline': {'width': 760, 'height': 540},
'user': {'width': 360, 'height': 720},
'version': {'width': 360, 'height': 185},
'video': {'width': 420, 'height': 360},
'videoview': {'addWidth': 48, 'addHeight': 80},
'watch': {'addWidth': 96, 'minWidth': 420, 'addHeight': 384},
'zone': {'addWidth': 520, 'addHeight': 260, 'minHeight': 600},
'zones': {'addWidth': 72, 'addHeight': 232}
};
/* eslint-enable key-spacing */

View File

@ -23,52 +23,54 @@
//
// Javascript window sizes
/* eslint-disable key-spacing */
var popupSizes = {
'bandwidth': { 'width': 300, 'height': 220 },
'console': { 'width': 750, 'height': 312 },
'control': { 'width': 380, 'height': 480 },
'controlcaps': { 'width': 780, 'height': 320 },
'controlcap': { 'width': 400, 'height': 400 },
'cycle': { 'addWidth': 32, 'minWidth': 384, 'addHeight': 62 },
'device': { 'width': 260, 'height': 150 },
'devices': { 'width': 400, 'height': 240 },
'donate': { 'width': 500, 'height': 280 },
'download': { 'width': 350, 'height': 215 },
'event': { 'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540 },
'eventdetail': { 'width': 600, 'height': 420 },
'events': { 'width': 1020, 'height': 780 },
'export': { 'width': 400, 'height': 340 },
'filter': { 'width': 820, 'height': 700 },
'frame': { 'addWidth': 32, 'minWidth': 384, 'addHeight': 200 },
'frames': { 'width': 600, 'height': 700 },
'function': { 'width': 400, 'height': 250 },
'group': { 'width': 660, 'height': 520 },
'groups': { 'width': 440, 'height': 220 },
'image': { 'addWidth': 48, 'addHeight': 80 },
'log': { 'width': 1080, 'height': 720 },
'login': { 'width': 720, 'height': 480 },
'logout': { 'width': 460, 'height': 300 },
'monitor': { 'width': 700, 'height': 680 },
'monitorpreset':{ 'width': 440, 'height': 200 },
'monitorprobe': { 'width': 500, 'height': 240 },
'monitorselect':{ 'width': 160, 'height': 200 },
'monitors': { 'width': 300, 'height': 640 },
'montage': { 'width': -1, 'height': -1 },
'onvifprobe': { 'width': 700, 'height': 550 },
'optionhelp': { 'width': 400, 'height': 320 },
'options': { 'width': 1000, 'height': 660 },
'preset': { 'width': 300, 'height': 120 },
'server': { 'width': 600, 'height': 405 },
'settings': { 'width': 220, 'height': 225 },
'state': { 'width': 370, 'height': 134 },
'stats': { 'width': 840, 'height': 200 },
'storage': { 'width': 600, 'height': 405 },
'timeline': { 'width': 760, 'height': 540 },
'user': { 'width': 360, 'height': 720 },
'version': { 'width': 360, 'height': 140 },
'video': { 'width': 420, 'height': 360 },
'videoview': { 'addWidth': 48, 'addHeight': 80 },
'watch': { 'addWidth': 96, 'minWidth': 420, 'addHeight': 384 },
'zone': { 'addWidth': 450, 'addHeight': 200, 'minHeight': 450 },
'zones': { 'addWidth': 72, 'addHeight': 232 }
'bandwidth': {'width': 300, 'height': 220},
'console': {'width': 750, 'height': 312},
'control': {'width': 380, 'height': 480},
'controlcaps': {'width': 780, 'height': 320},
'controlcap': {'width': 400, 'height': 400},
'cycle': {'addWidth': 32, 'minWidth': 384, 'addHeight': 62},
'device': {'width': 260, 'height': 150},
'devices': {'width': 400, 'height': 240},
'donate': {'width': 500, 'height': 280},
'download': {'width': 350, 'height': 215},
'event': {'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540},
'eventdetail': {'width': 600, 'height': 420},
'events': {'width': 1020, 'height': 780},
'export': {'width': 400, 'height': 340},
'filter': {'width': 820, 'height': 700},
'frame': {'addWidth': 32, 'minWidth': 384, 'addHeight': 200},
'frames': {'width': 600, 'height': 700},
'function': {'width': 400, 'height': 250},
'group': {'width': 660, 'height': 520},
'groups': {'width': 440, 'height': 220},
'image': {'addWidth': 48, 'addHeight': 80},
'log': {'width': 1080, 'height': 720},
'login': {'width': 720, 'height': 480},
'logout': {'width': 460, 'height': 300},
'monitor': {'width': 700, 'height': 680},
'monitorpreset':{'width': 440, 'height': 200},
'monitorprobe': {'width': 500, 'height': 240},
'monitorselect':{'width': 160, 'height': 200},
'monitors': {'width': 300, 'height': 640},
'montage': {'width': -1, 'height': -1},
'onvifprobe': {'width': 700, 'height': 550},
'optionhelp': {'width': 400, 'height': 320},
'options': {'width': 1000, 'height': 660},
'preset': {'width': 300, 'height': 120},
'server': {'width': 600, 'height': 405},
'settings': {'width': 220, 'height': 225},
'state': {'width': 370, 'height': 134},
'stats': {'width': 840, 'height': 200},
'storage': {'width': 600, 'height': 405},
'timeline': {'width': 760, 'height': 540},
'user': {'width': 360, 'height': 720},
'version': {'width': 360, 'height': 140},
'video': {'width': 420, 'height': 360},
'videoview': {'addWidth': 48, 'addHeight': 80},
'watch': {'addWidth': 96, 'minWidth': 420, 'addHeight': 384},
'zone': {'addWidth': 450, 'addHeight': 200, 'minHeight': 450},
'zones': {'addWidth': 72, 'addHeight': 232}
};
/* eslint-enable key-spacing */

View File

@ -1 +1 @@
jquery-1.11.3.js
jquery-2.2.4.js

View File

@ -1 +1 @@
http://code.jquery.com/jquery-1.11.3.js
https://code.jquery.com/jquery-2.2.4.js

View File

@ -26,47 +26,52 @@ var popupOptions = "resizable,scrollbars,status=no,toolbar=yes";
function checkSize() {
if ( 0 ) {
if (window.outerHeight) {
var w = window.outerWidth;
var prevW = w;
var h = window.outerHeight;
var prevH = h;
if (h > screen.availHeight)
h = screen.availHeight;
if (w > screen.availWidth)
w = screen.availWidth;
if (w != prevW || h != prevH)
window.resizeTo(w, h);
}
if (window.outerHeight) {
var w = window.outerWidth;
var prevW = w;
var h = window.outerHeight;
var prevH = h;
if (h > screen.availHeight) {
h = screen.availHeight;
}
if (w > screen.availWidth) {
w = screen.availWidth;
}
if (w != prevW || h != prevH) {
window.resizeTo(w, h);
}
}
}
}
// Deprecated
function newWindow( url, name, width, height ) {
var windowId = window.open( url, name, popupOptions+",width="+width+",height="+height );
window.open( url, name, popupOptions+",width="+width+",height="+height );
}
function getPopupSize( tag, width, height ) {
if ( typeof popupSizes == 'undefined' ) {
Error( "Can't find any window sizes" );
return( { 'width': 0, 'height': 0 } );
return ( {'width': 0, 'height': 0} );
}
var popupSize = Object.clone( popupSizes[tag] );
if ( !popupSize ) {
Error( "Can't find window size for tag '"+tag+"'" );
return( { 'width': 0, 'height': 0 } );
return ( {'width': 0, 'height': 0} );
}
if ( popupSize.width && popupSize.height ) {
if ( width || height )
if ( width || height ) {
Warning( "Ignoring passed dimensions "+width+"x"+height+" when getting popup size for tag '"+tag+"'" );
return( popupSize );
}
return ( popupSize );
}
if ( popupSize.addWidth ) {
popupSize.width = popupSize.addWidth;
if ( !width )
if ( !width ) {
Error( "Got addWidth but no passed width when getting popup size for tag '"+tag+"'" );
else
} else {
popupSize.width += parseInt(width);
}
} else if ( width ) {
popupSize.width = width;
Error( "Got passed width but no addWidth when getting popup size for tag '"+tag+"'" );
@ -77,10 +82,11 @@ function getPopupSize( tag, width, height ) {
}
if ( popupSize.addHeight ) {
popupSize.height = popupSize.addHeight;
if ( !height )
if ( !height ) {
Error( "Got addHeight but no passed height when getting popup size for tag '"+tag+"'" );
else
} else {
popupSize.height += parseInt(height);
}
} else if ( height ) {
popupSize.height = height;
Error( "Got passed height but no addHeight when getting popup size for tag '"+tag+"'" );
@ -89,7 +95,7 @@ function getPopupSize( tag, width, height ) {
Warning( "Adjusting to minimum height ("+popupSize.minHeight+") when getting popup size for tag '"+tag+"' because calculated height is " + popupSize.height );
popupSize.height = popupSize.minHeight;
}
return( popupSize );
return ( popupSize );
}
function zmWindow() {
@ -105,10 +111,12 @@ function zmWindow() {
function createPopup( url, name, tag, width, height ) {
var popupSize = getPopupSize( tag, width, height );
var popupDimensions = "";
if ( popupSize.width > 0 )
if ( popupSize.width > 0 ) {
popupDimensions += ",width="+popupSize.width;
if ( popupSize.height > 0 )
}
if ( popupSize.height > 0 ) {
popupDimensions += ",height="+popupSize.height;
}
var popup = window.open( url+"&popup=1", name, popupOptions+popupDimensions );
if ( ! popup ) {
// if popup blocking is enabled, the popup won't be defined.
@ -119,6 +127,12 @@ function createPopup( url, name, tag, width, height ) {
}
$j(document).ready(function() {
$j("form.validateFormOnSubmit").submit(function onSubmit(evt) {
if (!validateForm(this)) {
evt.preventDefault();
}
});
$j(".popup-link").click(function onClick(evt) {
var el = this;
var url;
@ -137,6 +151,8 @@ $j(document).ready(function() {
evt.preventDefault();
});
$j(".tabList a").click(submitTab);
// '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");
@ -166,8 +182,9 @@ $j(document).ready(function() {
function createEventPopup( eventId, eventFilter, width, height ) {
var url = '?view=event&eid='+eventId;
if ( eventFilter )
if ( eventFilter ) {
url += eventFilter;
}
var name = 'zmEvent';
var popupSize = getPopupSize( 'event', width, height );
var popup = window.open( url, name, popupOptions+",width="+popupSize.width+",height="+popupSize.height );
@ -220,16 +237,17 @@ function refreshWindow() {
function refreshParentWindow() {
if ( refreshParent ) {
if ( window.opener ) {
if ( refreshParent == true )
if ( refreshParent == true ) {
window.opener.location.reload( true );
else
} else {
window.opener.location.href = refreshParent;
}
}
}
}
if ( currentView != 'none' && currentView != 'login' ) {
$j.ajaxSetup({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
$j.ajaxSetup({timeout: AJAX_TIMEOUT}); //sets timeout for all getJSON.
$j(document).ready(function() {
if ($j('.navbar').length) {
@ -239,15 +257,15 @@ if ( currentView != 'none' && currentView != 'login' ) {
function getNavBar() {
$j.getJSON(thisUrl + '?view=request&request=status&entity=navBar')
.done(setNavBar)
.fail(function( jqxhr, textStatus, error ) {
console.log( "Request Failed: " + textStatus + ", " + error);
if ( textStatus != "timeout" ) {
.done(setNavBar)
.fail(function( jqxhr, textStatus, error ) {
console.log( "Request Failed: " + textStatus + ", " + error);
if ( textStatus != "timeout" ) {
// The idea is that this should only fail due to auth, so reload the page
// which should go to login if it can't stay logged in.
window.location.reload( true );
}
});
window.location.reload( true );
}
});
}
function setNavBar(data) {
@ -281,45 +299,58 @@ function secsToTime( seconds ) {
} else if ( seconds < 60*60 ) {
var timeMins = parseInt(seconds/60);
var timeSecs = seconds%60;
if ( timeSecs < 10 )
if ( timeSecs < 10 ) {
timeSecs = '0'+timeSecs.toString().substr( 0, 4 );
else
} else {
timeSecs = timeSecs.toString().substr( 0, 5 );
}
timeString = timeMins+":"+timeSecs;
} else {
var timeHours = parseInt(seconds/3600);
var timeMins = (seconds%3600)/60;
var timeSecs = seconds%60;
if ( timeMins < 10 )
if ( timeMins < 10 ) {
timeMins = '0'+timeMins.toString().substr( 0, 4 );
else
} else {
timeMins = timeMins.toString().substr( 0, 5 );
if ( timeSecs < 10 )
}
if ( timeSecs < 10 ) {
timeSecs = '0'+timeSecs.toString().substr( 0, 4 );
else
} else {
timeSecs = timeSecs.toString().substr( 0, 5 );
}
timeString = timeHours+":"+timeMins+":"+timeSecs;
}
return( timeString );
return ( timeString );
}
function submitTab( tab ) {
function submitTab(evt) {
var tab = this.getAttribute("data-tab-name");
var form = $('contentForm');
form.action.value = "";
form.tab.value = tab;
form.submit();
evt.preventDefault();
}
function submitThisForm() {
this.form.submit();
}
function toggleCheckbox( element, name ) {
var form = element.form;
var checked = element.checked;
for (var i = 0; i < form.elements.length; i++)
if (form.elements[i].name.indexOf(name) == 0)
form.elements[i].checked = checked;
/**
* @param {Element} headerCheckbox The select all/none checkbox that was just toggled.
* @param {DOMString} name The name of the checkboxes to toggle.
*/
function updateFormCheckboxesByName( headerCheckbox ) {
var name = headerCheckbox.getAttribute("data-checkbox-name");
var form = headerCheckbox.form;
var checked = headerCheckbox.checked;
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf(name) == 0) {
form.elements[i].checked = checked;
}
}
setButtonStates(headerCheckbox);
}
function configureDeleteButton( element ) {
@ -339,7 +370,7 @@ function configureDeleteButton( element ) {
}
function confirmDelete( message ) {
return( confirm( message?message:'Are you sure you wish to delete?' ) );
return ( confirm( message?message:'Are you sure you wish to delete?' ) );
}
if ( refreshParent ) {
@ -353,13 +384,13 @@ if ( closePopup ) {
closeWindow();
}
window.addEvent( 'domready', checkSize );
window.addEventListener( 'DOMContentLoaded', checkSize );
function convertLabelFormat(LabelFormat, monitorName) {
//convert label format from strftime to moment's format (modified from
//https://raw.githubusercontent.com/benjaminoakes/moment-strftime/master/lib/moment-strftime.js
//added %f and %N below (TODO: add %Q)
var replacements = { "a": 'ddd', "A": 'dddd', "b": 'MMM', "B": 'MMMM', "d": 'DD', "e": 'D', "F": 'YYYY-MM-DD', "H": 'HH', "I": 'hh', "j": 'DDDD', "k": 'H', "l": 'h', "m": 'MM', "M": 'mm', "p": 'A', "S": 'ss', "u": 'E', "w": 'd', "W": 'WW', "y": 'YY', "Y": 'YYYY', "z": 'ZZ', "Z": 'z', 'f': 'SS', 'N': "["+monitorName+"]", '%': '%' };
var replacements = {"a": 'ddd', "A": 'dddd', "b": 'MMM', "B": 'MMMM', "d": 'DD', "e": 'D', "F": 'YYYY-MM-DD', "H": 'HH', "I": 'hh', "j": 'DDDD', "k": 'H', "l": 'h', "m": 'MM', "M": 'mm', "p": 'A', "S": 'ss', "u": 'E', "w": 'd', "W": 'WW', "y": 'YY', "Y": 'YYYY', "z": 'ZZ', "Z": 'z', 'f': 'SS', 'N': "["+monitorName+"]", '%': '%'};
var momentLabelFormat = Object.keys(replacements).reduce(function(momentFormat, key) {
var value = replacements[key];
return momentFormat.replace("%" + key, value);
@ -374,31 +405,31 @@ function addVideoTimingTrack(video, LabelFormat, monitorName, duration, startTim
startTime = moment(startTime);
for (var i = 0; i <= duration; i++) {
cues[i] = {id: i, index: i, startTime: i, Ca: i+1, text: startTime.format(labelFormat)};
cues[i] = {id: i, index: i, startTime: i, endTime: i+1, text: startTime.format(labelFormat)};
startTime.add(1, 's');
}
}
/*
var labelFormat = convertLabelFormat(LabelFormat, monitorName);
var webvttformat = 'HH:mm:ss.SSS', webvttdata="WEBVTT\n\n";
var labelFormat = convertLabelFormat(LabelFormat, monitorName);
var webvttformat = 'HH:mm:ss.SSS', webvttdata="WEBVTT\n\n";
startTime = moment(startTime);
startTime = moment(startTime);
var seconds = moment({s:0}), endduration = moment({s:duration});
while(seconds.isBefore(endduration)){
webvttdata += seconds.format(webvttformat) + " --> ";
seconds.add(1,'s');
webvttdata += seconds.format(webvttformat) + "\n";
webvttdata += startTime.format(labelFormat) + "\n\n";
startTime.add(1, 's');
}
var track = document.createElement('track');
track.kind = "captions";
track.srclang = "en";
track.label = "English";
track['default'] = true;
track.src = 'data:plain/text;charset=utf-8,'+encodeURIComponent(webvttdata);
video.appendChild(track);
var seconds = moment({s:0}), endduration = moment({s:duration});
while(seconds.isBefore(endduration)){
webvttdata += seconds.format(webvttformat) + " --> ";
seconds.add(1,'s');
webvttdata += seconds.format(webvttformat) + "\n";
webvttdata += startTime.format(labelFormat) + "\n\n";
startTime.add(1, 's');
}
var track = document.createElement('track');
track.kind = "captions";
track.srclang = "en";
track.label = "English";
track['default'] = true;
track.src = 'data:plain/text;charset=utf-8,'+encodeURIComponent(webvttdata);
video.appendChild(track);
}
*/
@ -410,11 +441,11 @@ function endOfResize(e) {
}
function scaleToFit(baseWidth, baseHeight, scaleEl, bottomEl) {
$j(window).on('resize', endOfResize); //set delayed scaling when Scale to Fit is selected
$j(window).on('resize', endOfResize); //set delayed scaling when Scale to Fit is selected
var ratio = baseWidth / baseHeight;
var container = $j('#content');
var viewPort = $j(window);
// jquery does not provide a bottom offet, and offset dows not include margins. outerHeight true minus false gives total vertical margins.
// jquery does not provide a bottom offet, and offset dows not include margins. outerHeight true minus false gives total vertical margins.
var bottomLoc = bottomEl.offset().top + (bottomEl.outerHeight(true) - bottomEl.outerHeight()) + bottomEl.outerHeight(true);
var newHeight = viewPort.height() - (bottomLoc - scaleEl.outerHeight(true));
var newWidth = ratio * newHeight;
@ -423,7 +454,9 @@ function scaleToFit(baseWidth, baseHeight, scaleEl, bottomEl) {
newHeight = newWidth / ratio;
}
var autoScale = Math.round(newWidth / baseWidth * SCALE_BASE);
var scales = $j('#scale option').map(function() {return parseInt($j(this).val());}).get();
var scales = $j('#scale option').map(function() {
return parseInt($j(this).val());
}).get();
scales.shift();
var closest;
$j(scales).each(function() { //Set zms scale to nearest regular scale. Zoom does not like arbitrary scale values.

View File

@ -46,6 +46,8 @@ foreach ( $storage_areas as $S ) {
$html =
'
<div class="controlHeader">
<!-- Used to submit the form with the enter key -->
<input type="submit" class="hide"/>
<input type="hidden" name="filtering" value=""/>
';
@ -93,7 +95,7 @@ if ( ! empty($user['MonitorIds']) ) {
}
$html .= '<span class="MonitorNameFilter"><label>'.translate('Name').'</label>';
$html .= '<input type="text" name="MonitorName" value="'.(isset($_SESSION['MonitorName'])?$_SESSION['MonitorName']:'').'" onkeydown="if(event&&event.keyCode==13){this.form.submit();}" placeholder="text or regular expression"/>';
$html .= '<input type="text" name="MonitorName" value="'.(isset($_SESSION['MonitorName'])?$_SESSION['MonitorName']:'').'" placeholder="text or regular expression"/>';
$html .= '</span>';
$Functions = array();
@ -158,7 +160,7 @@ $html .= htmlSelect( 'Status[]', $status_options,
$html .= '</span>';
$html .= '<span class="SourceFilter"><label>'.translate('Source').'</label>';
$html .= '<input type="text" name="Source" value="'.(isset($_SESSION['Source'])?$_SESSION['Source']:'').'" onkeydown="if(event&&event.keyCode==13){this.form.submit();}" placeholder="text or regular expression"/>';
$html .= '<input type="text" name="Source" value="'.(isset($_SESSION['Source'])?$_SESSION['Source']:'').'" placeholder="text or regular expression"/>';
$html .= '</span>';
$sql = 'SELECT *,S.Status AS Status, S.CaptureFPS AS CaptureFPS, S.AnalysisFPS AS AnalysisFPS, S.CaptureBandwidth AS CaptureBandwidth

View File

@ -219,7 +219,7 @@ ob_start();
?>
<th class="colZones"><?php echo translate('Zones') ?></th>
<?php if ( canEdit('Monitors') ) { ?>
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" onclick="toggleCheckbox(this, 'markMids[]');setButtonStates(this);"/> <?php echo translate('All') ?></th>
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" data-checkbox-name="markMids[]" data-on-click-this="updateFormCheckboxesByName"/> <?php echo translate('All') ?></th>
<?php } ?>
</tr>
</thead>

View File

@ -23,17 +23,18 @@ if ( !canView( 'Control' ) ) {
return;
}
$params = array();
$groupSql = '';
if ( !empty($_REQUEST['group']) ) {
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($_REQUEST['group']) );
$groupSql = " and find_in_set( Id, '".$row['MonitorIds']."' )";
$groupSql = " AND gm.GroupId = :groupid";
$params[":groupid"] = $_REQUEST['group'];
}
$mid = !empty($_REQUEST['mid']) ? validInt($_REQUEST['mid']) : 0;
$sql = "SELECT * FROM Monitors WHERE Function != 'None' AND Controllable = 1$groupSql ORDER BY Sequence";
$sql = "SELECT m.* FROM Monitors m INNER JOIN Groups_Monitors AS gm ON m.Id = gm.MonitorId WHERE m.Function != 'None' AND m.Controllable = 1$groupSql ORDER BY Sequence";
$mids = array();
foreach( dbFetchAll( $sql ) as $row ) {
foreach( dbFetchAll( $sql, false, $params ) as $row ) {
if ( !visibleMonitor( $row['Id'] ) ) {
continue;
}

View File

@ -160,7 +160,7 @@ xhtmlHeaders(__FILE__, translate('ControlCap')." - ".$newControl['Name'] );
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('ControlCap') ?> - <?php echo $newControl['Name'] ?></h2>
<h2><?php echo translate('ControlCap') ?> - <?php echo validHtmlStr($newControl['Name']) ?></h2>
</div>
<div id="content">
<ul class="tabList">
@ -176,14 +176,14 @@ foreach ( $tabs as $name=>$value )
else
{
?>
<li><a href="#" onclick="submitTab( '<?php echo $name ?>' ); return( false );"><?php echo $value ?></a></li>
<li><a href="#" data-tab-name="<?php echo $name ?>"><?php echo $value ?></a></li>
<?php
}
}
?>
</ul>
<div class="clear"></div>
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm( this )">
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" class="validateFormOnSubmit">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
<input type="hidden" name="action" value="controlcap"/>
@ -215,30 +215,30 @@ if ( $tab != 'pan' )
{
?>
<input type="hidden" name="newControl[CanPan]" value="<?php echo !empty($newControl['CanPan']) ?>"/>
<input type="hidden" name="newControl[MinPanRange]" value="<?php echo $newControl['MinPanRange'] ?>"/>
<input type="hidden" name="newControl[MaxPanRange]" value="<?php echo $newControl['MaxPanRange'] ?>"/>
<input type="hidden" name="newControl[MinPanStep]" value="<?php echo $newControl['MinPanStep'] ?>"/>
<input type="hidden" name="newControl[MaxPanStep]" value="<?php echo $newControl['MaxPanStep'] ?>"/>
<input type="hidden" name="newControl[MinPanRange]" value="<?php echo validHtmlStr($newControl['MinPanRange']) ?>"/>
<input type="hidden" name="newControl[MaxPanRange]" value="<?php echo validHtmlStr($newControl['MaxPanRange']) ?>"/>
<input type="hidden" name="newControl[MinPanStep]" value="<?php echo validHtmlStr($newControl['MinPanStep']) ?>"/>
<input type="hidden" name="newControl[MaxPanStep]" value="<?php echo validHtmlStr($newControl['MaxPanStep']) ?>"/>
<input type="hidden" name="newControl[HasPanSpeed]" value="<?php echo !empty($newControl['HasPanSpeed']) ?>"/>
<input type="hidden" name="newControl[MinPanSpeed]" value="<?php echo $newControl['MinPanSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxPanSpeed]" value="<?php echo $newControl['MaxPanSpeed'] ?>"/>
<input type="hidden" name="newControl[MinPanSpeed]" value="<?php echo validHtmlStr($newControl['MinPanSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxPanSpeed]" value="<?php echo validHtmlStr($newControl['MaxPanSpeed']) ?>"/>
<input type="hidden" name="newControl[HasTurboPan]" value="<?php echo !empty($newControl['HasTurboPan']) ?>"/>
<input type="hidden" name="newControl[TurboPanSpeed]" value="<?php echo $newControl['TurboPanSpeed'] ?>"/>
<input type="hidden" name="newControl[TurboPanSpeed]" value="<?php echo validHtmlStr($newControl['TurboPanSpeed']) ?>"/>
<?php
}
if ( $tab != 'tilt' )
{
?>
<input type="hidden" name="newControl[CanTilt]" value="<?php echo !empty($newControl['CanTilt']) ?>"/>
<input type="hidden" name="newControl[MinTiltRange]" value="<?php echo $newControl['MinTiltRange'] ?>"/>
<input type="hidden" name="newControl[MaxTiltRange]" value="<?php echo $newControl['MaxTiltRange'] ?>"/>
<input type="hidden" name="newControl[MinTiltStep]" value="<?php echo $newControl['MinTiltStep'] ?>"/>
<input type="hidden" name="newControl[MaxTiltStep]" value="<?php echo $newControl['MaxTiltStep'] ?>"/>
<input type="hidden" name="newControl[MinTiltRange]" value="<?php echo validHtmlStr($newControl['MinTiltRange']) ?>"/>
<input type="hidden" name="newControl[MaxTiltRange]" value="<?php echo validHtmlStr($newControl['MaxTiltRange']) ?>"/>
<input type="hidden" name="newControl[MinTiltStep]" value="<?php echo validHtmlStr($newControl['MinTiltStep']) ?>"/>
<input type="hidden" name="newControl[MaxTiltStep]" value="<?php echo validHtmlStr($newControl['MaxTiltStep']) ?>"/>
<input type="hidden" name="newControl[HasTiltSpeed]" value="<?php echo !empty($newControl['HasTiltSpeed']) ?>"/>
<input type="hidden" name="newControl[MinTiltSpeed]" value="<?php echo $newControl['MinTiltSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxTiltSpeed]" value="<?php echo $newControl['MaxTiltSpeed'] ?>"/>
<input type="hidden" name="newControl[MinTiltSpeed]" value="<?php echo validHtmlStr($newControl['MinTiltSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxTiltSpeed]" value="<?php echo validHtmlStr($newControl['MaxTiltSpeed']) ?>"/>
<input type="hidden" name="newControl[HasTurboTilt]" value="<?php echo !empty($newControl['HasTurboTilt']) ?>"/>
<input type="hidden" name="newControl[TurboTiltSpeed]" value="<?php echo $newControl['TurboTiltSpeed'] ?>"/>
<input type="hidden" name="newControl[TurboTiltSpeed]" value="<?php echo validHtmlStr($newControl['TurboTiltSpeed']) ?>"/>
<?php
}
if ( $tab != 'zoom' )
@ -248,13 +248,13 @@ if ( $tab != 'zoom' )
<input type="hidden" name="newControl[CanZoomAbs]" value="<?php echo !empty($newControl['CanZoomAbs']) ?>"/>
<input type="hidden" name="newControl[CanZoomRel]" value="<?php echo !empty($newControl['CanZoomRel']) ?>"/>
<input type="hidden" name="newControl[CanZoomCon]" value="<?php echo !empty($newControl['CanZoomCon']) ?>"/>
<input type="hidden" name="newControl[MinZoomRange]" value="<?php echo $newControl['MinZoomRange'] ?>"/>
<input type="hidden" name="newControl[MaxZoomRange]" value="<?php echo $newControl['MaxZoomRange'] ?>"/>
<input type="hidden" name="newControl[MinZoomStep]" value="<?php echo $newControl['MinZoomStep'] ?>"/>
<input type="hidden" name="newControl[MaxZoomStep]" value="<?php echo $newControl['MaxZoomStep'] ?>"/>
<input type="hidden" name="newControl[MinZoomRange]" value="<?php echo validHtmlStr($newControl['MinZoomRange']) ?>"/>
<input type="hidden" name="newControl[MaxZoomRange]" value="<?php echo validHtmlStr($newControl['MaxZoomRange']) ?>"/>
<input type="hidden" name="newControl[MinZoomStep]" value="<?php echo validHtmlStr($newControl['MinZoomStep']) ?>"/>
<input type="hidden" name="newControl[MaxZoomStep]" value="<?php echo validHtmlStr($newControl['MaxZoomStep']) ?>"/>
<input type="hidden" name="newControl[HasZoomSpeed]" value="<?php echo !empty($newControl['HasZoomSpeed']) ?>"/>
<input type="hidden" name="newControl[MinZoomSpeed]" value="<?php echo $newControl['MinZoomSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxZoomSpeed]" value="<?php echo $newControl['MaxZoomSpeed'] ?>"/>
<input type="hidden" name="newControl[MinZoomSpeed]" value="<?php echo validHtmlStr($newControl['MinZoomSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxZoomSpeed]" value="<?php echo validHtmlStr($newControl['MaxZoomSpeed']) ?>"/>
<?php
}
if ( $tab != 'focus' )
@ -265,13 +265,13 @@ if ( $tab != 'focus' )
<input type="hidden" name="newControl[CanFocusAbs]" value="<?php echo !empty($newControl['CanFocusAbs']) ?>"/>
<input type="hidden" name="newControl[CanFocusRel]" value="<?php echo !empty($newControl['CanFocusRel']) ?>"/>
<input type="hidden" name="newControl[CanFocusCon]" value="<?php echo !empty($newControl['CanFocusCon']) ?>"/>
<input type="hidden" name="newControl[MinFocusRange]" value="<?php echo $newControl['MinFocusRange'] ?>"/>
<input type="hidden" name="newControl[MaxFocusRange]" value="<?php echo $newControl['MaxFocusRange'] ?>"/>
<input type="hidden" name="newControl[MinFocusStep]" value="<?php echo $newControl['MinFocusStep'] ?>"/>
<input type="hidden" name="newControl[MaxFocusStep]" value="<?php echo $newControl['MaxFocusStep'] ?>"/>
<input type="hidden" name="newControl[MinFocusRange]" value="<?php echo validHtmlStr($newControl['MinFocusRange']) ?>"/>
<input type="hidden" name="newControl[MaxFocusRange]" value="<?php echo validHtmlStr($newControl['MaxFocusRange']) ?>"/>
<input type="hidden" name="newControl[MinFocusStep]" value="<?php echo validHtmlStr($newControl['MinFocusStep']) ?>"/>
<input type="hidden" name="newControl[MaxFocusStep]" value="<?php echo validHtmlStr($newControl['MaxFocusStep']) ?>"/>
<input type="hidden" name="newControl[HasFocusSpeed]" value="<?php echo !empty($newControl['HasFocusSpeed']) ?>"/>
<input type="hidden" name="newControl[MinFocusSpeed]" value="<?php echo $newControl['MinFocusSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxFocusSpeed]" value="<?php echo $newControl['MaxFocusSpeed'] ?>"/>
<input type="hidden" name="newControl[MinFocusSpeed]" value="<?php echo validHtmlStr($newControl['MinFocusSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxFocusSpeed]" value="<?php echo validHtmlStr($newControl['MaxFocusSpeed']) ?>"/>
<?php
}
if ( $tab != 'iris' )
@ -282,13 +282,13 @@ if ( $tab != 'iris' )
<input type="hidden" name="newControl[CanIrisAbs]" value="<?php echo !empty($newControl['CanIrisAbs']) ?>"/>
<input type="hidden" name="newControl[CanIrisRel]" value="<?php echo !empty($newControl['CanIrisRel']) ?>"/>
<input type="hidden" name="newControl[CanIrisCon]" value="<?php echo !empty($newControl['CanIrisCon']) ?>"/>
<input type="hidden" name="newControl[MinIrisRange]" value="<?php echo $newControl['MinIrisRange'] ?>"/>
<input type="hidden" name="newControl[MaxIrisRange]" value="<?php echo $newControl['MaxIrisRange'] ?>"/>
<input type="hidden" name="newControl[MinIrisStep]" value="<?php echo $newControl['MinIrisStep'] ?>"/>
<input type="hidden" name="newControl[MaxIrisStep]" value="<?php echo $newControl['MaxIrisStep'] ?>"/>
<input type="hidden" name="newControl[MinIrisRange]" value="<?php echo validHtmlStr($newControl['MinIrisRange']) ?>"/>
<input type="hidden" name="newControl[MaxIrisRange]" value="<?php echo validHtmlStr($newControl['MaxIrisRange']) ?>"/>
<input type="hidden" name="newControl[MinIrisStep]" value="<?php echo validHtmlStr($newControl['MinIrisStep']) ?>"/>
<input type="hidden" name="newControl[MaxIrisStep]" value="<?php echo validHtmlStr($newControl['MaxIrisStep']) ?>"/>
<input type="hidden" name="newControl[HasIrisSpeed]" value="<?php echo !empty($newControl['HasIrisSpeed']) ?>"/>
<input type="hidden" name="newControl[MinIrisSpeed]" value="<?php echo $newControl['MinIrisSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxIrisSpeed]" value="<?php echo $newControl['MaxIrisSpeed'] ?>"/>
<input type="hidden" name="newControl[MinIrisSpeed]" value="<?php echo validHtmlStr($newControl['MinIrisSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxIrisSpeed]" value="<?php echo validHtmlStr($newControl['MaxIrisSpeed']) ?>"/>
<?php
}
if ( $tab != 'gain' )
@ -299,13 +299,13 @@ if ( $tab != 'gain' )
<input type="hidden" name="newControl[CanGainAbs]" value="<?php echo !empty($newControl['CanGainAbs']) ?>"/>
<input type="hidden" name="newControl[CanGainRel]" value="<?php echo !empty($newControl['CanGainRel']) ?>"/>
<input type="hidden" name="newControl[CanGainCon]" value="<?php echo !empty($newControl['CanGainCon']) ?>"/>
<input type="hidden" name="newControl[MinGainRange]" value="<?php echo $newControl['MinGainRange'] ?>"/>
<input type="hidden" name="newControl[MaxGainRange]" value="<?php echo $newControl['MaxGainRange'] ?>"/>
<input type="hidden" name="newControl[MinGainStep]" value="<?php echo $newControl['MinGainStep'] ?>"/>
<input type="hidden" name="newControl[MaxGainStep]" value="<?php echo $newControl['MaxGainStep'] ?>"/>
<input type="hidden" name="newControl[MinGainRange]" value="<?php echo validHtmlStr($newControl['MinGainRange']) ?>"/>
<input type="hidden" name="newControl[MaxGainRange]" value="<?php echo validHtmlStr($newControl['MaxGainRange']) ?>"/>
<input type="hidden" name="newControl[MinGainStep]" value="<?php echo validHtmlStr($newControl['MinGainStep']) ?>"/>
<input type="hidden" name="newControl[MaxGainStep]" value="<?php echo validHtmlStr($newControl['MaxGainStep']) ?>"/>
<input type="hidden" name="newControl[HasGainSpeed]" value="<?php echo !empty($newControl['HasGainSpeed']) ?>"/>
<input type="hidden" name="newControl[MinGainSpeed]" value="<?php echo $newControl['MinGainSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxGainSpeed]" value="<?php echo $newControl['MaxGainSpeed'] ?>"/>
<input type="hidden" name="newControl[MinGainSpeed]" value="<?php echo validHtmlStr($newControl['MinGainSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxGainSpeed]" value="<?php echo validHtmlStr($newControl['MaxGainSpeed']) ?>"/>
<?php
}
if ( $tab != 'white' )
@ -316,20 +316,20 @@ if ( $tab != 'white' )
<input type="hidden" name="newControl[CanWhiteAbs]" value="<?php echo !empty($newControl['CanWhiteAbs']) ?>"/>
<input type="hidden" name="newControl[CanWhiteRel]" value="<?php echo !empty($newControl['CanWhiteRel']) ?>"/>
<input type="hidden" name="newControl[CanWhiteCon]" value="<?php echo !empty($newControl['CanWhiteCon']) ?>"/>
<input type="hidden" name="newControl[MinWhiteRange]" value="<?php echo $newControl['MinWhiteRange'] ?>"/>
<input type="hidden" name="newControl[MaxWhiteRange]" value="<?php echo $newControl['MaxWhiteRange'] ?>"/>
<input type="hidden" name="newControl[MinWhiteStep]" value="<?php echo $newControl['MinWhiteStep'] ?>"/>
<input type="hidden" name="newControl[MaxWhiteStep]" value="<?php echo $newControl['MaxWhiteStep'] ?>"/>
<input type="hidden" name="newControl[MinWhiteRange]" value="<?php echo validHtmlStr($newControl['MinWhiteRange']) ?>"/>
<input type="hidden" name="newControl[MaxWhiteRange]" value="<?php echo validHtmlStr($newControl['MaxWhiteRange']) ?>"/>
<input type="hidden" name="newControl[MinWhiteStep]" value="<?php echo validHtmlStr($newControl['MinWhiteStep']) ?>"/>
<input type="hidden" name="newControl[MaxWhiteStep]" value="<?php echo validHtmlStr($newControl['MaxWhiteStep']) ?>"/>
<input type="hidden" name="newControl[HasWhiteSpeed]" value="<?php echo !empty($newControl['HasWhiteSpeed']) ?>"/>
<input type="hidden" name="newControl[MinWhiteSpeed]" value="<?php echo $newControl['MinWhiteSpeed'] ?>"/>
<input type="hidden" name="newControl[MaxWhiteSpeed]" value="<?php echo $newControl['MaxWhiteSpeed'] ?>"/>
<input type="hidden" name="newControl[MinWhiteSpeed]" value="<?php echo validHtmlStr($newControl['MinWhiteSpeed']) ?>"/>
<input type="hidden" name="newControl[MaxWhiteSpeed]" value="<?php echo validHtmlStr($newControl['MaxWhiteSpeed']) ?>"/>
<?php
}
if ( $tab != 'presets' )
{
?>
<input type="hidden" name="newControl[HasPresets]" value="<?php echo !empty($newControl['HasPresets']) ?>"/>
<input type="hidden" name="newControl[NumPresets]" value="<?php echo $newControl['NumPresets'] ?>"/>
<input type="hidden" name="newControl[NumPresets]" value="<?php echo validHtmlStr($newControl['NumPresets']) ?>"/>
<input type="hidden" name="newControl[HasHomePreset]" value="<?php echo !empty($newControl['HasHomePreset']) ?>"/>
<input type="hidden" name="newControl[CanSetPresets]" value="<?php echo !empty($newControl['CanSetPresets']) ?>"/>
<?php
@ -371,15 +371,15 @@ switch ( $tab )
{
?>
<tr><th scope="row"><?php echo translate('CanPan') ?></th><td><input type="checkbox" name="newControl[CanPan]" value="1"<?php if ( !empty($newControl['CanPan']) ) { ?> checked="checked"<?php } ?>></td></tr>
<tr><th scope="row"><?php echo translate('MinPanRange') ?></th><td><input type="text" name="newControl[MinPanRange]" value="<?php echo $newControl['MinPanRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxPanRange') ?></th><td><input type="text" name="newControl[MaxPanRange]" value="<?php echo $newControl['MaxPanRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinPanStep') ?></th><td><input type="text" name="newControl[MinPanStep]" value="<?php echo $newControl['MinPanStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxPanStep') ?></th><td><input type="text" name="newControl[MaxPanStep]" value="<?php echo $newControl['MaxPanStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinPanRange') ?></th><td><input type="text" name="newControl[MinPanRange]" value="<?php echo validHtmlStr($newControl['MinPanRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxPanRange') ?></th><td><input type="text" name="newControl[MaxPanRange]" value="<?php echo validHtmlStr($newControl['MaxPanRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinPanStep') ?></th><td><input type="text" name="newControl[MinPanStep]" value="<?php echo validHtmlStr($newControl['MinPanStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxPanStep') ?></th><td><input type="text" name="newControl[MaxPanStep]" value="<?php echo validHtmlStr($newControl['MaxPanStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasPanSpeed') ?></th><td><input type="checkbox" name="newControl[HasPanSpeed]" value="1"<?php if ( !empty($newControl['HasPanSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinPanSpeed') ?></th><td><input type="text" name="newControl[MinPanSpeed]" value="<?php echo $newControl['MinPanSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxPanSpeed') ?></th><td><input type="text" name="newControl[MaxPanSpeed]" value="<?php echo $newControl['MaxPanSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinPanSpeed') ?></th><td><input type="text" name="newControl[MinPanSpeed]" value="<?php echo validHtmlStr($newControl['MinPanSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxPanSpeed') ?></th><td><input type="text" name="newControl[MaxPanSpeed]" value="<?php echo validHtmlStr($newControl['MaxPanSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasTurboPan') ?></th><td><input type="checkbox" name="newControl[HasTurboPan]" value="1"<?php if ( !empty($newControl['HasTurboPan']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('TurboPanSpeed') ?></th><td><input type="text" name="newControl[TurboPanSpeed]" value="<?php echo $newControl['TurboPanSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('TurboPanSpeed') ?></th><td><input type="text" name="newControl[TurboPanSpeed]" value="<?php echo validHtmlStr($newControl['TurboPanSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -387,15 +387,15 @@ switch ( $tab )
{
?>
<tr><th scope="row"><?php echo translate('CanTilt') ?></th><td><input type="checkbox" name="newControl[CanTilt]" value="1"<?php if ( !empty($newControl['CanTilt']) ) { ?> checked="checked"<?php } ?>></td></tr>
<tr><th scope="row"><?php echo translate('MinTiltRange') ?></th><td><input type="text" name="newControl[MinTiltRange]" value="<?php echo $newControl['MinTiltRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxTiltRange') ?></th><td><input type="text" name="newControl[MaxTiltRange]" value="<?php echo $newControl['MaxTiltRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinTiltStep') ?></th><td><input type="text" name="newControl[MinTiltStep]" value="<?php echo $newControl['MinTiltStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxTiltStep') ?></th><td><input type="text" name="newControl[MaxTiltStep]" value="<?php echo $newControl['MaxTiltStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinTiltRange') ?></th><td><input type="text" name="newControl[MinTiltRange]" value="<?php echo validHtmlStr($newControl['MinTiltRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxTiltRange') ?></th><td><input type="text" name="newControl[MaxTiltRange]" value="<?php echo validHtmlStr($newControl['MaxTiltRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinTiltStep') ?></th><td><input type="text" name="newControl[MinTiltStep]" value="<?php echo validHtmlStr($newControl['MinTiltStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxTiltStep') ?></th><td><input type="text" name="newControl[MaxTiltStep]" value="<?php echo validHtmlStr($newControl['MaxTiltStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasTiltSpeed') ?></th><td><input type="checkbox" name="newControl[HasTiltSpeed]" value="1"<?php if ( !empty($newControl['HasTiltSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinTiltSpeed') ?></th><td><input type="text" name="newControl[MinTiltSpeed]" value="<?php echo $newControl['MinTiltSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxTiltSpeed') ?></th><td><input type="text" name="newControl[MaxTiltSpeed]" value="<?php echo $newControl['MaxTiltSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinTiltSpeed') ?></th><td><input type="text" name="newControl[MinTiltSpeed]" value="<?php echo validHtmlStr($newControl['MinTiltSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxTiltSpeed') ?></th><td><input type="text" name="newControl[MaxTiltSpeed]" value="<?php echo validHtmlStr($newControl['MaxTiltSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasTurboTilt') ?></th><td><input type="checkbox" name="newControl[HasTurboTilt]" value="1"<?php if ( !empty($newControl['HasTurboTilt']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('TurboTiltSpeed') ?></th><td><input type="text" name="newControl[TurboTiltSpeed]" value="<?php echo $newControl['TurboTiltSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('TurboTiltSpeed') ?></th><td><input type="text" name="newControl[TurboTiltSpeed]" value="<?php echo validHtmlStr($newControl['TurboTiltSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -406,13 +406,13 @@ switch ( $tab )
<tr><th scope="row"><?php echo translate('CanZoomAbs') ?></th><td><input type="checkbox" name="newControl[CanZoomAbs]" value="1"<?php if ( !empty($newControl['CanZoomAbs']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanZoomRel') ?></th><td><input type="checkbox" name="newControl[CanZoomRel]" value="1"<?php if ( !empty($newControl['CanZoomRel']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanZoomCon') ?></th><td><input type="checkbox" name="newControl[CanZoomCon]" value="1"<?php if ( !empty($newControl['CanZoomCon']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinZoomRange') ?></th><td><input type="text" name="newControl[MinZoomRange]" value="<?php echo $newControl['MinZoomRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxZoomRange') ?></th><td><input type="text" name="newControl[MaxZoomRange]" value="<?php echo $newControl['MaxZoomRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinZoomStep') ?></th><td><input type="text" name="newControl[MinZoomStep]" value="<?php echo $newControl['MinZoomStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxZoomStep') ?></th><td><input type="text" name="newControl[MaxZoomStep]" value="<?php echo $newControl['MaxZoomStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinZoomRange') ?></th><td><input type="text" name="newControl[MinZoomRange]" value="<?php echo validHtmlStr($newControl['MinZoomRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxZoomRange') ?></th><td><input type="text" name="newControl[MaxZoomRange]" value="<?php echo validHtmlStr($newControl['MaxZoomRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinZoomStep') ?></th><td><input type="text" name="newControl[MinZoomStep]" value="<?php echo validHtmlStr($newControl['MinZoomStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxZoomStep') ?></th><td><input type="text" name="newControl[MaxZoomStep]" value="<?php echo validHtmlStr($newControl['MaxZoomStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasZoomSpeed') ?></th><td><input type="checkbox" name="newControl[HasZoomSpeed]" value="1"<?php if ( !empty($newControl['HasZoomSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinZoomSpeed') ?></th><td><input type="text" name="newControl[MinZoomSpeed]" value="<?php echo $newControl['MinZoomSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxZoomSpeed') ?></th><td><input type="text" name="newControl[MaxZoomSpeed]" value="<?php echo $newControl['MaxZoomSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinZoomSpeed') ?></th><td><input type="text" name="newControl[MinZoomSpeed]" value="<?php echo validHtmlStr($newControl['MinZoomSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxZoomSpeed') ?></th><td><input type="text" name="newControl[MaxZoomSpeed]" value="<?php echo validHtmlStr($newControl['MaxZoomSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -424,13 +424,13 @@ switch ( $tab )
<tr><th scope="row"><?php echo translate('CanFocusAbs') ?></th><td><input type="checkbox" name="newControl[CanFocusAbs]" value="1"<?php if ( !empty($newControl['CanFocusAbs']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanFocusRel') ?></th><td><input type="checkbox" name="newControl[CanFocusRel]" value="1"<?php if ( !empty($newControl['CanFocusRel']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanFocusCon') ?></th><td><input type="checkbox" name="newControl[CanFocusCon]" value="1"<?php if ( !empty($newControl['CanFocusCon']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinFocusRange') ?></th><td><input type="text" name="newControl[MinFocusRange]" value="<?php echo $newControl['MinFocusRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxFocusRange') ?></th><td><input type="text" name="newControl[MaxFocusRange]" value="<?php echo $newControl['MaxFocusRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinFocusStep') ?></th><td><input type="text" name="newControl[MinFocusStep]" value="<?php echo $newControl['MinFocusStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxFocusStep') ?></th><td><input type="text" name="newControl[MaxFocusStep]" value="<?php echo $newControl['MaxFocusStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinFocusRange') ?></th><td><input type="text" name="newControl[MinFocusRange]" value="<?php echo validHtmlStr($newControl['MinFocusRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxFocusRange') ?></th><td><input type="text" name="newControl[MaxFocusRange]" value="<?php echo validHtmlStr($newControl['MaxFocusRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinFocusStep') ?></th><td><input type="text" name="newControl[MinFocusStep]" value="<?php echo validHtmlStr($newControl['MinFocusStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxFocusStep') ?></th><td><input type="text" name="newControl[MaxFocusStep]" value="<?php echo validHtmlStr($newControl['MaxFocusStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasFocusSpeed') ?></th><td><input type="checkbox" name="newControl[HasFocusSpeed]" value="1"<?php if ( !empty($newControl['HasFocusSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinFocusSpeed') ?></th><td><input type="text" name="newControl[MinFocusSpeed]" value="<?php echo $newControl['MinFocusSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxFocusSpeed') ?></th><td><input type="text" name="newControl[MaxFocusSpeed]" value="<?php echo $newControl['MaxFocusSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinFocusSpeed') ?></th><td><input type="text" name="newControl[MinFocusSpeed]" value="<?php echo validHtmlStr($newControl['MinFocusSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxFocusSpeed') ?></th><td><input type="text" name="newControl[MaxFocusSpeed]" value="<?php echo validHtmlStr($newControl['MaxFocusSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -442,13 +442,13 @@ switch ( $tab )
<tr><th scope="row"><?php echo translate('CanIrisAbs') ?></th><td><input type="checkbox" name="newControl[CanIrisAbs]" value="1"<?php if ( !empty($newControl['CanIrisAbs']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanIrisRel') ?></th><td><input type="checkbox" name="newControl[CanIrisRel]" value="1"<?php if ( !empty($newControl['CanIrisRel']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanIrisCon') ?></th><td><input type="checkbox" name="newControl[CanIrisCon]" value="1"<?php if ( !empty($newControl['CanIrisCon']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinIrisRange') ?></th><td><input type="text" name="newControl[MinIrisRange]" value="<?php echo $newControl['MinIrisRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxIrisRange') ?></th><td><input type="text" name="newControl[MaxIrisRange]" value="<?php echo $newControl['MaxIrisRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinIrisStep') ?></th><td><input type="text" name="newControl[MinIrisStep]" value="<?php echo $newControl['MinIrisStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxIrisStep') ?></th><td><input type="text" name="newControl[MaxIrisStep]" value="<?php echo $newControl['MaxIrisStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinIrisRange') ?></th><td><input type="text" name="newControl[MinIrisRange]" value="<?php echo validHtmlStr($newControl['MinIrisRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxIrisRange') ?></th><td><input type="text" name="newControl[MaxIrisRange]" value="<?php echo validHtmlStr($newControl['MaxIrisRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinIrisStep') ?></th><td><input type="text" name="newControl[MinIrisStep]" value="<?php echo validHtmlStr($newControl['MinIrisStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxIrisStep') ?></th><td><input type="text" name="newControl[MaxIrisStep]" value="<?php echo validHtmlStr($newControl['MaxIrisStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasIrisSpeed') ?></th><td><input type="checkbox" name="newControl[HasIrisSpeed]" value="1"<?php if ( !empty($newControl['HasIrisSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinIrisSpeed') ?></th><td><input type="text" name="newControl[MinIrisSpeed]" value="<?php echo $newControl['MinIrisSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxIrisSpeed') ?></th><td><input type="text" name="newControl[MaxIrisSpeed]" value="<?php echo $newControl['MaxIrisSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinIrisSpeed') ?></th><td><input type="text" name="newControl[MinIrisSpeed]" value="<?php echo validHtmlStr($newControl['MinIrisSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxIrisSpeed') ?></th><td><input type="text" name="newControl[MaxIrisSpeed]" value="<?php echo validHtmlStr($newControl['MaxIrisSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -460,13 +460,13 @@ switch ( $tab )
<tr><th scope="row"><?php echo translate('CanGainAbs') ?></th><td><input type="checkbox" name="newControl[CanGainAbs]" value="1"<?php if ( !empty($newControl['CanGainAbs']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanGainRel') ?></th><td><input type="checkbox" name="newControl[CanGainRel]" value="1"<?php if ( !empty($newControl['CanGainRel']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanGainCon') ?></th><td><input type="checkbox" name="newControl[CanGainCon]" value="1"<?php if ( !empty($newControl['CanGainCon']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinGainRange') ?></th><td><input type="text" name="newControl[MinGainRange]" value="<?php echo $newControl['MinGainRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxGainRange') ?></th><td><input type="text" name="newControl[MaxGainRange]" value="<?php echo $newControl['MaxGainRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinGainStep') ?></th><td><input type="text" name="newControl[MinGainStep]" value="<?php echo $newControl['MinGainStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxGainStep') ?></th><td><input type="text" name="newControl[MaxGainStep]" value="<?php echo $newControl['MaxGainStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinGainRange') ?></th><td><input type="text" name="newControl[MinGainRange]" value="<?php echo validHtmlStr($newControl['MinGainRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxGainRange') ?></th><td><input type="text" name="newControl[MaxGainRange]" value="<?php echo validHtmlStr($newControl['MaxGainRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinGainStep') ?></th><td><input type="text" name="newControl[MinGainStep]" value="<?php echo validHtmlStr($newControl['MinGainStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxGainStep') ?></th><td><input type="text" name="newControl[MaxGainStep]" value="<?php echo validHtmlStr($newControl['MaxGainStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasGainSpeed') ?></th><td><input type="checkbox" name="newControl[HasGainSpeed]" value="1"<?php if ( !empty($newControl['HasGainSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinGainSpeed') ?></th><td><input type="text" name="newControl[MinGainSpeed]" value="<?php echo $newControl['MinGainSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxGainSpeed') ?></th><td><input type="text" name="newControl[MaxGainSpeed]" value="<?php echo $newControl['MaxGainSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinGainSpeed') ?></th><td><input type="text" name="newControl[MinGainSpeed]" value="<?php echo validHtmlStr($newControl['MinGainSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxGainSpeed') ?></th><td><input type="text" name="newControl[MaxGainSpeed]" value="<?php echo validHtmlStr($newControl['MaxGainSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -478,13 +478,13 @@ switch ( $tab )
<tr><th scope="row"><?php echo translate('CanWhiteAbs') ?></th><td><input type="checkbox" name="newControl[CanWhiteAbs]" value="1"<?php if ( !empty($newControl['CanWhiteAbs']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanWhiteRel') ?></th><td><input type="checkbox" name="newControl[CanWhiteRel]" value="1"<?php if ( !empty($newControl['CanWhiteRel']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanWhiteCon') ?></th><td><input type="checkbox" name="newControl[CanWhiteCon]" value="1"<?php if ( !empty($newControl['CanWhiteCon']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinWhiteRange') ?></th><td><input type="text" name="newControl[MinWhiteRange]" value="<?php echo $newControl['MinWhiteRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxWhiteRange') ?></th><td><input type="text" name="newControl[MaxWhiteRange]" value="<?php echo $newControl['MaxWhiteRange'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinWhiteStep') ?></th><td><input type="text" name="newControl[MinWhiteStep]" value="<?php echo $newControl['MinWhiteStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxWhiteStep') ?></th><td><input type="text" name="newControl[MaxWhiteStep]" value="<?php echo $newControl['MaxWhiteStep'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinWhiteRange') ?></th><td><input type="text" name="newControl[MinWhiteRange]" value="<?php echo validHtmlStr($newControl['MinWhiteRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxWhiteRange') ?></th><td><input type="text" name="newControl[MaxWhiteRange]" value="<?php echo validHtmlStr($newControl['MaxWhiteRange']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinWhiteStep') ?></th><td><input type="text" name="newControl[MinWhiteStep]" value="<?php echo validHtmlStr($newControl['MinWhiteStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxWhiteStep') ?></th><td><input type="text" name="newControl[MaxWhiteStep]" value="<?php echo validHtmlStr($newControl['MaxWhiteStep']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasWhiteSpeed') ?></th><td><input type="checkbox" name="newControl[HasWhiteSpeed]" value="1"<?php if ( !empty($newControl['HasWhiteSpeed']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('MinWhiteSpeed') ?></th><td><input type="text" name="newControl[MinWhiteSpeed]" value="<?php echo $newControl['MinWhiteSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxWhiteSpeed') ?></th><td><input type="text" name="newControl[MaxWhiteSpeed]" value="<?php echo $newControl['MaxWhiteSpeed'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MinWhiteSpeed') ?></th><td><input type="text" name="newControl[MinWhiteSpeed]" value="<?php echo validHtmlStr($newControl['MinWhiteSpeed']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('MaxWhiteSpeed') ?></th><td><input type="text" name="newControl[MaxWhiteSpeed]" value="<?php echo validHtmlStr($newControl['MaxWhiteSpeed']) ?>" size="8"/></td></tr>
<?php
break;
}
@ -492,7 +492,7 @@ switch ( $tab )
{
?>
<tr><th scope="row"><?php echo translate('HasPresets') ?></th><td><input type="checkbox" name="newControl[HasPresets]" value="1"<?php if ( !empty($newControl['HasPresets']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('NumPresets') ?></th><td><input type="text" name="newControl[NumPresets]" value="<?php echo $newControl['NumPresets'] ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('NumPresets') ?></th><td><input type="text" name="newControl[NumPresets]" value="<?php echo validHtmlStr($newControl['NumPresets']) ?>" size="8"/></td></tr>
<tr><th scope="row"><?php echo translate('HasHomePreset') ?></th><td><input type="checkbox" name="newControl[HasHomePreset]" value="1"<?php if ( !empty($newControl['HasHomePreset']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<tr><th scope="row"><?php echo translate('CanSetPresets') ?></th><td><input type="checkbox" name="newControl[CanSetPresets]" value="1"<?php if ( !empty($newControl['CanSetPresets']) ) { ?> checked="checked"<?php } ?>/></td></tr>
<?php

View File

@ -181,7 +181,7 @@ while ( $event_row = dbFetchNext($results) ) {
<?php
}
?>
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" onclick="toggleCheckbox(this, 'eids[]');"/></th>
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" data-checkbox-name="eids[]" data-on-click-this="updateFormCheckboxesByName"/></th>
</tr>
<?php
}

View File

@ -180,7 +180,7 @@ if ( (null !== $filter->Concurrent()) and $filter->Concurrent() )
?>
</div>
</form>
<form name="contentForm" id="contentForm" method="post" onsubmit="return validateForm(this);">
<form name="contentForm" id="contentForm" method="post" class="validateFormOnSubmit">
<input type="hidden" name="Id" value="<?php echo $filter->Id() ?>"/>
<input type="hidden" name="action" value=""/>
<input type="hidden" name="object" value="filter"/>

View File

@ -1,5 +1,5 @@
var probeReq = new Request.JSON( { url:thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getProbeResponse } );
var probeReq = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getProbeResponse} );
function probe( url_e ) {
probeReq.send( "request=add_monitors&action=probe&url="+url_e.value );
@ -22,39 +22,39 @@ function getProbeResponse( respObj, respText ) {
return;
}
results_div.innerHTML = 'No streams found.';
//console.log("No streams: " + respText);
//console.log("No streams: " + respText);
}
} // end function getProbeResponse
function parseStreams( Streams ) {
ProbeResults = Array();
ProbeResults = Array();
var results_div = $j('#results')[0];
if ( ! results_div ) {
console.log("No results div found.");
return;
}
results_div.innerHTML = '';
var html = '';
var results_div = $j('#results')[0];
if ( ! results_div ) {
console.log("No results div found.");
return;
}
results_div.innerHTML = '';
var html = '';
for( i in Streams ) {
var stream = Streams[i];
if ( stream.url ) {
html += '<p>'+stream.Monitor.Name + ' at ' + stream.url;
if ( stream.Monitor.Id ) {
html += ' is already entered into the system by Monitor ' + stream.Monitor.Id + ' ' + stream.Monitor.Name + '<br/>';
html += '<input type="button" value="Edit" onclick="addMonitor(\''+stream.url+'\');"/>';
} else {
html += '<input type="button" value="Add" onclick="addMonitor(\''+stream.url+'\');"/>';
}
html += '</p>';
ProbeResults[stream.url] = stream;
for ( i in Streams ) {
var stream = Streams[i];
if ( stream.url ) {
html += '<p>'+stream.Monitor.Name + ' at ' + stream.url;
if ( stream.Monitor.Id ) {
html += ' is already entered into the system by Monitor ' + stream.Monitor.Id + ' ' + stream.Monitor.Name + '<br/>';
html += '<input type="button" value="Edit" onclick="addMonitor(\''+stream.url+'\');"/>';
} else {
//console.log(stream);
html += '<input type="button" value="Add" onclick="addMonitor(\''+stream.url+'\');"/>';
}
} // end for eah Stream
html += '</p>';
ProbeResults[stream.url] = stream;
} else {
//console.log(stream);
}
} // end for eah Stream
results_div.innerHTML = html;
results_div.innerHTML = html;
}
function addMonitor(url) {
@ -69,10 +69,12 @@ function addMonitor(url) {
popup_url = '?view=monitor&mid='+mid+'&newMonitor[Path]='+url;
keys = Object.keys( Monitor );
for ( i in Monitor ) {
if ( ! Monitor[i] )
if ( ! Monitor[i] ) {
continue;
if ( Monitor[i] == 'null' )
}
if ( Monitor[i] == 'null' ) {
Monitor[i]='';
}
popup_url += '&newMonitor['+i+']='+Monitor[i];
}
createPopup( popup_url, 'zmMonitor'+mid, 'monitor' );
@ -84,15 +86,15 @@ function import_csv( form ) {
//formData.append('file', $('#file')[0].files[0]);
$j.ajax({
url : thisUrl+"?request=add_monitors&action=import",
type : 'POST',
data : formData,
processData: false, // tell jQuery not to process the data
contentType: false, // tell jQuery not to set contentType
success : function(data) {
var json = JSON.parse(data);
parseStreams( json.Streams );
}
url: thisUrl+"?request=add_monitors&action=import",
type: 'POST',
data: formData,
processData: false, // tell jQuery not to process the data
contentType: false, // tell jQuery not to set contentType
success: function(data) {
var json = JSON.parse(data);
parseStreams( json.Streams );
}
});
}
function initPage() {
@ -101,4 +103,4 @@ function initPage() {
probe(url);
}
}
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -40,7 +40,6 @@ function addMonitor(element) {
function cloneMonitor(element) {
var form = element.form;
var dupParam;
var monitorId=-1;
// get the value of the first checkbox
for ( var i = 0; i < form.elements.length; i++ ) {
@ -79,10 +78,13 @@ function editMonitor( element ) {
//break;
}
} // end foreach checkboxes
if ( monitorIds.length == 1 )
createPopup( '?view=monitor&mid='+monitorIds[0], 'zmMonitor'+monitorIds[0], 'monitor' );
else if ( monitorIds.length > 1 )
createPopup( '?view=monitors&'+(monitorIds.map(function(mid) {return 'mids[]='+mid;}).join('&')), 'zmMonitors', 'monitors' );
if ( monitorIds.length == 1 ) {
createPopup( '?view=monitor&mid='+monitorIds[0], 'zmMonitor'+monitorIds[0], 'monitor' );
} else if ( monitorIds.length > 1 ) {
createPopup( '?view=monitors&'+(monitorIds.map(function(mid) {
return 'mids[]='+mid;
}).join('&')), 'zmMonitors', 'monitors' );
}
}
function deleteMonitor( element ) {
@ -98,12 +100,12 @@ function selectMonitor(element) {
var url = thisUrl+'?view=console';
for ( var i = 0; i < form.elements.length; i++ ) {
if (
form.elements[i].type == "checkbox"
form.elements[i].type == "checkbox"
&&
form.elements[i].name == "markMids[]"
&&
form.elements[i].checked
) {
) {
url += '&MonitorId='+form.elements[i].value;
}
}
@ -116,17 +118,19 @@ function reloadWindow() {
function initPage() {
reloadWindow.periodical( consoleRefreshTimeout );
if ( showVersionPopup )
if ( showVersionPopup ) {
createPopup( '?view=version', 'zmVersion', 'version' );
if ( showDonatePopup )
}
if ( showDonatePopup ) {
createPopup( '?view=donate', 'zmDonate', 'donate' );
}
// Makes table sortable
$j( function() {
$j( "#consoleTableBody" ).sortable({
handle: ".glyphicon-sort",
update: applySort,
axis:'Y' } );
handle: ".glyphicon-sort",
update: applySort,
axis: 'Y'} );
$j( "#consoleTableBody" ).disableSelection();
} );
}
@ -134,12 +138,12 @@ function initPage() {
function applySort(event, ui) {
var monitor_ids = $j(this).sortable('toArray');
var ajax = new Request.JSON( {
url: 'index.php?request=console',
data: { monitor_ids: monitor_ids, action: 'sort' },
method: 'post',
timeout: AJAX_TIMEOUT
} );
url: 'index.php?request=console',
data: {monitor_ids: monitor_ids, action: 'sort'},
method: 'post',
timeout: AJAX_TIMEOUT
} );
ajax.send();
} // end function applySort(event,ui)
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,9 +1,10 @@
var controlParms = "view=request&request=control";
var controlReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, onSuccess: getControlResponse } );
var controlReq = new Request.JSON( {url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, onSuccess: getControlResponse} );
function getControlResponse( respObj, respText ) {
if ( !respObj )
if ( !respObj ) {
return;
}
//console.log( respText );
if ( respObj.result != 'Ok' ) {
alert( "Control response was status = "+respObj.status+"\nmessage = "+respObj.message );
@ -21,18 +22,20 @@ function controlCmd( control, event, xtell, ytell ) {
if ( xtell ) {
var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 )
if ( xtell == -1 ) {
xge = 100 - xge;
else if ( xtell == 2 )
} else if ( xtell == 2 ) {
xge = 2*(50 - xge);
}
locParms += "&xge="+xge;
}
if ( ytell ) {
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
if ( ytell == -1 ) {
yge = 100 - yge;
else if ( ytell == 2 )
} else if ( ytell == 2 ) {
yge = 2*(50 - yge);
}
locParms += "&yge="+yge;
}
}

View File

@ -16,8 +16,8 @@ function validateForm( form ) {
if ( errors.length ) {
alert( errors.join( "\n" ) );
return( false );
return ( false );
}
return( true );
return ( true );
}

View File

@ -9,4 +9,4 @@ function updateLabel() {
form.newLabel.value = '';
}
}
window.addEvent('domready', updateLabel);
window.addEventListener('DOMContentLoaded', updateLabel);

View File

@ -6,4 +6,4 @@ function initCycle() {
nextCycleView.periodical(cycleRefreshTimeout);
}
window.addEvent('domready', initCycle);
window.addEventListener('DOMContentLoaded', initCycle);

View File

@ -1,9 +1,10 @@
function submitForm( element ) {
var form = element.form;
if ( form.option.selectedIndex == 0 )
if ( form.option.selectedIndex == 0 ) {
form.view.value = currentView;
else
} else {
form.view.value = 'none';
}
form.submit();
}

View File

@ -21,10 +21,11 @@ var exportTimer = null;
function exportProgress() {
var tickerText = $('exportProgressTicker').get('text');
if ( tickerText.length < 1 || tickerText.length > 4 )
if ( tickerText.length < 1 || tickerText.length > 4 ) {
$('exportProgressTicker').set( 'text', '.' );
else
} else {
$('exportProgressTicker').appendText( '.' );
}
}
function exportResponse( respObj, respText ) {
@ -34,7 +35,7 @@ function exportResponse( respObj, respText ) {
function exportEvent( form ) {
var parms = 'view=request&request=event&action=download';
parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse } );
var query = new Request.JSON( {url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse} );
query.send();
$('exportProgress').removeClass( 'hidden' );
$('exportProgress').setProperty( 'class', 'warnText' );
@ -49,4 +50,4 @@ function initPage() {
}
}
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,46 +1,47 @@
var vid = null;
// Function called when video.js hits the end of the video
function vjsReplay() {
var endTime = (Date.parse(eventData.EndTime)).getTime();
switch(replayMode.value) {
switch ( replayMode.value ) {
case 'none':
break;
case 'single':
vid.play();
break;
case 'all':
if (nextEventId == 0) {
if ( nextEventId == 0 ) {
var overLaid = $j("#videoobj");
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;">No more events</p>');
} else {
var endTime = (Date.parse(eventData.EndTime)).getTime();
var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse
if (nextStartTime <= endTime) {
streamNext( true );
return;
if ( nextStartTime <= endTime ) {
streamNext(true);
return;
}
var overLaid = $j("#videoobj");
vid.pause();
overLaid.append('<p class="vjsMessage" style="height: '+overLaid.height()+'px; line-height: '+overLaid.height()+'px;"></p>');
var gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
var messageP = $j(".vjsMessage");
var messageP = $j('.vjsMessage');
var x = setInterval(function() {
var now = new Date().getTime();
var remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11, 8);
messageP.html(remainder + ' to next event.');
if (remainder < 0) {
if ( remainder < 0 ) {
clearInterval(x);
streamNext( true );
streamNext(true);
}
}, 1000);
}
break;
break;
case 'gapless':
streamNext( true );
streamNext(true);
break;
}
}
$j.ajaxSetup({timeout: AJAX_TIMEOUT }); //sets timeout for all getJSON.
$j.ajaxSetup({timeout: AJAX_TIMEOUT}); //sets timeout for all getJSON.
var cueFrames = null; //make cueFrames available even if we don't send another ajax query
@ -69,13 +70,13 @@ function renderAlarmCues(containerEl) {
var alarmHtml = "";
var pixSkew = 0;
var skip = 0;
var num_cueFrames = cueFrames.length;
var num_cueFrames = cueFrames.length;
for ( var i = 0; i < num_cueFrames; i++ ) {
skip = 0;
frame = cueFrames[i];
if (frame.Type == "Alarm" && alarmed == 0) { //From nothing to alarm. End nothing and start alarm.
alarmed = 1;
if (frame.Delta == 0) continue; //If event starts with an alarm or too few for a nonespan
if (frame.Delta == 0) continue; //If event starts with an alarm or too few for a nonespan
spanTimeEnd = frame.Delta * 100;
spanTime = spanTimeEnd - spanTimeStart;
var pix = cueRatio * spanTime;
@ -104,7 +105,7 @@ var num_cueFrames = cueFrames.length;
}
indexPlus++;
}
if (skip == 1) continue; //javascript doesn't support continue 2;
if (skip == 1) continue; //javascript doesn't support continue 2;
spanTimeEnd = frame.Delta *100;
spanTime = spanTimeEnd - spanTimeStart;
alarmed = 0;
@ -165,8 +166,9 @@ function changeScale() {
newWidth = eventData.Width * scale / SCALE_BASE;
newHeight = eventData.Height * scale / SCALE_BASE;
}
if ( !(streamMode == 'stills') )
eventViewer.width(newWidth); //stills handles its own width
if ( !(streamMode == 'stills') ) {
eventViewer.width(newWidth);
} //stills handles its own width
eventViewer.height(newHeight);
if ( !vid ) { // zms needs extra sizing
streamScale(scale == "auto" ? autoScale : scale);
@ -189,7 +191,7 @@ function changeScale() {
function changeReplayMode() {
var replayMode = $('replayMode').get('value');
Cookie.write('replayMode', replayMode, { duration: 10*365 });
Cookie.write('replayMode', replayMode, {duration: 10*365});
refreshWindow();
}
@ -212,19 +214,21 @@ function getCmdResponse( respObj, respText ) {
zmsBroke = false;
if ( streamCmdTimer )
if ( streamCmdTimer ) {
streamCmdTimer = clearTimeout(streamCmdTimer);
}
streamStatus = respObj.status;
if ( streamStatus.progress >= Math.round(parseFloat(eventData.Length)) )
streamStatus.progress = parseFloat(eventData.Length); //Limit progress to reality
if ( streamStatus.progress >= Math.round(parseFloat(eventData.Length)) ) {
streamStatus.progress = parseFloat(eventData.Length);
} //Limit progress to reality
var eventId = streamStatus.event;
if ( lastEventId ) {
if ( eventId != lastEventId ) {
//Doesn't run on first load, prevents a double hit on event and nearEvents ajax
eventQuery(eventId);
initialAlarmCues(eventId); //zms uses this instead of a page reload, must call ajax+render
initialAlarmCues(eventId); //zms uses this instead of a page reload, must call ajax+render
lastEventId = eventId;
}
} else {
@ -240,18 +244,20 @@ function getCmdResponse( respObj, respText ) {
}
$j('#progressValue').html(secsToTime(parseInt(streamStatus.progress)));
$j('#zoomValue').html(streamStatus.zoom);
if ( streamStatus.zoom == "1.0" )
if ( streamStatus.zoom == "1.0" ) {
setButtonState( $('zoomOutBtn'), 'unavail' );
else
} else {
setButtonState( $('zoomOutBtn'), 'inactive' );
}
updateProgressBar();
if ( streamStatus.auth ) {
// Try to reload the image stream.
var streamImg = $j('#evtStream');
if ( streamImg )
if ( streamImg ) {
streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth );
}
} // end if haev a new auth hash
streamCmdTimer = streamQuery.delay( streamTimeout ); //Timeout is refresh rate for progressBox and time display
@ -275,8 +281,9 @@ function pauseClicked() {
}
function vjsPause() {
if ( intervalRewind )
if ( intervalRewind ) {
stopFastRev();
}
streamPause();
}
@ -305,8 +312,9 @@ function playClicked( ) {
}
function vjsPlay() { //catches if we change mode programatically
if ( intervalRewind )
if ( intervalRewind ) {
stopFastRev();
}
$j('#rateValue').html(vid.playbackRate());
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365});
streamPlay();
@ -332,8 +340,9 @@ function streamFastFwd( action ) {
if ( vid ) {
if ( revSpeed != .5 ) stopFastRev();
vid.playbackRate(rates[rates.indexOf(vid.playbackRate()*100)-1]/100);
if ( rates.indexOf(vid.playbackRate()*100)-1 == -1 )
if ( rates.indexOf(vid.playbackRate()*100)-1 == -1 ) {
setButtonState($('fastFwdBtn'), 'unavail');
}
$j('#rateValue').html(vid.playbackRate());
Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365});
} else {
@ -347,7 +356,7 @@ var revSpeed = .5;
function streamSlowFwd( action ) {
if ( vid ) {
vid.currentTime(vid.currentTime() + spf);
vid.currentTime(vid.currentTime() + spf);
} else {
streamReq.send(streamParms+"&command="+CMD_SLOWFWD);
}
@ -534,8 +543,9 @@ function getEventResponse( respObj, respText ) {
eventData = respObj.event;
var eventStills = $('eventStills');
if ( eventStills && !$('eventStills').hasClass( 'hidden' ) && currEventId != eventData.Id )
if ( eventStills && !$('eventStills').hasClass( 'hidden' ) && currEventId != eventData.Id ) {
resetEventStills();
}
currEventId = eventData.Id;
$('dataId').set( 'text', eventData.Id );
@ -563,8 +573,9 @@ function getEventResponse( respObj, respText ) {
// Technically, events can be different sizes, so may need to update the size of the image, but it might be better to have it stay scaled...
//var eventImg = $('eventImage');
//eventImg.setStyles( { 'width': eventData.width, 'height': eventData.height } );
if (vid && CurEventDefVideoPath) {
if ( vid && CurEventDefVideoPath ) {
vid.src({type: 'video/mp4', src: CurEventDefVideoPath}); //Currently mp4 is all we use
console.log("getEventResponse");
initialAlarmCues(eventData.Id);//ajax and render, new event
addVideoTimingTrack(vid, LabelFormat, eventData.MonitorName, eventData.Length, eventData.StartTime);
CurEventDefVideoPath = null;
@ -578,7 +589,7 @@ function getEventResponse( respObj, respText ) {
nearEventsQuery( eventData.Id );
} // end function getEventResponse
var eventReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getEventResponse } );
var eventReq = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getEventResponse} );
function eventQuery( eventId ) {
var eventParms = "view=request&request=status&entity=event&id="+eventId;
@ -593,8 +604,9 @@ var PrevEventDefVideoPath = "";
var NextEventDefVideoPath = "";
function getNearEventsResponse( respObj, respText ) {
if ( checkStreamForErrors( "getNearEventsResponse", respObj ) )
if ( checkStreamForErrors( "getNearEventsResponse", respObj ) ) {
return;
}
prevEventId = respObj.nearevents.PrevEventId;
nextEventId = respObj.nearevents.NextEventId;
prevEventStartTime = Date.parse(respObj.nearevents.PrevEventStartTime);
@ -610,7 +622,7 @@ function getNearEventsResponse( respObj, respText ) {
$j('#nextBtn').prop('disabled', nextEventId == 0 ? true : false).attr('class', nextEventId == 0 ? 'unavail' : 'inactive');
}
var nearEventsReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getNearEventsResponse } );
var nearEventsReq = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getNearEventsResponse} );
function nearEventsQuery( eventId ) {
var parms = "view=request&request=status&entity=nearevents&id="+eventId+filterQuery+sortQuery;
@ -627,18 +639,21 @@ function loadEventThumb( event, frame, loadImage ) {
}
var img = new Asset.image( imagePrefix+frame.EventId+"&fid="+frame.FrameId,
{
'onload': ( function( loadImage ) {
'onload': ( function( loadImage ) {
thumbImg.setProperty( 'src', img.getProperty( 'src' ) );
thumbImg.removeClass( 'placeholder' );
thumbImg.setProperty( 'class', frame.Type=='Alarm'?'alarm':'normal' );
thumbImg.setProperty( 'title', frame.FrameId+' / '+((frame.Type=='Alarm')?frame.Score:0) );
thumbImg.removeEvents( 'click' );
thumbImg.addEvent( 'click', function() { locateImage( frame.FrameId, true ); } );
if ( loadImage )
thumbImg.addEvent( 'click', function() {
locateImage( frame.FrameId, true );
} );
if ( loadImage ) {
loadEventImage( event, frame );
} ).pass( loadImage )
}
} ).pass( loadImage )
}
);
);
}
function loadEventImage( event, frame ) {
@ -655,26 +670,27 @@ function loadEventImage( event, frame ) {
}
$('eventImageBar').setStyle( 'width', event.Width );
if ( frame.Type=='Alarm' )
if ( frame.Type=='Alarm' ) {
$('eventImageStats').removeClass( 'hidden' );
else
} else {
$('eventImageStats').addClass( 'hidden' );
}
thumbImg.addClass( 'selected' );
thumbImg.setOpacity( 0.5 );
if ( eventImagePanel.getStyle( 'display' ) == 'none' ) {
eventImagePanel.setOpacity( 0 );
eventImagePanel.setStyle( 'display', 'inline-block' );
new Fx.Tween( eventImagePanel, { duration: 500, transition: Fx.Transitions.Sine } ).start( 'opacity', 0, 1 );
new Fx.Tween( eventImagePanel, {duration: 500, transition: Fx.Transitions.Sine} ).start( 'opacity', 0, 1 );
}
eventImg.setProperties( {
'class': frame.Type=='Alarm'?'alarm':'normal',
'src': thumbImg.getProperty( 'src' ),
'title': thumbImg.getProperty( 'title' ),
'alt': thumbImg.getProperty( 'alt' ),
'height': $j('#eventThumbs').height() - $j('#eventImageBar').outerHeight(true)-10
} );
'class': frame.Type=='Alarm'?'alarm':'normal',
'src': thumbImg.getProperty( 'src' ),
'title': thumbImg.getProperty( 'title' ),
'alt': thumbImg.getProperty( 'alt' ),
'height': $j('#eventThumbs').height() - $j('#eventImageBar').outerHeight(true)-10
} );
$('eventImageNo').set( 'text', frame.FrameId );
$('prevImageBtn').disabled = (frame.FrameId==1);
@ -683,7 +699,6 @@ function loadEventImage( event, frame ) {
}
function hideEventImageComplete() {
var eventImg = $('eventImage');
var thumbImg = $('eventThumb'+$('eventImage').getProperty( 'alt' ));
if ( thumbImg ) {
thumbImg.removeClass('selected');
@ -698,8 +713,9 @@ function hideEventImageComplete() {
}
function hideEventImage() {
if ( $('eventImagePanel').getStyle( 'display' ) != 'none' )
new Fx.Tween( $('eventImagePanel'), { duration: 500, transition: Fx.Transitions.Sine, onComplete: hideEventImageComplete } ).start( 'opacity', 1, 0 );
if ( $('eventImagePanel').getStyle( 'display' ) != 'none' ) {
new Fx.Tween( $('eventImagePanel'), {duration: 500, transition: Fx.Transitions.Sine, onComplete: hideEventImageComplete} ).start( 'opacity', 1, 0 );
}
}
function resetEventStills() {
@ -709,23 +725,26 @@ function resetEventStills() {
slider = new Slider( $('thumbsSlider'), $('thumbsKnob'), {
/*steps: eventData.Frames,*/
onChange: function( step ) {
if ( !step )
step = 0;
var fid = parseInt((step * eventData.Frames)/this.options.steps);
if ( fid < 1 )
fid = 1;
else if ( fid > eventData.Frames )
fid = eventData.Frames;
checkFrames( eventData.Id, fid, ($j('#eventImagePanel').css('display')=='none'?'':'true'));
scroll.toElement( 'eventThumb'+fid );
}
if ( !step ) {
step = 0;
}
var fid = parseInt((step * eventData.Frames)/this.options.steps);
if ( fid < 1 ) {
fid = 1;
} else if ( fid > eventData.Frames ) {
fid = eventData.Frames;
}
checkFrames( eventData.Id, fid, ($j('#eventImagePanel').css('display')=='none'?'':'true'));
scroll.toElement( 'eventThumb'+fid );
}
} ).set( 0 );
}
}
function getFrameResponse( respObj, respText ) {
if ( checkStreamForErrors( "getFrameResponse", respObj ) )
if ( checkStreamForErrors( "getFrameResponse", respObj ) ) {
return;
}
var frame = respObj.frameimage;
@ -734,15 +753,16 @@ function getFrameResponse( respObj, respText ) {
return;
}
if ( !eventData['frames'] )
eventData['frames'] = new Object();
if ( !eventData['frames'] ) {
eventData['frames'] = {};
}
eventData['frames'][frame.FrameId] = frame;
loadEventThumb( eventData, frame, respObj.loopback=="true" );
}
var frameReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getFrameResponse } );
var frameReq = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getFrameResponse} );
function frameQuery( eventId, frameId, loadImage ) {
var parms = "view=request&request=status&entity=frameimage&id[0]="+eventId+"&id[1]="+frameId+"&loopback="+loadImage;
@ -757,22 +777,27 @@ function checkFrames( eventId, frameId, loadImage ) {
return;
}
if ( !eventData['frames'] )
eventData['frames'] = new Object();
if ( !eventData['frames'] ) {
eventData['frames'] = {};
}
currFrameId = frameId;
var loFid = frameId - frameBatch/2;
if ( loFid < 1 )
if ( loFid < 1 ) {
loFid = 1;
}
var hiFid = loFid + (frameBatch-1);
if ( hiFid > eventData.Frames )
if ( hiFid > eventData.Frames ) {
hiFid = eventData.Frames;
}
for ( var fid = loFid; fid <= hiFid; fid++ ) {
if ( !$('eventThumb'+fid) ) {
var img = new Element( 'img', { 'id': 'eventThumb'+fid, 'src': 'graphics/transparent.png', 'alt': fid, 'class': 'placeholder' } );
img.addEvent( 'click', function() { eventData['frames'][fid] = null; checkFrames( eventId, fid ); } );
var img = new Element( 'img', {'id': 'eventThumb'+fid, 'src': 'graphics/transparent.png', 'alt': fid, 'class': 'placeholder'} );
img.addEvent( 'click', function() {
eventData['frames'][fid] = null; checkFrames( eventId, fid );
} );
frameQuery( eventId, fid, loadImage && (fid == frameId) );
var imgs = $('eventThumbs').getElements( 'img' );
var injected = false;
@ -784,20 +809,20 @@ function checkFrames( eventId, frameId, loadImage ) {
function( thumbImg, index ) {
if ( parseInt(img.getProperty( 'alt' )) < parseInt(thumbImg.getProperty( 'alt' )) ) {
img.inject( thumbImg, 'before' );
return( true );
return ( true );
}
return( false );
return ( false );
}
);
);
}
if ( !injected ) {
img.inject( $('eventThumbs') );
}
var scale = parseInt(img.getStyle('height'));
img.setStyles( {
'width': parseInt((eventData.Width*scale)/100),
'height': parseInt((eventData.Height*scale)/100)
} );
'width': parseInt((eventData.Width*scale)/100),
'height': parseInt((eventData.Height*scale)/100)
} );
} else if ( eventData['frames'][fid] ) {
if ( loadImage && (fid == frameId) ) {
loadEventImage( eventData, eventData['frames'][fid], loadImage );
@ -809,30 +834,35 @@ function checkFrames( eventId, frameId, loadImage ) {
}
function locateImage( frameId, loadImage ) {
if ( slider )
if ( slider ) {
slider.fireEvent( 'tick', slider.toPosition( parseInt((frameId-1)*slider.options.steps/eventData.Frames) ));
}
checkFrames( eventData.Id, frameId, loadImage );
scroll.toElement( 'eventThumb'+frameId );
}
function prevImage() {
if ( currFrameId > 1 )
if ( currFrameId > 1 ) {
locateImage( parseInt(currFrameId)-1, true );
}
}
function nextImage() {
if ( currFrameId < eventData.Frames )
if ( currFrameId < eventData.Frames ) {
locateImage( parseInt(currFrameId)+1, true );
}
}
function prevThumbs() {
if ( currFrameId > 1 )
if ( currFrameId > 1 ) {
locateImage( parseInt(currFrameId)>10?(parseInt(currFrameId)-10):1, $('eventImagePanel').getStyle('display')!="none" );
}
}
function nextThumbs() {
if ( currFrameId < eventData.Frames )
if ( currFrameId < eventData.Frames ) {
locateImage( parseInt(currFrameId)<(eventData.Frames-10)?(parseInt(currFrameId)+10):eventData.Frames, $('eventImagePanel').getStyle('display')!="none" );
}
}
function prevEvent() {
@ -850,19 +880,22 @@ function nextEvent() {
}
function getActResponse( respObj, respText ) {
if ( checkStreamForErrors( "getActResponse", respObj ) )
if ( checkStreamForErrors( "getActResponse", respObj ) ) {
return;
}
if ( respObj.refreshEvent )
if ( respObj.refreshEvent ) {
eventQuery( eventData.Id );
}
}
var actReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getActResponse } );
var actReq = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getActResponse} );
function actQuery( action, parms ) {
var actParms = "view=request&request=event&id="+eventData.Id+"&action="+action;
if ( parms != null )
if ( parms != null ) {
actParms += "&"+Object.toQueryString( parms );
}
actReq.send( actParms );
}
@ -874,7 +907,7 @@ function deleteEvent() {
function renameEvent() {
var newName = $('eventName').get('value');
actQuery( 'rename', { eventName: newName } );
actQuery( 'rename', {eventName: newName} );
}
function editEvent() {
@ -931,9 +964,9 @@ function showStills() {
scroll = new Fx.Scroll( 'eventThumbs', {
wait: false,
duration: 500,
offset: { 'x': 0, 'y': 0 },
offset: {'x': 0, 'y': 0},
transition: Fx.Transitions.Quad.easeInOut
}
}
);
}
resetEventStills();
@ -995,15 +1028,19 @@ function handleClick( event ) {
function initPage() {
//FIXME prevent blocking...not sure what is happening or best way to unblock
if ($j('#videoobj').length) {
if ( $j('#videoobj').length ) {
vid = videojs('videoobj');
addVideoTimingTrack(vid, LabelFormat, eventData.MonitorName, eventData.Length, eventData.StartTime);
$j('.vjs-progress-control').append('<div class="alarmCue"></div>');//add a place for videojs only on first load
vid.on('ended', vjsReplay);
vid.on('play', vjsPlay);
vid.on('pause', vjsPause);
vid.on('click', function(event) {handleClick(event);});
vid.on('timeupdate', function() {$j('#progressValue').html(secsToTime(Math.floor(vid.currentTime())));});
vid.on('click', function(event) {
handleClick(event);
});
vid.on('timeupdate', function() {
$j('#progressValue').html(secsToTime(Math.floor(vid.currentTime())));
});
if ( rate > 1 ) {
// rate should be 100 = 1x, etc.
@ -1018,9 +1055,12 @@ function initPage() {
console.log('No element with id tag imageFeed found.');
} else {
var streamImg = imageFeed.getElement('img');
if ( !streamImg )
if ( !streamImg ) {
streamImg = imageFeed.getElement('object');
$(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } );
}
$(streamImg).addEvent( 'click', function( event ) {
handleClick( event );
} );
}
}
}
@ -1030,4 +1070,4 @@ function initPage() {
}
// Kick everything off
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -5,12 +5,9 @@ function closeWindows() {
filterWindow.close();
}
function toggleCheckbox( element, name ) {
function setButtonStates( element ) {
var form = element.form;
var checked = element.checked;
for (var i = 0; i < form.elements.length; i++)
if (form.elements[i].name.indexOf(name) == 0)
form.elements[i].checked = checked;
form.viewBtn.disabled = !(canViewEvents && checked);
form.editBtn.disabled = !(canEditEvents && checked);
form.archiveBtn.disabled = unarchivedEvents?!checked:true;
@ -33,8 +30,9 @@ function configureButton( element, name ) {
}
}
}
if ( !element.checked )
if ( !element.checked ) {
form.toggleCheck.checked = false;
}
form.viewBtn.disabled = !(canViewEvents && checked);
form.editBtn.disabled = !(canEditEvents && checked);
form.archiveBtn.disabled = (!checked)||(!unarchivedEvents);

View File

@ -4,10 +4,11 @@ function configureExportButton( element ) {
var checkCount = 0;
var radioCount = 0;
for ( var i = 0; i < form.elements.length; i++ ) {
if ( form.elements[i].type == "checkbox" && form.elements[i].checked )
if ( form.elements[i].type == "checkbox" && form.elements[i].checked ) {
checkCount++;
else if ( form.elements[i].type == "radio" && form.elements[i].checked )
} else if ( form.elements[i].type == "radio" && form.elements[i].checked ) {
radioCount++;
}
}
form.elements['exportButton'].disabled = (checkCount == 0 || radioCount == 0);
}
@ -20,10 +21,11 @@ var exportTimer = null;
function exportProgress() {
var tickerText = $('exportProgressTicker').get('text');
if ( tickerText.length < 1 || tickerText.length > 4 )
if ( tickerText.length < 1 || tickerText.length > 4 ) {
$('exportProgressTicker').set( 'text', '.' );
else
} else {
$('exportProgressTicker').appendText( '.' );
}
}
function exportResponse( respObj, respText ) {
@ -43,7 +45,7 @@ function exportResponse( respObj, respText ) {
function exportEvent( form ) {
var parms = 'view=request&request=event&action=export';
parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse } );
var query = new Request.JSON( {url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse} );
query.send();
$('exportProgress').removeClass( 'hidden' );
$('exportProgress').setProperty( 'class', 'warnText' );
@ -59,4 +61,4 @@ function initPage() {
}
}
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -31,22 +31,23 @@ function updateButtons(element) {
form.elements['executeButton'].disabled = false;
} else {
var canExecute = false;
if ( form.elements['filter[AutoArchive]'] && form.elements['filter[AutoArchive]'].checked )
if ( form.elements['filter[AutoArchive]'] && form.elements['filter[AutoArchive]'].checked ) {
canExecute = true;
else if ( form.elements['filter[AutoVideo]'] && form.elements['filter[AutoVideo]'].checked )
} else if ( form.elements['filter[AutoVideo]'] && form.elements['filter[AutoVideo]'].checked ) {
canExecute = true;
else if ( form.elements['filter[AutoUpload]'] && form.elements['filter[AutoUpload]'].checked )
} else if ( form.elements['filter[AutoUpload]'] && form.elements['filter[AutoUpload]'].checked ) {
canExecute = true;
else if ( form.elements['filter[AutoEmail]'] && form.elements['filter[AutoEmail]'].checked )
} else if ( form.elements['filter[AutoEmail]'] && form.elements['filter[AutoEmail]'].checked ) {
canExecute = true;
else if ( form.elements['filter[AutoMessage]'] && form.elements['filter[AutoMessage]'].checked )
} else if ( form.elements['filter[AutoMessage]'] && form.elements['filter[AutoMessage]'].checked ) {
canExecute = true;
else if ( form.elements['filter[AutoExecute]'].checked && form.elements['filter[AutoExecuteCmd]'].value != '' )
} else if ( form.elements['filter[AutoExecute]'].checked && form.elements['filter[AutoExecuteCmd]'].value != '' ) {
canExecute = true;
else if ( form.elements['filter[AutoDelete]'].checked )
} else if ( form.elements['filter[AutoDelete]'].checked ) {
canExecute = true;
else if ( form.elements['filter[UpdateDiskSpace]'].checked )
} else if ( form.elements['filter[UpdateDiskSpace]'].checked ) {
canExecute = true;
}
form.elements['executeButton'].disabled = !canExecute;
}
if ( form.elements['filter[Name]'].value ) {
@ -144,7 +145,7 @@ function parseRows(rows) {
}
if (rows.length == 1) {
inputTds.eq(6).find(':input[value="-"]').prop('disabled', true); //enable/disable remove row button
inputTds.eq(6).find(':input[value="-"]').prop('disabled', true); //enable/disable remove row button
} else {
inputTds.eq(6).find(':input[value="-"]').prop('disabled', false);
}
@ -159,7 +160,7 @@ function parseRows(rows) {
}
var archiveVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(archiveSelect).children().val(archiveVal).chosen({width: "101%"});
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
} else if ( attr.indexOf('Weekday') >= 0 ) { //Weekday selection
var weekdaySelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for (var i = 0; i < weekdays.length; i++) {
weekdaySelect.append('<option value="' + i + '">' + weekdays[i] + '</option>');
@ -182,7 +183,7 @@ function parseRows(rows) {
inputTds.eq(4).html(serverSelect).children().val(serverVal).chosen({width: "101%"});
} else if ( attr == 'StorageId' ) { //Choose by storagearea
var storageSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
for ( key in storageareas ) {
for ( key in storageareas ) {
storageSelect.append('<option value="' + key + '">' + storageareas[key] + '</option>');
}
var storageVal = inputTds.eq(4).children().val();
@ -194,7 +195,7 @@ function parseRows(rows) {
}
var monitorVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(monitorSelect).children().val(monitorVal);
} else { //Reset to regular text field and operator for everything that isn't special
} else { //Reset to regular text field and operator for everything that isn't special
var opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
for (var key in opTypes) {
opSelect.append('<option value="' + key + '">' + opTypes[key] + '</option>');
@ -227,7 +228,7 @@ function parseRows(rows) {
function stringFilter(term) {
var termString = '';
term.forEach(function(item) {
termString += '[' + item + ']';
termString += '[' + item + ']';
});
return termString;
}
@ -260,4 +261,4 @@ function init() {
$j("#sortTable [name$='sort_field\\]']").chosen();
}
window.addEvent( 'domready', init );
window.addEventListener( 'DOMContentLoaded', init );

View File

@ -24,8 +24,8 @@ function changeScale() {
img.css('width', newWidth + 'px');
img.css('height', newHeight + 'px');
}
Cookie.write( 'zmWatchScale', scale, { duration: 10*365 } );
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
Cookie.write( 'zmWatchScale', scale, {duration: 10*365} );
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&'));
});
}

View File

@ -1,15 +1,15 @@
var logParms = "view=request&request=log&task=query";
var logReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: logResponse } );
var logReq = new Request.JSON( {url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: logResponse} );
var logTimer = undefined;
var logTable = undefined;
var logCodes = new Object({
'0': 'INF',
'-1': 'WAR',
'-2': 'ERR',
'-3': 'FAT',
'-4': 'PNC',
});
var logCodes = {
'0': 'INF',
'-1': 'WAR',
'-2': 'ERR',
'-3': 'FAT',
'-4': 'PNC',
};
var minSampleTime = 2000;
var maxSampleTime = 16000;
@ -27,13 +27,14 @@ var options = {};
function buildFetchParms( parms ) {
var fetchParms = logParms+'&limit='+maxLogFetch;
if ( parms )
if ( parms ) {
fetchParms += '&'+parms;
}
Object.each(filter,
function( value, key ) {
fetchParms += '&filter['+key+']='+value;
}
);
);
return fetchParms;
}
@ -46,8 +47,9 @@ function fetchPrevLogs() {
}
function logResponse( respObj ) {
if ( logTimer )
if ( logTimer ) {
logTimer = clearTimeout( logTimer );
}
if ( respObj.result == 'Ok' ) {
if ( respObj.logs.length > 0 ) {
@ -56,22 +58,25 @@ function logResponse( respObj ) {
try {
respObj.logs.each(
function( log ) {
if ( ( !maxLogTime ) || ( log.TimeKey > maxLogTime ) )
if ( ( !maxLogTime ) || ( log.TimeKey > maxLogTime ) ) {
maxLogTime = log.TimeKey;
if ( ( !minLogTime ) || ( log.TimeKey < minLogTime ) )
}
if ( ( !minLogTime ) || ( log.TimeKey < minLogTime ) ) {
minLogTime = log.TimeKey;
var row = logTable.push( [{ content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
}
var row = logTable.push( [{content: log.DateTime, properties: {style: 'white-space: nowrap'}}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
delete log.Message;
row.tr.store( 'log', log );
if ( log.Level <= -3 )
row.tr.addClass( 'log-fat' );
else if ( log.Level <= -2 )
row.tr.addClass( 'log-err' );
else if ( log.Level <= -1 )
row.tr.addClass( 'log-war' );
else if ( log.Level > 0 )
row.tr.addClass( 'log-dbg' );
if ( log.Level <= -3 ) {
row.tr.addClass( 'log-fat' );
} else if ( log.Level <= -2 ) {
row.tr.addClass( 'log-err' );
} else if ( log.Level <= -1 ) {
row.tr.addClass( 'log-war' );
} else if ( log.Level > 0 ) {
row.tr.addClass( 'log-dbg' );
}
if ( !firstLoad ) {
var color = document.defaultView.getComputedStyle(row.tr, null).getPropertyValue('color');
var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/);
@ -82,12 +87,13 @@ function logResponse( respObj ) {
);
if ( typeof(respObj.options) == 'object' ) {
$j.each( respObj.options,
function( field ) {
if ( options[field] )
options[field] = Object.assign(options[field], respObj.options[field]);
else
options[field] = respObj.options[field];
}
function( field ) {
if ( options[field] ) {
options[field] = Object.assign(options[field], respObj.options[field]);
} else {
options[field] = respObj.options[field];
}
}
);
}
updateFilterSelectors();
@ -101,21 +107,24 @@ function logResponse( respObj ) {
$('availLogs').set('text', respObj.available);
$('displayLogs').set('text', logCount);
if ( firstLoad ) {
if ( logCount < displayLimit )
if ( logCount < displayLimit ) {
fetchPrevLogs();
}
}
logTable.reSort();
} catch( e ) {
} catch ( e ) {
console.error( e );
}
logTimeout /= 2;
if ( logTimeout < minSampleTime )
if ( logTimeout < minSampleTime ) {
logTimeout = minSampleTime;
}
} else {
firstLoad = false;
logTimeout *= 2;
if ( logTimeout > maxSampleTime )
if ( logTimeout > maxSampleTime ) {
logTimeout = maxSampleTime;
}
} // end logs.length > 0
} // end if result == Ok
logTimer = fetchNextLogs.delay( logTimeout );
@ -161,10 +170,11 @@ function filterLog() {
return;
}
var value = selector.get('value');
if ( value )
if ( value ) {
filter[field] = value;
}
}
);
);
refreshLog();
}
@ -200,14 +210,14 @@ function exportRequest() {
$('exportError').hide();
if ( form.validate() ) {
var exportParms = "view=request&request=log&task=export";
var exportReq = new Request.JSON( { url: thisUrl, method: 'post', link: 'cancel', onSuccess: exportResponse, onFailure: exportFail } );
var exportReq = new Request.JSON( {url: thisUrl, method: 'post', link: 'cancel', onSuccess: exportResponse, onFailure: exportFail} );
var selection = form.getElement('input[name=selector]:checked').get('value');
if ( selection == 'filter' || selection == 'current' ) {
$$('#filters select').each(
function( select ) {
exportParms += "&"+select.get('id')+"="+select.get('value');
}
);
);
}
if ( selection == 'current' ) {
var tbody = $(logTable).getElement( 'tbody' );
@ -226,70 +236,73 @@ function exportRequest() {
function updateFilterSelectors() {
Object.each(options,
function( values, key ) {
var selector = $('filter['+key+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
window.console.log("No selector found for " + key );
function( values, key ) {
var selector = $('filter['+key+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
window.console.log("No selector found for " + key );
}
return;
}
selector.options.length = 1;
if ( key == 'Level' ) {
Object.each(values,
function( value, label ) {
selector.options[selector.options.length] = new Option(value, label);
}
);
} else if ( key == 'ServerId' ) {
Object.each(values,
function( value, label ) {
selector.options[selector.options.length] = new Option(value, label);
}
);
} else {
Object.each(values,
function( value, label ) {
selector.options[selector.options.length] = new Option(value, label);
}
);
}
if ( filter[key] ) {
selector.set('value', filter[key]);
}
return;
}
selector.options.length = 1;
if ( key == 'Level' ) {
Object.each(values,
function( value, label ) {
selector.options[selector.options.length] = new Option(value, label);
}
);
} else if ( key == 'ServerId' ) {
Object.each(values,
function( value, label ) {
selector.options[selector.options.length] = new Option(value, label);
}
);
} else {
Object.each(values,
function( value, label ) {
selector.options[selector.options.length] = new Option(value, label);
}
);
}
if ( filter[key] )
selector.set('value', filter[key]);
}
);
}
function initPage() {
displayLimit = initialDisplayLimit;
for ( var i = 1; i <= 9; i++ )
for ( var i = 1; i <= 9; i++ ) {
logCodes[''+i] = 'DB'+i;
}
logTable = new HtmlTable( $('logTable'),
{
zebra: true,
sortable: true,
sortReverse: true
}
);
);
logTable.addEvent( 'sort', function( tbody, index ) {
var header = tbody.getParent( 'table' ).getElement( 'thead' );
var columns = header.getElement( 'tr' ).getElements( 'th' );
var column = columns[index];
sortReversed = column.hasClass( 'table-th-sort-rev' );
if ( logCount > displayLimit ) {
var rows = tbody.getElements( 'tr' );
var startIndex;
if ( sortReversed )
startIndex = displayLimit;
else
startIndex = 0;
for ( var i = startIndex; logCount > displayLimit; i++ ) {
rows[i].destroy();
logCount--;
}
$('displayLogs').set('text', logCount);
} // end if loCount > displayLimit
}
var header = tbody.getParent( 'table' ).getElement( 'thead' );
var columns = header.getElement( 'tr' ).getElements( 'th' );
var column = columns[index];
sortReversed = column.hasClass( 'table-th-sort-rev' );
if ( logCount > displayLimit ) {
var rows = tbody.getElements( 'tr' );
var startIndex;
if ( sortReversed ) {
startIndex = displayLimit;
} else {
startIndex = 0;
}
for ( var i = startIndex; logCount > displayLimit; i++ ) {
rows[i].destroy();
logCount--;
}
$('displayLogs').set('text', logCount);
} // end if loCount > displayLimit
}
);
exportFormValidator = new Form.Validator.Inline($('exportForm'), {
useTitles: true,
@ -301,4 +314,4 @@ function initPage() {
}
// Kick everything off
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,4 +1,4 @@
window.addEvent( 'domready', function() {
window.addEventListener( 'DOMContentLoaded', function() {
if ( failed == true ) {
$('loginError').removeClass( 'hidden' );
}

View File

@ -6,22 +6,24 @@ function updateMonitorDimensions( element ) {
if ( form.elements['preserveAspectRatio'].checked ) {
var monitorWidth = parseInt(form.elements['newMonitor[Width]'].value);
var monitorHeight = parseInt(form.elements['newMonitor[Height]'].value);
switch( element.name ) {
switch ( element.name ) {
case 'newMonitor[Width]':
if ( monitorWidth >= 0 )
if ( monitorWidth >= 0 ) {
form.elements['newMonitor[Height]'].value = Math.round((monitorWidth * heightFactor) / widthFactor);
else
} else {
form.elements['newMonitor[Height]'].value = '';
}
break;
case 'newMonitor[Height]':
if ( monitorHeight >= 0 )
if ( monitorHeight >= 0 ) {
form.elements['newMonitor[Width]'].value = Math.round((monitorHeight * widthFactor) / heightFactor);
else
} else {
form.elements['newMonitor[Width]'].value = '';
}
break;
}
}
return( false );
return ( false );
}
function loadLocations( element ) {
@ -46,4 +48,4 @@ function initPage() {
//updateMethods( $(protocolSelector) );
}
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -12,16 +12,18 @@ function Monitor(monitorData) {
this.lastAlarmState = STATE_IDLE;
this.streamCmdParms = 'view=request&request=stream&connkey='+this.connKey;
this.onclick = monitorData.onclick;
if ( auth_hash )
if ( auth_hash ) {
this.streamCmdParms += '&auth='+auth_hash;
}
this.streamCmdTimer = null;
this.type = monitorData.type;
this.refresh = monitorData.refresh;
this.start = function(delay) {
if ( this.streamCmdQuery )
if ( this.streamCmdQuery ) {
this.streamCmdTimer = this.streamCmdQuery.delay(delay, this);
else
} else {
console.log("No streamCmdQuery");
}
};
this.setStateClass = function(element, stateClass) {
@ -51,18 +53,20 @@ function Monitor(monitorData) {
}
if ( 0 ) {
// Requeue, but want to wait a while.
if ( this.streamCmdTimer )
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
var streamCmdTimeout = 1000*statusRefreshTimeout;
this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this, true );
requestQueue.resume();
if ( this.streamCmdTimer ) {
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
}
var streamCmdTimeout = 1000*statusRefreshTimeout;
this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this, true );
requestQueue.resume();
}
console.log("done failure");
console.log("done failure");
};
this.getStreamCmdResponse = function(respObj, respText) {
if ( this.streamCmdTimer )
this.streamCmdTimer = clearTimeout(this.streamCmdTimer);
if ( this.streamCmdTimer ) {
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
}
var stream = $j('#liveStream'+this.id)[0];
@ -72,12 +76,13 @@ function Monitor(monitorData) {
this.alarmState = this.status.state;
var stateClass = "";
if ( this.alarmState == STATE_ALARM )
if ( this.alarmState == STATE_ALARM ) {
stateClass = "alarm";
else if ( this.alarmState == STATE_ALERT )
} else if ( this.alarmState == STATE_ALERT ) {
stateClass = "alert";
else
} else {
stateClass = "idle";
}
if ( (!COMPACT_MONTAGE) && (this.type != 'WebSite') ) {
$('fpsValue'+this.id).set('text', this.status.fps);
@ -113,8 +118,9 @@ function Monitor(monitorData) {
if ( this.status.auth ) {
if ( this.status.auth != auth_hash ) {
// Try to reload the image stream.
if ( stream )
if ( stream ) {
stream.src = stream.src.replace(/auth=\w+/i, 'auth='+this.status.auth);
}
console.log("Changed auth from " + auth_hash + " to " + this.status.auth);
auth_hash = this.status.auth;
}
@ -138,7 +144,7 @@ function Monitor(monitorData) {
// However, there is a timeout in the php side which isn't getting modified,
// so this may cause a problem. Also the server may only be able to update so fast.
//if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT ) {
//streamCmdTimeout = streamCmdTimeout/5;
//streamCmdTimeout = streamCmdTimeout/5;
//}
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this);
this.lastAlarmState = this.alarmState;
@ -208,7 +214,7 @@ function selectLayout(element) {
console.log("No Monitor styles to apply");
} // end if specific monitor style
} // end foreach monitor
} // end if a stored layout
} // end if a stored layout
if ( ! layout ) {
return;
}
@ -254,10 +260,12 @@ function changeSize() {
console.log("Error finding frame for " + monitor.id);
continue;
}
if ( width )
if ( width ) {
monitor_frame.css('width', width+'px');
if ( height )
}
if ( height ) {
monitor_frame.css('height', height+'px');
}
/*Stream could be an applet so can't use moo tools*/
var streamImg = $('liveStream'+monitor.id);
@ -304,15 +312,17 @@ function changeScale() {
var newHeight = ( monitorData[i].height * scale ) / SCALE_BASE;
// Scale the frame
monitor_frame = $j('#monitorFrame'+monitor.id);
if ( !monitor_frame ) {
console.log("Error finding frame for " + monitor.id);
continue;
}
if ( width )
monitor_frame.css('width', width+'px');
if ( height )
monitor_frame.css('height', height+'px');
monitor_frame = $j('#monitorFrame'+monitor.id);
if ( !monitor_frame ) {
console.log("Error finding frame for " + monitor.id);
continue;
}
if ( width ) {
monitor_frame.css('width', width+'px');
}
if ( height ) {
monitor_frame.css('height', height+'px');
}
/*Stream could be an applet so can't use moo tools*/
var streamImg = $j('#liveStream'+monitor.id)[0];
if ( streamImg ) {
@ -403,7 +413,7 @@ function initPage() {
jQuery("#hdrbutton").click(function() {
jQuery("#flipMontageHeader").slideToggle("slow");
jQuery("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
Cookie.write( 'zmMontageHeaderFlip', jQuery('#hdrbutton').hasClass('glyphicon-menu-up') ? 'up' : 'down', { duration: 10*365 } );
Cookie.write( 'zmMontageHeaderFlip', jQuery('#hdrbutton').hasClass('glyphicon-menu-up') ? 'up' : 'down', {duration: 10*365} );
});
});
if ( Cookie.read('zmMontageHeaderFlip') == 'down' ) {
@ -427,4 +437,4 @@ function initPage() {
selectLayout('#zmMontageLayout');
}
// Kick everything off
window.addEvent('domready', initPage);
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -3,10 +3,10 @@ function evaluateLoadTimes() {
// Only consider it a completed event if we load ALL monitors, then zero all and start again
var start=0;
var end=0;
if ( liveMode != 1 && currentSpeed == 0 ) return; // don't evaluate when we are not moving as we can do nothing really fast.
if ( liveMode != 1 && currentSpeed == 0 ) return; // don't evaluate when we are not moving as we can do nothing really fast.
for ( var i = 0; i < monitorIndex.length; i++ ) {
if ( monitorName[i] > "" ) {
if ( monitorLoadEndTimems[i] == 0 ) return; // if we have a monitor with no time yet just wait
if ( monitorLoadEndTimems[i] == 0 ) return; // if we have a monitor with no time yet just wait
if ( start == 0 || start > monitorLoadStartTimems[i] ) start = monitorLoadStartTimems[i];
if ( end == 0 || end < monitorLoadEndTimems[i] ) end = monitorLoadEndTimems[i];
}
@ -21,11 +21,12 @@ function evaluateLoadTimes() {
freeTimeLastIntervals[imageLoadTimesEvaluated++] = 1 - ((end - start)/currentDisplayInterval);
if ( imageLoadTimesEvaluated < imageLoadTimesNeeded ) return;
var avgFrac=0;
for ( var i=0; i < imageLoadTimesEvaluated; i++ )
for ( var i=0; i < imageLoadTimesEvaluated; i++ ) {
avgFrac += freeTimeLastIntervals[i];
}
avgFrac = avgFrac / imageLoadTimesEvaluated;
// The larger this is(positive) the faster we can go
if (avgFrac >= 0.9) currentDisplayInterval = (currentDisplayInterval * 0.50).toFixed(1); // we can go much faster
if (avgFrac >= 0.9) currentDisplayInterval = (currentDisplayInterval * 0.50).toFixed(1); // we can go much faster
else if (avgFrac >= 0.8) currentDisplayInterval = (currentDisplayInterval * 0.55).toFixed(1);
else if (avgFrac >= 0.7) currentDisplayInterval = (currentDisplayInterval * 0.60).toFixed(1);
else if (avgFrac >= 0.6) currentDisplayInterval = (currentDisplayInterval * 0.65).toFixed(1);
@ -49,8 +50,9 @@ function getFrame( monId, time ) {
for ( var event_id in events ) {
// Search for the event matching this time. Would be more efficient if we had events indexed by monitor
Event = events[event_id];
if ( Event.MonitorId != monId || Event.StartTimeSecs > time || Event.EndTimeSecs < time )
if ( Event.MonitorId != monId || Event.StartTimeSecs > time || Event.EndTimeSecs < time ) {
continue;
}
var duration = Event.EndTimeSecs - Event.StartTimeSecs;
if ( ! Event.FramesById ) {
@ -61,33 +63,33 @@ function getFrame( monId, time ) {
// Need to get frame by time, not some fun calc that assumes frames have the same mlength.
// Frames are not sorted.
for ( var frame_id in Event.FramesById ) {
if ( 0 ) {
if ( frame == 0 ) {
console.log("Found frame for time " + time );
console.log(Frame);
Frame = Event.FramesById[frame_id];
break;
if ( 0 ) {
if ( frame == 0 ) {
console.log("Found frame for time " + time );
console.log(Frame);
Frame = Event.FramesById[frame_id];
break;
}
frame --;
continue;
}
frame --;
continue;
}
if (
Event.FramesById[frame_id].TimeStampSecs == time
Event.FramesById[frame_id].TimeStampSecs == time
|| (
Event.FramesById[frame_id].TimeStampSecs < time
&& (
(!Event.FramesById[frame_id].NextTimeStampSecs)
(!Event.FramesById[frame_id].NextTimeStampSecs)
||
(Event.FramesById[frame_id].NextTimeStampSecs > time)
)
)
) {
)
) {
Frame = Event.FramesById[frame_id];
break;
}
} // end foreach frame in the event.
if ( ! Frame ) {
console.log("Didn't find frame for " + time );
console.log("Didn't find frame for " + time );
return null;
}
} // end foreach event
@ -100,7 +102,7 @@ function getImageSource( monId, time ) {
var new_url = monitorImageObject[monId].src.replace(
/rand=\d+/i,
'rand='+Math.floor((Math.random() * 1000000) )
);
);
if ( auth_hash ) {
// update auth hash
new_url = new_url.replace(/auth=[a-z0-9]+/i, 'auth='+auth_hash);
@ -110,11 +112,10 @@ function getImageSource( monId, time ) {
var Frame = getFrame(monId, time);
if ( Frame ) {
// Adjust for bulk frames
var frame_id;
if ( Frame.NextFrameId ) {
var duration = Frame.NextTimeStampSecs - Frame.TimeStampSecs;
frame_id = Frame.FrameId + parseInt( (Frame.NextFrameId-Frame.FrameId) * ( time-Frame.TimeStampSecs )/duration );
//console.log("Have NextFrame: duration: " + duration + " frame_id = " + frame_id + " from " + Frame.NextFrameId + ' - ' + Frame.FrameId + " time: " + (time-Frame.TimeStampSecs) );
//console.log("Have NextFrame: duration: " + duration + " frame_id = " + frame_id + " from " + Frame.NextFrameId + ' - ' + Frame.FrameId + " time: " + (time-Frame.TimeStampSecs) );
//} else {
//console.log("No NextFrame");
}
@ -207,16 +208,16 @@ function writeText( monId, text ) {
function loadImage2Monitor( monId, url ) {
if ( monitorLoading[monId] && monitorImageObject[monId].src != url ) {
// never queue the same image twice (if it's loading it has to be defined, right?
monitorLoadingStageURL[monId] = url; // we don't care if we are overriting, it means it didn't change fast enough
monitorLoadingStageURL[monId] = url; // we don't care if we are overriting, it means it didn't change fast enough
} else {
if ( monitorImageObject[monId].src == url ) return; // do nothing if it's the same
if ( monitorImageObject[monId].src == url ) return; // do nothing if it's the same
if ( url == 'no data' ) {
writeText(monId, 'No Data');
} else {
//writeText(monId, 'Loading...');
monitorLoading[monId] = true;
monitorLoadStartTimems[monId] = new Date().getTime();
monitorImageObject[monId].src = url; // starts a load but doesn't refresh yet, wait until ready
monitorImageObject[monId].src = url; // starts a load but doesn't refresh yet, wait until ready
}
}
}
@ -227,18 +228,18 @@ function timerFire() {
// zero just turn off interrupts
clearInterval(timerObj);
timerInterval=currentDisplayInterval;
if ( currentSpeed>0 || liveMode!=0 ) timerObj=setInterval(timerFire, timerInterval); // don't fire out of live mode if speed is zero
if ( currentSpeed>0 || liveMode!=0 ) timerObj=setInterval(timerFire, timerInterval); // don't fire out of live mode if speed is zero
}
if ( liveMode ) {
outputUpdate(currentTimeSecs); // In live mode we basically do nothing but redisplay
} else if ( currentTimeSecs + playSecsperInterval >= maxTimeSecs ) {
// beyond the end just stop
console.log("Current time " + currentTimeSecs + " + " + playSecsperInterval + " >= " + maxTimeSecs + " so stopping");
console.log("Current time " + currentTimeSecs + " + " + playSecsperInterval + " >= " + maxTimeSecs + " so stopping");
setSpeed(0);
outputUpdate(currentTimeSecs);
} else {
//console.log("Current time " + currentTimeSecs + " + " + playSecsperInterval );
//console.log("Current time " + currentTimeSecs + " + " + playSecsperInterval );
outputUpdate(playSecsperInterval + currentTimeSecs);
}
return;
@ -256,15 +257,16 @@ function drawSliderOnGraph(val) {
// Set some sizes
var labelpx = Math.max( 6, Math.min( 20, parseInt(cHeight * timeLabelsFractOfRow / (numMonitors+1)) ) );
var labbottom = parseInt(cHeight * 0.2 / (numMonitors+1)).toString() + "px"; // This is positioning same as row labels below, but from bottom so 1-position
var labfont = labelpx + "px"; // set this like below row labels
var labbottom = parseInt(cHeight * 0.2 / (numMonitors+1)).toString() + "px"; // This is positioning same as row labels below, but from bottom so 1-position
var labfont = labelpx + "px"; // set this like below row labels
if ( numMonitors > 0 ) {
// if we have no data to display don't do the slider itself
var sliderX = parseInt( (val - minTimeSecs) / rangeTimeSecs * cWidth - sliderWidth/2); // position left side of slider
var sliderX = parseInt( (val - minTimeSecs) / rangeTimeSecs * cWidth - sliderWidth/2); // position left side of slider
if ( sliderX < 0 ) sliderX = 0;
if ( sliderX+sliderWidth > cWidth )
if ( sliderX+sliderWidth > cWidth ) {
sliderX=cWidth-sliderWidth-1;
}
// If we have data already saved first restore it from LAST time
@ -297,10 +299,11 @@ function drawSliderOnGraph(val) {
// try to get length and then when we get too close to the right switch to the left
var len = o.offsetWidth;
var x;
if(sliderX > cWidth/2)
if (sliderX > cWidth/2) {
x=sliderX - len - 10;
else
} else {
x=sliderX + 10;
}
o.style.left=x.toString() + "px";
}
@ -314,15 +317,16 @@ function drawSliderOnGraph(val) {
o.style.bottom=labbottom;
o.style.font=labfont;
o.style.left="5px";
if ( numMonitors == 0 ) // we need a len calculation if we skipped the slider
if ( numMonitors == 0 ) { // we need a len calculation if we skipped the slider
len = o.offsetWidth;
}
// If the slider will overlay part of this suppress (this is the left side)
if ( len + 10 > sliderX || cWidth < len * 4 ) {
// that last check is for very narrow browsers
o.style.display="none";
} else {
o.style.display="inline";
o.style.display="inline-flex"; // safari won't take this but will just ignore
o.style.display="inline-flex"; // safari won't take this but will just ignore
}
var o = $('scrubright');
@ -342,7 +346,7 @@ function drawSliderOnGraph(val) {
function drawGraph() {
var divWidth=$('timelinediv').clientWidth;
canvas.width = cWidth = divWidth; // Let it float and determine width (it should be sized a bit smaller percentage of window)
canvas.width = cWidth = divWidth; // Let it float and determine width (it should be sized a bit smaller percentage of window)
cHeight = parseInt(window.innerHeight * 0.10);
if ( cHeight < numMonitors * 20 ) {
cHeight = numMonitors * 20;
@ -360,7 +364,7 @@ function drawGraph() {
underSlider=undefined;
return;
}
var rowHeight = parseInt(cHeight / (numMonitors + 1) ); // Leave room for a scale of some sort
var rowHeight = parseInt(cHeight / (numMonitors + 1) ); // Leave room for a scale of some sort
// first fill in the bars for the events (not alarms)
@ -371,33 +375,34 @@ function drawGraph() {
var x1 = parseInt((Event.StartTimeSecs - minTimeSecs) / rangeTimeSecs * cWidth);
var x2 = parseInt((Event.EndTimeSecs - minTimeSecs) / rangeTimeSecs * cWidth + 0.5 ); // round high end up to be sure consecutive ones connect
ctx.fillStyle = monitorColour[Event.MonitorId];
ctx.globalAlpha = 0.2; // light color for background
ctx.clearRect(x1, monitorIndex[Event.MonitorId]*rowHeight, x2-x1, rowHeight); // Erase any overlap so it doesn't look artificially darker
ctx.globalAlpha = 0.2; // light color for background
ctx.clearRect(x1, monitorIndex[Event.MonitorId]*rowHeight, x2-x1, rowHeight); // Erase any overlap so it doesn't look artificially darker
ctx.fillRect(x1, monitorIndex[Event.MonitorId]*rowHeight, x2-x1, rowHeight);
for ( var frame_id in Event.FramesById ) {
var Frame = Event.FramesById[frame_id];
if ( ! Frame.Score )
if ( ! Frame.Score ) {
continue;
}
// Now put in scored frames (if any)
var x1=parseInt( (Frame.TimeStampSecs - minTimeSecs) / rangeTimeSecs * cWidth); // round low end down
var x1=parseInt( (Frame.TimeStampSecs - minTimeSecs) / rangeTimeSecs * cWidth); // round low end down
var x2=parseInt( (Frame.TimeStampSecs - minTimeSecs) / rangeTimeSecs * cWidth + 0.5 ); // round up
if(x2-x1 < 2) x2=x1+2; // So it is visible make them all at least this number of seconds wide
if (x2-x1 < 2) x2=x1+2; // So it is visible make them all at least this number of seconds wide
ctx.fillStyle=monitorColour[Event.MonitorId];
ctx.globalAlpha = 0.4 + 0.6 * (1 - Frame.Score/maxScore); // Background is scaled but even lowest is twice as dark as the background
ctx.globalAlpha = 0.4 + 0.6 * (1 - Frame.Score/maxScore); // Background is scaled but even lowest is twice as dark as the background
ctx.fillRect(x1, monitorIndex[Event.MonitorId]*rowHeight, x2-x1, rowHeight);
} // end foreach frame
} // end foreach Event
for(var i=0; i<numMonitors; i++) {
for (var i=0; i<numMonitors; i++) {
// Note that this may be a sparse array
ctx.font= parseInt(rowHeight * timeLabelsFractOfRow).toString() + "px Georgia";
ctx.fillStyle="white";
ctx.globalAlpha=1;
ctx.fillText(monitorName[monitorPtr[i]], 0, (i + 1 - (1 - timeLabelsFractOfRow)/2 ) * rowHeight ); // This should roughly center font in row
ctx.fillText(monitorName[monitorPtr[i]], 0, (i + 1 - (1 - timeLabelsFractOfRow)/2 ) * rowHeight ); // This should roughly center font in row
}
underSlider=undefined; // flag we don't have a slider cached
underSlider=undefined; // flag we don't have a slider cached
drawSliderOnGraph(currentTimeSecs);
return;
} // end function drawGraph
@ -439,17 +444,18 @@ function redrawScreen() {
$('ScaleDiv').style.display="none";
$('fit').innerHTML="Scale";
var vh=window.innerHeight;
var vw=window.innerWidth;
var pos=$('monitors').getPosition();
var mh=(vh - pos.y - $('fps').getSize().y);
$('monitors').setStyle('height', mh.toString() + "px"); // leave a small gap at bottom
if(maxfit2($('monitors').getSize().x, $('monitors').getSize().y) == 0) /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
$('monitors').setStyle('height', mh.toString() + "px"); // leave a small gap at bottom
if (maxfit2($('monitors').getSize().x, $('monitors').getSize().y) == 0) { /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
fitMode=1-fitMode;
}
} else {
// switch out of fit mode
// if we fit, then monitors were absolutely positioned already (or will be) otherwise release them to float
for( var i=0; i<numMonitors; i++ )
for ( var i=0; i<numMonitors; i++ ) {
monitorCanvasObj[monitorPtr[i]].style.position="";
}
$('monitors').setStyle('height', "auto");
$('ScaleDiv').style.display="inline";
$('ScaleDiv').style.display="inline-flex";
@ -457,7 +463,7 @@ function redrawScreen() {
setScale(currentScale);
}
outputUpdate(currentTimeSecs);
timerFire(); // force a fire in case it's not timing
timerFire(); // force a fire in case it's not timing
}
function outputUpdate(time) {
@ -481,22 +487,30 @@ function relMouseCoords(event) {
do {
totalOffsetX += currentElement.offsetLeft - currentElement.scrollLeft;
totalOffsetY += currentElement.offsetTop - currentElement.scrollTop;
} while(currentElement = currentElement.offsetParent);
} while (currentElement = currentElement.offsetParent);
canvasX = event.pageX - totalOffsetX;
canvasY = event.pageY - totalOffsetY;
return {x:canvasX, y:canvasY};
return {x: canvasX, y: canvasY};
}
HTMLCanvasElement.prototype.relMouseCoords = relMouseCoords;
// These are the functions for mouse movement in the timeline. Note that touch is treated as a mouse move with mouse down
var mouseisdown=false;
function mdown(event) {mouseisdown=true; mmove(event);}
function mup(event) {mouseisdown=false;}
function mout(event) {mouseisdown=false;} // if we go outside treat it as release
function tmove(event) {mouseisdown=true; mmove(event);}
function mdown(event) {
mouseisdown=true; mmove(event);
}
function mup(event) {
mouseisdown=false;
}
function mout(event) {
mouseisdown=false;
} // if we go outside treat it as release
function tmove(event) {
mouseisdown=true; mmove(event);
}
function mmove(event) {
if ( mouseisdown ) {
@ -538,15 +552,15 @@ function setFit(value) {
}
function showScale(newscale) {
// updates slider only
$('scaleslideroutput').innerHTML = parseFloat(newscale).toFixed(2).toString() + " x";
return;
// updates slider only
$('scaleslideroutput').innerHTML = parseFloat(newscale).toFixed(2).toString() + " x";
return;
}
function setScale(newscale) {
// makes actual change
showScale(newscale);
for(var i=0; i<numMonitors; i++) {
for (var i=0; i<numMonitors; i++) {
monitorCanvasObj[monitorPtr[i]].width=monitorWidth[monitorPtr[i]]*monitorNormalizeScale[monitorPtr[i]]*monitorZoomScale[monitorPtr[i]]*newscale;
monitorCanvasObj[monitorPtr[i]].height=monitorHeight[monitorPtr[i]]*monitorNormalizeScale[monitorPtr[i]]*monitorZoomScale[monitorPtr[i]]*newscale;
}
@ -559,7 +573,7 @@ function showSpeed(val) {
}
function setSpeed( speed_index ) {
if ( liveMode == 1 ) return; // we shouldn't actually get here but just in case
if ( liveMode == 1 ) return; // we shouldn't actually get here but just in case
currentSpeed = parseFloat(speeds[speed_index]);
speedIndex = speed_index;
playSecsperInterval = Math.floor( 1000 * currentSpeed * currentDisplayInterval ) / 1000000;
@ -590,8 +604,9 @@ function clicknav(minSecs, maxSecs, live) {// we use the current time if we can
var maxStr = "";
var currentStr = "";
if ( minSecs > 0 ) {
if ( maxSecs > now )
if ( maxSecs > now ) {
maxSecs = parseInt(now);
}
maxStr="&maxTime=" + secs2inputstr(maxSecs);
$('maxTime').value = secs2inputstr(maxSecs);
}
@ -605,18 +620,22 @@ function clicknav(minSecs, maxSecs, live) {// we use the current time if we can
}
var intervalStr="&displayinterval=" + currentDisplayInterval.toString();
if ( minSecs && maxSecs ) {
if ( currentTimeSecs > minSecs && currentTimeSecs < maxSecs ) // make sure time is in the new range
if ( currentTimeSecs > minSecs && currentTimeSecs < maxSecs ) { // make sure time is in the new range
currentStr="&current=" + secs2dbstr(currentTimeSecs);
}
}
var liveStr="&live=0";
if ( live == 1 )
if ( live == 1 ) {
liveStr="&live=1";
}
var zoomStr="";
for ( var i=0; i < numMonitors; i++ )
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) // allow for some up/down changes and just treat as 1 of almost 1
for ( var i=0; i < numMonitors; i++ ) {
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) { // allow for some up/down changes and just treat as 1 of almost 1
zoomStr += "&z" + monitorPtr[i].toString() + "=" + monitorZoomScale[monitorPtr[i]].toFixed(2);
}
}
var uri = "?view=" + currentView + '&fit='+(fitMode==1?'1':'0') + minStr + maxStr + currentStr + intervalStr + liveStr + zoomStr + "&scale=" + $j("#scaleslider")[0].value + "&speed=" + speeds[$j("#speedslider")[0].value];
window.location = uri;
@ -637,14 +656,14 @@ function click_lastEight() {
}
function click_zoomin() {
rangeTimeSecs = parseInt(rangeTimeSecs / 2);
minTimeSecs = parseInt(currentTimeSecs - rangeTimeSecs/2); // this is the slider current time, we center on that
minTimeSecs = parseInt(currentTimeSecs - rangeTimeSecs/2); // this is the slider current time, we center on that
maxTimeSecs = parseInt(currentTimeSecs + rangeTimeSecs/2);
clicknav(minTimeSecs, maxTimeSecs, 0);
}
function click_zoomout() {
rangeTimeSecs = parseInt(rangeTimeSecs * 2);
minTimeSecs = parseInt(currentTimeSecs - rangeTimeSecs/2); // this is the slider current time, we center on that
minTimeSecs = parseInt(currentTimeSecs - rangeTimeSecs/2); // this is the slider current time, we center on that
maxTimeSecs = parseInt(currentTimeSecs + rangeTimeSecs/2);
clicknav(minTimeSecs, maxTimeSecs, 0);
}
@ -680,11 +699,10 @@ function compSize(a, b) { // sort array by some size parameter - height seems t
function maxfit2(divW, divH) {
var bestFitX=[]; // how we arranged the so-far best match
var bestFitX=[]; // how we arranged the so-far best match
var bestFitX2=[];
var bestFitY=[];
var bestFitY2=[];
var bestFitScale;
var minScale=0.05;
var maxScale=5.00;
@ -694,30 +712,32 @@ function maxfit2(divW, divH) {
//monitorPtr.sort(compSize); //Sorts monitors by size in viewport. If enabled makes captions not line up with graphs.
while(1) {
if( maxScale - minScale < 0.01 ) break;
while (1) {
if ( maxScale - minScale < 0.01 ) break;
var thisScale = (maxScale + minScale) / 2;
var allFit=1;
var thisArea=0;
var thisX=[]; // top left
var thisX=[]; // top left
var thisY=[];
var thisX2=[]; // bottom right
var thisX2=[]; // bottom right
var thisY2=[];
for ( var m = 0; m < numMonitors; m++ ) {
// this loop places each monitor (if it can)
var monId = monitorPtr[m];
function doesItFit(x, y, w, h, d) { // does block (w,h) fit at position (x,y) relative to edge and other nodes already done (0..d)
if(x+w>=divW) return 0;
if(y+h>=divH) return 0;
for(var i=0; i<=d; i++)
if( !( thisX[i]>x+w-1 || thisX2[i] < x || thisY[i] > y+h-1 || thisY2[i] < y ) ) return 0;
function doesItFit(x, y, w, h, d) { // does block (w,h) fit at position (x,y) relative to edge and other nodes already done (0..d)
if (x+w>=divW) return 0;
if (y+h>=divH) return 0;
for (var i=0; i<=d; i++) {
if ( !( thisX[i]>x+w-1 || thisX2[i] < x || thisY[i] > y+h-1 || thisY2[i] < y ) ) return 0;
}
return 1; // it's OK
}
if ( borders <= 0 )
borders=$("Monitor"+monId).getStyle("border").toInt() * 2; // assume fixed size border, and added to both sides and top/bottom
if ( borders <= 0 ) {
borders=$("Monitor"+monId).getStyle("border").toInt() * 2;
} // assume fixed size border, and added to both sides and top/bottom
// try fitting over first, then down. Each new one must land at either upper right or lower left corner of last (try in that order)
// Pick the one with the smallest Y, then smallest X if Y equal
var fitX = 999999999;
@ -756,7 +776,7 @@ function maxfit2(divW, divH) {
}
if ( allFit == 1 ) {
minScale=thisScale;
if(bestFitArea<thisArea) {
if (bestFitArea<thisArea) {
bestFitArea=thisArea;
bestFitX=thisX;
bestFitY=thisY;
@ -796,8 +816,8 @@ function showOneMonitor(monId) {
} else {
var Frame = getFrame( monId, currentTimeSecs );
if ( Frame ) {
url="?view=event&eid=" + Frame.EventId + '&fid=' +Frame.FrameId;
createPopup(url, 'zmEvent', 'event', monitorWidth[monId], monitorHeight[monId]);
url="?view=event&eid=" + Frame.EventId + '&fid=' +Frame.FrameId;
createPopup(url, 'zmEvent', 'event', monitorWidth[monId], monitorHeight[monId]);
} else {
url="?view=watch&mid=" + monId.toString();
createPopup(url, 'zmWatch', 'watch', monitorWidth[monId], monitorHeight[monId] );
@ -811,7 +831,7 @@ function zoom(monId, scale) {
if ( redrawScreen() == 0 ) {// failure here is probably because we zoomed too far
monitorZoomScale[monId] = lastZoomMonPriorScale;
alert("You can't zoom that far -- rolling back");
redrawScreen(); // put things back and hope it works
redrawScreen(); // put things back and hope it works
}
}
@ -819,12 +839,13 @@ function clickMonitor(event, monId) {
var monitor_element = $("Monitor"+monId.toString());
var pos_x = event.offsetX ? (event.offsetX) : event.pageX - monitor_element.offsetLeft;
var pos_y = event.offsetY ? (event.offsetY) : event.pageY - monitor_element.offsetTop;
if ( pos_x < monitor_element.width/4 && pos_y < monitor_element.height/4 )
if ( pos_x < monitor_element.width/4 && pos_y < monitor_element.height/4 ) {
zoom(monId, 1.15);
else if ( pos_x > monitor_element.width * 3/4 && pos_y < monitor_element.height/4 )
} else if ( pos_x > monitor_element.width * 3/4 && pos_y < monitor_element.height/4 ) {
zoom(monId, 1/1.15);
else
} else {
showOneMonitor(monId);
}
return;
}
@ -837,7 +858,7 @@ function changeDateTime(e) {
if ( minTime.isAfter(maxTime) ) {
maxTime_element.parent().addClass('has-error');
return; // Don't reload because we have invalid datetime filter.
} else {
} else {
maxTime_element.parent().removeClass('has-error');
}
@ -848,9 +869,11 @@ function changeDateTime(e) {
var fitStr ="&fit="+(fitMode?"1":"0");
var zoomStr="";
for ( var i=0; i < numMonitors; i++ )
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) // allow for some up/down changes and just treat as 1 of almost 1
zoomStr += "&z" + monitorPtr[i].toString() + "=" + monitorZoomScale[monitorPtr[i]].toFixed(2);
for ( var i=0; i < numMonitors; i++ ) {
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) { // allow for some up/down changes and just treat as 1 of almost 1
zoomStr += "&z" + monitorPtr[i].toString() + "=" + monitorZoomScale[monitorPtr[i]].toFixed(2);
}
}
var uri = "?view=" + currentView + fitStr + minStr + maxStr + liveStr + zoomStr + "&scale=" + $j("#scaleslider")[0].value + "&speed=" + speeds[$j("#speedslider")[0].value];
window.location = uri;
@ -876,8 +899,12 @@ function initPage() {
monitorCanvasCtx[monId] = monitorCanvasObj[monId].getContext('2d');
var imageObject = monitorImageObject[monId] = new Image();
imageObject.monId = monId;
imageObject.onload = function() {imagedone(this, this.monId, true );};
imageObject.onerror = function() {imagedone(this, this.monId, false );};
imageObject.onload = function() {
imagedone(this, this.monId, true );
};
imageObject.onerror = function() {
imagedone(this, this.monId, false );
};
loadImage2Monitor( monId, monitorImageURL[monId] );
}
}
@ -891,29 +918,29 @@ function initPage() {
//setLive(liveMode); // will redraw
redrawScreen();
$j('#minTime').datetimepicker({
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
}
});
$j('#maxTime').datetimepicker({
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
minDate: $j('#minTime').val(),
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
minDate: $j('#minTime').val(),
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
}
});
}
window.addEventListener("resize", redrawScreen, {passive:true});
window.addEventListener("resize", redrawScreen, {passive: true});
// Kick everything off
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -29,7 +29,7 @@ function configureButtons( element ) {
(form.username == "") || (form.username == null) ||
(form.password == "") || (form.password == null);
}
if(form.elements.namedItem("saveBtn")) {
if (form.elements.namedItem("saveBtn")) {
form.saveBtn.disabled = (form.probe.selectedIndex==0);
}
}

View File

@ -1,5 +1,5 @@
function validateForm( form ) {
return( true );
return ( true );
}
function submitForm( form ) {
@ -16,7 +16,7 @@ function limitRange( field, minValue, maxValue ) {
}
function initPage() {
return( true );
return ( true );
}
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,9 +1,10 @@
function submitForm( element ) {
var form = element.form;
if ( form.option.selectedIndex == 0 )
if ( form.option.selectedIndex == 0 ) {
form.view.value = currentView;
else
} else {
form.view.value = 'none';
}
form.submit();
}

View File

@ -12,7 +12,7 @@ function changeDateTime(e) {
}
minTime_element[0].form.submit();
return;
return;
var minStr = "&minTime="+($j('#minTime')[0].value);
var maxStr = "&maxTime="+($j('#maxTime')[0].value);
@ -20,9 +20,11 @@ return;
var fitStr ="&fit="+(fitMode?"1":"0");
var zoomStr="";
for ( var i=0; i < numMonitors; i++ )
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) // allow for some up/down changes and just treat as 1 of almost 1
zoomStr += "&z" + monitorPtr[i].toString() + "=" + monitorZoomScale[monitorPtr[i]].toFixed(2);
for ( var i=0; i < numMonitors; i++ ) {
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) { // allow for some up/down changes and just treat as 1 of almost 1
zoomStr += "&z" + monitorPtr[i].toString() + "=" + monitorZoomScale[monitorPtr[i]].toFixed(2);
}
}
var uri = "?view=" + currentView + fitStr + minStr + maxStr + liveStr + zoomStr + "&scale=" + $j("#scaleslider")[0].value + "&speed=" + speeds[$j("#speedslider")[0].value];
window.location = uri;
@ -30,28 +32,28 @@ return;
function initPage() {
$j('#minTime').datetimepicker({
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
}
});
$j('#maxTime').datetimepicker({
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
minDate: $j('#minTime').val(),
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
minDate: $j('#minTime').val(),
maxDate: +0,
constrainInput: false,
onClose: function(newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
}
}
});
}
// Kick everything off
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,11 +1,11 @@
function validateForm( form, newServer ) {
var errors = new Array();
function validateForm(form) {
var errors = [];
if ( !form.elements['newServer[Name]'].value ) {
errors[errors.length] = "You must supply a name";
}
if ( errors.length ) {
alert( errors.join( "\n" ) );
return( false );
return ( false );
}
return( true );
return ( true );
}

View File

@ -1,63 +1,63 @@
$j(document).ready(function() {
// Enable or disable the Delete button depending on the selected run state
$j("#runState").change(function() {
runstate = $j(this).val();
// Enable or disable the Delete button depending on the selected run state
$j("#runState").change(function() {
runstate = $j(this).val();
if ( (runstate == 'stop') || (runstate == 'restart') || (runstate == 'start') || (runstate == 'default') ) {
$j("#btnDelete").prop( "disabled", true );
} else {
$j("#btnDelete").prop( "disabled", false );
}
});
if ( (runstate == 'stop') || (runstate == 'restart') || (runstate == 'start') || (runstate == 'default') ) {
$j("#btnDelete").prop( "disabled", true );
} else {
$j("#btnDelete").prop( "disabled", false );
}
});
// Enable or disable the Save button when entering a new state
$j("#newState").keyup(function() {
length = $j(this).val().length;
console.log(length);
if (length < 1) {
$j("#btnSave").prop( "disabled", true );
} else {
$j("#btnSave").prop( "disabled", false );
}
});
// Enable or disable the Save button when entering a new state
$j("#newState").keyup(function() {
length = $j(this).val().length;
console.log(length);
if (length < 1) {
$j("#btnSave").prop( "disabled", true );
} else {
$j("#btnSave").prop( "disabled", false );
}
});
// Delete a state
$j("#btnDelete").click(function() {
stateStuff( 'delete', $j("#runState").val( ));
});
// Delete a state
$j("#btnDelete").click(function() {
stateStuff( 'delete', $j("#runState").val( ));
});
// Save a new state
$j("#btnSave").click(function() {
stateStuff( 'save', undefined, $j("#newState").val() );
});
// Save a new state
$j("#btnSave").click(function() {
stateStuff( 'save', undefined, $j("#newState").val() );
});
// Change state
$j("#btnApply").click(function() {
stateStuff( 'state', $j("#runState").val() );
});
// Change state
$j("#btnApply").click(function() {
stateStuff( 'state', $j("#runState").val() );
});
function stateStuff( action, runState, newState ) {
var formData = {
'view' : 'console',
'action' : action,
'apply' : 1,
'runState' : runState,
'newState' : newState
};
console.log(formData);
function stateStuff( action, runState, newState ) {
var formData = {
'view': 'console',
'action': action,
'apply': 1,
'runState': runState,
'newState': newState
};
console.log(formData);
$j("#pleasewait").toggleClass("hidden");
$j("#pleasewait").toggleClass("hidden");
$j.ajax({
type: 'POST',
url: thisUrl,
data: formData,
dataType: 'html',
enocde: true
}).done(function(data) {
location.reload();
});
}
$j.ajax({
type: 'POST',
url: thisUrl,
data: formData,
dataType: 'html',
enocde: true
}).done(function(data) {
location.reload();
});
}
});

View File

@ -1,14 +1,15 @@
function validateForm( form, newStorage ) {
var errors = new Array();
if ( !form.elements['newStorage[Name]'].value ) {
errors[errors.length] = "You must supply a name";
}
if ( !form.elements['newStorage[Path]'].value ) {
errors[errors.length] = "You must supply a path";
}
if ( errors.length ) {
alert( errors.join( "\n" ) );
return( false );
}
return( true );
function validateForm(form) {
var errors = [];
if ( !form.elements['newStorage[Name]'].value ) {
errors[errors.length] = 'You must supply a name';
}
if ( !form.elements['newStorage[Path]'].value ) {
errors[errors.length] = 'You must supply a path';
}
if ( errors.length ) {
alert(errors.join("\n"));
return false;
}
return true;
}

View File

@ -16,19 +16,22 @@ function showEvent( eid, fid, width, height ) {
function createEventHtml( event, frame ) {
var eventHtml = new Element( 'div' );
if ( event.Archived > 0 )
if ( event.Archived > 0 ) {
eventHtml.addClass( 'archived' );
}
new Element( 'p' ).inject( eventHtml ).set( 'text', monitors[event.MonitorId].Name );
new Element( 'p' ).inject( eventHtml ).set( 'text', event.Name+(frame?("("+frame.FrameId+")"):"") );
new Element( 'p' ).inject( eventHtml ).set( 'text', event.StartTime+" - "+event.Length+"s" );
new Element( 'p' ).inject( eventHtml ).set( 'text', event.Cause );
if ( event.Notes )
if ( event.Notes ) {
new Element( 'p' ).inject( eventHtml ).set( 'text', event.Notes );
if ( event.Archived > 0 )
}
if ( event.Archived > 0 ) {
new Element( 'p' ).inject( eventHtml ).set( 'text', archivedString );
}
return( eventHtml );
return ( eventHtml );
}
function showEventDetail( eventHtml ) {
@ -66,7 +69,7 @@ function frameDataResponse( respObj, respText ) {
if ( !event['frames'] ) {
console.log("No frames data in event response");
event['frames'] = new Object();
event['frames'] = {};
}
event['frames'][frame.FrameId] = frame;
@ -75,8 +78,8 @@ function frameDataResponse( respObj, respText ) {
previewEvent(frame.EventId, frame.FrameId);
}
var eventQuery = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: eventDataResponse } );
var frameQuery = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: frameDataResponse } );
var eventQuery = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: eventDataResponse} );
var frameQuery = new Request.JSON( {url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: frameDataResponse} );
function requestFrameData( eventId, frameId ) {
if ( !events[eventId] ) {
@ -119,15 +122,16 @@ function loadEventImage( imagePath, eid, fid, width, height, fps, videoName, dur
var sources = vid.getElementsByTagName('source');
sources[0].src = newsource;
var tracks = vid.getElementsByTagName('track');
if(tracks.length) {
if (tracks.length) {
tracks[0].parentNode.removeChild(tracks[0]);
}
vid.load();
addVideoTimingTrack(vid, Monitor.LabelFormat, Monitor.Name, duration, startTime);
vid.currentTime = fid/fps;
vid.currentTime = fid/fps;
} else {
if ( ! vid.seeking )
if ( ! vid.seeking ) {
vid.currentTime=fid/fps;
}
}
} else {
if ( vid ) vid.hide();

View File

@ -14,13 +14,14 @@ function validateForm( form, newUser ) {
}
var monitorIds = new Array();
for ( var i = 0; i < form.elements['monitorIds'].options.length; i++ ) {
if ( form.elements['monitorIds'].options[i].selected )
if ( form.elements['monitorIds'].options[i].selected ) {
monitorIds[monitorIds.length] = form.elements['monitorIds'].options[i].value;
}
}
form.elements['newUser[MonitorIds]'].value = monitorIds.join( ',' );
if ( errors.length ) {
alert( errors.join( "\n" ) );
return( false );
return ( false );
}
return( true );
return ( true );
}

View File

@ -10,10 +10,11 @@ var generateVideoTimer = null;
function generateVideoProgress() {
var tickerText = $('videoProgressTicker').get('text');
if ( tickerText.length < 1 || tickerText.length > 4 )
if ( tickerText.length < 1 || tickerText.length > 4 ) {
$('videoProgressTicker').set( 'text', '.' );
else
} else {
$('videoProgressTicker').appendText( '.' );
}
}
function generateVideoResponse( respObj, respText ) {
@ -23,7 +24,7 @@ function generateVideoResponse( respObj, respText ) {
function generateVideo( form ) {
var parms = 'view=request&request=event&action=video';
parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: generateVideoResponse } );
var query = new Request.JSON( {url: thisUrl, method: 'post', data: parms, onSuccess: generateVideoResponse} );
query.send();
$('videoProgress').removeClass( 'hidden' );
$('videoProgress').setProperty( 'class', 'warnText' );

View File

@ -8,20 +8,24 @@ function setButtonState(element, butClass) {
function showEvents() {
$('ptzControls').addClass( 'hidden' );
$('events').removeClass( 'hidden' );
if ( $('eventsControl') )
if ( $('eventsControl') ) {
$('eventsControl').addClass('hidden');
if ( $('controlControl') )
}
if ( $('controlControl') ) {
$('controlControl').removeClass('hidden');
}
showMode = "events";
}
function showPtzControls() {
$('events').addClass( 'hidden' );
$('ptzControls').removeClass( 'hidden' );
if ( $('eventsControl') )
if ( $('eventsControl') ) {
$('eventsControl').removeClass('hidden');
if ( $('controlControl') )
}
if ( $('controlControl') ) {
$('controlControl').addClass('hidden');
}
showMode = "control";
}
@ -40,7 +44,7 @@ function changeScale() {
newHeight = monitorHeight * scale / SCALE_BASE;
}
Cookie.write( 'zmWatchScale'+monitorId, scale, { duration: 10*365 } );
Cookie.write( 'zmWatchScale'+monitorId, scale, {duration: 10*365} );
/*Stream could be an applet so can't use moo tools*/
var streamImg = $('liveStream'+monitorId);
@ -60,17 +64,18 @@ var lastAlarmState = STATE_IDLE;
function setAlarmState( currentAlarmState ) {
alarmState = currentAlarmState;
var stateString = "Unknown";
var stateClass = "";
if ( alarmState == STATE_ALARM )
if ( alarmState == STATE_ALARM ) {
stateClass = "alarm";
else if ( alarmState == STATE_ALERT )
} else if ( alarmState == STATE_ALERT ) {
stateClass = "alert";
}
$('stateValue').set( 'text', stateStrings[alarmState] );
if ( stateClass )
if ( stateClass ) {
$('stateValue').setProperty( 'class', stateClass );
else
} else {
$('stateValue').removeProperty( 'class' );
}
var isAlarmed = ( alarmState == STATE_ALARM || alarmState == STATE_ALERT );
var wasAlarmed = ( lastAlarmState == STATE_ALARM || lastAlarmState == STATE_ALERT );
@ -81,10 +86,11 @@ function setAlarmState( currentAlarmState ) {
if ( newAlarm ) {
if ( SOUND_ON_ALARM ) {
// Enable the alarm sound
if ( !canPlayPauseAudio )
if ( !canPlayPauseAudio ) {
$('alarmSound').removeClass( 'hidden' );
else
} else {
$('MediaPlayer').Play();
}
}
if ( POPUP_ON_ALARM ) {
window.focus();
@ -93,22 +99,25 @@ function setAlarmState( currentAlarmState ) {
if ( SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
if ( !canPlayPauseAudio )
if ( !canPlayPauseAudio ) {
$('alarmSound').addClass( 'hidden' );
else
} else {
$('MediaPlayer').Stop();
}
}
}
if ( oldAlarm) //done with an event do a refresh
if (oldAlarm) { // done with an event do a refresh
eventCmdQuery();
}
lastAlarmState = alarmState;
}
if ( monitorType != 'WebSite' ) {
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
if ( auth_hash )
if ( auth_hash ) {
streamCmdParms += '&auth='+auth_hash;
}
var streamCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
@ -133,8 +142,9 @@ function getStreamCmdFailure(xhr) {
}
function getStreamCmdResponse(respObj, respText) {
watchdogOk("stream");
if ( streamCmdTimer )
if ( streamCmdTimer ) {
streamCmdTimer = clearTimeout(streamCmdTimer);
}
if ( respObj.result == 'Ok' ) {
// The get status command can get backed up, in which case we won't be able to get the semaphore and will exit.
if ( respObj.status ) {
@ -144,12 +154,13 @@ function getStreamCmdResponse(respObj, respText) {
setAlarmState(streamStatus.state);
$('levelValue').set('text', streamStatus.level);
if ( streamStatus.level > 95 )
if ( streamStatus.level > 95 ) {
$('levelValue').className = "alarm";
else if ( streamStatus.level > 80 )
} else if ( streamStatus.level > 80 ) {
$('levelValue').className = "alert";
else
} else {
$('levelValue').className = "ok";
}
var delayString = secsToTime(streamStatus.delay);
@ -170,15 +181,17 @@ function getStreamCmdResponse(respObj, respText) {
if ( streamStatus.rate == 1 ) {
streamCmdPlay(false);
} else if ( streamStatus.rate > 0 ) {
if ( streamStatus.rate < 1 )
if ( streamStatus.rate < 1 ) {
streamCmdSlowFwd(false);
else
} else {
streamCmdFastFwd(false);
}
} else {
if ( streamStatus.rate > -1 )
if ( streamStatus.rate > -1 ) {
streamCmdSlowRev(false);
else
} else {
streamCmdFastRev(false);
}
} // rate
} else {
$('modeValue').set( 'text', "Live" );
@ -189,10 +202,11 @@ function getStreamCmdResponse(respObj, respText) {
} // end if paused or delayed
$('zoomValue').set( 'text', streamStatus.zoom );
if ( streamStatus.zoom == "1.0" )
if ( streamStatus.zoom == "1.0" ) {
setButtonState( $('zoomOutBtn'), 'unavail' );
else
} else {
setButtonState( $('zoomOutBtn'), 'inactive' );
}
if ( canEditMonitors ) {
if ( streamStatus.enabled ) {
@ -218,8 +232,9 @@ function getStreamCmdResponse(respObj, respText) {
console.log("Have a new auth hash" + streamStatus.auth);
// Try to reload the image stream.
var streamImg = $('liveStream');
if ( streamImg )
if ( streamImg ) {
streamImg.src = streamImg.src.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
}
} // end if have a new auth hash
} // end if respObj.status
} else {
@ -228,19 +243,20 @@ function getStreamCmdResponse(respObj, respText) {
// If it's an auth error, we should reload the whole page.
window.location.reload();
if ( 0 ) {
var streamImg = $('liveStream'+monitorId);
if ( streamImg ) {
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
console.log("Changing livestream src to " + streamImg.src);
} else {
console.log("Unable to find streamImg liveStream");
}
var streamImg = $('liveStream'+monitorId);
if ( streamImg ) {
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
console.log("Changing livestream src to " + streamImg.src);
} else {
console.log("Unable to find streamImg liveStream");
}
}
}
var streamCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
streamCmdTimeout = streamCmdTimeout/5;
}
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
@ -252,8 +268,9 @@ function streamCmdPause( action ) {
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
}
}
function streamCmdPlay( action ) {
@ -272,8 +289,9 @@ function streamCmdPlay( action ) {
setButtonState( $('slowRevBtn'), 'unavail' );
setButtonState( $('fastRevBtn'), 'unavail' );
}
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
}
}
function streamCmdStop( action ) {
@ -284,8 +302,9 @@ function streamCmdStop( action ) {
setButtonState( $('slowFwdBtn'), 'unavail' );
setButtonState( $('slowRevBtn'), 'unavail' );
setButtonState( $('fastRevBtn'), 'unavail' );
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
}
setButtonState( $('stopBtn'), 'unavail' );
setButtonState( $('playBtn'), 'active' );
}
@ -298,8 +317,9 @@ function streamCmdFastFwd( action ) {
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_FASTFWD );
}
}
function streamCmdSlowFwd( action ) {
@ -310,8 +330,9 @@ function streamCmdSlowFwd( action ) {
setButtonState( $('slowFwdBtn'), 'active' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_SLOWFWD );
}
setButtonState( $('pauseBtn'), 'active' );
setButtonState( $('slowFwdBtn'), 'inactive' );
}
@ -324,8 +345,9 @@ function streamCmdSlowRev( action ) {
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'active' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_SLOWREV );
}
setButtonState( $('pauseBtn'), 'active' );
setButtonState( $('slowRevBtn'), 'inactive' );
}
@ -338,8 +360,9 @@ function streamCmdFastRev( action ) {
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_FASTREV );
}
}
function streamCmdZoomIn( x, y ) {
@ -364,26 +387,30 @@ function streamCmdQuery() {
if ( monitorType != 'WebSite' ) {
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
if ( auth_hash )
if ( auth_hash ) {
statusCmdParms += '&auth='+auth_hash;
var statusCmdReq = new Request.JSON( { url: monitorUrl, method: 'get', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
}
var statusCmdReq = new Request.JSON( {url: monitorUrl, method: 'get', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse} );
var statusCmdTimer = null;
}
function getStatusCmdResponse(respObj, respText) {
watchdogOk("status");
if ( statusCmdTimer )
if ( statusCmdTimer ) {
statusCmdTimer = clearTimeout(statusCmdTimer);
}
if ( respObj.result == 'Ok' ) {
$('fpsValue').set('text', respObj.monitor.FrameRate);
setAlarmState(respObj.monitor.Status);
} else
} else {
checkStreamForErrors("getStatusCmdResponse", respObj);
}
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
statusCmdTimeout = statusCmdTimeout/5;
}
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
@ -393,8 +420,9 @@ function statusCmdQuery() {
if ( monitorType != 'WebSite' ) {
var alarmCmdParms = "view=request&request=alarm&id="+monitorId;
if ( auth_hash )
if ( auth_hash ) {
alarmCmdParms += '&auth='+auth_hash;
}
var alarmCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
@ -452,8 +480,9 @@ function deleteEvent( event, eventId ) {
if ( monitorType != 'WebSite' ) {
var eventCmdParms = "view=request&request=status&entity=events&id="+monitorId+"&count="+maxDisplayEvents+"&sort=Id%20desc";
if ( auth_hash )
if ( auth_hash ) {
eventCmdParms += '&auth='+auth_hash;
}
var eventCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
@ -473,8 +502,9 @@ function highlightRow( row ) {
function getEventCmdResponse( respObj, respText ) {
watchdogOk("event");
if ( eventCmdTimer )
if ( eventCmdTimer ) {
eventCmdTimer = clearTimeout( eventCmdTimer );
}
if ( respObj.result == 'Ok' ) {
var dbEvents = respObj.events.reverse();
@ -482,53 +512,56 @@ function getEventCmdResponse( respObj, respText ) {
var eventListBody = $(eventList).getElement( 'tbody' );
var eventListRows = $(eventListBody).getElements( 'tr' );
eventListRows.each( function( row ) { row.removeClass( 'updated' ); } );
eventListRows.each( function( row ) {
row.removeClass( 'updated' );
} );
for ( var i = 0; i < dbEvents.length; i++ ) {
var event = dbEvents[i];
var row = $('event'+event.Id);
var newEvent = (row == null ? true : false);
if ( newEvent ) {
row = new Element( 'tr', { 'id': 'event'+event.Id } );
new Element( 'td', { 'class': 'colId' } ).inject( row );
new Element( 'td', { 'class': 'colName' } ).inject( row );
new Element( 'td', { 'class': 'colTime' } ).inject( row );
new Element( 'td', { 'class': 'colSecs' } ).inject( row );
new Element( 'td', { 'class': 'colFrames' } ).inject( row );
new Element( 'td', { 'class': 'colScore' } ).inject( row );
new Element( 'td', { 'class': 'colDelete' } ).inject( row );
row = new Element( 'tr', {'id': 'event'+event.Id} );
new Element( 'td', {'class': 'colId'} ).inject( row );
new Element( 'td', {'class': 'colName'} ).inject( row );
new Element( 'td', {'class': 'colTime'} ).inject( row );
new Element( 'td', {'class': 'colSecs'} ).inject( row );
new Element( 'td', {'class': 'colFrames'} ).inject( row );
new Element( 'td', {'class': 'colScore'} ).inject( row );
new Element( 'td', {'class': 'colDelete'} ).inject( row );
var cells = row.getElements( 'td' );
var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1&popup=1', event.Width, event.Height] ) } });
var link = new Element( 'a', {'href': '#', 'events': {'click': createEventPopup.pass( [event.Id, '&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1&popup=1', event.Width, event.Height] )}});
link.set( 'text', event.Id );
link.inject( row.getElement( 'td.colId' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1&popup=1', event.Width, event.Height] ) } });
link = new Element( 'a', {'href': '#', 'events': {'click': createEventPopup.pass( [event.Id, '&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1&popup=1', event.Width, event.Height] )}});
link.set( 'text', event.Name );
link.inject( row.getElement( 'td.colName' ) );
row.getElement( 'td.colTime' ).set( 'text', event.StartTime );
row.getElement( 'td.colSecs' ).set( 'text', event.Length );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [event.Id, event.Width, event.Height] ) } });
link = new Element( 'a', {'href': '#', 'events': {'click': createFramesPopup.pass( [event.Id, event.Width, event.Height] )}});
link.set( 'text', event.Frames+'/'+event.AlarmFrames );
link.inject( row.getElement( 'td.colFrames' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [event.Id, '0', event.Width, event.Height] ) } });
link = new Element( 'a', {'href': '#', 'events': {'click': createFramePopup.pass( [event.Id, '0', event.Width, event.Height] )}});
link.set( 'text', event.AvgScore+'/'+event.MaxScore );
link.inject( row.getElement( 'td.colScore' ) );
link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }, 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } });
link = new Element( 'a', {'href': '#', 'title': deleteString, 'events': {'click': function( e ) {
deleteEvent( e, event.Id );
}, 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row )}});
link.set( 'text', 'X' );
link.inject( row.getElement( 'td.colDelete' ) );
if ( i == 0 )
if ( i == 0 ) {
row.inject( $(eventListBody) );
else {
} else {
row.inject( $(eventListBody), 'top' );
if ( !eventCmdFirst )
if ( !eventCmdFirst ) {
row.addClass( 'recent' );
}
}
} else {
row.getElement( 'td.colName a' ).set( 'text', event.Name );
@ -552,32 +585,37 @@ function getEventCmdResponse( respObj, respText ) {
rows[rows.length-1].destroy();
rows.length--;
}
} else
} else {
checkStreamForErrors("getEventCmdResponse", respObj);
}
var eventCmdTimeout = eventsRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
eventCmdTimeout = eventCmdTimeout/5;
}
eventCmdTimer = eventCmdQuery.delay( eventCmdTimeout );
eventCmdFirst = false;
}
function eventCmdQuery() {
if ( eventCmdTimer ) //avoid firing another if we are firing one
if ( eventCmdTimer ) { // avoid firing another if we are firing one
eventCmdTimer = clearTimeout( eventCmdTimer );
}
eventCmdReq.send();
}
if ( monitorType != 'WebSite' ) {
var controlParms = "view=request&request=control&id="+monitorId;
if ( auth_hash )
if ( auth_hash ) {
controlParms += '&auth='+auth_hash;
var controlReq = new Request.JSON( { url: monitorUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getControlResponse } );
}
var controlReq = new Request.JSON( {url: monitorUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getControlResponse} );
}
function getControlResponse( respObj, respText ) {
if ( !respObj )
if ( !respObj ) {
return;
}
//console.log( respText );
if ( respObj.result != 'Ok' ) {
alert( "Control response was status = "+respObj.status+"\nmessage = "+respObj.message );
@ -596,24 +634,27 @@ function controlCmd( control, event, xtell, ytell ) {
if ( xtell ) {
var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 )
if ( xtell == -1 ) {
xge = 100 - xge;
else if ( xtell == 2 )
} else if ( xtell == 2 ) {
xge = 2*(50 - xge);
}
locParms += "&xge="+xge;
}
if ( ytell ) {
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
if ( ytell == -1 ) {
yge = 100 - yge;
else if ( ytell == 2 )
} else if ( ytell == 2 ) {
yge = 2*(50 - yge);
}
locParms += "&yge="+yge;
}
}
controlReq.send( controlParms+"&control="+control+locParms );
if ( streamMode == "single" )
if ( streamMode == "single" ) {
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 );
}
}
function controlCmdImage( x, y ) {
@ -622,8 +663,9 @@ function controlCmdImage( x, y ) {
imageControlParms += "&control="+imageControlMode;
controlReq.send( imageControlParms+"&x="+x+"&y="+y );
if ( streamMode == "single" )
if ( streamMode == "single" ) {
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 );
}
}
function fetchImage( streamImage ) {
@ -636,10 +678,11 @@ function handleClick( event ) {
var y = event.page.y - $(target).getTop();
if ( showMode == "events" || !imageControlMode ) {
if ( event.shift )
if ( event.shift ) {
streamCmdPan( x, y );
else
} else {
streamCmdZoomIn( x, y );
}
} else {
controlCmdImage( x, y );
}
@ -651,8 +694,9 @@ function appletRefresh() {
var parent = streamImg.getParent();
streamImg.dispose();
streamImg.inject( parent );
if ( appletRefreshTime )
if ( appletRefreshTime ) {
appletRefresh.delay( appletRefreshTime*1000 );
}
} else {
appletRefresh.delay( 15*1000 ); //if we are paused or delayed check every 15 seconds if we are live yet...
}
@ -704,25 +748,30 @@ function initPage() {
if ( canStreamNative || streamMode == "single" ) {
var streamImg = $('imageFeed').getElement('img');
if ( !streamImg )
if ( !streamImg ) {
streamImg = $('imageFeed').getElement('object');
}
if ( streamMode == "single" ) {
streamImg.addEvent('click', fetchImage.pass(streamImg));
fetchImage.pass(streamImg).periodical(imageRefreshTimeout);
} else
streamImg.addEvent('click', function(event) { handleClick(event); });
} else {
streamImg.addEvent('click', function(event) {
handleClick(event);
});
}
}
if ( refreshApplet && appletRefreshTime )
if ( refreshApplet && appletRefreshTime ) {
appletRefresh.delay(appletRefreshTime*1000);
}
if ( scale == "auto" ) changeScale();
if ( window.history.length == 1 ) {
$j('#closeControl').html('');
}
} else if ( monitorRefresh > 0 ) {
var myReload = setInterval(reloadWebSite, monitorRefresh*1000);
setInterval(reloadWebSite, monitorRefresh*1000);
}
}
// Kick everything off
window.addEvent('domready', initPage);
window.addEventListener('DOMContentLoaded', initPage);

View File

@ -176,13 +176,15 @@ function applyPreset() {
}
function toPixels( field, maxValue ) {
if ( field.value != '' )
if ( field.value != '' ) {
field.value = Math.round((field.value*maxValue)/100);
}
}
function toPercent( field, maxValue ) {
if ( field.value != '' )
if ( field.value != '' ) {
field.value = Math.round((100*100*field.value)/maxValue)/100;
}
}
function applyZoneUnits() {
@ -209,8 +211,9 @@ function applyZoneUnits() {
}
function limitRange( field, minValue, maxValue ) {
if ( field.value != '' )
if ( field.value != '' ) {
field.value = constrainValue( parseInt(field.value), parseInt(minValue), parseInt(maxValue) );
}
}
function limitFilter( field ) {
@ -250,9 +253,10 @@ function unsetActivePoint( index ) {
function getCoordString() {
var coords = new Array();
for ( var i = 0; i < zone['Points'].length; i++ )
for ( var i = 0; i < zone['Points'].length; i++ ) {
coords[coords.length] = zone['Points'][i].x+','+zone['Points'][i].y;
return( coords.join( " " ) );
}
return ( coords.join( " " ) );
}
function updateZoneImage() {
@ -300,14 +304,16 @@ function updateActivePoint( index ) {
function addPoint( index ) {
var nextIndex = index+1;
if ( index >= (zone['Points'].length-1) )
if ( index >= (zone['Points'].length-1) ) {
nextIndex = 0;
}
var newX = parseInt(Math.round((zone['Points'][index]['x']+zone['Points'][nextIndex]['x'])/2));
var newY = parseInt(Math.round((zone['Points'][index]['y']+zone['Points'][nextIndex]['y'])/2));
if ( nextIndex == 0 )
zone['Points'][zone['Points'].length] = { 'x': newX, 'y': newY };
else
zone['Points'].splice( nextIndex, 0, { 'x': newX, 'y': newY } );
if ( nextIndex == 0 ) {
zone['Points'][zone['Points'].length] = {'x': newX, 'y': newY};
} else {
zone['Points'].splice( nextIndex, 0, {'x': newX, 'y': newY} );
}
drawZonePoints();
// drawZonePoints calls updateZoneImage
//updateZoneImage();
@ -376,7 +382,9 @@ function saveChanges( element ) {
}
function drawZonePoints() {
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) {
element.destroy();
} );
for ( var i = 0; i < zone['Points'].length; i++ ) {
var div = new Element( 'div', {
'id': 'point'+i,
@ -391,30 +399,32 @@ function drawZonePoints() {
div.addEvent( 'mouseout', highlightOff.pass( i ) );
div.inject( $('imageFrame') );
div.makeDraggable( {
'container': $('imageFrame'),
'onStart': setActivePoint.pass( i ),
'onComplete': fixActivePoint.pass( i ),
'onDrag': updateActivePoint.pass( i )
} );
'container': $('imageFrame'),
'onStart': setActivePoint.pass( i ),
'onComplete': fixActivePoint.pass( i ),
'onDrag': updateActivePoint.pass( i )
} );
}
var tables = $('zonePoints').getElements( 'table' );
tables.each( function( table ) { table.getElement( 'tbody' ).empty(); } );
tables.each( function( table ) {
table.getElement( 'tbody' ).empty();
} );
for ( var i = 0; i < zone['Points'].length; i++ ) {
var row = new Element( 'tr', { 'id': 'row'+i } );
row.addEvents( { 'mouseover': highlightOn.pass( i ), 'mouseout': highlightOff.pass( i ) } );
var row = new Element( 'tr', {'id': 'row'+i} );
row.addEvents( {'mouseover': highlightOn.pass( i ), 'mouseout': highlightOff.pass( i )} );
var cell = new Element( 'td' );
cell.set( 'text', i+1 );
cell.inject( row );
cell = new Element( 'td' );
var input = new Element( 'input', { 'id': 'newZone[Points]['+i+'][x]', 'name': 'newZone[Points]['+i+'][x]', 'value': zone['Points'][i].x, 'size': 5 } );
var input = new Element( 'input', {'id': 'newZone[Points]['+i+'][x]', 'name': 'newZone[Points]['+i+'][x]', 'value': zone['Points'][i].x, 'size': 5} );
input.addEvent( 'input', updateX.pass( i ) );
input.inject( cell );
cell.inject( row );
cell = new Element( 'td' );
input = new Element( 'input', { 'id': 'newZone[Points]['+i+'][y]', 'name': 'newZone[Points]['+i+'][y]', 'value': zone['Points'][i].y, 'size': 5 } );
input = new Element( 'input', {'id': 'newZone[Points]['+i+'][y]', 'name': 'newZone[Points]['+i+'][y]', 'value': zone['Points'][i].y, 'size': 5} );
input.addEvent( 'input', updateY.pass( i ) );
input.inject( cell );
cell.inject( row );
@ -443,17 +453,18 @@ var lastAlarmState = STATE_IDLE;
function setAlarmState( currentAlarmState ) {
alarmState = currentAlarmState;
var stateString = "Unknown";
var stateClass = "";
if ( alarmState == STATE_ALARM )
if ( alarmState == STATE_ALARM ) {
stateClass = "alarm";
else if ( alarmState == STATE_ALERT )
} else if ( alarmState == STATE_ALERT ) {
stateClass = "alert";
}
$('stateValue').set( 'text', stateStrings[alarmState] );
if ( stateClass )
if ( stateClass ) {
$('stateValue').setProperty( 'class', stateClass );
else
} else {
$('stateValue').removeProperty( 'class' );
}
var isAlarmed = ( alarmState == STATE_ALARM || alarmState == STATE_ALERT );
var wasAlarmed = ( lastAlarmState == STATE_ALARM || lastAlarmState == STATE_ALERT );
@ -464,27 +475,30 @@ function setAlarmState( currentAlarmState ) {
if ( newAlarm ) {
if ( SOUND_ON_ALARM ) {
// Enable the alarm sound
if ( !canPlayPauseAudio )
if ( !canPlayPauseAudio ) {
$('alarmSound').removeClass( 'hidden' );
else
} else {
$('MediaPlayer').Play();
}
}
}
if ( SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
if ( !canPlayPauseAudio )
if ( !canPlayPauseAudio ) {
$('alarmSound').addClass( 'hidden' );
else
} else {
$('MediaPlayer').Stop();
}
}
}
lastAlarmState = alarmState;
}
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
if ( auth_hash )
streamCmdParms += '&auth='+auth_hash;
if ( auth_hash ) {
streamCmdParms += '&auth='+auth_hash;
}
var streamCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
@ -498,8 +512,9 @@ var streamStatus;
function getStreamCmdResponse( respObj, respText ) {
watchdogOk("stream");
if ( streamCmdTimer )
if ( streamCmdTimer ) {
streamCmdTimer = clearTimeout( streamCmdTimer );
}
if ( respObj.result == 'Ok' ) {
streamStatus = respObj.status;
@ -507,8 +522,6 @@ function getStreamCmdResponse( respObj, respText ) {
setAlarmState( streamStatus.state );
var delayString = secsToTime( streamStatus.delay );
if ( streamStatus.paused == true ) {
streamCmdPause( false );
} else if ( streamStatus.delayed == true && streamStatus.rate == 1 ) {
@ -519,15 +532,17 @@ function getStreamCmdResponse( respObj, respText ) {
if ( ! streamPause ) {
// Try to reload the image stream.
var streamImg = $('liveStream'+monitorId);
if ( streamImg )
if ( streamImg ) {
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
}
}
if ( ! streamPause ) {
var streamCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
streamCmdTimeout = streamCmdTimeout/5;
}
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
}
@ -547,18 +562,21 @@ function streamCmdPauseToggle() {
}
function streamCmdPause( action ) {
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
}
}
function streamCmdPlay( action ) {
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
}
}
function streamCmdStop( action ) {
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
}
}
function streamCmdQuery() {
@ -566,8 +584,9 @@ function streamCmdQuery() {
}
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
if ( auth_hash )
statusCmdParms += '&auth='+auth_hash;
if ( auth_hash ) {
statusCmdParms += '&auth='+auth_hash;
}
var statusCmdReq = new Request.JSON( {
url: monitorUrl,
method: 'get',
@ -580,19 +599,22 @@ var statusCmdTimer = null;
function getStatusCmdResponse( respObj, respText ) {
watchdogOk("status");
if ( statusCmdTimer )
if ( statusCmdTimer ) {
statusCmdTimer = clearTimeout( statusCmdTimer );
}
if ( respObj.result == 'Ok' ) {
$('fpsValue').set( 'text', respObj.monitor.FrameRate );
setAlarmState( respObj.monitor.Status );
} else
} else {
checkStreamForErrors("getStatusCmdResponse", respObj);
}
if ( ! streamPause ) {
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT ) {
statusCmdTimeout = statusCmdTimeout/5;
}
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
}
@ -611,8 +633,9 @@ function appletRefresh() {
var parent = streamImg.getParent();
streamImg.dispose();
streamImg.inject( parent );
if ( appletRefreshTime )
if ( appletRefreshTime ) {
appletRefresh.delay( appletRefreshTime*1000 );
}
} else {
appletRefresh.delay( 15*1000 ); //if we are paused or delayed check every 15 seconds if we are live yet...
}
@ -693,16 +716,18 @@ function initPage() {
if ( canStreamNative || streamMode == "single" ) {
var streamImg = $('imageFrame').getElement('img');
if ( !streamImg )
if ( !streamImg ) {
streamImg = $('imageFrame').getElement('object');
}
if ( streamMode == "single" ) {
streamImg.addEvent( 'click', fetchImage.pass( streamImg ) );
fetchImage.pass( streamImg ).periodical( imageRefreshTimeout );
}
}
if ( refreshApplet && appletRefreshTime )
if ( refreshApplet && appletRefreshTime ) {
appletRefresh.delay( appletRefreshTime*1000 );
}
}
function Polygon_calcArea( coords ) {
@ -717,4 +742,4 @@ function Polygon_calcArea( coords ) {
return Math.round( Math.abs( float_area ) );
}
window.addEvent( 'domready', initPage );
window.addEventListener( 'DOMContentLoaded', initPage );

View File

@ -1,8 +1,9 @@
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
var streamCmdReq = new Request.JSON( { url: monitorUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel' } );
var streamCmdReq = new Request.JSON( {url: monitorUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel'} );
function streamCmdQuit( action ) {
if ( action )
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUIT );
}
}

View File

@ -6,7 +6,7 @@ xhtmlHeaders(__FILE__, translate('Login') );
<div class="container">
<form class="center-block" name="loginForm" id="loginForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="login"/>
<input type="hidden" name="view" value="postlogin"/>
<input type="hidden" name="view" value="login"/>
<input type="hidden" name="postLoginQuery" value="<?php echo htmlspecialchars($_SERVER['QUERY_STRING']) ?>">
<div id="loginError" class="hidden alarm" role="alert">

View File

@ -510,7 +510,7 @@ foreach ( $tabs as $name=>$value ) {
<?php
} else {
?>
<li><a href="#" onclick="submitTab( '<?php echo $name ?>' ); return( false );"><?php echo $value ?></a></li>
<li><a href="#" data-tab-name="<?php echo $name ?>"><?php echo $value ?></a></li>
<?php
}
}

View File

@ -39,7 +39,7 @@ xhtmlHeaders(__FILE__, translate('Server').' - '.$Server->Name());
<h2><?php echo translate('Server').' - '.$Server->Name() ?></h2>
</div>
<div id="content">
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm(this, <?php echo empty($Server->Name())?'true':'false' ?>)">
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" class="validateFormOnSubmit">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="object" value="server"/>
<input type="hidden" name="id" value="<?php echo validHtmlStr($_REQUEST['id']) ?>"/>

View File

@ -63,7 +63,7 @@ xhtmlHeaders(__FILE__, translate('Storage')." - ".$newStorage['Name'] );
<h2><?php echo translate('Storage')." - ".$newStorage['Name'] ?></h2>
</div>
<div id="content">
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm( this, <?php echo empty($newStorage['Name'])?'true':'false' ?> )">
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" class="validateFormOnSubmit">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="object" value="storage"/>
<input type="hidden" name="id" value="<?php echo validHtmlStr($_REQUEST['id']) ?>"/>