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

This commit is contained in:
Isaac Connor 2017-05-26 22:20:50 -04:00
commit 2e673e49c8
22 changed files with 1149 additions and 1273 deletions

View File

@ -1,20 +1,7 @@
ZoneMinder H264 Patch
ZoneMinder
==========
[![Build Status](https://travis-ci.org/ZoneMinder/ZoneMinder.png?branch=feature-h264-videostorage)](https://travis-ci.org/ZoneMinder/ZoneMinder) [![Bountysource](https://api.bountysource.com/badge/team?team_id=204&style=bounties_received)](https://www.bountysource.com/teams/zoneminder/issues?utm_source=ZoneMinder&utm_medium=shield&utm_campaign=bounties_received)
##Feature-h264-videostorage Branch Details
This branch supports direct recording of h264 cameras into MP4 format uisng the h264 Passthrough option, but only with FFMPEG Monitors currently. It also provides h264 encoding for any other monitor type. If you encounter any issues, please open an issue on GitHub and attach it to the h264 milestone. But do remember this is bleeding edge so it will have problems.
Thanks to @chriswiggins and @mastertheknife for their work, @SteveGilvarry is now maintaining this branch and welcomes any assistance.
**The following SQL changes are required, these will be merged to zmupdate once we are ready to merge this branch to master.**
```
ALTER TABLE `Monitors` ADD `SaveJPEGs` TINYINT NOT NULL DEFAULT '3' AFTER `Deinterlacing` ,
ADD `VideoWriter` TINYINT NOT NULL DEFAULT '0' AFTER `SaveJPEGs` ,
ADD `EncoderParameters` TEXT NOT NULL AFTER `VideoWriter` ,
ADD `RecordAudio` TINYINT NOT NULL DEFAULT '0' AFTER `EncoderParameters` ;
ALTER TABLE `Events` ADD `DefaultVideo` VARCHAR( 64 ) NOT NULL AFTER `AlarmFrames` ;
```
[![Build Status](https://travis-ci.org/ZoneMinder/ZoneMinder.png)](https://travis-ci.org/ZoneMinder/ZoneMinder) [![Bountysource](https://api.bountysource.com/badge/team?team_id=204&style=bounties_received)](https://www.bountysource.com/teams/zoneminder/issues?utm_source=ZoneMinder&utm_medium=shield&utm_campaign=bounties_received)
All documentation for ZoneMinder is now online at https://zoneminder.readthedocs.org

View File

@ -354,7 +354,7 @@ CREATE TABLE `Monitors` (
`Deinterlacing` int(10) unsigned NOT NULL default '0',
`SaveJPEGs` TINYINT NOT NULL DEFAULT '3' ,
`VideoWriter` TINYINT NOT NULL DEFAULT '0',
`EncoderParameters` TEXT NOT NULL,
`EncoderParameters` TEXT,
`RecordAudio` TINYINT NOT NULL DEFAULT '0',
`RTSPDescribe` tinyint(1) unsigned,
`Brightness` mediumint(7) NOT NULL default '-1',

View File

@ -71,3 +71,27 @@ SET @s = (SELECT IF(
PREPARE stmt FROM @s;
EXECUTE stmt;
--
-- The following alters various columns to allow NULLs
--
ALTER TABLE Monitors MODIFY Host varchar(64);
ALTER TABLE Monitors MODIFY LabelFormat varchar(64);
ALTER TABLE Monitors MODIFY LinkedMonitors varchar(255);
ALTER TABLE Monitors MODIFY Options varchar(255);
ALTER TABLE Monitors MODIFY Protocol varchar(16);
ALTER TABLE Monitors MODIFY User varchar(64);
ALTER TABLE Monitors MODIFY Pass varchar(64);
ALTER TABLE Monitors MODIFY RTSPDescribe tinyint(1) unsigned;
ALTER TABLE Monitors MODIFY ControlId int(10) unsigned;
ALTER TABLE Monitors MODIFY TrackDelay smallint(5) unsigned;
ALTER TABLE Monitors MODIFY ReturnDelay smallint(5) unsigned;
ALTER TABLE Monitors MODIFY EncoderParameters TEXT;
ALTER TABLE Monitors MODIFY Path varchar(255);
ALTER TABLE Monitors MODIFY V4LMultiBuffer tinyint(1) unsigned;
ALTER TABLE Users MODIFY MonitorIds tinytext;
ALTER TABLE Users MODIFY Language varchar(8);
ALTER TABLE Users MODIFY MaxBandwidth varchar(16);

View File

@ -1,20 +1,20 @@
Alias /zm /usr/share/zoneminder/www
<IfModule mod_fcgid.c>
<Directory /usr/share/zoneminder/www>
Options -Indexes +ExecCGI
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /usr/bin/php5-cgi
Order allow,deny
Allow from all
</Directory>
<Directory /usr/share/zoneminder/www>
Options -Indexes +ExecCGI
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /usr/bin/php5-cgi
Order allow,deny
Allow from all
</Directory>
</IfModule>
<IfModule mod_php5.c>
<Directory /usr/share/zoneminder/www>
Options -Indexes +FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>
<Directory /usr/share/zoneminder/www>
Options -Indexes +FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>
</IfModule>

View File

@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 9), cmake
, libphp-serialization-perl
, libgnutls28-dev | libgnutls-dev
, libmysqlclient-dev | libmariadbclient-dev
, libjpeg-dev
, libjpeg8-dev | libjpeg-dev
, libpcre3-dev
, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev
, libavdevice-dev

View File

@ -29,7 +29,7 @@ override_dh_auto_install:
install -D -m 0644 debian/apache.conf $(INSTDIR)/etc/zm/apache.conf
rm -f $(INSTDIR)/usr/share/zoneminder/www/api/lib/Cake/LICENSE.txt
rm -f $(INSTDIR)/usr/share/zoneminder/www/api/.gitignore
rm -rf $(INSTDIR)/usr/share/zoneminder/www/api/lib/Cake/Test
rm -rf $(INSTDIR)/usr/share/zoneminder/www/api/lib/Cake/Test
override_dh_auto_test:
# do not run tests...

View File

@ -5,10 +5,19 @@ Maintainer: Dmitry Smirnov <onlyjob@debian.org>
Uploaders: Vagrant Cascadian <vagrant@debian.org>
Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apache2-dev, dh-linktree
,cmake
<<<<<<< HEAD
,libx264-dev, libmp4v2-dev
,libavcodec-dev, libavformat-dev, libswscale-dev
,libavutil-dev, libavdevice-dev, libavresample-dev
,libboost-dev
=======
,libboost-dev
,libavdevice-dev (>= 6:10~)
,libavcodec-dev (>= 6:10~)
,libavformat-dev (>= 6:10~)
,libavutil-dev (>= 6:10~)
,libswscale-dev (>= 6:10~)
>>>>>>> dragndrop_monitor_sorting
,libbz2-dev
,libgcrypt-dev
,libcurl4-gnutls-dev

View File

@ -1,83 +0,0 @@
AUTOMAKE_OPTIONS = gnu
# Ack! Nasty hack to get modules Makefile regenerated if wiped with make clean
all-local: ZoneMinder/Makefile
ZoneMinder/Makefile: ZoneMinder/Makefile.PL
( cd ZoneMinder; perl Makefile.PL )
bin_SCRIPTS = \
zmdc.pl \
zmaudit.pl \
zmfilter.pl \
zmtrigger.pl \
zmx10.pl \
zmwatch.pl \
zmpkg.pl \
zmupdate.pl \
zmvideo.pl \
zmcontrol.pl \
zmtrack.pl \
zmcamtool.pl \
zmsystemctl.pl \
zmtelemetry.pl
SUBDIRS = \
. \
ZoneMinder
EXTRA_DIST = \
zmdc.pl.in \
zmaudit.pl.in \
zmfilter.pl.in \
zmtrigger.pl.in \
zmx10.pl.in \
zmwatch.pl.in \
zmpkg.pl.in \
zmupdate.pl.in \
zmvideo.pl.in \
zmcontrol.pl.in \
zmtrack.pl.in \
zmcamtool.pl.in \
zmsystemctl.pl.in \
zmtelemtry.pl.in \
ZoneMinder/Makefile.PL \
ZoneMinder/README \
ZoneMinder/Changes \
ZoneMinder/META.yml \
ZoneMinder/MANIFEST \
ZoneMinder/t/ZoneMinder.t \
ZoneMinder/lib/ZoneMinder.pm \
ZoneMinder/lib/ZoneMinder/Base.pm.in \
ZoneMinder/lib/ZoneMinder/Config.pm.in \
ZoneMinder/lib/ZoneMinder/Event.pm \
ZoneMinder/lib/ZoneMinder/Filter.pm \
ZoneMinder/lib/ZoneMinder/Monitor.pm \
ZoneMinder/lib/ZoneMinder/Object.pm \
ZoneMinder/lib/ZoneMinder/Server.pm \
ZoneMinder/lib/ZoneMinder/Storage.pm \
ZoneMinder/lib/ZoneMinder/Logger.pm \
ZoneMinder/lib/ZoneMinder/General.pm \
ZoneMinder/lib/ZoneMinder/Database.pm \
ZoneMinder/lib/ZoneMinder/Memory.pm.in \
ZoneMinder/lib/ZoneMinder/Memory/Shared.pm \
ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm \
ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm \
ZoneMinder/lib/ZoneMinder/ConfigData.pm.in \
ZoneMinder/lib/ZoneMinder/Control.pm \
ZoneMinder/lib/ZoneMinder/Control \
ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Handle.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Spawning.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Inet.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Unix.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/File.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Connection.pm \
ZoneMinder/lib/ZoneMinder/Trigger/Connection/Example.pm \
zm.in \
zmdbbackup.in \
zmdbrestore.in \
zmeventdump.in \
zmlogrotate.conf.in

View File

@ -187,7 +187,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
snprintf( video_file, sizeof(video_file), video_file_format, path, video_name );
/* X264 MP4 video writer */
if(monitor->GetOptVideoWriter() == 1) {
if ( monitor->GetOptVideoWriter() == Monitor::X264ENCODE ) {
#if ZM_HAVE_VIDEOWRITER_X264MP4
videowriter = new X264MP4Writer(video_file, monitor->Width(), monitor->Height(), monitor->Colours(), monitor->SubpixelOrder(), monitor->GetOptEncoderParams());
#else
@ -195,8 +195,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
#endif
}
if(videowriter != NULL) {
if ( videowriter != NULL ) {
/* Open the video stream */
int nRet = videowriter->Open();
if(nRet != 0) {
@ -207,9 +206,10 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
snprintf( timecodes_name, sizeof(timecodes_name), "%d-%s", id, "video.timecodes" );
snprintf( timecodes_file, sizeof(timecodes_file), video_file_format, path, timecodes_name );
/* Create timecodes file */
timecodes_fd = fopen(timecodes_file, "wb");
if(timecodes_fd == NULL) {
if ( timecodes_fd == NULL ) {
Error("Failed creating timecodes file");
}
}
@ -353,12 +353,12 @@ void Event::updateNotes( const StringSetMap &newNoteSetMap ) {
noteSet.insert( newNote );
update = true;
}
}
}
}
} // end for
} // end if ( noteSetMap.size() == 0
} // end if newNoteSetupMap.size() > 0
} // end for
} // end if ( noteSetMap.size() == 0
} // end if newNoteSetupMap.size() > 0
} // end foreach newNoteSetMap
} // end if have old notes
} // end if have new notes
if ( update ) {
std::string notes;

View File

@ -61,7 +61,6 @@
#define MAP_LOCKED 0
#endif
//=============================================================================
std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> elems;
std::stringstream ss(s);
@ -71,7 +70,6 @@ std::vector<std::string> split(const std::string &s, char delim) {
}
return elems;
}
//=============================================================================
Monitor::MonitorLink::MonitorLink( int p_id, const char *p_name ) : id( p_id ) {
strncpy( name, p_name, sizeof(name) );
@ -1228,7 +1226,7 @@ bool Monitor::Analyse() {
}
shared_data->action &= ~RESUME;
}
} // end ifshared_data->action
} // end if shared_data->action
if ( auto_resume_time && (now.tv_sec >= auto_resume_time) ) {
Info( "Auto resuming at count %d", image_count );

View File

@ -163,7 +163,7 @@ protected:
typedef struct {
uint32_t size;
char event_file[4096];
timeval recording; // used as both bool and a pointer to the timestamp when recording should begin
timeval recording; // used as both bool and a pointer to the timestamp when recording should begin
//uint32_t frameNumber;
} VideoStoreData;
@ -222,19 +222,19 @@ protected:
protected:
// These are read from the DB and thereafter remain unchanged
unsigned int id;
char name[64];
unsigned int server_id; // Id of the Server object
unsigned int storage_id; // Id of the Storage Object, which currently will just provide a path, but in future may do more.
Function function; // What the monitor is doing
bool enabled; // Whether the monitor is enabled or asleep
unsigned int width; // Normally the same as the camera, but not if partly rotated
unsigned int height; // Normally the same as the camera, but not if partly rotated
bool v4l_multi_buffer;
unsigned int v4l_captures_per_frame;
Orientation orientation; // Whether the image has to be rotated at all
unsigned int deinterlacing;
bool videoRecording;
unsigned int id;
char name[64];
unsigned int server_id; // Id of the Server object
unsigned int storage_id; // Id of the Storage Object, which currently will just provide a path, but in future may do more.
Function function; // What the monitor is doing
bool enabled; // Whether the monitor is enabled or asleep
unsigned int width; // Normally the same as the camera, but not if partly rotated
unsigned int height; // Normally the same as the camera, but not if partly rotated
bool v4l_multi_buffer;
unsigned int v4l_captures_per_frame;
Orientation orientation; // Whether the image has to be rotated at all
unsigned int deinterlacing;
bool videoRecording;
int savejpegspref;
VideoWriter videowriter;

View File

@ -48,18 +48,16 @@ RemoteCamera::RemoteCamera(
path = '/'+path;
}
RemoteCamera::~RemoteCamera()
{
if(hp != NULL) {
freeaddrinfo(hp);
hp = NULL;
}
RemoteCamera::~RemoteCamera() {
if ( hp != NULL ) {
freeaddrinfo(hp);
hp = NULL;
}
}
void RemoteCamera::Initialise()
{
if( protocol.empty() )
Fatal( "No protocol specified for remote camera" );
void RemoteCamera::Initialise() {
if( protocol.empty() )
Fatal( "No protocol specified for remote camera" );
if( host.empty() )
Fatal( "No host specified for remote camera" );
@ -71,21 +69,19 @@ void RemoteCamera::Initialise()
//Fatal( "No path specified for remote camera" );
// Cache as much as we can to speed things up
std::string::size_type authIndex = host.rfind( '@' );
std::string::size_type authIndex = host.rfind( '@' );
if ( authIndex != std::string::npos )
{
auth = host.substr( 0, authIndex );
host.erase( 0, authIndex+1 );
auth64 = base64Encode( auth );
if ( authIndex != std::string::npos ) {
auth = host.substr( 0, authIndex );
host.erase( 0, authIndex+1 );
auth64 = base64Encode( auth );
authIndex = auth.rfind( ':' );
username = auth.substr(0,authIndex);
password = auth.substr( authIndex+1, auth.length() );
authIndex = auth.rfind( ':' );
username = auth.substr(0,authIndex);
password = auth.substr( authIndex+1, auth.length() );
}
}
mNeedAuth = false;
mNeedAuth = false;
mAuthenticator = new zm::Authenticator(username,password);
struct addrinfo hints;
@ -93,10 +89,8 @@ void RemoteCamera::Initialise()
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
int ret = getaddrinfo(host.c_str(), port.c_str(), &hints, &hp);
if ( ret != 0 )
{
Fatal( "Can't getaddrinfo(%s port %s): %s", host.c_str(), port.c_str(), gai_strerror(ret) );
}
int ret = getaddrinfo(host.c_str(), port.c_str(), &hints, &hp);
if ( ret != 0 ) {
Fatal( "Can't getaddrinfo(%s port %s): %s", host.c_str(), port.c_str(), gai_strerror(ret) );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -94,7 +94,10 @@ class ImageComponent extends Component {
// Take the StartTime of an Event and return
// the path to its location on the filesystem
public function getEventPath( $event ) {
return $event['Event']['MonitorId'].'/'.strftime( "%y/%m/%d/%H/%M/%S", strtotime($event['Event']['StartTime']) );
}
if ( $config['ZM_USE_DEEP_STORAGE'] == 1 )
return $event['Event']['MonitorId'].'/'.strftime( "%y/%m/%d/%H/%M/%S", strtotime($event['Event']['StartTime']) );
else
return $event['Event']['MonitorId'].'/'.$event['Event']['Id'];
}
}
?>

View File

@ -1,9 +0,0 @@
AUTOMAKE_OPTIONS = gnu
webdir = @WEB_PREFIX@/css
dist_web_DATA = \
bootstrap.min.css \
reset.css \
spinner.css \
overlay.css

View File

@ -61,12 +61,8 @@
text-align: left;
}
#consoleTable .colOrder {
text-align: center;
}
#consoleTable .colMark {
width: 32px;
width: 62px;
text-align: center;
}
@ -85,13 +81,3 @@
#consoleTable .colLeftButtons input {
margin-right: 24px;
}
#consoleTable .colRightButtons {
text-align: right;
padding-right: 8px;
}
#consoleTable .colRightButtons input {
margin: 0 8px;
}

