diff --git a/CMakeLists.txt b/CMakeLists.txt index 733ec81be..1fa4b2e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -418,9 +418,7 @@ message(STATUS "Using web group: ${ZM_WEB_GROUP}") set(ZM_PID "${ZM_RUNDIR}/zm.pid") set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf") set(VERSION "${zoneminder_VERSION}") -set(PATH_BUILD "${PROJECT_SOURCE_DIR}") set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder") -set(TIME_BUILD "1000000") # Don't have a solution for this one yet set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}") set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") set(SYSCONFDIR "/${CMAKE_INSTALL_SYSCONFDIR}") @@ -428,6 +426,7 @@ set(WEB_PREFIX "${ZM_WEBDIR}") set(CGI_PREFIX "${ZM_CGIDIR}") set(WEB_USER "${ZM_WEB_USER}") set(WEB_GROUP "${ZM_WEB_GROUP}") +set(ZM_DB_TYPE "mysql") set(EXTRA_PERL_LIB "use lib '${ZM_PERL_USE_PATH}';") # Reassign some variables if a target distro has been specified @@ -438,10 +437,10 @@ if((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6")) endif((ZM_TARGET_DISTRO STREQUAL "f19") OR (ZM_TARGET_DISTRO STREQUAL "el6")) # Generate files from the .in files -configure_file(zoneminder-config.cmake config.h @ONLY) -configure_file(zm.conf.in zm.conf @ONLY) -configure_file(zmconfgen.pl.in zmconfgen.pl @ONLY) -configure_file(zmlinkcontent.sh.in zmlinkcontent.sh @ONLY) +configure_file(zm.conf.in "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" @ONLY) +configure_file(zoneminder-config.cmake "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) +configure_file(zmconfgen.pl.in "${CMAKE_CURRENT_BINARY_DIR}/zmconfgen.pl" @ONLY) +configure_file(zmlinkcontent.sh.in "${CMAKE_CURRENT_BINARY_DIR}/zmlinkcontent.sh" @ONLY) # Process subdirectories add_subdirectory(src) @@ -472,7 +471,7 @@ else(zmconfgen_result EQUAL 0) endif(zmconfgen_result EQUAL 0) # Install zm.conf -install(FILES zm.conf DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}") # Uninstall target configure_file( diff --git a/configure.ac b/configure.ac index 69c467612..14637fe9d 100644 --- a/configure.ac +++ b/configure.ac @@ -6,10 +6,7 @@ AC_CONFIG_HEADERS(config.h) AC_SUBST([AM_CXXFLAGS], [-D__STDC_CONSTANT_MACROS]) -PATH_BUILD=`pwd` -AC_SUBST(PATH_BUILD) -TIME_BUILD=`date +'%s'` -AC_SUBST(TIME_BUILD) +AC_SUBST(VERSION) AC_ARG_VAR(ZM_DB_TYPE,[Type of the ZoneMinder database, default mysql]) AC_ARG_VAR(ZM_DB_HOST,[Hostname where ZoneMinder database located, default localhost]) @@ -181,22 +178,6 @@ if test "$ENABLE_DEBUG" != "yes"; then AC_DEFINE(ZM_DBG_OFF,1,"Whether debug is switched off and compiled out") fi -ENABLE_CRASHTRACE=yes -AC_ARG_ENABLE(crashtrace, - [ --enable-crashtrace= enable or disabled crash tracing, default enabled], - [ENABLE_CRASHTRACE=$enable_crashtrace], - AC_MSG_WARN([You can call configure with the --enable-crashtrace= or --disable-crashtrace option. - This tells configure whether to compile ZoneMinder with crash tracing included. This allows a - dump of the stack trace when a ZoneMinder binary crashes or is killed by an unexpected signal. - Although this should work on most systems it does rely on un(or loosely) documented features and - so should be regarded as experimental. If you experience problems compiling zm_signal.cpp or - ZoneMinder binaries fail to shut down correctly then you should probably disable this feature. - e.g. --enable-crashtrace=yes or --disable-crashtrace]) -) -if test "$ENABLE_CRASHTRACE" != "yes"; then - AC_DEFINE(ZM_NO_CRASHTRACE,1,"Whether crash tracing is switched off and compiled out") -fi - ENABLE_MMAP=yes AC_ARG_ENABLE(mmap, [ --enable-mmap= enable or disabled mapped memory versus shared memory, default mapped], diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt index 41481a250..e1b551b1c 100644 --- a/db/CMakeLists.txt +++ b/db/CMakeLists.txt @@ -3,9 +3,11 @@ # Create files from the .in files configure_file(zm_create.sql.in "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" @ONLY) -# Glob all files matching zm*.sql (to exclude *.in files and autotools's files) -file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm*.sql") +# Glob all database upgrade scripts +file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm_update-*.sql") -# Install the database scripts, exclude makefiles and cmake stuff +# Install the database upgrade scripts install(FILES ${dbfileslist} DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") +# install zm_create.sql +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm_create.sql" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db") diff --git a/distros/fedora/zoneminder.service b/distros/fedora/zoneminder.service index d59fc6796..fdd9b3af2 100644 --- a/distros/fedora/zoneminder.service +++ b/distros/fedora/zoneminder.service @@ -1,5 +1,6 @@ [Unit] Description=Video security and surveillance system +After=mysqld.service [Service] Type=forking diff --git a/distros/ubuntu1204/control b/distros/ubuntu1204/control index 06bc6801e..39503027e 100644 --- a/distros/ubuntu1204/control +++ b/distros/ubuntu1204/control @@ -2,13 +2,31 @@ Source: zoneminder Section: net Priority: optional Maintainer: Isaac Connor -Build-Depends: debhelper (>= 5), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf +Build-Depends: debhelper (>= 7.0.50), autoconf, automake, dpatch, libphp-serialization-perl, libgnutls-dev, libmysqlclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libpcre3, libarchive-zip-perl, libmime-lite-perl, libjpeg8, dh-autoreconf Standards-Version: 3.9.2 Package: zoneminder Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5, php5, php5-mysql, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-lite-perl, mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice53, libjpeg8, zip, libnet-sftp-foreign-perl -Description: Linux video camera security and surveillance solution +Description: A video camera security and surveillance solution + ZoneMinder is intended for use in single or multi-camera video security + applications, including commercial or home CCTV, theft prevention and child + or family member or home monitoring and other care scenarios. It + supports capture, analysis, recording, and monitoring of video data coming + from one or more video or network cameras attached to a Linux system. + ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom + cameras using a variety of protocols. It is suitable for use as a home + video security system and for commercial or professional video security + and surveillance. It can also be integrated into a home automation system + via X.10 or other protocols. + +Package: zoneminder-dbg +Architecture: any +Depends: + zoneminder (= ${binary:Version}), + ${misc:Depends} +Description: debugging syumbols for zoneminder. + ZoneMinder is a video camera security and surveillance solution. ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child or family member or home monitoring and other care scenarios. It diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index 601dcf62a..3dea63174 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -71,3 +71,7 @@ override_dh_fixperms: override_dh_auto_test: # do not run tests... + +.PHONY: override_dh_strip +override_dh_strip: + dh_strip --dbg-package=zoneminder-dbg diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt index 830e70ace..c1dbcabb9 100644 --- a/misc/CMakeLists.txt +++ b/misc/CMakeLists.txt @@ -5,6 +5,6 @@ configure_file(apache.conf.in "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" @ONLY) configure_file(logrotate.conf.in "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" @ONLY) configure_file(syslog.conf.in "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" @ONLY) -# Install the misc files -install(FILES apache.conf logrotate.conf syslog.conf DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc") +# Do not install the misc files by default +#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apache.conf" "${CMAKE_CURRENT_BINARY_DIR}/logrotate.conf" "${CMAKE_CURRENT_BINARY_DIR}/syslog.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 2409c7681..d78a4e56b 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -23,7 +23,7 @@ configure_file(zm.in "${CMAKE_CURRENT_BINARY_DIR}/zm" @ONLY) #configure_file(zmeventdump.in zmeventdump @ONLY) # Install the perl scripts -install(FILES zmaudit.pl zmcontrol.pl zmdc.pl zmfilter.pl zmpkg.pl zmtrack.pl zmtrigger.pl zmupdate.pl zmvideo.pl zmwatch.pl DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zmaudit.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmcontrol.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmdc.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmfilter.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmpkg.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmtrack.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmtrigger.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmupdate.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmvideo.pl" "${CMAKE_CURRENT_BINARY_DIR}/zmwatch.pl" DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) if(NOT ZM_NO_X10) -install(FILES zmx10.pl DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zmx10.pl" DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif(NOT ZM_NO_X10) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in index 37119f725..3f10e9137 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Base.pm.in @@ -32,6 +32,8 @@ require Exporter; our @ISA = qw(Exporter); +use constant ZM_VERSION => "@VERSION@"; + # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @@ -39,7 +41,7 @@ our @ISA = qw(Exporter); # This allows declaration use ZoneMinder ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw() ] ); +our %EXPORT_TAGS = ( 'all' => [ qw(ZM_VERSION) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in index fbd9ea374..a840db080 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/Config.pm.in @@ -78,7 +78,11 @@ BEGIN { next if ( $str =~ /^\s*$/ ); next if ( $str =~ /^\s*#/ ); - my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.+?)\s*$/; + my ( $name, $value ) = $str =~ /^\s*([^=\s]+)\s*=\s*(.*?)\s*$/; + if ( ! $name ) { + print( STDERR "Warning, bad line in $config_file: $str\n" ); + next; + } # end if $name =~ tr/a-z/A-Z/; *{$name} = sub { $value }; push( @EXPORT_CONFIG, $name ); diff --git a/scripts/zmdbbackup.in b/scripts/zmdbbackup.in index 303cf86be..37879b5f1 100644 --- a/scripts/zmdbbackup.in +++ b/scripts/zmdbbackup.in @@ -20,6 +20,8 @@ # Edit these to suit your configuration ZM_CONFIG=@ZM_CONFIG@ source $ZM_CONFIG +# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it. +ZM_VERSION=@VERSION@ MYSQLDUMP=/usr/bin/mysqldump BACKUP_PATH=/var/lib/zm diff --git a/scripts/zmeventdump.in b/scripts/zmeventdump.in index 342b665b0..fad82db37 100644 --- a/scripts/zmeventdump.in +++ b/scripts/zmeventdump.in @@ -23,6 +23,8 @@ # Edit these to suit your configuration ZM_CONFIG=@ZM_CONFIG@ +# ZM_VERSION in the config is now deprecated but will likely still exist in people's config files. This will override it. +ZM_VERSION=@VERSION@ MYSQLDUMP=/usr/bin/mysqldump # The rest should not need editing diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 18b93c57b..f60d6e9d0 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -3000,23 +3000,23 @@ __attribute__((noinline,__target__("sse2"))) void sse2_fastblend(const uint8_t* // 1.5625% blending divider = 6; clearmask = 0x03030303; - } else if(blendpercent >= 2.34375 && blendpercent < 4.6875) { + } else if(blendpercent < 4.6875) { // 3.125% blending divider = 5; clearmask = 0x07070707; - } else if(blendpercent >= 4.6875 && blendpercent < 9.375) { + } else if(blendpercent < 9.375) { // 6.25% blending divider = 4; clearmask = 0x0F0F0F0F; - } else if(blendpercent >= 9.375 && blendpercent < 18.75) { + } else if(blendpercent < 18.75) { // 12.5% blending divider = 3; clearmask = 0x1F1F1F1F; - } else if(blendpercent >= 18.75 && blendpercent < 37.5) { + } else if(blendpercent < 37.5) { // 25% blending divider = 2; clearmask = 0x3F3F3F3F; - } else if(blendpercent >= 37.5) { + } else { // 50% blending divider = 1; clearmask = 0x7F7F7F7F; @@ -3063,19 +3063,19 @@ __attribute__((noinline)) void std_fastblend(const uint8_t* col1, const uint8_t* if(blendpercent < 2.34375) { // 1.5625% blending divider = 6; - } else if(blendpercent >= 2.34375 && blendpercent < 4.6875) { + } else if(blendpercent < 4.6875) { // 3.125% blending divider = 5; - } else if(blendpercent >= 4.6875 && blendpercent < 9.375) { + } else if(blendpercent < 9.375) { // 6.25% blending divider = 4; - } else if(blendpercent >= 9.375 && blendpercent < 18.75) { + } else if(blendpercent < 18.75) { // 12.5% blending divider = 3; - } else if(blendpercent >= 18.75 && blendpercent < 37.5) { + } else if(blendpercent < 37.5) { // 25% blending divider = 2; - } else if(blendpercent >= 37.5) { + } else { // 50% blending divider = 1; } diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 59c6f53e0..80cdca430 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -1086,7 +1086,7 @@ int RemoteCameraHttp::PreCapture() int RemoteCameraHttp::Capture( Image &image ) { - unsigned int content_length = GetResponse(); + int content_length = GetResponse(); if ( content_length == 0 ) { Warning( "Unable to capture image, retrying" ); @@ -1112,7 +1112,7 @@ int RemoteCameraHttp::Capture( Image &image ) } case X_RGB : { - if ( content_length != image.Size() ) + if ( (unsigned int)content_length != image.Size() ) { Error( "Image length mismatch, expected %d bytes, content length was %d", image.Size(), content_length ); Disconnect(); diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index 51853a0b9..f1418e4e5 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -956,12 +956,16 @@ int Zone::Load( Monitor *monitor, Zone **&zones ) Debug( 5, "Parsing polygon %s", Coords ); Polygon polygon; - if ( !ParsePolygonString( Coords, polygon ) ) - Panic( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s", Coords, Id, Name, monitor->Name() ); + if ( !ParsePolygonString( Coords, polygon ) ) { + Error( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s, ignoring", Coords, Id, Name, monitor->Name() ); + continue; + } if ( polygon.LoX() < 0 || polygon.HiX() >= (int)monitor->Width() - || polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) - Panic( "Zone %d/%s for monitor %s extends outside of image dimensions, %d, %d, %d, %d", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() ); + || polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) { + Error( "Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), ignoring", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() ); + continue; + } if ( false && !strcmp( Units, "Percent" ) ) { diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt index b547df708..b122bea4e 100644 --- a/web/CMakeLists.txt +++ b/web/CMakeLists.txt @@ -7,5 +7,6 @@ add_subdirectory(tools/mootools) configure_file(includes/config.php.in "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" @ONLY) # Install the web files -install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE) +install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE PATTERN "*cmake*" EXCLUDE REGEX "includes/config.php$" EXCLUDE) install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/includes/config.php" DESTINATION "${ZM_WEBDIR}/includes") diff --git a/web/includes/config.php.in b/web/includes/config.php.in index 573bc6881..c3281d1d9 100644 --- a/web/includes/config.php.in +++ b/web/includes/config.php.in @@ -22,6 +22,8 @@ // This section contains options substituted by the zmconfig.pl utility, do not edit these directly // define( "ZM_CONFIG", "@ZM_CONFIG@" ); // Path to config file +// Define, and override any given in config file +define( "ZM_VERSION", "@VERSION@" ); // Version $configFile = ZM_CONFIG; $localConfigFile = basename($configFile); diff --git a/web/skins/classic/views/css/zone.css b/web/skins/classic/views/css/zone.css index 554255a74..2f6754275 100644 --- a/web/skins/classic/views/css/zone.css +++ b/web/skins/classic/views/css/zone.css @@ -33,9 +33,13 @@ position: relative; } +/* NB: The size of the imageFrame determines the area within which the markers + * may be moved. When adjusting the padding and margins of the imageFrame and + * the DIVs within it, test that the markers behave sensibly when dragged to + * the extreme edges of the imageFrame. */ #imageFrame { position: relative; - padding: 0 6px 6px 0; /* Double margin of points below */ + padding: 0 3px 3px 0; /* Compensate for negative margins in the markers just below. */ } #imageFrame div { diff --git a/web/skins/classic/views/js/zone.js b/web/skins/classic/views/js/zone.js index ed2024e26..7f6824127 100644 --- a/web/skins/classic/views/js/zone.js +++ b/web/skins/classic/views/js/zone.js @@ -255,30 +255,13 @@ function applyZoneUnits() function limitRange( field, minValue, maxValue ) { - if ( parseInt(field.value) < parseInt(minValue) ) - { - field.value = minValue; - } - else if ( parseInt(field.value) > parseInt(maxValue) ) - { - field.value = maxValue; - } + field.value = constrainValue( parseInt(field.value), parseInt(minValue), parseInt(maxValue) ); } function limitFilter( field ) { - var minValue = 3; - var maxValue = 15; - field.value = (Math.floor((field.value-1)/2)*2) + 1; - if ( parseInt(field.value) < minValue ) - { - field.value = minValue; - } - if ( parseInt(field.value) > maxValue ) - { - field.value = maxValue; - } + field.value = constrainValue(parseInt(field.value), 3, 15); } function limitArea( field ) @@ -352,11 +335,22 @@ function fixActivePoint( index ) updateZoneImage(); } +function constrainValue( value, loVal, hiVal ) +{ + if ( value < loVal ) { + return loVal; + } + if ( value > hiVal ) { + return hiVal; + } + return value; +} + function updateActivePoint( index ) { var point = $('point'+index); - var x = point.getStyle( 'left' ).toInt(); - var y = point.getStyle( 'top' ).toInt(); + var x = constrainValue( point.getStyle( 'left' ).toInt(), 0, maxX ); + var y = constrainValue( point.getStyle( 'top' ).toInt(), 0, maxY ); $('newZone[Points]['+index+'][x]').value = x; $('newZone[Points]['+index+'][y]').value = y; @@ -387,10 +381,7 @@ function delPoint( index ) function limitPointValue( point, loVal, hiVal ) { - if ( point.value < loVal ) - point.value = 0; - else if ( point.value > hiVal ) - point.value = hiVal; + point.value = constrainValue(point.value, loVal, hiVal) } function updateX( index ) diff --git a/zm.conf.in b/zm.conf.in index c3b836501..37d654441 100644 --- a/zm.conf.in +++ b/zm.conf.in @@ -9,18 +9,9 @@ # or installations. # -# Current version of ZoneMinder -ZM_VERSION=@VERSION@ - -# Path to build directory -ZM_PATH_BUILD=@PATH_BUILD@ - # Path to installed data directory, used mostly for finding DB upgrade scripts ZM_PATH_DATA=@PKGDATADIR@ -# Build time, used to record when to trigger various checks -ZM_TIME_BUILD=@TIME_BUILD@ - # Path to ZoneMinder binaries ZM_PATH_BIN=@BINDIR@