Merge branch 'master' into storageareas
This commit is contained in:
commit
8a80cf686b
|
@ -63,7 +63,7 @@ DROP TABLE IF EXISTS `Controls`;
|
||||||
CREATE TABLE `Controls` (
|
CREATE TABLE `Controls` (
|
||||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||||
`Name` varchar(64) NOT NULL default '',
|
`Name` varchar(64) NOT NULL default '',
|
||||||
`Type` enum('Local','Remote','Ffmpeg','Libvlc','cURL') NOT NULL default 'Local',
|
`Type` enum('Local','Remote','Ffmpeg','Libvlc','cURL','WebSite') NOT NULL default 'Local',
|
||||||
`Protocol` varchar(64) default NULL,
|
`Protocol` varchar(64) default NULL,
|
||||||
`CanWake` tinyint(3) unsigned NOT NULL default '0',
|
`CanWake` tinyint(3) unsigned NOT NULL default '0',
|
||||||
`CanSleep` tinyint(3) unsigned NOT NULL default '0',
|
`CanSleep` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
@ -892,7 +892,7 @@ INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('4 Wide', '{ "default":{
|
||||||
INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('5 Wide', '{ "default":{"float":"left", "width":"19%","left":"0px","right":"0px","top":"0px","bottom":"0px"} }' );
|
INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('5 Wide', '{ "default":{"float":"left", "width":"19%","left":"0px","right":"0px","top":"0px","bottom":"0px"} }' );
|
||||||
|
|
||||||
-- We generally don't alter triggers, we drop and re-create them, so let's keep them in a separate file that we can just source in update scripts.
|
-- We generally don't alter triggers, we drop and re-create them, so let's keep them in a separate file that we can just source in update scripts.
|
||||||
source @ZM_PATH_DATA@/db/triggers.sql
|
source @PKGDATADIR@/db/triggers.sql
|
||||||
--
|
--
|
||||||
-- Apply the initial configuration
|
-- Apply the initial configuration
|
||||||
--
|
--
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
--
|
||||||
|
-- This updates a 1.31.42 database to 1.31.43
|
||||||
|
--
|
||||||
|
-- Add WebSite enum to Monitor.Type
|
||||||
|
-- Add Refresh column to Monitors table
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE `zm`.`Monitors`
|
||||||
|
CHANGE COLUMN `Type` `Type` ENUM('Local', 'Remote', 'File', 'Ffmpeg', 'Libvlc', 'cURL', 'WebSite') NOT NULL DEFAULT 'Local' ;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE table_name = 'Monitors'
|
||||||
|
AND table_schema = DATABASE()
|
||||||
|
AND column_name = 'Refresh'
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Column Refresh exists in Monitors'",
|
||||||
|
"ALTER TABLE Monitors ADD `Refresh` int(10) unsigned default NULL"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
%global _hardened_build 1
|
%global _hardened_build 1
|
||||||
|
|
||||||
Name: zoneminder
|
Name: zoneminder
|
||||||
Version: 1.31.42
|
Version: 1.31.43
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: A camera monitoring and analysis tool
|
Summary: A camera monitoring and analysis tool
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
|
|
|
@ -147,6 +147,23 @@ Keep aspect ratio
|
||||||
Orientation
|
Orientation
|
||||||
As per local devices.
|
As per local devices.
|
||||||
|
|
||||||
|
WebSite
|
||||||
|
^^^^^^^
|
||||||
|
|
||||||
|
This Source Type allows one to configure an arbitrary website as a non-reocrdable, fully interactive, monitor in ZoneMinder. Note that sites with self-signed certificates will not display until the end user first manually navigates to the site and accpets the unsigned certificate. Also note that some sites will set an X-Frame option in the header, which discourages their site from being displayed within a frame. ZoneMinder will detect this condition and present a warning in the log. When this occurs, the end user can choose to install a browser plugin or extension to workaround this issue.
|
||||||
|
|
||||||
|
Website URL
|
||||||
|
Enter the full http or https url to the desired website.
|
||||||
|
|
||||||
|
Width (pixels)
|
||||||
|
Chose a desired width in pixels that gives an acceptable appearance. This may take some expirimentation.
|
||||||
|
|
||||||
|
Height (pixels)
|
||||||
|
Chose a desired height in pixels that gives an acceptable appearance. This may take some expirimentation.
|
||||||
|
|
||||||
|
Web Site Refresh
|
||||||
|
If the website in question has static content, optionally enter a time period in seconds for ZoneMinder to refresh the content.
|
||||||
|
|
||||||
Timestamp Tab
|
Timestamp Tab
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -2946,6 +2946,23 @@ our @options = (
|
||||||
type => $types{boolean},
|
type => $types{boolean},
|
||||||
category => 'web',
|
category => 'web',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => 'ZM_WEB_XFRAME_WARN',
|
||||||
|
default => 'yes',
|
||||||
|
description => 'Warn when website X-Frame-Options is set to sameorigin',
|
||||||
|
help => q`
|
||||||
|
When creating a Web Site monitor, if the target web site has
|
||||||
|
X-Frame-Options set to sameorigin in the header, the site will
|
||||||
|
not display in ZoneMinder. This is a design feature in most modern
|
||||||
|
browsers. When this condiction has occured, ZoneMinder will write a
|
||||||
|
warning to the log file. To get around this, one can install a browser
|
||||||
|
plugin or extension to ignore X-Frame headers, and then the page will
|
||||||
|
display properly. Once the plugin or extenstion has ben installed,
|
||||||
|
the end user may choose to turn this warning off.
|
||||||
|
`,
|
||||||
|
type => $types{boolean},
|
||||||
|
category => 'web',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name => 'ZM_WEB_H_REFRESH_MAIN',
|
name => 'ZM_WEB_H_REFRESH_MAIN',
|
||||||
default => '60',
|
default => '60',
|
||||||
|
|
|
@ -646,8 +646,8 @@ sub substituteTags {
|
||||||
$text =~ s/%MEM%/$Monitor->{MonthEvents}/g;
|
$text =~ s/%MEM%/$Monitor->{MonthEvents}/g;
|
||||||
$text =~ s/%MEA%/$Monitor->{ArchivedEvents}/g;
|
$text =~ s/%MEA%/$Monitor->{ArchivedEvents}/g;
|
||||||
$text =~ s/%MP%/$url?view=watch&mid=$Event->{MonitorId}/g;
|
$text =~ s/%MP%/$url?view=watch&mid=$Event->{MonitorId}/g;
|
||||||
$text =~ s/%MPS%/$url?view=watchfeed&mid=$Event->{MonitorId}&mode=stream/g;
|
$text =~ s/%MPS%/$url?view=watch&mid=$Event->{MonitorId}&mode=stream/g;
|
||||||
$text =~ s/%MPI%/$url?view=watchfeed&mid=$Event->{MonitorId}&mode=still/g;
|
$text =~ s/%MPI%/$url?view=watch&mid=$Event->{MonitorId}&mode=still/g;
|
||||||
$text =~ s/%EP%/$url?view=event&mid=$Event->{MonitorId}&eid=$Event->{Id}/g;
|
$text =~ s/%EP%/$url?view=event&mid=$Event->{MonitorId}&eid=$Event->{Id}/g;
|
||||||
$text =~ s/%EPS%/$url?view=event&mode=stream&mid=$Event->{MonitorId}&eid=$Event->{Id}/g;
|
$text =~ s/%EPS%/$url?view=event&mode=stream&mid=$Event->{MonitorId}&eid=$Event->{Id}/g;
|
||||||
$text =~ s/%EPI%/$url?view=event&mode=still&mid=$Event->{MonitorId}&eid=$Event->{Id}/g;
|
$text =~ s/%EPI%/$url?view=event&mode=still&mid=$Event->{MonitorId}&eid=$Event->{Id}/g;
|
||||||
|
|
|
@ -211,7 +211,7 @@ if ( $command =~ /^(?:start|restart)$/ ) {
|
||||||
my $res = $sth->execute( @values )
|
my $res = $sth->execute( @values )
|
||||||
or Fatal( "Can't execute: ".$sth->errstr() );
|
or Fatal( "Can't execute: ".$sth->errstr() );
|
||||||
while( my $monitor = $sth->fetchrow_hashref() ) {
|
while( my $monitor = $sth->fetchrow_hashref() ) {
|
||||||
if ( $monitor->{Function} ne 'None' ) {
|
if ( $monitor->{Function} ne 'None' && $monitor->{Type} ne 'WebSite' ) {
|
||||||
if ( $monitor->{Type} eq 'Local' ) {
|
if ( $monitor->{Type} eq 'Local' ) {
|
||||||
runCommand( "zmdc.pl start zmc -d $monitor->{Device}" );
|
runCommand( "zmdc.pl start zmc -d $monitor->{Device}" );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -84,6 +84,7 @@ while( 1 ) {
|
||||||
while( my $monitor = $sth->fetchrow_hashref() ) {
|
while( my $monitor = $sth->fetchrow_hashref() ) {
|
||||||
my $now = time();
|
my $now = time();
|
||||||
next if $monitor->{Function} eq 'None';
|
next if $monitor->{Function} eq 'None';
|
||||||
|
next if $monitor->{Type} eq 'WebSite';
|
||||||
my $restart = 0;
|
my $restart = 0;
|
||||||
if ( zmMemVerify( $monitor ) ) {
|
if ( zmMemVerify( $monitor ) ) {
|
||||||
# Check we have got an image recently
|
# Check we have got an image recently
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#include "zm.h"
|
#include "zm.h"
|
||||||
#include "zm_db.h"
|
#include "zm_db.h"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#include "zm_ffmpeg.h"
|
#include "zm_ffmpeg.h"
|
||||||
#include "zm_image.h"
|
#include "zm_image.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#include "zm.h"
|
#include "zm.h"
|
||||||
#include "zm_db.h"
|
#include "zm_db.h"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#define __STDC_FORMAT_MACROS 1
|
#define __STDC_FORMAT_MACROS 1
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <cinttypes>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/msg.h>
|
#include <sys/msg.h>
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#include "zm.h"
|
#include "zm.h"
|
||||||
#include "zm_db.h"
|
#include "zm_db.h"
|
||||||
|
|
|
@ -87,6 +87,7 @@ Options for use with monitors:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#include "zm.h"
|
#include "zm.h"
|
||||||
#include "zm_db.h"
|
#include "zm_db.h"
|
||||||
|
|
|
@ -105,10 +105,11 @@ commonprep () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# fix 32bit rpm builds
|
# fix 32bit rpm builds
|
||||||
patch --dry-run --silent -f -p1 < utils/packpack/setarch.patch
|
# FIXME: breaks arm rpm builds
|
||||||
if [ $? -eq 0 ]; then
|
#patch --dry-run --silent -f -p1 < utils/packpack/setarch.patch
|
||||||
patch -p1 < utils/packpack/setarch.patch
|
#if [ $? -eq 0 ]; then
|
||||||
fi
|
# patch -p1 < utils/packpack/setarch.patch
|
||||||
|
#fi
|
||||||
|
|
||||||
# The rpm specfile requires we download each submodule as a tarball then manually move it into place
|
# The rpm specfile requires we download each submodule as a tarball then manually move it into place
|
||||||
# Might as well do this for Debian as well, rather than git submodule init
|
# Might as well do this for Debian as well, rather than git submodule init
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
::
|
::
|
||||||
:: Bake is a shell script for running CakePHP bake script
|
:: Bake is a shell script for running CakePHP bake script
|
||||||
::
|
::
|
||||||
:: CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
:: CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||||
:: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
:: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||||
::
|
::
|
||||||
:: Licensed under The MIT License
|
:: Licensed under The MIT License
|
||||||
:: Redistributions of files must retain the above copyright notice.
|
:: Redistributions of files must retain the above copyright notice.
|
||||||
::
|
::
|
||||||
:: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
:: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||||
:: @link https://cakephp.org CakePHP(tm) Project
|
:: @link https://cakephp.org CakePHP(tm) Project
|
||||||
:: @package app.Console
|
:: @package app.Console
|
||||||
:: @since CakePHP(tm) v 2.0
|
:: @since CakePHP(tm) v 2.0
|
||||||
::
|
::
|
||||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
|
||||||
|
|
||||||
@echo.
|
@echo.
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
SET app=%0
|
SET app=%0
|
||||||
SET lib=%~dp0
|
SET lib=%~dp0
|
||||||
|
|
||||||
php -q "%lib%cake.php" -working "%CD% " %*
|
php -q "%lib%cake.php" -working "%CD% " %*
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
::
|
::
|
||||||
:: Bake is a shell script for running CakePHP bake script
|
:: Bake is a shell script for running CakePHP bake script
|
||||||
::
|
::
|
||||||
:: CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
:: CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||||
:: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
:: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||||
::
|
::
|
||||||
:: Licensed under The MIT License
|
:: Licensed under The MIT License
|
||||||
:: Redistributions of files must retain the above copyright notice.
|
:: Redistributions of files must retain the above copyright notice.
|
||||||
::
|
::
|
||||||
:: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
:: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||||
:: @link https://cakephp.org CakePHP(tm) Project
|
:: @link https://cakephp.org CakePHP(tm) Project
|
||||||
:: @package Cake.Console
|
:: @package Cake.Console
|
||||||
:: @since CakePHP(tm) v 1.2.0.5012
|
:: @since CakePHP(tm) v 1.2.0.5012
|
||||||
:: @license https://opensource.org/licenses/mit-license.php MIT License
|
:: @license https://opensource.org/licenses/mit-license.php MIT License
|
||||||
::
|
::
|
||||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
SET app=%0
|
SET app=%0
|
||||||
SET lib=%~dp0
|
SET lib=%~dp0
|
||||||
|
|
||||||
php -q "%lib%cake.php" -working "%CD% " %*
|
php -q "%lib%cake.php" -working "%CD% " %*
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
|
@ -299,10 +299,12 @@ if ( isset($_REQUEST['object']) and $_REQUEST['object'] == 'Monitor' ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$Monitor = new Monitor( $mid );
|
$Monitor = new Monitor( $mid );
|
||||||
$Monitor->zmaControl('stop');
|
if ( $Monitor->Type() != 'WebSite' ) {
|
||||||
$Monitor->zmcControl('stop');
|
$Monitor->zmaControl('stop');
|
||||||
|
$Monitor->zmcControl('stop');
|
||||||
|
}
|
||||||
$Monitor->save( $_REQUEST['newMonitor'] );
|
$Monitor->save( $_REQUEST['newMonitor'] );
|
||||||
if ($Monitor->Function() != 'None' ) {
|
if ($Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite' ) {
|
||||||
$Monitor->zmcControl('start');
|
$Monitor->zmcControl('start');
|
||||||
if ( $Monitor->Enabled() ) {
|
if ( $Monitor->Enabled() ) {
|
||||||
$Monitor->zmaControl('start');
|
$Monitor->zmaControl('start');
|
||||||
|
@ -330,7 +332,7 @@ if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
|
||||||
|
|
||||||
$monitor['Function'] = $newFunction;
|
$monitor['Function'] = $newFunction;
|
||||||
$monitor['Enabled'] = $newEnabled;
|
$monitor['Enabled'] = $newEnabled;
|
||||||
if ( daemonCheck() ) {
|
if ( daemonCheck() && $monitor['Type'] != 'WebSite' ) {
|
||||||
$restart = ($oldFunction == 'None') || ($newFunction == 'None') || ($newEnabled != $oldEnabled);
|
$restart = ($oldFunction == 'None') || ($newFunction == 'None') || ($newEnabled != $oldEnabled);
|
||||||
zmaControl( $monitor, 'stop' );
|
zmaControl( $monitor, 'stop' );
|
||||||
zmcControl( $monitor, $restart?'restart':'' );
|
zmcControl( $monitor, $restart?'restart':'' );
|
||||||
|
@ -371,7 +373,7 @@ if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
|
||||||
} else {
|
} else {
|
||||||
dbQuery( 'INSERT INTO Zones SET MonitorId=?, '.implode( ', ', $changes ), array( $mid ) );
|
dbQuery( 'INSERT INTO Zones SET MonitorId=?, '.implode( ', ', $changes ), array( $mid ) );
|
||||||
}
|
}
|
||||||
if ( daemonCheck() ) {
|
if ( daemonCheck() && $monitor['Type'] != 'WebSite' ) {
|
||||||
if ( $_REQUEST['newZone']['Type'] == 'Privacy' ) {
|
if ( $_REQUEST['newZone']['Type'] == 'Privacy' ) {
|
||||||
zmaControl( $monitor, 'stop' );
|
zmaControl( $monitor, 'stop' );
|
||||||
zmcControl( $monitor, 'restart' );
|
zmcControl( $monitor, 'restart' );
|
||||||
|
@ -399,7 +401,7 @@ if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($changes>0) {
|
if($changes>0) {
|
||||||
if ( daemonCheck() ) {
|
if ( daemonCheck() && $monitor['Type'] != 'WebSite' ) {
|
||||||
zmaControl( $mid, 'restart' );
|
zmaControl( $mid, 'restart' );
|
||||||
}
|
}
|
||||||
$refreshParent = true;
|
$refreshParent = true;
|
||||||
|
@ -424,7 +426,7 @@ if ( !empty($_REQUEST['mid']) && canEdit( 'Monitors', $_REQUEST['mid'] ) ) {
|
||||||
$deletedZid = 1;
|
$deletedZid = 1;
|
||||||
}
|
}
|
||||||
if ( $deletedZid ) {
|
if ( $deletedZid ) {
|
||||||
if ( daemonCheck() ) {
|
if ( daemonCheck() && $monitor['Type'] != 'WebSite' ) {
|
||||||
if ( $zone['Type'] == 'Privacy' ) {
|
if ( $zone['Type'] == 'Privacy' ) {
|
||||||
zmaControl( $mid, 'stop' );
|
zmaControl( $mid, 'stop' );
|
||||||
zmcControl( $mid, 'restart' );
|
zmcControl( $mid, 'restart' );
|
||||||
|
@ -492,8 +494,10 @@ if ( canEdit( 'Monitors' ) ) {
|
||||||
if ( $mid ) {
|
if ( $mid ) {
|
||||||
|
|
||||||
# If we change anything that changes the shared mem size, zma can complain. So let's stop first.
|
# If we change anything that changes the shared mem size, zma can complain. So let's stop first.
|
||||||
zmaControl( $monitor, 'stop' );
|
if ( $monitor['Type'] != 'WebSite' ) {
|
||||||
zmcControl( $monitor, 'stop' );
|
zmaControl( $monitor, 'stop' );
|
||||||
|
zmcControl( $monitor, 'stop' );
|
||||||
|
}
|
||||||
dbQuery( 'UPDATE Monitors SET '.implode( ', ', $changes ).' WHERE Id=?', array($mid) );
|
dbQuery( 'UPDATE Monitors SET '.implode( ', ', $changes ).' WHERE Id=?', array($mid) );
|
||||||
// Groups will be added below
|
// Groups will be added below
|
||||||
if ( isset($changes['Name']) or isset($changes['StorageId']) ) {
|
if ( isset($changes['Name']) or isset($changes['StorageId']) ) {
|
||||||
|
@ -606,8 +610,10 @@ if ( canEdit( 'Monitors' ) ) {
|
||||||
$new_monitor = new Monitor($mid);
|
$new_monitor = new Monitor($mid);
|
||||||
//fixDevices();
|
//fixDevices();
|
||||||
|
|
||||||
$new_monitor->zmcControl('start');
|
if ( $monitor['Type'] != 'WebSite' ) {
|
||||||
$new_monitor->zmaControl('start');
|
$new_monitor->zmcControl('start');
|
||||||
|
$new_monitor->zmaControl('start');
|
||||||
|
}
|
||||||
|
|
||||||
if ( $new_monitor->Controllable() ) {
|
if ( $new_monitor->Controllable() ) {
|
||||||
require_once( 'control_functions.php' );
|
require_once( 'control_functions.php' );
|
||||||
|
|
|
@ -280,6 +280,27 @@ function getImageStill( $id, $src, $width, $height, $title='' ) {
|
||||||
return '<img id="'.$id.'" src="'.$src.'" alt="'.$title.'"'.(validInt($width)?' width="'.$width.'"':'').(validInt($height)?' height="'.$height.'"':'').'/>';
|
return '<img id="'.$id.'" src="'.$src.'" alt="'.$title.'"'.(validInt($width)?' width="'.$width.'"':'').(validInt($height)?' height="'.$height.'"':'').'/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getWebSiteUrl( $id, $src, $width, $height, $title='' ) {
|
||||||
|
# Prevent unsightly warnings when php cannot verify the ssl certificate
|
||||||
|
stream_context_set_default( [
|
||||||
|
'ssl' => [
|
||||||
|
'verify_peer' => false,
|
||||||
|
'verify_peer_name' => false,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
# The End User can turn off the following warning under Options -> Web
|
||||||
|
if ( ZM_WEB_XFRAME_WARN ) {
|
||||||
|
$header = get_headers($src, 1);
|
||||||
|
# If the target website has set X-Frame-Options, check it for "sameorigin" and warn the end user
|
||||||
|
if (array_key_exists('X-Frame-Options', $header)) {
|
||||||
|
$header = $header['X-Frame-Options'];
|
||||||
|
if ( stripos($header, 'sameorigin') === 0 )
|
||||||
|
Warning("Web site $src has X-Frame-Options set to sameorigin. An X-Frame-Options browser plugin is required to display this site.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '<object id="'.$id.'" data="'.$src.'" alt="'.$title.'" width="'.$width.'" height="'.$height.'"></object>';
|
||||||
|
}
|
||||||
|
|
||||||
function outputControlStill( $src, $width, $height, $monitor, $scale, $target ) {
|
function outputControlStill( $src, $width, $height, $monitor, $scale, $target ) {
|
||||||
?>
|
?>
|
||||||
<form name="ctrlForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" target="<?php echo $target ?>">
|
<form name="ctrlForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" target="<?php echo $target ?>">
|
||||||
|
@ -495,11 +516,11 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) {
|
||||||
switch( $types[$key] ) {
|
switch( $types[$key] ) {
|
||||||
case 'set' :
|
case 'set' :
|
||||||
{
|
{
|
||||||
if ( is_array( $newValues[$key] ) ) {
|
if ( is_array($newValues[$key]) ) {
|
||||||
if ( join(',',$newValues[$key]) != $values[$key] ) {
|
if ( (!isset($values[$key])) or ( join(',',$newValues[$key]) != $values[$key] ) ) {
|
||||||
$changes[$key] = "`$key` = ".dbEscape(join(',',$newValues[$key]));
|
$changes[$key] = "`$key` = ".dbEscape(join(',',$newValues[$key]));
|
||||||
}
|
}
|
||||||
} elseif ( $values[$key] ) {
|
} else if ( (!isset($values[$key])) or $values[$key] ) {
|
||||||
$changes[$key] = "`$key` = ''";
|
$changes[$key] = "`$key` = ''";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -548,7 +569,7 @@ function getFormChanges( $values, $newValues, $types=false, $columns=false ) {
|
||||||
}
|
}
|
||||||
case 'raw' :
|
case 'raw' :
|
||||||
{
|
{
|
||||||
if ( $values[$key] != $value ) {
|
if ( (!isset($values[$key])) or ($values[$key] != $value) ) {
|
||||||
$changes[$key] = $key . ' = '.dbEscape($value);
|
$changes[$key] = $key . ' = '.dbEscape($value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2128,8 +2149,14 @@ function getStreamHTML( $monitor, $options = array() ) {
|
||||||
$options['buffer'] = $monitor->StreamReplayBuffer();
|
$options['buffer'] = $monitor->StreamReplayBuffer();
|
||||||
//Warning("width: " . $options['width'] . ' height: ' . $options['height']. ' scale: ' . $options['scale'] );
|
//Warning("width: " . $options['width'] . ' height: ' . $options['height']. ' scale: ' . $options['scale'] );
|
||||||
|
|
||||||
|
if ( $monitor->Type() == "WebSite" ) {
|
||||||
|
return getWebSiteUrl( 'liveStream'.$monitor->Id(), $monitor->Path(),
|
||||||
|
( isset($options['width']) ? $options['width'] : NULL ),
|
||||||
|
( isset($options['height']) ? $options['height'] : NULL ),
|
||||||
|
$monitor->Name()
|
||||||
|
);
|
||||||
//FIXME, the width and height of the image need to be scaled.
|
//FIXME, the width and height of the image need to be scaled.
|
||||||
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
} else if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
||||||
$streamSrc = $monitor->getStreamSrc( array(
|
$streamSrc = $monitor->getStreamSrc( array(
|
||||||
'mode'=>'mpeg',
|
'mode'=>'mpeg',
|
||||||
'scale'=>(isset($options['scale'])?$options['scale']:100),
|
'scale'=>(isset($options['scale'])?$options['scale']:100),
|
||||||
|
|
|
@ -174,8 +174,10 @@ $SLANG = array(
|
||||||
'BadSectionLength' => 'Section length must be an integer of 30 or more',
|
'BadSectionLength' => 'Section length must be an integer of 30 or more',
|
||||||
'BadSignalCheckColour' => 'Signal check colour must be a valid RGB colour string',
|
'BadSignalCheckColour' => 'Signal check colour must be a valid RGB colour string',
|
||||||
'BadStreamReplayBuffer' => 'Stream replay buffer must be an integer of zero or more',
|
'BadStreamReplayBuffer' => 'Stream replay buffer must be an integer of zero or more',
|
||||||
|
'BadSourceType' => 'Source Type \"Web Site\" requires the Function to be set to \"Monitor\"',
|
||||||
'BadWarmupCount' => 'Warmup frames must be an integer of zero or more',
|
'BadWarmupCount' => 'Warmup frames must be an integer of zero or more',
|
||||||
'BadWebColour' => 'Web colour must be a valid web colour string',
|
'BadWebColour' => 'Web colour must be a valid web colour string',
|
||||||
|
'BadWebSitePath' => 'Please enter a complete website url, including the http:// or https:// prefix.',
|
||||||
'BadWidth' => 'Width must be set to a valid value',
|
'BadWidth' => 'Width must be set to a valid value',
|
||||||
'Bandwidth' => 'Bandwidth',
|
'Bandwidth' => 'Bandwidth',
|
||||||
'BandwidthHead' => 'Bandwidth', // This is the end of the bandwidth status on the top of the console, different in many language due to phrasing
|
'BandwidthHead' => 'Bandwidth', // This is the end of the bandwidth status on the top of the console, different in many language due to phrasing
|
||||||
|
@ -768,6 +770,7 @@ $SLANG = array(
|
||||||
'Watch' => 'Watch',
|
'Watch' => 'Watch',
|
||||||
'WebColour' => 'Web Colour',
|
'WebColour' => 'Web Colour',
|
||||||
'Web' => 'Web',
|
'Web' => 'Web',
|
||||||
|
'WebSiteUrl' => 'Website URL',
|
||||||
'Week' => 'Week',
|
'Week' => 'Week',
|
||||||
'WhiteBalance' => 'White Balance',
|
'WhiteBalance' => 'White Balance',
|
||||||
'White' => 'White',
|
'White' => 'White',
|
||||||
|
|
|
@ -111,6 +111,9 @@ $status_counts = array();
|
||||||
for ( $i = 0; $i < count($displayMonitors); $i++ ) {
|
for ( $i = 0; $i < count($displayMonitors); $i++ ) {
|
||||||
$monitor = &$displayMonitors[$i];
|
$monitor = &$displayMonitors[$i];
|
||||||
if ( ! $monitor['Status'] ) {
|
if ( ! $monitor['Status'] ) {
|
||||||
|
if ( $monitor['Type'] == 'WebSite' )
|
||||||
|
$monitor['Status'] = 'Running';
|
||||||
|
else
|
||||||
$monitor['Status'] = 'NotRunning';
|
$monitor['Status'] = 'NotRunning';
|
||||||
}
|
}
|
||||||
if ( !isset($status_counts[$monitor['Status']]) )
|
if ( !isset($status_counts[$monitor['Status']]) )
|
||||||
|
@ -238,7 +241,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
||||||
?>
|
?>
|
||||||
<tr id="<?php echo 'monitor_id-'.$monitor['Id'] ?>" title="<?php echo $monitor['Id'] ?>">
|
<tr id="<?php echo 'monitor_id-'.$monitor['Id'] ?>" title="<?php echo $monitor['Id'] ?>">
|
||||||
<?php
|
<?php
|
||||||
if ( (!$monitor['Status']) or ($monitor['Status'] == 'NotRunning') ) {
|
if ( (!$monitor['Status'] || $monitor['Status'] == 'NotRunning') && $monitor['Type']!='WebSite' ) {
|
||||||
$source_class = 'errorText';
|
$source_class = 'errorText';
|
||||||
} else {
|
} else {
|
||||||
if ( $monitor['CaptureFPS'] == '0.00' ) {
|
if ( $monitor['CaptureFPS'] == '0.00' ) {
|
||||||
|
@ -256,7 +259,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
||||||
if ( !$monitor['Enabled'] )
|
if ( !$monitor['Enabled'] )
|
||||||
$fclass .= ' disabledText';
|
$fclass .= ' disabledText';
|
||||||
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||||
$stream_available = canView('Stream') && $monitor['CaptureFPS'] && $monitor['Function'] != 'None';
|
$stream_available = canView('Stream') and $monitor['Type']=='WebSite' or ($monitor['CaptureFPS'] && $monitor['Function'] != 'None');
|
||||||
$dot_class=$source_class;
|
$dot_class=$source_class;
|
||||||
if ( $fclass != 'infoText' ) $dot_class=$fclass;
|
if ( $fclass != 'infoText' ) $dot_class=$fclass;
|
||||||
|
|
||||||
|
@ -313,7 +316,7 @@ if ( $fclass != 'infoText' ) $dot_class=$fclass;
|
||||||
}
|
}
|
||||||
} elseif ( $monitor['Type'] == 'File' || $monitor['Type'] == 'cURL' ) {
|
} elseif ( $monitor['Type'] == 'File' || $monitor['Type'] == 'cURL' ) {
|
||||||
$source = preg_replace( '/^.*\//', '', $monitor['Path'] );
|
$source = preg_replace( '/^.*\//', '', $monitor['Path'] );
|
||||||
} elseif ( $monitor['Type'] == 'Ffmpeg' || $monitor['Type'] == 'Libvlc' ) {
|
} elseif ( $monitor['Type'] == 'Ffmpeg' || $monitor['Type'] == 'Libvlc' || $monitor['Type'] == 'WebSite' ) {
|
||||||
$url_parts = parse_url( $monitor['Path'] );
|
$url_parts = parse_url( $monitor['Path'] );
|
||||||
unset($url_parts['user']);
|
unset($url_parts['user']);
|
||||||
unset($url_parts['pass']);
|
unset($url_parts['pass']);
|
||||||
|
|
|
@ -54,14 +54,6 @@ function validateForm( form ) {
|
||||||
else if ( monitorNames[form.elements['newMonitor[Name]'].value] )
|
else if ( monitorNames[form.elements['newMonitor[Name]'].value] )
|
||||||
errors[errors.length] = "<?php echo translate('DuplicateMonitorName') ?>";
|
errors[errors.length] = "<?php echo translate('DuplicateMonitorName') ?>";
|
||||||
|
|
||||||
if ( form.elements['newMonitor[AnalysisFPSLimit]'].value && !(parseFloat(form.elements['newMonitor[AnalysisFPSLimit]'].value) > 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadAnalysisFPS') ?>";
|
|
||||||
if ( form.elements['newMonitor[MaxFPS]'].value && !(parseFloat(form.elements['newMonitor[MaxFPS]'].value) > 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadMaxFPS') ?>";
|
|
||||||
if ( form.elements['newMonitor[AlarmMaxFPS]'].value && !(parseFloat(form.elements['newMonitor[AlarmMaxFPS]'].value) > 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadAlarmMaxFPS') ?>";
|
|
||||||
if ( !form.elements['newMonitor[RefBlendPerc]'].value || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) > 100 ) || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) < 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadRefBlendPerc') ?>";
|
|
||||||
if ( form.elements['newMonitor[Type]'].value == 'Local' ) {
|
if ( form.elements['newMonitor[Type]'].value == 'Local' ) {
|
||||||
if ( !form.elements['newMonitor[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
|
if ( !form.elements['newMonitor[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
|
||||||
errors[errors.length] = "<?php echo translate('BadPalette') ?>";
|
errors[errors.length] = "<?php echo translate('BadPalette') ?>";
|
||||||
|
@ -81,44 +73,63 @@ function validateForm( form ) {
|
||||||
} else if ( form.elements['newMonitor[Type]'].value == 'File' ) {
|
} else if ( form.elements['newMonitor[Type]'].value == 'File' ) {
|
||||||
if ( !form.elements['newMonitor[Path]'].value )
|
if ( !form.elements['newMonitor[Path]'].value )
|
||||||
errors[errors.length] = "<?php echo translate('BadPath') ?>";
|
errors[errors.length] = "<?php echo translate('BadPath') ?>";
|
||||||
|
} else if ( form.elements['newMonitor[Type]'].value == 'WebSite' ) {
|
||||||
|
if ( form.elements['newMonitor[Function]'].value != 'Monitor' && form.elements['newMonitor[Function]'].value != 'None')
|
||||||
|
errors[errors.length] = "<?php echo translate('BadSourceType') ?>";
|
||||||
|
if ( form.elements['newMonitor[Path]'].value.search(/^https?:\/\//i) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadWebSitePath') ?>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( form.elements['newMonitor[Type]'].value != 'WebSite' ) {
|
||||||
|
|
||||||
|
if ( form.elements['newMonitor[AnalysisFPSLimit]'].value && !(parseFloat(form.elements['newMonitor[AnalysisFPSLimit]'].value) > 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadAnalysisFPS') ?>";
|
||||||
|
if ( form.elements['newMonitor[MaxFPS]'].value && !(parseFloat(form.elements['newMonitor[MaxFPS]'].value) > 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadMaxFPS') ?>";
|
||||||
|
if ( form.elements['newMonitor[AlarmMaxFPS]'].value && !(parseFloat(form.elements['newMonitor[AlarmMaxFPS]'].value) > 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadAlarmMaxFPS') ?>";
|
||||||
|
if ( !form.elements['newMonitor[RefBlendPerc]'].value || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) > 100 ) || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) < 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadRefBlendPerc') ?>";
|
||||||
|
|
||||||
|
if ( !form.elements['newMonitor[Colours]'].value || (parseInt(form.elements['newMonitor[Colours]'].value) != 1 && parseInt(form.elements['newMonitor[Colours]'].value) != 3 && parseInt(form.elements['newMonitor[Colours]'].value) != 4 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadColours') ?>";
|
||||||
|
if ( !form.elements['newMonitor[Width]'].value || !(parseInt(form.elements['newMonitor[Width]'].value) > 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadWidth') ?>";
|
||||||
|
if ( !form.elements['newMonitor[Height]'].value || !(parseInt(form.elements['newMonitor[Height]'].value) > 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadHeight') ?>";
|
||||||
|
if ( !form.elements['newMonitor[LabelX]'].value || !(parseInt(form.elements['newMonitor[LabelX]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadLabelX') ?>";
|
||||||
|
if ( !form.elements['newMonitor[LabelY]'].value || !(parseInt(form.elements['newMonitor[LabelY]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadLabelY') ?>";
|
||||||
|
if ( !form.elements['newMonitor[ImageBufferCount]'].value || !(parseInt(form.elements['newMonitor[ImageBufferCount]'].value) >= 10 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadImageBufferCount') ?>";
|
||||||
|
if ( !form.elements['newMonitor[WarmupCount]'].value || !(parseInt(form.elements['newMonitor[WarmupCount]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadWarmupCount') ?>";
|
||||||
|
if ( !form.elements['newMonitor[PreEventCount]'].value || !(parseInt(form.elements['newMonitor[PreEventCount]'].value) >= 0 ) || (parseInt(form.elements['newMonitor[PreEventCount]'].value) > parseInt(form.elements['newMonitor[ImageBufferCount]'].value)) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadPreEventCount') ?>";
|
||||||
|
if ( !form.elements['newMonitor[PostEventCount]'].value || !(parseInt(form.elements['newMonitor[PostEventCount]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadPostEventCount') ?>";
|
||||||
|
if ( !form.elements['newMonitor[StreamReplayBuffer]'].value || !(parseInt(form.elements['newMonitor[StreamReplayBuffer]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadStreamReplayBuffer') ?>";
|
||||||
|
if ( !form.elements['newMonitor[AlarmFrameCount]'].value || !(parseInt(form.elements['newMonitor[AlarmFrameCount]'].value) > 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadAlarmFrameCount') ?>";
|
||||||
|
if ( !form.elements['newMonitor[SectionLength]'].value || !(parseInt(form.elements['newMonitor[SectionLength]'].value) >= 30 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadSectionLength') ?>";
|
||||||
|
if ( !form.elements['newMonitor[AnalysisUpdateDelay]'].value || !(parseInt(form.elements['newMonitor[AnalysisUpdateDelay]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadAnalysisUpdateDelay') ?>";
|
||||||
|
if ( !form.elements['newMonitor[FPSReportInterval]'].value || !(parseInt(form.elements['newMonitor[FPSReportInterval]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadFPSReportInterval') ?>";
|
||||||
|
if ( !form.elements['newMonitor[FrameSkip]'].value || !(parseInt(form.elements['newMonitor[FrameSkip]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadFrameSkip') ?>";
|
||||||
|
if ( !form.elements['newMonitor[MotionFrameSkip]'].value || !(parseInt(form.elements['newMonitor[MotionFrameSkip]'].value) >= 0 ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadMotionFrameSkip') ?>";
|
||||||
|
if ( form.elements['newMonitor[Type]'].value == 'Local' )
|
||||||
|
if ( !form.elements['newMonitor[SignalCheckColour]'].value || !form.elements['newMonitor[SignalCheckColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadSignalCheckColour') ?>";
|
||||||
|
if ( !form.elements['newMonitor[WebColour]'].value || !form.elements['newMonitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
||||||
|
errors[errors.length] = "<?php echo translate('BadWebColour') ?>";
|
||||||
|
|
||||||
}
|
}
|
||||||
if ( !form.elements['newMonitor[Colours]'].value || (parseInt(form.elements['newMonitor[Colours]'].value) != 1 && parseInt(form.elements['newMonitor[Colours]'].value) != 3 && parseInt(form.elements['newMonitor[Colours]'].value) != 4 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadColours') ?>";
|
|
||||||
if ( !form.elements['newMonitor[Width]'].value || !(parseInt(form.elements['newMonitor[Width]'].value) > 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadWidth') ?>";
|
|
||||||
if ( !form.elements['newMonitor[Height]'].value || !(parseInt(form.elements['newMonitor[Height]'].value) > 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadHeight') ?>";
|
|
||||||
if ( !form.elements['newMonitor[LabelX]'].value || !(parseInt(form.elements['newMonitor[LabelX]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadLabelX') ?>";
|
|
||||||
if ( !form.elements['newMonitor[LabelY]'].value || !(parseInt(form.elements['newMonitor[LabelY]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadLabelY') ?>";
|
|
||||||
if ( !form.elements['newMonitor[ImageBufferCount]'].value || !(parseInt(form.elements['newMonitor[ImageBufferCount]'].value) >= 10 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadImageBufferCount') ?>";
|
|
||||||
if ( !form.elements['newMonitor[WarmupCount]'].value || !(parseInt(form.elements['newMonitor[WarmupCount]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadWarmupCount') ?>";
|
|
||||||
if ( !form.elements['newMonitor[PreEventCount]'].value || !(parseInt(form.elements['newMonitor[PreEventCount]'].value) >= 0 ) || (parseInt(form.elements['newMonitor[PreEventCount]'].value) > parseInt(form.elements['newMonitor[ImageBufferCount]'].value)) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadPreEventCount') ?>";
|
|
||||||
if ( !form.elements['newMonitor[PostEventCount]'].value || !(parseInt(form.elements['newMonitor[PostEventCount]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadPostEventCount') ?>";
|
|
||||||
if ( !form.elements['newMonitor[StreamReplayBuffer]'].value || !(parseInt(form.elements['newMonitor[StreamReplayBuffer]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadStreamReplayBuffer') ?>";
|
|
||||||
if ( !form.elements['newMonitor[AlarmFrameCount]'].value || !(parseInt(form.elements['newMonitor[AlarmFrameCount]'].value) > 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadAlarmFrameCount') ?>";
|
|
||||||
if ( !form.elements['newMonitor[SectionLength]'].value || !(parseInt(form.elements['newMonitor[SectionLength]'].value) >= 30 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadSectionLength') ?>";
|
|
||||||
if ( !form.elements['newMonitor[AnalysisUpdateDelay]'].value || !(parseInt(form.elements['newMonitor[AnalysisUpdateDelay]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadAnalysisUpdateDelay') ?>";
|
|
||||||
if ( !form.elements['newMonitor[FPSReportInterval]'].value || !(parseInt(form.elements['newMonitor[FPSReportInterval]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadFPSReportInterval') ?>";
|
|
||||||
if ( !form.elements['newMonitor[FrameSkip]'].value || !(parseInt(form.elements['newMonitor[FrameSkip]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadFrameSkip') ?>";
|
|
||||||
if ( !form.elements['newMonitor[MotionFrameSkip]'].value || !(parseInt(form.elements['newMonitor[MotionFrameSkip]'].value) >= 0 ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadMotionFrameSkip') ?>";
|
|
||||||
if ( form.elements['newMonitor[Type]'].value == 'Local' )
|
|
||||||
if ( !form.elements['newMonitor[SignalCheckColour]'].value || !form.elements['newMonitor[SignalCheckColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadSignalCheckColour') ?>";
|
|
||||||
if ( !form.elements['newMonitor[WebColour]'].value || !form.elements['newMonitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
|
||||||
errors[errors.length] = "<?php echo translate('BadWebColour') ?>";
|
|
||||||
|
|
||||||
if ( errors.length ) {
|
if ( errors.length ) {
|
||||||
alert( errors.join( "\n" ) );
|
alert( errors.join( "\n" ) );
|
||||||
|
|
|
@ -12,6 +12,15 @@ function Monitor( monitorData ) {
|
||||||
if ( auth_hash )
|
if ( auth_hash )
|
||||||
this.streamCmdParms += '&auth='+auth_hash;
|
this.streamCmdParms += '&auth='+auth_hash;
|
||||||
this.streamCmdTimer = null;
|
this.streamCmdTimer = null;
|
||||||
|
this.type = monitorData.type;
|
||||||
|
this.refresh = monitorData.refresh;
|
||||||
|
this.start = function( delay ) {
|
||||||
|
if ( this.streamCmdQuery )
|
||||||
|
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
|
||||||
|
else
|
||||||
|
console.log("No streamCmdQuery");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
this.setStateClass = function( element, stateClass ) {
|
this.setStateClass = function( element, stateClass ) {
|
||||||
if ( !element.hasClass( stateClass ) ) {
|
if ( !element.hasClass( stateClass ) ) {
|
||||||
|
@ -68,7 +77,7 @@ function Monitor( monitorData ) {
|
||||||
else
|
else
|
||||||
stateClass = "idle";
|
stateClass = "idle";
|
||||||
|
|
||||||
if ( !COMPACT_MONTAGE ) {
|
if ( (!COMPACT_MONTAGE) && (this.type != 'WebSite') ) {
|
||||||
$('fpsValue'+this.id).set( 'text', this.status.fps );
|
$('fpsValue'+this.id).set( 'text', this.status.fps );
|
||||||
$('stateValue'+this.id).set( 'text', stateStrings[this.alarmState] );
|
$('stateValue'+this.id).set( 'text', stateStrings[this.alarmState] );
|
||||||
this.setStateClass( $('monitorState'+this.id), stateClass );
|
this.setStateClass( $('monitorState'+this.id), stateClass );
|
||||||
|
@ -137,22 +146,26 @@ function Monitor( monitorData ) {
|
||||||
this.streamCmdReq.cancel();
|
this.streamCmdReq.cancel();
|
||||||
}
|
}
|
||||||
//console.log("Starting CmdQuery for " + this.connKey );
|
//console.log("Starting CmdQuery for " + this.connKey );
|
||||||
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
|
if ( this.type != 'WebSite' ) {
|
||||||
|
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.streamCmdReq = new Request.JSON( {
|
if ( this.type != 'WebSite' ) {
|
||||||
url: this.server_url,
|
this.streamCmdReq = new Request.JSON( {
|
||||||
method: 'get',
|
url: this.server_url,
|
||||||
timeout: 1000+AJAX_TIMEOUT,
|
method: 'get',
|
||||||
onSuccess: this.getStreamCmdResponse.bind( this ),
|
timeout: 1000+AJAX_TIMEOUT,
|
||||||
onTimeout: this.streamCmdQuery.bind( this, true ),
|
onSuccess: this.getStreamCmdResponse.bind( this ),
|
||||||
onError: this.onError.bind(this),
|
onTimeout: this.streamCmdQuery.bind( this, true ),
|
||||||
onFailure: this.onFailure.bind(this),
|
onError: this.onError.bind(this),
|
||||||
link: 'cancel'
|
onFailure: this.onFailure.bind(this),
|
||||||
} );
|
link: 'cancel'
|
||||||
|
} );
|
||||||
|
console.log("queueing for " + this.id + " " + this.connKey );
|
||||||
|
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
|
||||||
|
}
|
||||||
|
|
||||||
console.log("queueing for " + this.id + " " + this.connKey );
|
|
||||||
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectLayout( element ) {
|
function selectLayout( element ) {
|
||||||
|
@ -378,15 +391,26 @@ function cancel_layout(button) {
|
||||||
selectLayout('#zmMontageLayout');
|
selectLayout('#zmMontageLayout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadWebSite(ndx) {
|
||||||
|
document.getElementById('imageFeed'+ndx).innerHTML = document.getElementById('imageFeed'+ndx).innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
var monitors = new Array();
|
var monitors = new Array();
|
||||||
function initPage() {
|
function initPage() {
|
||||||
console.log("initPage");
|
|
||||||
for ( var i = 0; i < monitorData.length; i++ ) {
|
for ( var i = 0; i < monitorData.length; i++ ) {
|
||||||
monitors[i] = new Monitor(monitorData[i]);
|
monitors[i] = new Monitor(monitorData[i]);
|
||||||
|
var delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
|
||||||
|
var interval = monitors[i].refresh;
|
||||||
|
monitors[i].start( delay );
|
||||||
|
if ( monitors[i].type == 'WebSite' && interval > 0 ) {
|
||||||
|
setInterval(reloadWebSite, interval*1000, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
selectLayout('#zmMontageLayout');
|
selectLayout('#zmMontageLayout');
|
||||||
|
|
||||||
for ( var i = 0; i < monitorData.length; i++ ) {
|
for ( var i = 0; i < monitorData.length; i++ ) {
|
||||||
|
if ( monitors[i].type == 'WebSite' )
|
||||||
|
continue;
|
||||||
var delay = Math.round( (Math.random()+0.75)*statusRefreshTimeout );
|
var delay = Math.round( (Math.random()+0.75)*statusRefreshTimeout );
|
||||||
console.log("Delay for monitor " + monitorData[i].id + " is " + delay );
|
console.log("Delay for monitor " + monitorData[i].id + " is " + delay );
|
||||||
monitors[i].streamCmdQuery.delay( delay, monitors[i] );
|
monitors[i].streamCmdQuery.delay( delay, monitors[i] );
|
||||||
|
|
|
@ -36,7 +36,9 @@ monitorData[monitorData.length] = {
|
||||||
'width': <?php echo $monitor->Width() ?>,
|
'width': <?php echo $monitor->Width() ?>,
|
||||||
'height':<?php echo $monitor->Height() ?>,
|
'height':<?php echo $monitor->Height() ?>,
|
||||||
'server_url': '<?php echo $monitor->Server()->Url().$_SERVER['PHP_SELF'] ?>',
|
'server_url': '<?php echo $monitor->Server()->Url().$_SERVER['PHP_SELF'] ?>',
|
||||||
'onclick': function(){createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );}
|
'onclick': function(){createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );},
|
||||||
|
'type': '<?php echo $monitor->Type() ?>',
|
||||||
|
'refresh': '<?php echo $monitor->Refresh() ?>'
|
||||||
};
|
};
|
||||||
<?php
|
<?php
|
||||||
} // end foreach monitor
|
} // end foreach monitor
|
||||||
|
|
|
@ -105,18 +105,20 @@ function setAlarmState( currentAlarmState ) {
|
||||||
lastAlarmState = alarmState;
|
lastAlarmState = alarmState;
|
||||||
}
|
}
|
||||||
|
|
||||||
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
|
if ( monitorType != 'WebSite' ) {
|
||||||
if ( auth_hash )
|
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
|
||||||
streamCmdParms += '&auth='+auth_hash;
|
if ( auth_hash )
|
||||||
var streamCmdReq = new Request.JSON( {
|
streamCmdParms += '&auth='+auth_hash;
|
||||||
url: monitorUrl+thisUrl,
|
var streamCmdReq = new Request.JSON( {
|
||||||
method: 'get',
|
url: monitorUrl+thisUrl,
|
||||||
timeout: AJAX_TIMEOUT,
|
method: 'get',
|
||||||
link: 'chain',
|
timeout: AJAX_TIMEOUT,
|
||||||
onSuccess: getStreamCmdResponse,
|
link: 'chain',
|
||||||
onFailure: getStreamCmdFailure
|
onSuccess: getStreamCmdResponse,
|
||||||
} );
|
onFailure: getStreamCmdFailure
|
||||||
var streamCmdTimer = null;
|
} );
|
||||||
|
var streamCmdTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
var streamStatus;
|
var streamStatus;
|
||||||
|
|
||||||
|
@ -350,11 +352,13 @@ function streamCmdQuery() {
|
||||||
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
|
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
|
if ( monitorType != 'WebSite' ) {
|
||||||
if ( auth_hash )
|
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
|
||||||
statusCmdParms += '&auth='+auth_hash;
|
if ( auth_hash )
|
||||||
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'get', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
|
statusCmdParms += '&auth='+auth_hash;
|
||||||
var statusCmdTimer = null;
|
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'get', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
|
||||||
|
var statusCmdTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
function getStatusCmdResponse( respObj, respText ) {
|
function getStatusCmdResponse( respObj, respText ) {
|
||||||
watchdogOk("status");
|
watchdogOk("status");
|
||||||
|
@ -377,18 +381,20 @@ function statusCmdQuery() {
|
||||||
statusCmdReq.send();
|
statusCmdReq.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
var alarmCmdParms = "view=request&request=alarm&id="+monitorId;
|
if ( monitorType != 'WebSite' ) {
|
||||||
if ( auth_hash )
|
var alarmCmdParms = "view=request&request=alarm&id="+monitorId;
|
||||||
alarmCmdParms += '&auth='+auth_hash;
|
if ( auth_hash )
|
||||||
var alarmCmdReq = new Request.JSON( {
|
alarmCmdParms += '&auth='+auth_hash;
|
||||||
url: monitorUrl+thisUrl,
|
var alarmCmdReq = new Request.JSON( {
|
||||||
method: 'post',
|
url: monitorUrl+thisUrl,
|
||||||
timeout: AJAX_TIMEOUT,
|
method: 'post',
|
||||||
link: 'cancel',
|
timeout: AJAX_TIMEOUT,
|
||||||
onSuccess: getAlarmCmdResponse,
|
link: 'cancel',
|
||||||
onTimeout: streamCmdQuery
|
onSuccess: getAlarmCmdResponse,
|
||||||
} );
|
onTimeout: streamCmdQuery
|
||||||
var alarmCmdFirst = true;
|
} );
|
||||||
|
var alarmCmdFirst = true;
|
||||||
|
}
|
||||||
|
|
||||||
function getAlarmCmdResponse( respObj, respText ) {
|
function getAlarmCmdResponse( respObj, respText ) {
|
||||||
checkStreamForErrors("getAlarmCmdResponse", respObj);
|
checkStreamForErrors("getAlarmCmdResponse", respObj);
|
||||||
|
@ -428,12 +434,14 @@ function deleteEvent( event, eventId ) {
|
||||||
event.stop();
|
event.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventCmdParms = "view=request&request=status&entity=events&id="+monitorId+"&count="+maxDisplayEvents+"&sort=Id%20desc";
|
if ( monitorType != 'WebSite' ) {
|
||||||
if ( auth_hash )
|
var eventCmdParms = "view=request&request=status&entity=events&id="+monitorId+"&count="+maxDisplayEvents+"&sort=Id%20desc";
|
||||||
eventCmdParms += '&auth='+auth_hash;
|
if ( auth_hash )
|
||||||
var eventCmdReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, data: eventCmdParms, link: 'cancel', onSuccess: getEventCmdResponse, onTimeout: eventCmdQuery } );
|
eventCmdParms += '&auth='+auth_hash;
|
||||||
var eventCmdTimer = null;
|
var eventCmdReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, data: eventCmdParms, link: 'cancel', onSuccess: getEventCmdResponse, onTimeout: eventCmdQuery } );
|
||||||
var eventCmdFirst = true;
|
var eventCmdTimer = null;
|
||||||
|
var eventCmdFirst = true;
|
||||||
|
}
|
||||||
|
|
||||||
function highlightRow( row ) {
|
function highlightRow( row ) {
|
||||||
$(row).toggleClass( 'highlight' );
|
$(row).toggleClass( 'highlight' );
|
||||||
|
@ -536,10 +544,12 @@ function eventCmdQuery() {
|
||||||
eventCmdReq.send();
|
eventCmdReq.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
var controlParms = "view=request&request=control&id="+monitorId;
|
if ( monitorType != 'WebSite' ) {
|
||||||
if ( auth_hash )
|
var controlParms = "view=request&request=control&id="+monitorId;
|
||||||
controlParms += '&auth='+auth_hash;
|
if ( auth_hash )
|
||||||
var controlReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getControlResponse } );
|
controlParms += '&auth='+auth_hash;
|
||||||
|
var controlReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getControlResponse } );
|
||||||
|
}
|
||||||
|
|
||||||
function getControlResponse( respObj, respText ) {
|
function getControlResponse( respObj, respText ) {
|
||||||
if ( !respObj )
|
if ( !respObj )
|
||||||
|
@ -652,33 +662,37 @@ function watchdogOk( type ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initPage() {
|
function initPage() {
|
||||||
if ( streamMode == "single" ) {
|
if ( monitorType != 'WebSite' ) {
|
||||||
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
|
||||||
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2);
|
|
||||||
} else {
|
|
||||||
streamCmdTimer = streamCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
|
||||||
watchdogCheck.pass('stream').periodical(statusRefreshTimeout*2);
|
|
||||||
}
|
|
||||||
|
|
||||||
eventCmdTimer = eventCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
|
||||||
watchdogCheck.pass('event').periodical(eventsRefreshTimeout*2);
|
|
||||||
|
|
||||||
if ( canStreamNative || streamMode == "single" ) {
|
|
||||||
var streamImg = $('imageFeed').getElement('img');
|
|
||||||
if ( !streamImg )
|
|
||||||
streamImg = $('imageFeed').getElement('object');
|
|
||||||
if ( streamMode == "single" ) {
|
if ( streamMode == "single" ) {
|
||||||
streamImg.addEvent( 'click', fetchImage.pass( streamImg ) );
|
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
||||||
fetchImage.pass( streamImg ).periodical( imageRefreshTimeout );
|
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2);
|
||||||
} else
|
} else {
|
||||||
streamImg.addEvent( 'click', function( event ) { handleClick( event ); } );
|
streamCmdTimer = streamCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
||||||
}
|
watchdogCheck.pass('stream').periodical(statusRefreshTimeout*2);
|
||||||
|
}
|
||||||
|
|
||||||
if ( refreshApplet && appletRefreshTime )
|
eventCmdTimer = eventCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
|
||||||
appletRefresh.delay( appletRefreshTime*1000 );
|
watchdogCheck.pass('event').periodical(eventsRefreshTimeout*2);
|
||||||
if (scale == "auto") changeScale();
|
|
||||||
if (window.history.length == 1) {
|
if ( canStreamNative || streamMode == "single" ) {
|
||||||
$j('#closeControl').html('');
|
var streamImg = $('imageFeed').getElement('img');
|
||||||
|
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 ); } );
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ var monitorId = <?php echo $monitor->Id() ?>;
|
||||||
var monitorWidth = <?php echo $monitor->Width() ?>;
|
var monitorWidth = <?php echo $monitor->Width() ?>;
|
||||||
var monitorHeight = <?php echo $monitor->Height() ?>;
|
var monitorHeight = <?php echo $monitor->Height() ?>;
|
||||||
var monitorUrl = '<?php echo ( $monitor->Server()->Url() . ( ZM_MIN_STREAMING_PORT ? ':'. (ZM_MIN_STREAMING_PORT+$monitor->Id()) : '' ) ) ?>';
|
var monitorUrl = '<?php echo ( $monitor->Server()->Url() . ( ZM_MIN_STREAMING_PORT ? ':'. (ZM_MIN_STREAMING_PORT+$monitor->Id()) : '' ) ) ?>';
|
||||||
|
var monitorType = '<?php echo ( $monitor->Type() ) ?>';
|
||||||
|
var monitorRefresh = '<?php echo ( $monitor->Refresh() ) ?>';
|
||||||
|
|
||||||
var scale = '<?php echo $scale ?>';
|
var scale = '<?php echo $scale ?>';
|
||||||
|
|
||||||
|
|
|
@ -26,23 +26,6 @@ if ( !canView( 'Monitors' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs = array();
|
|
||||||
$tabs['general'] = translate('General');
|
|
||||||
$tabs['source'] = translate('Source');
|
|
||||||
$tabs['storage'] = translate('Storage');
|
|
||||||
$tabs['timestamp'] = translate('Timestamp');
|
|
||||||
$tabs['buffers'] = translate('Buffers');
|
|
||||||
if ( ZM_OPT_CONTROL && canView( 'Control' ) )
|
|
||||||
$tabs['control'] = translate('Control');
|
|
||||||
if ( ZM_OPT_X10 )
|
|
||||||
$tabs['x10'] = translate('X10');
|
|
||||||
$tabs['misc'] = translate('Misc');
|
|
||||||
|
|
||||||
if ( isset($_REQUEST['tab']) )
|
|
||||||
$tab = validHtmlStr($_REQUEST['tab']);
|
|
||||||
else
|
|
||||||
$tab = 'general';
|
|
||||||
|
|
||||||
$Server = null;
|
$Server = null;
|
||||||
if ( defined( 'ZM_SERVER_ID' ) ) {
|
if ( defined( 'ZM_SERVER_ID' ) ) {
|
||||||
$Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) );
|
$Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) );
|
||||||
|
@ -142,6 +125,7 @@ if ( ! $monitor ) {
|
||||||
'V4LCapturesPerFrame' => 1,
|
'V4LCapturesPerFrame' => 1,
|
||||||
'ServerId' => 'auto',
|
'ServerId' => 'auto',
|
||||||
'StorageId' => '1',
|
'StorageId' => '1',
|
||||||
|
'Refresh' => '',
|
||||||
) );
|
) );
|
||||||
} # end if $_REQUEST['dupID']
|
} # end if $_REQUEST['dupID']
|
||||||
} # end if $_REQUEST['mid']
|
} # end if $_REQUEST['mid']
|
||||||
|
@ -212,7 +196,8 @@ $sourceTypes = array(
|
||||||
'Ffmpeg' => translate('Ffmpeg'),
|
'Ffmpeg' => translate('Ffmpeg'),
|
||||||
'Libvlc' => translate('Libvlc'),
|
'Libvlc' => translate('Libvlc'),
|
||||||
'cURL' => 'cURL (HTTP(S) only)',
|
'cURL' => 'cURL (HTTP(S) only)',
|
||||||
'NVSocket' => translate('NVSocket')
|
'WebSite'=> 'Web Site',
|
||||||
|
'NVSocket' => translate('NVSocket')
|
||||||
);
|
);
|
||||||
if ( !ZM_HAS_V4L )
|
if ( !ZM_HAS_V4L )
|
||||||
unset($sourceTypes['Local']);
|
unset($sourceTypes['Local']);
|
||||||
|
@ -507,6 +492,25 @@ if ( canEdit( 'Monitors' ) ) {
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<ul class="tabList">
|
<ul class="tabList">
|
||||||
<?php
|
<?php
|
||||||
|
$tabs = array();
|
||||||
|
$tabs['general'] = translate('General');
|
||||||
|
$tabs['source'] = translate('Source');
|
||||||
|
if ( $monitor->Type() != 'WebSite' ) {
|
||||||
|
$tabs['storage'] = translate('Storage');
|
||||||
|
$tabs['timestamp'] = translate('Timestamp');
|
||||||
|
$tabs['buffers'] = translate('Buffers');
|
||||||
|
if ( ZM_OPT_CONTROL && canView( 'Control' ) )
|
||||||
|
$tabs['control'] = translate('Control');
|
||||||
|
if ( ZM_OPT_X10 )
|
||||||
|
$tabs['x10'] = translate('X10');
|
||||||
|
$tabs['misc'] = translate('Misc');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($_REQUEST['tab']) )
|
||||||
|
$tab = validHtmlStr($_REQUEST['tab']);
|
||||||
|
else
|
||||||
|
$tab = 'general';
|
||||||
|
|
||||||
foreach ( $tabs as $name=>$value ) {
|
foreach ( $tabs as $name=>$value ) {
|
||||||
if ( $tab == $name ) {
|
if ( $tab == $name ) {
|
||||||
?>
|
?>
|
||||||
|
@ -583,7 +587,7 @@ if ( $tab != 'source' || ($monitor->Type()!= 'Ffmpeg' && $monitor->Type()!= 'Lib
|
||||||
<input type="hidden" name="newMonitor[Options]" value="<?php echo validHtmlStr($monitor->Options()) ?>"/>
|
<input type="hidden" name="newMonitor[Options]" value="<?php echo validHtmlStr($monitor->Options()) ?>"/>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if ( $tab != 'source' || ($monitor->Type()!= 'Remote' && $monitor->Type()!= 'File' && $monitor->Type()!= 'Ffmpeg' && $monitor->Type()!= 'Libvlc' && $monitor->Type()!= 'cURL') ) {
|
if ( $tab != 'source' || ($monitor->Type()!= 'Remote' && $monitor->Type()!= 'File' && $monitor->Type()!= 'Ffmpeg' && $monitor->Type()!= 'Libvlc' && $monitor->Type()!= 'cURL' && $monitor->Type() != 'WebSite') ) {
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>"/>
|
<input type="hidden" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>"/>
|
||||||
<input type="hidden" name="newMonitor[User]" value="<?php echo validHtmlStr($monitor->User()) ?>"/>
|
<input type="hidden" name="newMonitor[User]" value="<?php echo validHtmlStr($monitor->User()) ?>"/>
|
||||||
|
@ -713,6 +717,9 @@ switch ( $tab ) {
|
||||||
?>
|
?>
|
||||||
</select></td></tr>
|
</select></td></tr>
|
||||||
<tr><td><?php echo translate('Enabled') ?></td><td><input type="checkbox" name="newMonitor[Enabled]" value="1"<?php if ( $monitor->Enabled() ) { ?> checked="checked"<?php } ?>/></td></tr>
|
<tr><td><?php echo translate('Enabled') ?></td><td><input type="checkbox" name="newMonitor[Enabled]" value="1"<?php if ( $monitor->Enabled() ) { ?> checked="checked"<?php } ?>/></td></tr>
|
||||||
|
<?php
|
||||||
|
if ( $monitor->Type != 'WebSite' ) {
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo translate('LinkedMonitors') ?></td>
|
<td><?php echo translate('LinkedMonitors') ?></td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -802,6 +809,7 @@ echo htmlOptions(Group::get_dropdown_options( ), $monitor->GroupIds() );
|
||||||
?>
|
?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'source' :
|
case 'source' :
|
||||||
|
@ -868,6 +876,13 @@ include('_monitor_source_nvsocket.php');
|
||||||
<tr><td><?php echo 'URL' ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>" size="36"/></td></tr>
|
<tr><td><?php echo 'URL' ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>" size="36"/></td></tr>
|
||||||
<tr><td><?php echo 'Username' ?></td><td><input type="text" name="newMonitor[User]" value="<?php echo validHtmlStr($monitor->User()) ?>" size="12"/></td></tr>
|
<tr><td><?php echo 'Username' ?></td><td><input type="text" name="newMonitor[User]" value="<?php echo validHtmlStr($monitor->User()) ?>" size="12"/></td></tr>
|
||||||
<tr><td><?php echo 'Password' ?></td><td><input type="text" name="newMonitor[Pass]" value="<?php echo validHtmlStr($monitor->Pass()) ?>" size="12"/></td></tr>
|
<tr><td><?php echo 'Password' ?></td><td><input type="text" name="newMonitor[Pass]" value="<?php echo validHtmlStr($monitor->Pass()) ?>" size="12"/></td></tr>
|
||||||
|
<?php
|
||||||
|
} elseif ( $monitor->Type() == 'WebSite' ) {
|
||||||
|
?>
|
||||||
|
<tr><td><?php echo translate('WebSiteUrl') ?></td><td><input type="text" name="newMonitor[Path]" value="<?php echo validHtmlStr($monitor->Path()) ?>" size="36"/></td></tr>
|
||||||
|
<tr><td><?php echo translate('Width') ?> (<?php echo translate('Pixels') ?>)</td><td><input type="text" name="newMonitor[Width]" value="<?php echo validHtmlStr($monitor->Width()) ?>" size="4";"/></td></tr>
|
||||||
|
<tr><td><?php echo translate('Height') ?> (<?php echo translate('Pixels') ?>)</td><td><input type="text" name="newMonitor[Height]" value="<?php echo validHtmlStr($monitor->Height()) ?>" size="4";"/></td></tr>
|
||||||
|
<tr><td><?php echo 'Web Site Refresh (Optional)' ?></td><td><input type="number" name="newMonitor[Refresh]" value="<?php echo $monitor->Refresh()?>"/></td></tr>
|
||||||
<?php
|
<?php
|
||||||
} elseif ( $monitor->Type() == 'Ffmpeg' || $monitor->Type() == 'Libvlc' ) {
|
} elseif ( $monitor->Type() == 'Ffmpeg' || $monitor->Type() == 'Libvlc' ) {
|
||||||
?>
|
?>
|
||||||
|
@ -876,7 +891,7 @@ include('_monitor_source_nvsocket.php');
|
||||||
<tr><td><?php echo translate('Options') ?> (<?php echo makePopupLink( '?view=optionhelp&option=OPTIONS_'.strtoupper($monitor->Type()), 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" name="newMonitor[Options]" value="<?php echo validHtmlStr($monitor->Options()) ?>" size="36"/></td></tr>
|
<tr><td><?php echo translate('Options') ?> (<?php echo makePopupLink( '?view=optionhelp&option=OPTIONS_'.strtoupper($monitor->Type()), 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" name="newMonitor[Options]" value="<?php echo validHtmlStr($monitor->Options()) ?>" size="36"/></td></tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if ( $monitor->Type() != 'NVSocket' ) {
|
if ( $monitor->Type() != 'NVSocket' && $monitor->Type() != 'WebSite' ) {
|
||||||
?>
|
?>
|
||||||
<tr><td><?php echo translate('TargetColorspace') ?></td><td><?php echo htmlSelect('newMonitor[Colours]', $Colours, $monitor->Colours() ); ?>
|
<tr><td><?php echo translate('TargetColorspace') ?></td><td><?php echo htmlSelect('newMonitor[Colours]', $Colours, $monitor->Colours() ); ?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
@ -890,7 +905,7 @@ if ( $monitor->Type() == 'Local' ) {
|
||||||
?>
|
?>
|
||||||
<tr><td><?php echo translate('Deinterlacing') ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts_v4l2 as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Deinterlacing()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
<tr><td><?php echo translate('Deinterlacing') ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts_v4l2 as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Deinterlacing()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else if ( $monitor->Type() != 'WebSite' ) {
|
||||||
?>
|
?>
|
||||||
<tr><td><?php echo translate('Deinterlacing') ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Deinterlacing()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
<tr><td><?php echo translate('Deinterlacing') ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Deinterlacing()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -204,7 +204,11 @@ foreach ( $monitors as $monitor ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo getStreamHTML( $monitor, $monitor_options );
|
if ( $monitor->Type() == "WebSite" ) {
|
||||||
|
echo getWebSiteUrl( 'liveStream'.$monitor->Id(), $monitor->Path(), reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
||||||
|
} else {
|
||||||
|
echo getStreamHTML( $monitor, $monitor_options );
|
||||||
|
}
|
||||||
if ( $showZones ) {
|
if ( $showZones ) {
|
||||||
$height = null;
|
$height = null;
|
||||||
$width = null;
|
$width = null;
|
||||||
|
@ -255,7 +259,7 @@ foreach ( $monitors as $monitor ) {
|
||||||
<?php } # end if showZones ?>
|
<?php } # end if showZones ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if ( !ZM_WEB_COMPACT_MONTAGE ) {
|
if ( (!ZM_WEB_COMPACT_MONTAGE) && ($monitor->Type() != 'WebSite') ) {
|
||||||
?>
|
?>
|
||||||
<div id="monitorState<?php echo $monitor->Id() ?>" class="monitorState idle"><?php echo translate('State') ?>: <span id="stateValue<?php echo $monitor->Id() ?>"></span> - <span id="fpsValue<?php echo $monitor->Id() ?>"></span> fps</div>
|
<div id="monitorState<?php echo $monitor->Id() ?>" class="monitorState idle"><?php echo translate('State') ?>: <span id="stateValue<?php echo $monitor->Id() ?>"></span> - <span id="fpsValue<?php echo $monitor->Id() ?>"></span> fps</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -207,7 +207,7 @@ $frameSql .= ' ORDER BY Id DESC';
|
||||||
|
|
||||||
$monitors = array();
|
$monitors = array();
|
||||||
foreach( $displayMonitors as $row ) {
|
foreach( $displayMonitors as $row ) {
|
||||||
if ( $row['Function'] == 'None' )
|
if ( $row['Function'] == 'None' || $row['Type'] == 'WebSite' )
|
||||||
continue;
|
continue;
|
||||||
$Monitor = new Monitor( $row );
|
$Monitor = new Monitor( $row );
|
||||||
$monitors[] = $Monitor;
|
$monitors[] = $Monitor;
|
||||||
|
|
|
@ -41,7 +41,7 @@ if ( ! visibleMonitor( $mid ) ) {
|
||||||
$monitor = new Monitor( $mid );
|
$monitor = new Monitor( $mid );
|
||||||
|
|
||||||
#Whether to show the controls button
|
#Whether to show the controls button
|
||||||
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView( 'Control' ) );
|
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView('Control') && $monitor->Type() != 'WebSite' );
|
||||||
|
|
||||||
if ( isset( $_REQUEST['scale'] ) ) {
|
if ( isset( $_REQUEST['scale'] ) ) {
|
||||||
$scale = validInt($_REQUEST['scale']);
|
$scale = validInt($_REQUEST['scale']);
|
||||||
|
@ -80,6 +80,7 @@ if ( canView( 'Control' ) && $monitor->Type() == 'Local' ) {
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="imageFeed"><?php echo getStreamHTML( $monitor, array('scale'=>$scale) ); ?></div>
|
<div id="imageFeed"><?php echo getStreamHTML( $monitor, array('scale'=>$scale) ); ?></div>
|
||||||
|
<?php if ( $monitor->Type() != 'WebSite' ) { ?>
|
||||||
<div id="monitorStatus">
|
<div id="monitorStatus">
|
||||||
<?php if ( canEdit( 'Monitors' ) ) { ?>
|
<?php if ( canEdit( 'Monitors' ) ) { ?>
|
||||||
<div id="enableDisableAlarms"><a id="enableAlarmsLink" href="#" onclick="cmdEnableAlarms(); return( false );" class="hidden"><?php echo translate('EnableAlarms') ?></a><a id="disableAlarmsLink" href="#" onclick="cmdDisableAlarms(); return( false );" class="hidden"><?php echo translate('DisableAlarms') ?></a></div>
|
<div id="enableDisableAlarms"><a id="enableAlarmsLink" href="#" onclick="cmdEnableAlarms(); return( false );" class="hidden"><?php echo translate('EnableAlarms') ?></a><a id="disableAlarmsLink" href="#" onclick="cmdDisableAlarms(); return( false );" class="hidden"><?php echo translate('DisableAlarms') ?></a></div>
|
||||||
|
@ -119,7 +120,7 @@ if ( $streamMode == 'jpeg' ) {
|
||||||
?>
|
?>
|
||||||
<input type="button" value="–" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="avail" onclick="streamCmdZoomOut()"/>
|
<input type="button" value="–" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="avail" onclick="streamCmdZoomOut()"/>
|
||||||
<?php
|
<?php
|
||||||
} // end if streamMode==jpeg
|
} // end if streamMode==jpeg
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div id="replayStatus"<?php echo $streamMode=="single"?' class="hidden"':'' ?>>
|
<div id="replayStatus"<?php echo $streamMode=="single"?' class="hidden"':'' ?>>
|
||||||
|
@ -129,6 +130,7 @@ if ( $streamMode == 'jpeg' ) {
|
||||||
<span id="level"><?php echo translate('Buffer') ?>: <span id="levelValue"></span>%</span>
|
<span id="level"><?php echo translate('Buffer') ?>: <span id="levelValue"></span>%</span>
|
||||||
<span id="zoom"><?php echo translate('Zoom') ?>: <span id="zoomValue"></span>x</span>
|
<span id="zoom"><?php echo translate('Zoom') ?>: <span id="zoomValue"></span>x</span>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } // end if $monitor->Type() != 'WebSite' ?>
|
||||||
<?php
|
<?php
|
||||||
if ( $showPtzControls ) {
|
if ( $showPtzControls ) {
|
||||||
foreach ( getSkinIncludes( 'includes/control_functions.php' ) as $includeFile )
|
foreach ( getSkinIncludes( 'includes/control_functions.php' ) as $includeFile )
|
||||||
|
@ -139,7 +141,7 @@ if ( $showPtzControls ) {
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if ( canView( 'Events' ) ) {
|
if ( canView( 'Events' ) && $monitor->Type() != 'WebSite' ) {
|
||||||
?>
|
?>
|
||||||
<div id="events">
|
<div id="events">
|
||||||
<table id="eventList" cellspacing="0">
|
<table id="eventList" cellspacing="0">
|
||||||
|
|
Loading…
Reference in New Issue