Merge branch 'storageareas' into zma_to_thread

This commit is contained in:
Isaac Connor 2017-12-20 15:45:42 -05:00
commit d85ce7bf43
7 changed files with 61 additions and 65 deletions

View File

@ -102,10 +102,6 @@ class EventsController extends AppController {
*/
public function view($id = null) {
$this->loadModel('Config');
$configs = $this->Config->find('list', array(
'fields' => array('Name', 'Value'),
'conditions' => array('Name' => array('ZM_DIR_EVENTS'))
));
$this->Event->recursive = 1;
if (!$this->Event->exists($id)) {
@ -123,9 +119,6 @@ class EventsController extends AppController {
$options = array('conditions' => array(array('Event.' . $this->Event->primaryKey => $id), $mon_options));
$event = $this->Event->find('first', $options);
//$path = $configs['ZM_DIR_EVENTS'].'/'.$this->Image->getEventPath($event).'/';
//$event['Event']['BasePath'] = $path;
# Get the previous and next events for any monitor
$this->Event->id = $id;
$event_neighbors = $this->Event->find('neighbors');

View File

@ -78,10 +78,10 @@ class Event extends AppModel {
'className' => 'Group',
'joinTable' => 'Groups_Monitors',
'foreignKey' => 'MonitorId',
'associationForeignKey' => 'GroupId',
'associationForeignKey' => 'MonitorId',
'unique' => true,
'dependent' => false,
'conditions' => 'Groups_Monitors.MonitorId=Event.MonitorId',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',

View File

@ -21,11 +21,11 @@
//
// 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( "ZM_CONFIG_SUBDIR", "@ZM_CONFIG_SUBDIR@" ); // Path to config subfolder
define( 'ZM_CONFIG', '@ZM_CONFIG@' ); // Path to config file
define( 'ZM_CONFIG_SUBDIR', '@ZM_CONFIG_SUBDIR@' ); // Path to config subfolder
// Define, and override any given in config file
define( "ZM_VERSION", "@VERSION@" ); // Version
define( "ZM_DIR_TEMP", "@ZM_TMPDIR@" );
define( 'ZM_VERSION', '@VERSION@' ); // Version
define( 'ZM_DIR_TEMP', '@ZM_TMPDIR@' );
$configFile = ZM_CONFIG;
$localConfigFile = basename($configFile);
@ -65,81 +65,83 @@ foreach( $configvals as $key => $value) {
//
// This section is options normally derived from other options or configuration
//
define( "ZMU_PATH", ZM_PATH_BIN."/zmu" ); // Local path to the ZoneMinder Utility
define( 'ZMU_PATH', ZM_PATH_BIN.'/zmu' ); // Local path to the ZoneMinder Utility
//
// If setup supports Video 4 Linux v2 and/or v1
//
define( "ZM_HAS_V4L2", "@ZM_HAS_V4L2@" ); // V4L2 support enabled
define( "ZM_HAS_V4L1", "@ZM_HAS_V4L1@" ); // V4L1 support enabled
define( "ZM_HAS_V4L", "@ZM_HAS_V4L@" ); // V4L support enabled
define( 'ZM_HAS_V4L2', '@ZM_HAS_V4L2@' ); // V4L2 support enabled
define( 'ZM_HAS_V4L1', '@ZM_HAS_V4L1@' ); // V4L1 support enabled
define( 'ZM_HAS_V4L', '@ZM_HAS_V4L@' ); // V4L support enabled
//
// If ONVIF support has been built in
//
define( "ZM_HAS_ONVIF", "@ZM_HAS_ONVIF@" ); // ONVIF support enabled
define( 'ZM_HAS_ONVIF', '@ZM_HAS_ONVIF@' ); // ONVIF support enabled
//
// If PCRE dev libraries are installed
//
define( "ZM_PCRE", "@ZM_PCRE@" ); // PCRE support enabled
define( 'ZM_PCRE', '@ZM_PCRE@' ); // PCRE support enabled
//
// Alarm states
//
define( "STATE_IDLE", 0 );
define( "STATE_PREALARM", 1 );
define( "STATE_ALARM", 2 );
define( "STATE_ALERT", 3 );
define( "STATE_TAPE", 4 );
define( 'STATE_IDLE', 0 );
define( 'STATE_PREALARM', 1 );
define( 'STATE_ALARM', 2 );
define( 'STATE_ALERT', 3 );
define( 'STATE_TAPE', 4 );
//
// DVR Control Commands
//
define( "MSG_CMD", 1 );
define( "MSG_DATA_WATCH", 2 );
define( "MSG_DATA_EVENT", 3 );
define( 'MSG_CMD', 1 );
define( 'MSG_DATA_WATCH', 2 );
define( 'MSG_DATA_EVENT', 3 );
define( "CMD_NONE", 0 );
define( "CMD_PAUSE", 1 );
define( "CMD_PLAY", 2 );
define( "CMD_STOP", 3 );
define( "CMD_FASTFWD", 4 );
define( "CMD_SLOWFWD", 5 );
define( "CMD_SLOWREV", 6 );
define( "CMD_FASTREV", 7 );
define( "CMD_ZOOMIN", 8 );
define( "CMD_ZOOMOUT", 9 );
define( "CMD_PAN", 10 );
define( "CMD_SCALE", 11 );
define( "CMD_PREV", 12 );
define( "CMD_NEXT", 13 );
define( "CMD_SEEK", 14 );
define( "CMD_VARPLAY", 15 );
define( "CMD_QUIT", 17 );
define( "CMD_QUERY", 99 );
define( 'CMD_NONE', 0 );
define( 'CMD_PAUSE', 1 );
define( 'CMD_PLAY', 2 );
define( 'CMD_STOP', 3 );
define( 'CMD_FASTFWD', 4 );
define( 'CMD_SLOWFWD', 5 );
define( 'CMD_SLOWREV', 6 );
define( 'CMD_FASTREV', 7 );
define( 'CMD_ZOOMIN', 8 );
define( 'CMD_ZOOMOUT', 9 );
define( 'CMD_PAN', 10 );
define( 'CMD_SCALE', 11 );
define( 'CMD_PREV', 12 );
define( 'CMD_NEXT', 13 );
define( 'CMD_SEEK', 14 );
define( 'CMD_VARPLAY', 15 );
define( 'CMD_QUIT', 17 );
define( 'CMD_QUERY', 99 );
//
// These are miscellaneous options you won't normally need to change
//
define( "MAX_EVENTS", 10 ); // The maximum number of events to show in the monitor event listing
define( "RATE_BASE", 100 ); // The additional scaling factor used to help get fractional rates in integer format
define( "SCALE_BASE", 100 ); // The additional scaling factor used to help get fractional scales in integer format
define( 'MAX_EVENTS', 10 ); // The maximum number of events to show in the monitor event listing
define( 'RATE_BASE', 100 ); // The additional scaling factor used to help get fractional rates in integer format
define( 'SCALE_BASE', 100 ); // The additional scaling factor used to help get fractional scales in integer format
//
// Date and time formats, not to be modified by language files
//
define( "STRF_FMT_DATETIME_DB", "%Y-%m-%d %H:%M:%S" ); // Strftime format for database queries, don't change
define( "MYSQL_FMT_DATETIME_SHORT", "%y/%m/%d %H:%i:%S" ); // MySQL date_format shorter format for dates with time
define( 'STRF_FMT_DATETIME_DB', '%Y-%m-%d %H:%M:%S' ); // Strftime format for database queries, don't change
define( 'MYSQL_FMT_DATETIME_SHORT', '%y/%m/%d %H:%i:%S' ); // MySQL date_format shorter format for dates with time
require_once( 'database.php' );
require_once( 'logger.php' );
loadConfig();
Logger::fetch()->initialise();
$GLOBALS['defaultUser'] = array(
'Username' => "admin",
'Password' => "",
'Language' => "",
'Username' => 'admin',
'Password' => '',
'Language' => '',
'Enabled' => 1,
'Stream' => 'View',
'Events' => 'Edit',
@ -178,20 +180,19 @@ function loadConfig( $defineConsts=true ) {
//print_r( $configCats );
}
require_once( 'logger.php' );
// For Human-readability, use ZM_SERVER_HOST or ZM_SERVER_NAME in zm.conf, and convert it here to a ZM_SERVER_ID
if ( ! defined('ZM_SERVER_ID') ) {
if ( defined('ZM_SERVER_NAME') and ZM_SERVER_NAME ) {
$server_id = dbFetchOne('SELECT Id FROM Servers WHERE Name=?', 'Id', array(ZM_SERVER_NAME));
if ( ! $server_id ) {
Error("Invalid Multi-Server configration detected. ZM_SERVER_NAME set to " . ZM_SERVER_NAME . " in zm.conf, but no corresponding entry found in Servers table.");
Error('Invalid Multi-Server configration detected. ZM_SERVER_NAME set to ' . ZM_SERVER_NAME . ' in zm.conf, but no corresponding entry found in Servers table.');
} else {
define( 'ZM_SERVER_ID', $server_id );
}
} else if ( defined('ZM_SERVER_HOST') and ZM_SERVER_HOST ) {
$server_id = dbFetchOne('SELECT Id FROM Servers WHERE Name=?', 'Id', array(ZM_SERVER_HOST));
if ( ! $server_id ) {
Error("Invalid Multi-Server configration detected. ZM_SERVER_HOST set to " . ZM_SERVER_HOST . " in zm.conf, but no corresponding entry found in Servers table.");
Error('Invalid Multi-Server configration detected. ZM_SERVER_HOST set to ' . ZM_SERVER_HOST . ' in zm.conf, but no corresponding entry found in Servers table.');
} else {
define( 'ZM_SERVER_ID', $server_id );
}

View File

@ -373,7 +373,7 @@ class Logger {
}
if ( $this->useErrorLog )
$message .= " at ".$file." line ".$line;
$message .= ' at '.$file.' line '.$line;
else
$message = $message;
@ -401,9 +401,9 @@ class Logger {
if ( $level <= $this->databaseLevel ) {
try {
global $dbConn;
$sql = "INSERT INTO Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) values ( ?, ?, ?, ?, ?, ?, ?, ? )";
$sql = 'INSERT INTO Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) values ( ?, ?, ?, ?, ?, ?, ?, ? )';
$stmt = $dbConn->prepare( $sql );
$result = $stmt->execute( array( sprintf( "%d.%06d", $time['sec'], $time['usec'] ), $this->id, getmypid(), $level, $code, $string, $file, $line ) );
$result = $stmt->execute( array( sprintf( '%d.%06d', $time['sec'], $time['usec'] ), $this->id, getmypid(), $level, $code, $string, $file, $line ) );
} catch(PDOException $ex) {
$this->databaseLevel = self::NOLOG;
Fatal( "Can't write log entry '$sql': ". $ex->getMessage() );

View File

@ -233,7 +233,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0}); </script>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false}); </script>
</td>
<?php
} elseif ( $term['attr'] == 'Date' || $term['attr'] == 'StartDate' || $term['attr'] == 'EndDate') {
@ -241,7 +241,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr($term['val']):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datepicker({dateFormat: "yy-mm-dd", maxDate: 0}); </script>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false}); </script>
</td>
<?php
} elseif ( $term['attr'] == 'StartTime' || $term['attr'] == 'EndTime') {
@ -249,7 +249,7 @@ for ( $i=0; $i < count($terms); $i++ ) {
<td><?php echo htmlSelect( "filter[Query][terms][$i][op]", $opTypes, $term['op'] ); ?></td>
<td>
<input type="text" name="filter[Query][terms][<?php echo $i ?>][val]" id="filter[Query][terms][<?php echo $i ?>][val]" value="<?php echo isset($term['val'])?validHtmlStr(str_replace('T', ' ', $term['val'])):'' ?>"/>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").timepicker({timeFormat: "HH:mm:ss"}); </script>
<script type="text/javascript">$j("[name$='\\[<?php echo $i ?>\\]\\[val\\]']").timepicker({timeFormat: "HH:mm:ss", constrainInput: falsepi}); </script>
</td>
<?php
} elseif ( $term['attr'] == 'StateId' ) {

View File

@ -198,11 +198,11 @@ function parseRows (rows) {
inputTds.eq(4).html(textInput).children().val(textVal);
}
if (inputTds.eq(2).children().val().endsWith('DateTime')) { //Start/End DateTime
inputTds.eq(4).children().datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0});
inputTds.eq(4).children().datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});
} else if (inputTds.eq(2).children().val().endsWith('Date')) { //Start/End Date
inputTds.eq(4).children().datepicker({dateFormat: "yy-mm-dd", maxDate: 0});
inputTds.eq(4).children().datepicker({dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});
} else if (inputTds.eq(2).children().val().endsWith('Time')) { //Start/End Time
inputTds.eq(4).children().timepicker({timeFormat: "HH:mm:ss"});
inputTds.eq(4).children().timepicker({timeFormat: "HH:mm:ss", constrainInput: false});
}
let attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name

View File

@ -769,6 +769,7 @@ function initPage() {
timeFormat: "HH:mm:ss",
dateFormat: "yy-mm-dd",
maxDate: +0,
constrainInput: false,
onClose: function (newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();
@ -780,6 +781,7 @@ function initPage() {
dateFormat: "yy-mm-dd",
minDate: $j('#minTime').val(),
maxDate: +0,
constrainInput: false,
onClose: function (newDate, oldData) {
if (newDate !== oldData.lastVal) {
changeDateTime();