View File

@ -61,12 +61,8 @@
text-align: left;
}
#consoleTable .colOrder {
text-align: center;
}
#consoleTable .colMark {
width: 32px;
width: 62px;
text-align: center;
}
@ -85,13 +81,3 @@
#consoleTable .colLeftButtons input {
margin-right: 24px;
}
#consoleTable .colRightButtons {
text-align: right;
padding-right: 8px;
}
#consoleTable .colRightButtons input {
margin: 0 8px;
}

View File

@ -61,12 +61,8 @@
text-align: left;
}
#consoleTable .colOrder {
text-align: center;
}
#consoleTable .colMark {
width: 32px;
width: 62px;
text-align: center;
}
@ -85,12 +81,3 @@
#consoleTable .colLeftButtons input {
margin-right: 24px;
}
#consoleTable .colRightButtons {
text-align: right;
padding-right: 8px;
}
#consoleTable .colRightButtons input {
margin: 0 8px;
}

View File

@ -74,8 +74,6 @@ function xhtmlHeaders( $file, $title ) {
<script type="text/javascript" src="tools/mootools/mootools-core.js"></script>
<script type="text/javascript" src="tools/mootools/mootools-more.js"></script>
<script type="text/javascript" src="js/mootools.ext.js"></script>
<?php if ( !in_array($basename, $bad_views) ) { ?>
<!--<script type="text/javascript" src="js/overlay.js"></script>-->
<script type="text/javascript" src="skins/<?php echo $skin; ?>/js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="skins/<?php echo $skin; ?>/js/jquery-ui-1.11.3.js"></script>
<script type="text/javascript" src="skins/<?php echo $skin; ?>/js/bootstrap.min.js"></script>
@ -90,7 +88,6 @@ var $j = jQuery.noConflict();
//]]>
</script>
<script type="text/javascript" src="skins/<?php echo $skin; ?>/views/js/state.js"></script>
<?php } ?>
<?php if ( $title == 'Login' && (defined('ZM_OPT_USE_GOOG_RECAPTCHA') && ZM_OPT_USE_GOOG_RECAPTCHA) ) { ?>
<script src='https://www.google.com/recaptcha/api.js'></script>
<?php } else if ( $title == 'Event' ) {
@ -100,7 +97,7 @@ var $j = jQuery.noConflict();
<script src="./js/videojs.zoomrotate.js"></script>
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
<?php }
if ( $skinJsPhpFile ) {
if ( $skinJsPhpFile ) {
?>
<script type="text/javascript">
//<![CDATA[

View File

@ -83,6 +83,7 @@ $eventCounts = array(
$displayMonitors = NULL;
<<<<<<< HEAD
# Also populates displayMonitors
$navbar = getNavBarHTML();
$zoneCount = 0;
@ -107,12 +108,76 @@ for( $i = 0; $i < count($displayMonitors); $i += 1 ) {
$eventCounts[$j]['total'] += $monitor['EventCount'.$j];
}
$zoneCount += $monitor['ZoneCount'];
=======
$group = NULL;
if ( ! empty($_COOKIE['zmGroup']) ) {
if ( $group = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_COOKIE['zmGroup'])) )
$groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
}
noCacheHeaders();
$maxWidth = 0;
$maxHeight = 0;
$cycleCount = 0;
$minSequence = 0;
$maxSequence = 1;
$monitors = dbFetchAll( "select * from Monitors order by Sequence asc" );
$displayMonitors = array();
for ( $i = 0; $i < count($monitors); $i++ ) {
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
continue;
}
if ( $group && !empty($groupIds) && !array_key_exists( $monitors[$i]['Id'], $groupIds ) ) {
continue;
}
$monitors[$i]['Show'] = true;
$monitors[$i]['zmc'] = zmcStatus( $monitors[$i] );
$monitors[$i]['zma'] = zmaStatus( $monitors[$i] );
$monitors[$i]['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitors[$i]['Id']) );
$counts = array();
for ( $j = 0; $j < count($eventCounts); $j++ ) {
$filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['terms']), array( "cnj" => "and", "attr" => "MonitorId", "op" => "=", "val" => $monitors[$i]['Id'] ) );
parseFilter( $filter );
$counts[] = "count(if(1".$filter['sql'].",1,NULL)) as EventCount$j";
$monitors[$i]['eventCounts'][$j]['filter'] = $filter;
}
$sql = "select ".join($counts,", ")." from Events as E where MonitorId = ?";
$counts = dbFetchOne( $sql, NULL, array($monitors[$i]['Id']) );
if ( $monitors[$i]['Function'] != 'None' ) {
$cycleCount++;
$scaleWidth = reScale( $monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
$scaleHeight = reScale( $monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
if ( $maxWidth < $scaleWidth ) $maxWidth = $scaleWidth;
if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight;
}
if ( $counts ) $monitors[$i] = array_merge( $monitors[$i], $counts );
$displayMonitors[] = $monitors[$i];
>>>>>>> dragndrop_monitor_sorting
}
noCacheHeaders();
$eventsView = ZM_WEB_EVENTS_VIEW;
$eventsWindow = 'zm'.ucfirst(ZM_WEB_EVENTS_VIEW);
<<<<<<< HEAD
=======
$eventCount = 0;
for ( $i = 0; $i < count($eventCounts); $i++ ) {
$eventCounts[$i]['total'] = 0;
}
$zoneCount = 0;
foreach( $displayMonitors as $monitor ) {
for ( $i = 0; $i < count($eventCounts); $i++ ) {
$eventCounts[$i]['total'] += $monitor['EventCount'.$i];
}
$zoneCount += $monitor['ZoneCount'];
}
$versionClass = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'errorText':'';
>>>>>>> dragndrop_monitor_sorting
$left_columns = 3;
if ( count($servers) ) $left_columns += 1;
if ( ZM_WEB_ID_ON_CONSOLE ) $left_columns += 1;
@ -124,11 +189,56 @@ xhtmlHeaders( __FILE__, translate('Console') );
<form name="monitorForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value=""/>
<<<<<<< HEAD
<?php echo $navbar ?>
<div class="container-fluid">
<table class="table table-striped table-hover table-condensed">
=======
<div id="header">
<h3 id="systemTime"><?php echo preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG ) ?></h3>
<h3 id="systemStats"><?php echo translate('Load') ?>: <?php echo getLoad() ?> - <?php echo translate('Disk') ?>: <?php echo getDiskPercent() ?>% - <?php echo ZM_PATH_MAP ?>: <?php echo getDiskPercent(ZM_PATH_MAP) ?>%</h3>
<h2 id="title"><a href="http://www.zoneminder.com" target="ZoneMinder">ZoneMinder</a> <?php echo translate('Console') ?> - <?php echo makePopupLink( '?view=state', 'zmState', 'state', $status, canEdit( 'System' ) ) ?> - <?php echo $run_state ?> <?php echo makePopupLink( '?view=version', 'zmVersion', 'version', '<span class="'.$versionClass.'">v'.ZM_VERSION.'</span>', canEdit( 'System' ) ) ?></h2>
<div class="clear"></div>
<h3 id="development"><center><?php echo ZM_WEB_CONSOLE_BANNER ?></center></h3>
<div id="monitorSummary"><?php echo makePopupLink( '?view=groups', 'zmGroups', 'groups', sprintf( $CLANG['MonitorCount'], count($displayMonitors), zmVlang( $VLANG['Monitor'], count($displayMonitors) ) ).($group?' ('.$group['Name'].')':''), canView( 'Groups' ) ); ?></div>
<?php
if ( ZM_OPT_X10 && canView( 'Devices' ) ) {
?>
<div id="devices"><?php echo makePopupLink( '?view=devices', 'zmDevices', 'devices', translate('Devices') ) ?></div>
<?php
}
if ( canView( 'System' ) ) {
?>
<div id="options"><?php echo makePopupLink( '?view=options', 'zmOptions', 'options', translate('Options') ) ?><?php if ( logToDatabase() > Logger::NOLOG ) { ?> / <?php echo makePopupLink( '?view=log', 'zmLog', 'log', '<span class="'.logState().'">'.translate('Log').'</span>' ) ?><?php } ?></div>
<?php
}
if ( canView( 'Stream' ) && $cycleCount > 1 ) {
$cycleGroup = isset($_COOKIE['zmGroup'])?$_COOKIE['zmGroup']:0;
?>
<div id="cycleMontage">
<?php echo makePopupLink( '?view=cycle&amp;group='.$cycleGroup, 'zmCycle'.$cycleGroup, array( 'cycle', $cycleWidth, $cycleHeight ), translate('Cycle'), $running ) ?>&nbsp;/&nbsp;
<?php echo makePopupLink( '?view=montage&amp;group='.$cycleGroup, 'zmMontage'.$cycleGroup, 'montage', translate('Montage'), $running ) ?>&nbsp;/&nbsp;
<?php echo makePopupLink( '?view=montagereview&amp;group='.$cycleGroup, 'zmMontage'.$cycleGroup, 'montagereview', translate('Montage Review'), $running ) ?>
</div>
<?php
} else {
?>
<?php
}
?>
<h3 id="loginBandwidth"><?php
if ( ZM_OPT_USE_AUTH ) {
?><?php echo translate('LoggedInAs') ?> <?php echo makePopupLink( '?view=logout', 'zmLogout', 'logout', $user['Username'], (ZM_AUTH_TYPE == "builtin") ) ?>, <?php echo strtolower( translate('ConfiguredFor') ) ?><?php
} else {
?><?php echo translate('ConfiguredFor') ?><?php
}
?>&nbsp;<?php echo makePopupLink( '?view=bandwidth', 'zmBandwidth', 'bandwidth', $bwArray[$_COOKIE['zmBandwidth']], ($user && $user['MaxBandwidth'] != 'low' ) ) ?> <?php echo translate('BandwidthHead') ?></h3>
</div>
<div id="content">
<table id="consoleTable" cellspacing="0">
>>>>>>> dragndrop_monitor_sorting
<thead>
<tr>
<?php if ( ZM_WEB_ID_ON_CONSOLE ) { ?>
@ -140,6 +250,7 @@ xhtmlHeaders( __FILE__, translate('Console') );
<th class="colServer"><?php echo translate('Server') ?></th>
<?php } ?>
<th class="colSource"><?php echo translate('Source') ?></th>
<<<<<<< HEAD
<?php if ( $show_storage_areas ) { ?>
<th class="colStorage"><?php echo translate('Storage') ?></th>
<?php } ?>
@ -148,6 +259,16 @@ xhtmlHeaders( __FILE__, translate('Console') );
<?php } ?>
<th class="colZones"><a href="<?php echo $_SERVER['PHP_SELF'] ?>?view=zones_overview"><?php echo translate('Zones') ?></a></th>
<?php if ( canEdit('Monitors') ) { ?>
=======
<?php
for ( $i = 0; $i < count($eventCounts); $i++ ) {
?>
<th class="colEvents"><?php echo $eventCounts[$i]['title'] ?></th>
<?php
}
?>
<th class="colZones"><?php echo translate('Zones') ?></th>
>>>>>>> dragndrop_monitor_sorting
<th class="colMark"><?php echo translate('Mark') ?></th>
<?php } ?>
</tr>
@ -155,6 +276,7 @@ xhtmlHeaders( __FILE__, translate('Console') );
<tfoot>
<tr>
<td class="colLeftButtons" colspan="<?php echo $left_columns ?>">
<<<<<<< HEAD
<input type="button" class="btn btn-primary" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
<input type="button" class="btn btn-primary" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
@ -164,42 +286,63 @@ xhtmlHeaders( __FILE__, translate('Console') );
</td>
<?php for ( $i = 0; $i < count($eventCounts); $i++ ) {
parseFilter( $eventCounts[$i]['filter'] );
=======
<input type="button" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
<?php echo makePopupButton( '?view=filter&amp;filter[terms][0][attr]=DateTime&amp;filter[terms][0][op]=%3c&amp;filter[terms][0][val]=now', 'zmFilter', 'filter', translate('Filters'), canView( 'Events' ) ) ?>
<input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/>
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteMonitor( this )" disabled="disabled"/>
</td>
<?php
for ( $i = 0; $i < count($eventCounts); $i++ ) {
parseFilter( $eventCounts[$i]['filter'] );
>>>>>>> dragndrop_monitor_sorting
?>
<td class="colEvents"><?php echo makePopupLink( '?view='.$eventsView.'&amp;page=1'.$eventCounts[$i]['filter']['query'], $eventsWindow, $eventsView, $eventCounts[$i]['total'], canView( 'Events' ) ) ?></td>
<?php
}
?>
<td class="colZones"><?php echo $zoneCount ?></td>
<<<<<<< HEAD
<?php if ( canEdit('Monitors') ) { ?>
<td class="colMark"></td>
<?php } ?>
=======
<td class="colMark"></td>
>>>>>>> dragndrop_monitor_sorting
</tr>
</tfoot>
<tbody id="consoleTableBody">
<?php
<<<<<<< HEAD
for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
$monitor = $displayMonitors[$monitor_i];
?>
<tr id="<?php echo 'monitor_id-'.$monitor['Id'] ?>" title="<?php echo $monitor['Id'] ?>">
=======
foreach( $displayMonitors as $monitor ) {
?>
<tr id="<?php echo 'monitor_id-'.$monitor['Id'] ?>">
>>>>>>> dragndrop_monitor_sorting
<?php
if ( !$monitor['zmc'] )
$dclass = "errorText";
else
{
if ( !$monitor['zmc'] ) {
$dclass = "errorText";
} else {
// https://github.com/ZoneMinder/ZoneMinder/issues/1082
if ( !$monitor['zma'] && $monitor['Function']!='Monitor' )
$dclass = "warnText";
else
$dclass = "infoText";
if ( !$monitor['zma'] && $monitor['Function']!='Monitor' )
$dclass = "warnText";
else
$dclass = "infoText";
}
if ( $monitor['Function'] == 'None' )
$fclass = "errorText";
$fclass = "errorText";
//elseif ( $monitor['Function'] == 'Monitor' )
// $fclass = "warnText";
else
$fclass = "infoText";
$fclass = "infoText";
if ( !$monitor['Enabled'] )
$fclass .= " disabledText";
$fclass .= " disabledText";
$scale = max( reScale( SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
?>
<?php if ( ZM_WEB_ID_ON_CONSOLE ) { ?>
@ -220,7 +363,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
if ( $shortpath == '' ) {
$shortpath = 'Monitor ' . $monitor['Id'];
$shortpath = 'Monitor ' . $monitor['Id'];
}
?>
<td class="colSource"><?php echo makePopupLink( '?view=monitor&amp;mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></td>
@ -262,13 +405,4 @@ if ( canEdit('System') ) {
}
?>
</body>
<script>
$j( function() {
$j( "#consoleTableBody" ).sortable({
handle: ".glyphicon-sort",
update: applySort,
axis:'Y' } );
$j( "#consoleTableBody" ).disableSelection();
} );
</script>
</html>

View File

@ -74,6 +74,15 @@ function initPage() {
createPopup( '?view=version', 'zmVersion', 'version' );
if ( showDonatePopup )
createPopup( '?view=donate', 'zmDonate', 'donate' );
// Makes table sortable
$j( function() {
$j( "#consoleTableBody" ).sortable({
handle: ".glyphicon-sort",
update: applySort,
axis:'Y' } );
$j( "#consoleTableBody" ).disableSelection();
} );
}
function applySort(event, ui) {

View File

@ -19,7 +19,6 @@
//
require_once( 'includes/Server.php');
require_once( 'includes/Storage.php');
if ( !canView( 'Monitors' ) ) {
$view = "error";
@ -29,7 +28,6 @@ if ( !canView( 'Monitors' ) ) {
$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' ) )
@ -137,7 +135,6 @@ if ( ! empty($_REQUEST['mid']) ) {
'V4LMultiBuffer' => '',
'V4LCapturesPerFrame' => 1,
'ServerId' => $Server['Id'],
'StorageId' => '0',
) );
} # end if $_REQUEST['dupID']
} # end if $_REQUEST['mid']
@ -519,7 +516,6 @@ if ( $tab != 'general' ) {
?>
<input type="hidden" name="newMonitor[Name]" value="<?php echo validHtmlStr($monitor->Name) ?>"/>
<input type="hidden" name="newMonitor[ServerId]" value="<?php echo validHtmlStr($monitor->ServerId() ) ?>"/>
<input type="hidden" name="newMonitor[StorageId]" value="<?= validHtmlStr($monitor->StorageId() ) ?>"/>
<input type="hidden" name="newMonitor[Type]" value="<?php echo validHtmlStr($monitor->Type) ?>"/>
<input type="hidden" name="newMonitor[Function]" value="<?php echo validHtmlStr($monitor->Function) ?>"/>
<input type="hidden" name="newMonitor[Enabled]" value="<?php echo validHtmlStr($monitor->Enabled) ?>"/>
@ -682,17 +678,6 @@ switch ( $tab )
$servers[$server_obj->Id()] = $server_obj->Name();
}
echo htmlSelect( "newMonitor[ServerId]", $servers, $monitor->ServerId() );
?>
</td></tr>
<tr><td><?php echo translate('StorageArea') ?></td><td>
<?php
$storage_areas = array(0=>'Default');
$result = dbQuery( 'SELECT * FROM Storage ORDER BY Name');
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Storage' );
foreach ( $results as $row => $storage_obj ) {
$storage_areas[$storage_obj->Id] = $storage_obj->Name();
}
echo htmlSelect( "newMonitor[StorageId]", $storage_areas, $monitor->StorageId() );
?>
</td></tr>
<tr><td><?php echo translate('SourceType') ?></td><td><?php echo htmlSelect( "newMonitor[Type]", $sourceTypes, $monitor->Type() ); ?></td></tr>