Merge branch 'storageareas' of github.com:connortechnology/ZoneMinder into storageareas
commit
be424f46f0
|
@ -36,8 +36,8 @@ env:
|
|||
- SMPFLAGS=-j4
|
||||
matrix:
|
||||
- OS=el DIST=7
|
||||
- OS=fedora DIST=26 DOCKER_REPO=knnniggett/packpack
|
||||
- OS=fedora DIST=27 DOCKER_REPO=knnniggett/packpack
|
||||
- OS=fedora DIST=28 DOCKER_REPO=knnniggett/packpack
|
||||
- OS=ubuntu DIST=trusty
|
||||
- OS=ubuntu DIST=xenial
|
||||
- OS=ubuntu DIST=trusty ARCH=i386
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Viewing Monitors
|
||||
================
|
||||
|
||||
ZoneMinder allows you to view a live feed of your configured monitors. Once can access this view by clicking on the "Name" column of any of the monitors
|
||||
ZoneMinder allows you to view a live feed of your configured monitors. One can access this view by clicking on the "Name" column of any of the monitors
|
||||
|
||||
.. image:: images/viewmonitor-main.png
|
||||
:width: 500px
|
||||
|
|
|
@ -551,7 +551,7 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
|
|||
} else {
|
||||
Level tempDatabaseLevel = mDatabaseLevel;
|
||||
databaseLevel(NOLOG);
|
||||
Error("Can't insert log entry: sql(%s) error(db is locked)", sql);
|
||||
Error("Can't insert log entry: sql(%s) error(db is locked)", logString);
|
||||
databaseLevel(tempDatabaseLevel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1543,8 +1543,9 @@ bool Monitor::Analyse() {
|
|||
}
|
||||
if ( score ) {
|
||||
if ( (state == IDLE || state == TAPE || state == PREALARM ) ) {
|
||||
if ( Event::PreAlarmCount() > alarm_frame_count ) {
|
||||
Info( "%s: %03d - Gone into alarm state", name, image_count );
|
||||
if ( (!pre_event_count) || (Event::PreAlarmCount() >= alarm_frame_count) ) {
|
||||
Info("%s: %03d - Gone into alarm state %u > %u",
|
||||
name, image_count, Event::PreAlarmCount(), alarm_frame_count);
|
||||
shared_data->state = state = ALARM;
|
||||
if ( signal_change || (function != MOCORD && state != ALERT) ) {
|
||||
int pre_index;
|
||||
|
|
809
web/ajax/log.php
809
web/ajax/log.php
|
@ -4,443 +4,404 @@
|
|||
# These are the valid columns that you can filter on.
|
||||
$filterFields = array( 'Component', 'ServerId', 'Pid', 'Level', 'File', 'Line' );
|
||||
|
||||
switch ( $_REQUEST['task'] )
|
||||
{
|
||||
case 'create' :
|
||||
{
|
||||
// Silently ignore bogus requests
|
||||
if ( !empty($_POST['level']) && !empty($_POST['message']) )
|
||||
{
|
||||
logInit( array( 'id' => "web_js" ) );
|
||||
switch ( $_REQUEST['task'] ) {
|
||||
case 'create' :
|
||||
{
|
||||
// Silently ignore bogus requests
|
||||
if ( !empty($_POST['level']) && !empty($_POST['message']) ) {
|
||||
logInit(array('id'=>'web_js'));
|
||||
|
||||
$string = $_POST['message'];
|
||||
$string = $_POST['message'];
|
||||
|
||||
$file = !empty($_POST['file']) ? preg_replace( '/\w+:\/\/\w+\//', '', $_POST['file'] ) : '';
|
||||
if ( !empty( $_POST['line'] ) )
|
||||
$line = $_POST['line'];
|
||||
else
|
||||
$line = NULL;
|
||||
$file = !empty($_POST['file']) ? preg_replace( '/\w+:\/\/\w+\//', '', $_POST['file'] ) : '';
|
||||
if ( !empty( $_POST['line'] ) )
|
||||
$line = $_POST['line'];
|
||||
else
|
||||
$line = NULL;
|
||||
|
||||
$levels = array_flip(Logger::$codes);
|
||||
if ( !isset($levels[$_POST['level']]) )
|
||||
Panic( "Unexpected logger level '".$_POST['level']."'" );
|
||||
$level = $levels[$_POST['level']];
|
||||
Logger::fetch()->logPrint( $level, $string, $file, $line );
|
||||
}
|
||||
ajaxResponse();
|
||||
break;
|
||||
$levels = array_flip(Logger::$codes);
|
||||
if ( !isset($levels[$_POST['level']]) )
|
||||
Panic("Unexpected logger level '".$_POST['level']."'");
|
||||
$level = $levels[$_POST['level']];
|
||||
Logger::fetch()->logPrint( $level, $string, $file, $line );
|
||||
}
|
||||
case 'query' :
|
||||
{
|
||||
if ( !canView( 'System' ) )
|
||||
ajaxError( 'Insufficient permissions to view log entries' );
|
||||
ajaxResponse();
|
||||
break;
|
||||
}
|
||||
case 'query' :
|
||||
{
|
||||
if ( !canView('System') )
|
||||
ajaxError('Insufficient permissions to view log entries');
|
||||
|
||||
$servers = Server::find_all();
|
||||
$servers_by_Id = array();
|
||||
# There is probably a better way to do this.
|
||||
foreach ( $servers as $server ) {
|
||||
$servers_by_Id[$server->Id()] = $server;
|
||||
}
|
||||
|
||||
$minTime = isset($_REQUEST['minTime'])?$_REQUEST['minTime']:NULL;
|
||||
$maxTime = isset($_REQUEST['maxTime'])?$_REQUEST['maxTime']:NULL;
|
||||
|
||||
$limit = 100;
|
||||
if ( isset($_REQUEST['limit']) ) {
|
||||
if ( ( !is_integer( $_REQUEST['limit'] ) and !ctype_digit($_REQUEST['limit']) ) ) {
|
||||
Error("Invalid value for limit " . $_REQUEST['limit'] );
|
||||
} else {
|
||||
$limit = $_REQUEST['limit'];
|
||||
}
|
||||
}
|
||||
$sortField = 'TimeKey';
|
||||
if ( isset($_REQUEST['sortField']) ) {
|
||||
if ( ! in_array( $_REQUEST['sortField'], $filterFields ) and ( $_REQUEST['sortField'] != 'TimeKey' ) ) {
|
||||
Error("Invalid sort field " . $_REQUEST['sortField'] );
|
||||
} else {
|
||||
$sortField = $_REQUEST['sortField'];
|
||||
}
|
||||
}
|
||||
$sortOrder = (isset($_REQUEST['sortOrder']) and $_REQUEST['sortOrder']) == 'asc' ? 'asc':'desc';
|
||||
$filter = isset($_REQUEST['filter'])?$_REQUEST['filter']:array();
|
||||
|
||||
$total = dbFetchOne( 'SELECT count(*) AS Total FROM Logs', 'Total' );
|
||||
$sql = 'SELECT * FROM Logs';
|
||||
$where = array();
|
||||
$values = array();
|
||||
if ( $minTime ) {
|
||||
$where[] = "TimeKey > ?";
|
||||
$values[] = $minTime;
|
||||
} elseif ( $maxTime ) {
|
||||
$where[] = "TimeKey < ?";
|
||||
$values[] = $maxTime;
|
||||
}
|
||||
|
||||
foreach ( $filter as $field=>$value ) {
|
||||
if ( ! in_array( $field, $filterFields ) ) {
|
||||
Error("$field is not in valid filter fields");
|
||||
continue;
|
||||
}
|
||||
if ( $field == 'Level' ){
|
||||
$where[] = $field." <= ?";
|
||||
$values[] = $value;
|
||||
} else {
|
||||
$where[] = $field." = ?";
|
||||
$values[] = $value;
|
||||
}
|
||||
}
|
||||
if ( count($where) )
|
||||
$sql.= ' WHERE '.join( ' AND ', $where );
|
||||
$sql .= " order by ".$sortField." ".$sortOrder." limit ".$limit;
|
||||
$logs = array();
|
||||
foreach ( dbFetchAll( $sql, NULL, $values ) as $log ) {
|
||||
$log['DateTime'] = preg_replace( '/^\d+/', strftime( '%Y-%m-%d %H:%M:%S', intval($log['TimeKey']) ), $log['TimeKey'] );
|
||||
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
|
||||
$log['Message'] = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $log['Message'] );
|
||||
$logs[] = $log;
|
||||
}
|
||||
$options = array();
|
||||
$where = array();
|
||||
$values = array();
|
||||
foreach( $filter as $field=>$value ) {
|
||||
if ( $field == 'Level' ) {
|
||||
$where[$field] = $field." <= ?";
|
||||
$values[$field] = $value;
|
||||
} else {
|
||||
$where[$field] = $field." = ?";
|
||||
$values[$field] = $value;
|
||||
}
|
||||
}
|
||||
foreach( $filterFields as $field )
|
||||
{
|
||||
$sql = "SELECT DISTINCT $field FROM Logs WHERE NOT isnull($field)";
|
||||
$fieldWhere = array_diff_key( $where, array( $field=>true ) );
|
||||
$fieldValues = array_diff_key( $values, array( $field=>true ) );
|
||||
if ( count($fieldWhere) )
|
||||
$sql.= " AND ".join( ' AND ', $fieldWhere );
|
||||
$sql.= " ORDER BY $field ASC";
|
||||
if ( $field == 'Level' )
|
||||
{
|
||||
foreach( dbFetchAll( $sql, $field, array_values($fieldValues) ) as $value )
|
||||
if ( $value <= Logger::INFO )
|
||||
$options[$field][$value] = Logger::$codes[$value];
|
||||
else
|
||||
$options[$field][$value] = "DB".$value;
|
||||
}
|
||||
elseif ( $field == 'ServerId' )
|
||||
{
|
||||
foreach( dbFetchAll( $sql, $field, array_values($fieldValues) ) as $value )
|
||||
$options['ServerId'][$value] = ( $value and isset($servers_by_Id[$value]) ) ? $servers_by_Id[$value]->Name() : '';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( dbFetchAll( $sql, $field, array_values( $fieldValues ) ) as $value )
|
||||
if ( $value != '' )
|
||||
$options[$field][] = $value;
|
||||
}
|
||||
}
|
||||
if ( count($filter) )
|
||||
{
|
||||
$sql = "SELECT count(*) AS Available FROM Logs WHERE ".join( ' AND ', $where );
|
||||
$available = dbFetchOne( $sql, 'Available', array_values($values) );
|
||||
}
|
||||
ajaxResponse( array(
|
||||
'updated' => preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG ),
|
||||
'total' => $total,
|
||||
'available' => isset($available)?$available:$total,
|
||||
'logs' => $logs,
|
||||
'state' => logState(),
|
||||
'options' => $options
|
||||
) );
|
||||
break;
|
||||
$servers = Server::find_all();
|
||||
$servers_by_Id = array();
|
||||
# There is probably a better way to do this.
|
||||
foreach ( $servers as $server ) {
|
||||
$servers_by_Id[$server->Id()] = $server;
|
||||
}
|
||||
case 'export' :
|
||||
|
||||
$minTime = isset($_REQUEST['minTime'])?$_REQUEST['minTime']:NULL;
|
||||
$maxTime = isset($_REQUEST['maxTime'])?$_REQUEST['maxTime']:NULL;
|
||||
|
||||
$limit = 100;
|
||||
if ( isset($_REQUEST['limit']) ) {
|
||||
if ( ( !is_integer( $_REQUEST['limit'] ) and !ctype_digit($_REQUEST['limit']) ) ) {
|
||||
Error('Invalid value for limit ' . $_REQUEST['limit'] );
|
||||
} else {
|
||||
$limit = $_REQUEST['limit'];
|
||||
}
|
||||
}
|
||||
$sortField = 'TimeKey';
|
||||
if ( isset($_REQUEST['sortField']) ) {
|
||||
if ( ! in_array( $_REQUEST['sortField'], $filterFields ) and ( $_REQUEST['sortField'] != 'TimeKey' ) ) {
|
||||
Error("Invalid sort field " . $_REQUEST['sortField'] );
|
||||
} else {
|
||||
$sortField = $_REQUEST['sortField'];
|
||||
}
|
||||
}
|
||||
$sortOrder = (isset($_REQUEST['sortOrder']) and $_REQUEST['sortOrder']) == 'asc' ? 'asc':'desc';
|
||||
$filter = isset($_REQUEST['filter'])?$_REQUEST['filter']:array();
|
||||
|
||||
$total = dbFetchOne('SELECT count(*) AS Total FROM Logs', 'Total');
|
||||
$sql = 'SELECT * FROM Logs';
|
||||
$where = array();
|
||||
$values = array();
|
||||
if ( $minTime ) {
|
||||
$where[] = 'TimeKey > ?';
|
||||
$values[] = $minTime;
|
||||
} elseif ( $maxTime ) {
|
||||
$where[] = 'TimeKey < ?';
|
||||
$values[] = $maxTime;
|
||||
}
|
||||
|
||||
foreach ( $filter as $field=>$value ) {
|
||||
if ( ! in_array($field, $filterFields) ) {
|
||||
Error("$field is not in valid filter fields");
|
||||
continue;
|
||||
}
|
||||
if ( $field == 'Level' ){
|
||||
$where[] = $field.' <= ?';
|
||||
$values[] = $value;
|
||||
} else {
|
||||
$where[] = $field.' = ?';
|
||||
$values[] = $value;
|
||||
}
|
||||
}
|
||||
$options = array();
|
||||
if ( count($where) )
|
||||
$sql.= ' WHERE '.join( ' AND ', $where );
|
||||
$sql .= ' ORDER BY '.$sortField.' '.$sortOrder.' LIMIT '.$limit;
|
||||
$logs = array();
|
||||
foreach ( dbFetchAll($sql, NULL, $values) as $log ) {
|
||||
$log['DateTime'] = preg_replace('/^\d+/', strftime('%Y-%m-%d %H:%M:%S', intval($log['TimeKey'])), $log['TimeKey']);
|
||||
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
|
||||
$log['Message'] = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $log['Message'] );
|
||||
foreach( $filterFields as $field ) {
|
||||
if ( ! isset( $options[$field] ) )
|
||||
$options[$field] = array();
|
||||
$value = $log[$field];
|
||||
|
||||
if ( $field == 'Level' ) {
|
||||
if ( $value <= Logger::INFO )
|
||||
$options[$field][$value] = Logger::$codes[$value];
|
||||
else
|
||||
$options[$field][$value] = 'DB'.$value;
|
||||
} else if ( $field == 'ServerId' ) {
|
||||
$options['ServerId'][$value] = ( $value and isset($servers_by_Id[$value]) ) ? $servers_by_Id[$value]->Name() : '';
|
||||
} else if ( isset($log[$field]) ) {
|
||||
$options[$field][$log[$field]] = $log[$field];
|
||||
}
|
||||
}
|
||||
$logs[] = $log;
|
||||
}
|
||||
|
||||
$available = count($logs);
|
||||
ajaxResponse( array(
|
||||
'updated' => preg_match('/%/', DATE_FMT_CONSOLE_LONG)?strftime(DATE_FMT_CONSOLE_LONG):date(DATE_FMT_CONSOLE_LONG),
|
||||
'total' => $total,
|
||||
'available' => isset($available)?$available:$total,
|
||||
'logs' => $logs,
|
||||
'state' => logState(),
|
||||
'options' => $options
|
||||
) );
|
||||
break;
|
||||
}
|
||||
case 'export' :
|
||||
{
|
||||
if ( !canView('System') )
|
||||
ajaxError('Insufficient permissions to export logs');
|
||||
|
||||
$minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL;
|
||||
$maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL;
|
||||
if ( !is_null($minTime) && !is_null($maxTime) && $minTime > $maxTime ) {
|
||||
$tempTime = $minTime;
|
||||
$minTime = $maxTime;
|
||||
$maxTime = $tempTime;
|
||||
}
|
||||
//$limit = isset($_POST['limit'])?$_POST['limit']:1000;
|
||||
$filter = isset($_POST['filter'])?$_POST['filter']:array();
|
||||
$sortField = 'TimeKey';
|
||||
if ( isset($_POST['sortField']) ) {
|
||||
if ( ! in_array( $_POST['sortField'], $filterFields ) and ( $_POST['sortField'] != 'TimeKey' ) ) {
|
||||
Error("Invalid sort field " . $_POST['sortField'] );
|
||||
} else {
|
||||
$sortField = $_POST['sortField'];
|
||||
}
|
||||
}
|
||||
$sortOrder = (isset($_POST['sortOrder']) and $_POST['sortOrder']) == 'asc' ? 'asc':'desc';
|
||||
|
||||
$servers = Server::find_all();
|
||||
$servers_by_Id = array();
|
||||
# There is probably a better way to do this.
|
||||
foreach ( $servers as $server ) {
|
||||
$servers_by_Id[$server->Id()] = $server;
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM Logs';
|
||||
$where = array();
|
||||
$values = array();
|
||||
if ( $minTime ) {
|
||||
preg_match('/(.+)(\.\d+)/', $minTime, $matches);
|
||||
$minTime = strtotime($matches[1]).$matches[2];
|
||||
$where[] = 'TimeKey >= ?';
|
||||
$values[] = $minTime;
|
||||
}
|
||||
if ( $maxTime ) {
|
||||
preg_match('/(.+)(\.\d+)/', $maxTime, $matches);
|
||||
$maxTime = strtotime($matches[1]).$matches[2];
|
||||
$where[] = 'TimeKey <= ?';
|
||||
$values[] = $maxTime;
|
||||
}
|
||||
foreach ( $filter as $field=>$value ) {
|
||||
if ( $value != '' ) {
|
||||
if ( $field == 'Level' ) {
|
||||
$where[] = $field.' <= ?';
|
||||
$values[] = $value;
|
||||
} else {
|
||||
$where[] = $field.' = ?';
|
||||
$values[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( count($where) )
|
||||
$sql.= ' WHERE '.join( ' AND ', $where );
|
||||
$sql .= ' ORDER BY '.$sortField.' '.$sortOrder;
|
||||
//$sql .= " limit ".dbEscape($limit);
|
||||
$format = isset($_POST['format'])?$_POST['format']:'text';
|
||||
switch( $format ) {
|
||||
case 'text' :
|
||||
$exportExt = 'txt';
|
||||
break;
|
||||
case 'tsv' :
|
||||
$exportExt = 'tsv';
|
||||
break;
|
||||
case 'html' :
|
||||
$exportExt = 'html';
|
||||
break;
|
||||
case 'xml' :
|
||||
$exportExt = 'xml';
|
||||
break;
|
||||
default :
|
||||
Fatal("Unrecognised log export format '$format'");
|
||||
}
|
||||
$exportKey = substr(md5(rand()),0,8);
|
||||
$exportFile = "zm-log.$exportExt";
|
||||
$exportPath = ZM_PATH_SWAP."/zm-log-$exportKey.$exportExt";
|
||||
if ( !($exportFP = fopen( $exportPath, "w" )) )
|
||||
Fatal("Unable to open log export file $exportPath");
|
||||
$logs = array();
|
||||
foreach ( dbFetchAll( $sql, NULL, $values ) as $log ) {
|
||||
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
|
||||
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
|
||||
$logs[] = $log;
|
||||
}
|
||||
switch( $format ) {
|
||||
case 'text' :
|
||||
{
|
||||
if ( !canView( 'System' ) )
|
||||
ajaxError( 'Insufficient permissions to export logs' );
|
||||
|
||||
$minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL;
|
||||
$maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL;
|
||||
if ( !is_null($minTime) && !is_null($maxTime) && $minTime > $maxTime )
|
||||
{
|
||||
$tempTime = $minTime;
|
||||
$minTime = $maxTime;
|
||||
$maxTime = $tempTime;
|
||||
}
|
||||
//$limit = isset($_POST['limit'])?$_POST['limit']:1000;
|
||||
$filter = isset($_POST['filter'])?$_POST['filter']:array();
|
||||
$sortField = 'TimeKey';
|
||||
if ( isset($_POST['sortField']) ) {
|
||||
if ( ! in_array( $_POST['sortField'], $filterFields ) and ( $_POST['sortField'] != 'TimeKey' ) ) {
|
||||
Error("Invalid sort field " . $_POST['sortField'] );
|
||||
} else {
|
||||
$sortField = $_POST['sortField'];
|
||||
}
|
||||
}
|
||||
$sortOrder = (isset($_POST['sortOrder']) and $_POST['sortOrder']) == 'asc' ? 'asc':'desc';
|
||||
|
||||
$servers = Server::find_all();
|
||||
$servers_by_Id = array();
|
||||
# There is probably a better way to do this.
|
||||
foreach ( $servers as $server ) {
|
||||
$servers_by_Id[$server->Id()] = $server;
|
||||
}
|
||||
|
||||
$sql = "select * from Logs";
|
||||
$where = array();
|
||||
$values = array();
|
||||
if ( $minTime )
|
||||
{
|
||||
preg_match( '/(.+)(\.\d+)/', $minTime, $matches );
|
||||
$minTime = strtotime($matches[1]).$matches[2];
|
||||
$where[] = "TimeKey >= ?";
|
||||
$values[] = $minTime;
|
||||
}
|
||||
if ( $maxTime )
|
||||
{
|
||||
preg_match( '/(.+)(\.\d+)/', $maxTime, $matches );
|
||||
$maxTime = strtotime($matches[1]).$matches[2];
|
||||
$where[] = "TimeKey <= ?";
|
||||
$values[] = $maxTime;
|
||||
}
|
||||
foreach ( $filter as $field=>$value ) {
|
||||
if ( $value != '' ) {
|
||||
if ( $field == 'Level' ) {
|
||||
$where[] = $field." <= ?";
|
||||
$values[] = $value;
|
||||
} else {
|
||||
$where[] = $field." = ?'";
|
||||
$values[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( count($where) )
|
||||
$sql.= " where ".join( " and ", $where );
|
||||
$sql .= " order by ".$sortField." ".$sortOrder;
|
||||
//$sql .= " limit ".dbEscape($limit);
|
||||
$format = isset($_POST['format'])?$_POST['format']:'text';
|
||||
switch( $format )
|
||||
{
|
||||
case 'text' :
|
||||
$exportExt = "txt";
|
||||
break;
|
||||
case 'tsv' :
|
||||
$exportExt = "tsv";
|
||||
break;
|
||||
case 'html' :
|
||||
$exportExt = "html";
|
||||
break;
|
||||
case 'xml' :
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
default :
|
||||
Fatal( "Unrecognised log export format '$format'" );
|
||||
}
|
||||
$exportKey = substr(md5(rand()),0,8);
|
||||
$exportFile = "zm-log.$exportExt";
|
||||
$exportPath = ZM_PATH_SWAP."/zm-log-$exportKey.$exportExt";
|
||||
if ( !($exportFP = fopen( $exportPath, "w" )) )
|
||||
Fatal( "Unable to open log export file $exportPath" );
|
||||
$logs = array();
|
||||
foreach ( dbFetchAll( $sql, NULL, $values ) as $log )
|
||||
{
|
||||
$log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] );
|
||||
$log['Server'] = ( $log['ServerId'] and isset($servers_by_Id[$log['ServerId']]) ) ? $servers_by_Id[$log['ServerId']]->Name() : '';
|
||||
$logs[] = $log;
|
||||
}
|
||||
switch( $format )
|
||||
{
|
||||
case 'text' :
|
||||
{
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
if ( $log['Line'] )
|
||||
fprintf( $exportFP, "%s %s[%d].%s-%s/%d [%s]\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Line'], $log['Message'] );
|
||||
else
|
||||
fprintf( $exportFP, "%s %s[%d].%s-%s [%s]\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Message'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'tsv' :
|
||||
{
|
||||
# This line doesn't need fprintf, it could use fwrite
|
||||
fprintf( $exportFP, join( "\t",
|
||||
translate('DateTime'),
|
||||
translate('Component'),
|
||||
translate('Server'),
|
||||
translate('Pid'),
|
||||
translate('Level'),
|
||||
translate('Message'),
|
||||
translate('File'),
|
||||
translate('Line')
|
||||
)."\n" );
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
fprintf( $exportFP, "%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'html' :
|
||||
{
|
||||
fwrite( $exportFP,
|
||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>'.translate('ZoneMinderLog').'</title>
|
||||
<style type="text/css">
|
||||
body, h3, p, table, td {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
th {
|
||||
font-weight: bold;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #888888;
|
||||
padding: 1px 2px;
|
||||
}
|
||||
tr.log-fat td {
|
||||
background-color:#ffcccc;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
tr.log-err td {
|
||||
background-color:#ffcccc;
|
||||
}
|
||||
tr.log-war td {
|
||||
background-color: #ffe4b5;
|
||||
}
|
||||
tr.log-dbg td {
|
||||
color: #666666;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
foreach ( $logs as $log ) {
|
||||
if ( $log['Line'] )
|
||||
fprintf( $exportFP, "%s %s[%d].%s-%s/%d [%s]\n",
|
||||
$log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Line'], $log['Message'] );
|
||||
else
|
||||
fprintf( $exportFP, "%s %s[%d].%s-%s [%s]\n",
|
||||
$log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Message'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'tsv' :
|
||||
{
|
||||
# This line doesn't need fprintf, it could use fwrite
|
||||
fprintf( $exportFP, join( "\t",
|
||||
translate('DateTime'),
|
||||
translate('Component'),
|
||||
translate('Server'),
|
||||
translate('Pid'),
|
||||
translate('Level'),
|
||||
translate('Message'),
|
||||
translate('File'),
|
||||
translate('Line')
|
||||
)."\n" );
|
||||
foreach ( $logs as $log ) {
|
||||
fprintf( $exportFP, "%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'html' :
|
||||
{
|
||||
fwrite( $exportFP,
|
||||
'
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>'.translate('ZoneMinderLog').'</title>
|
||||
<style type="text/css">
|
||||
body, h3, p, table, td {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
th {
|
||||
font-weight: bold;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #888888;
|
||||
padding: 1px 2px;
|
||||
}
|
||||
tr.log-fat td {
|
||||
background-color:#ffcccc;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
tr.log-err td {
|
||||
background-color:#ffcccc;
|
||||
}
|
||||
tr.log-war td {
|
||||
background-color: #ffe4b5;
|
||||
}
|
||||
tr.log-dbg td {
|
||||
color: #666666;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>'.translate('ZoneMinderLog').'</h3>
|
||||
<p>'.htmlspecialchars(preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG )).'</p>
|
||||
<p>'.count($logs).' '.translate('Logs').'</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr><th>'.translate('DateTime').'</th><th>'.translate('Component').'</th><th>'.translate('Server').'</th><th>'.translate('Pid').'</th><th>'.translate('Level').'</th><th>'.translate('Message').'</th><th>'.translate('File').'</th><th>'.translate('Line').'</th></tr>
|
||||
' );
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
$classLevel = $log['Level'];
|
||||
if ( $classLevel < Logger::FATAL )
|
||||
$classLevel = Logger::FATAL;
|
||||
elseif ( $classLevel > Logger::DEBUG )
|
||||
$classLevel = Logger::DEBUG;
|
||||
$logClass = 'log-'.strtolower(Logger::$codes[$classLevel]);
|
||||
fprintf( $exportFP, " <tr class=\"%s\"><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $logClass, $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
|
||||
}
|
||||
fwrite( $exportFP,
|
||||
' </tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>' );
|
||||
break;
|
||||
}
|
||||
case 'xml' :
|
||||
{
|
||||
fwrite( $exportFP,
|
||||
'<?xml version="1.0" encoding="utf-8"?>
|
||||
<logexport title="'.translate('ZoneMinderLog').'" date="'.htmlspecialchars(preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG )).'">
|
||||
<selector>'.$_POST['selector'].'</selector>' );
|
||||
foreach ( $filter as $field=>$value )
|
||||
if ( $value != '' )
|
||||
fwrite( $exportFP,
|
||||
' <filter>
|
||||
<'.strtolower($field).'>'.htmlspecialchars($value).'</'.strtolower($field).'>
|
||||
</filter>' );
|
||||
fwrite( $exportFP,
|
||||
' <columns>
|
||||
<column field="datetime">'.translate('DateTime').'</column><column field="component">'.translate('Component').'</column><column field="'.translate('Server').'</column><column field="pid">'.translate('Pid').'</column><column field="level">'.translate('Level').'</column><column field="message">'.translate('Message').'</column><column field="file">'.translate('File').'</column><column field="line">'.translate('Line').'</column>
|
||||
</columns>
|
||||
<logs count="'.count($logs).'">
|
||||
' );
|
||||
foreach ( $logs as $log )
|
||||
{
|
||||
fprintf( $exportFP,
|
||||
" <log>
|
||||
<datetime>%s</datetime>
|
||||
<component>%s</component>
|
||||
<server>%s</server>
|
||||
<pid>%d</pid>
|
||||
<level>%s</level>
|
||||
<message><![CDATA[%s]]></message>
|
||||
<file>%s</file>
|
||||
<line>%d</line>
|
||||
</log>\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], utf8_decode( $log['Message'] ), $log['File'], $log['Line'] );
|
||||
}
|
||||
fwrite( $exportFP,
|
||||
' </logs>
|
||||
</logexport>' );
|
||||
break;
|
||||
}
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
}
|
||||
fclose( $exportFP );
|
||||
ajaxResponse( array(
|
||||
'key' => $exportKey,
|
||||
'format' => $format,
|
||||
) );
|
||||
break;
|
||||
<tbody>
|
||||
<tr><th>'.translate('DateTime').'</th><th>'.translate('Component').'</th><th>'.translate('Server').'</th><th>'.translate('Pid').'</th><th>'.translate('Level').'</th><th>'.translate('Message').'</th><th>'.translate('File').'</th><th>'.translate('Line').'</th></tr>
|
||||
' );
|
||||
foreach ( $logs as $log ) {
|
||||
$classLevel = $log['Level'];
|
||||
if ( $classLevel < Logger::FATAL )
|
||||
$classLevel = Logger::FATAL;
|
||||
elseif ( $classLevel > Logger::DEBUG )
|
||||
$classLevel = Logger::DEBUG;
|
||||
$logClass = 'log-'.strtolower(Logger::$codes[$classLevel]);
|
||||
fprintf( $exportFP, " <tr class=\"%s\"><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $logClass, $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], $log['Message'], $log['File'], $log['Line'] );
|
||||
}
|
||||
case 'download' :
|
||||
fwrite( $exportFP,
|
||||
' </tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>' );
|
||||
break;
|
||||
}
|
||||
case 'xml' :
|
||||
{
|
||||
if ( !canView( 'System' ) )
|
||||
ajaxError( 'Insufficient permissions to download logs' );
|
||||
|
||||
if ( empty($_REQUEST['key']) )
|
||||
Fatal( "No log export key given" );
|
||||
$exportKey = $_REQUEST['key'];
|
||||
if ( empty($_REQUEST['format']) )
|
||||
Fatal( "No log export format given" );
|
||||
$format = $_REQUEST['format'];
|
||||
|
||||
switch( $format )
|
||||
{
|
||||
case 'text' :
|
||||
$exportExt = "txt";
|
||||
break;
|
||||
case 'tsv' :
|
||||
$exportExt = "tsv";
|
||||
break;
|
||||
case 'html' :
|
||||
$exportExt = "html";
|
||||
break;
|
||||
case 'xml' :
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
default :
|
||||
Fatal( "Unrecognised log export format '$format'" );
|
||||
}
|
||||
|
||||
$exportFile = "zm-log.$exportExt";
|
||||
$exportPath = ZM_PATH_SWAP."/zm-log-$exportKey.$exportExt";
|
||||
|
||||
header( "Pragma: public" );
|
||||
header( "Expires: 0" );
|
||||
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
|
||||
header( "Cache-Control: private", false ); // required by certain browsers
|
||||
header( "Content-Description: File Transfer" );
|
||||
header( 'Content-Disposition: attachment; filename="'.$exportFile.'"' );
|
||||
header( "Content-Transfer-Encoding: binary" );
|
||||
header( "Content-Type: application/force-download" );
|
||||
header( "Content-Length: ".filesize($exportPath) );
|
||||
readfile( $exportPath );
|
||||
exit( 0 );
|
||||
break;
|
||||
fwrite( $exportFP,
|
||||
'<?xml version="1.0" encoding="utf-8"?>
|
||||
<logexport title="'.translate('ZoneMinderLog').'" date="'.htmlspecialchars(preg_match( '/%/', DATE_FMT_CONSOLE_LONG )?strftime( DATE_FMT_CONSOLE_LONG ):date( DATE_FMT_CONSOLE_LONG )).'">
|
||||
<selector>'.$_POST['selector'].'</selector>' );
|
||||
foreach ( $filter as $field=>$value )
|
||||
if ( $value != '' )
|
||||
fwrite( $exportFP,
|
||||
' <filter>
|
||||
<'.strtolower($field).'>'.htmlspecialchars($value).'</'.strtolower($field).'>
|
||||
</filter>' );
|
||||
fwrite( $exportFP,
|
||||
' <columns>
|
||||
<column field="datetime">'.translate('DateTime').'</column><column field="component">'.translate('Component').'</column><column field="'.translate('Server').'</column><column field="pid">'.translate('Pid').'</column><column field="level">'.translate('Level').'</column><column field="message">'.translate('Message').'</column><column field="file">'.translate('File').'</column><column field="line">'.translate('Line').'</column>
|
||||
</columns>
|
||||
<logs count="'.count($logs).'">
|
||||
' );
|
||||
foreach ( $logs as $log ) {
|
||||
fprintf( $exportFP,
|
||||
" <log>
|
||||
<datetime>%s</datetime>
|
||||
<component>%s</component>
|
||||
<server>%s</server>
|
||||
<pid>%d</pid>
|
||||
<level>%s</level>
|
||||
<message><![CDATA[%s]]></message>
|
||||
<file>%s</file>
|
||||
<line>%d</line>
|
||||
</log>\n", $log['DateTime'], $log['Component'], $log['Server'], $log['Pid'], $log['Code'], utf8_decode( $log['Message'] ), $log['File'], $log['Line'] );
|
||||
}
|
||||
fwrite( $exportFP,
|
||||
' </logs>
|
||||
</logexport>' );
|
||||
break;
|
||||
}
|
||||
$exportExt = "xml";
|
||||
break;
|
||||
}
|
||||
fclose( $exportFP );
|
||||
ajaxResponse( array(
|
||||
'key' => $exportKey,
|
||||
'format' => $format,
|
||||
) );
|
||||
break;
|
||||
}
|
||||
case 'download' :
|
||||
{
|
||||
if ( !canView('System') )
|
||||
ajaxError('Insufficient permissions to download logs');
|
||||
|
||||
if ( empty($_REQUEST['key']) )
|
||||
Fatal( "No log export key given" );
|
||||
$exportKey = $_REQUEST['key'];
|
||||
if ( empty($_REQUEST['format']) )
|
||||
Fatal( "No log export format given" );
|
||||
$format = $_REQUEST['format'];
|
||||
|
||||
switch( $format ) {
|
||||
case 'text' :
|
||||
$exportExt = 'txt';
|
||||
break;
|
||||
case 'tsv' :
|
||||
$exportExt = 'tsv';
|
||||
break;
|
||||
case 'html' :
|
||||
$exportExt = 'html';
|
||||
break;
|
||||
case 'xml' :
|
||||
$exportExt = 'xml';
|
||||
break;
|
||||
default :
|
||||
Fatal("Unrecognised log export format '$format'");
|
||||
}
|
||||
|
||||
$exportFile = "zm-log.$exportExt";
|
||||
$exportPath = ZM_PATH_SWAP."/zm-log-$exportKey.$exportExt";
|
||||
|
||||
header( "Pragma: public" );
|
||||
header( "Expires: 0" );
|
||||
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
|
||||
header( "Cache-Control: private", false ); // required by certain browsers
|
||||
header( "Content-Description: File Transfer" );
|
||||
header( 'Content-Disposition: attachment; filename="'.$exportFile.'"' );
|
||||
header( "Content-Transfer-Encoding: binary" );
|
||||
header( "Content-Type: application/force-download" );
|
||||
header( "Content-Length: ".filesize($exportPath) );
|
||||
readfile( $exportPath );
|
||||
exit( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
|
||||
ajaxError('Unrecognised action or insufficient permissions');
|
||||
?>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef
|
||||
Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5
|
|
@ -27,7 +27,7 @@ class Event {
|
|||
'Videoed',
|
||||
'Uploaded',
|
||||
'Emailed',
|
||||
'Messages',
|
||||
'Messaged',
|
||||
'Executed',
|
||||
'Notes',
|
||||
'StateId',
|
||||
|
|
|
@ -20,7 +20,7 @@ public $defaults = array(
|
|||
'limit' => 100,
|
||||
'Query' => array(),
|
||||
'sort_field' => ZM_WEB_EVENT_SORT_FIELD,
|
||||
'sort_asc' => (ZM_WEB_EVENT_SORT_ORDER == 'asc' ? 'asc' : 'desc'),
|
||||
'sort_asc' => ZM_WEB_EVENT_SORT_ORDER == 'asc' ? 'asc' : 'desc',
|
||||
);
|
||||
|
||||
public function __construct( $IdOrRow=NULL ) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
require_once( 'database.php' );
|
||||
require_once( 'Server.php' );
|
||||
require_once('database.php');
|
||||
require_once('Server.php');
|
||||
|
||||
class Monitor {
|
||||
|
||||
|
@ -130,12 +130,12 @@ private $control_fields = array(
|
|||
public function __construct( $IdOrRow = NULL ) {
|
||||
if ( $IdOrRow ) {
|
||||
$row = NULL;
|
||||
if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
|
||||
$row = dbFetchOne( 'SELECT * FROM Monitors WHERE Id=?', NULL, array( $IdOrRow ) );
|
||||
if ( is_integer($IdOrRow) or is_numeric($IdOrRow) ) {
|
||||
$row = dbFetchOne('SELECT * FROM Monitors WHERE Id=?', NULL, array($IdOrRow));
|
||||
if ( ! $row ) {
|
||||
Error("Unable to load Monitor record for Id=" . $IdOrRow );
|
||||
Error("Unable to load Monitor record for Id=" . $IdOrRow);
|
||||
}
|
||||
} elseif ( is_array( $IdOrRow ) ) {
|
||||
} elseif ( is_array($IdOrRow) ) {
|
||||
$row = $IdOrRow;
|
||||
} else {
|
||||
Error("Unknown argument passed to Monitor Constructor ($IdOrRow)");
|
||||
|
@ -147,7 +147,7 @@ private $control_fields = array(
|
|||
$this->{$k} = $v;
|
||||
}
|
||||
if ( $this->{'Controllable'} ) {
|
||||
$s = dbFetchOne( 'SELECT * FROM Controls WHERE Id=?', NULL, array( $this->{'ControlId'} ) );
|
||||
$s = dbFetchOne('SELECT * FROM Controls WHERE Id=?', NULL, array($this->{'ControlId'}) );
|
||||
foreach ($s as $k => $v) {
|
||||
if ( $k == 'Id' ) {
|
||||
continue;
|
||||
|
@ -165,13 +165,13 @@ private $control_fields = array(
|
|||
}
|
||||
|
||||
} else {
|
||||
Error('No row for Monitor ' . $IdOrRow );
|
||||
Error('No row for Monitor ' . $IdOrRow);
|
||||
}
|
||||
} # end if isset($IdOrRow)
|
||||
} // end function __construct
|
||||
|
||||
public function Server() {
|
||||
return new Server( $this->{'ServerId'} );
|
||||
return new Server($this->{'ServerId'});
|
||||
}
|
||||
public function __call($fn, array $args){
|
||||
if ( count($args) ) {
|
||||
|
@ -484,9 +484,9 @@ private $control_fields = array(
|
|||
$url_parts = parse_url( $this->{'Path'} );
|
||||
unset($url_parts['user']);
|
||||
unset($url_parts['pass']);
|
||||
unset($url_parts['scheme']);
|
||||
#unset($url_parts['scheme']);
|
||||
unset($url_parts['query']);
|
||||
unset($url_parts['path']);
|
||||
#unset($url_parts['path']);
|
||||
if ( isset($url_parts['port']) and ( $url_parts['port'] == '80' or $url_parts['port'] == '554' ) )
|
||||
unset($url_parts['port']);
|
||||
$source = unparse_url($url_parts);
|
||||
|
|
|
@ -200,7 +200,7 @@ isset($view) || $view = NULL;
|
|||
isset($request) || $request = NULL;
|
||||
isset($action) || $action = NULL;
|
||||
|
||||
if ( ZM_ENABLE_CSRF_MAGIC && $action != 'login' && $view != 'view_video' && $view != 'video' && $request != 'control' && $view != 'frames') {
|
||||
if ( ZM_ENABLE_CSRF_MAGIC && $action != 'login' && $view != 'view_video' && $view != 'video' && $request != 'control' && $view != 'frames' && $view != 'archive' ) {
|
||||
require_once( 'includes/csrf/csrf-magic.php' );
|
||||
#Logger::Debug("Calling csrf_check with the following values: \$request = \"$request\", \$view = \"$view\", \$action = \"$action\"");
|
||||
csrf_check();
|
||||
|
|
|
@ -18,126 +18,113 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
function getControlCommands( $monitor )
|
||||
{
|
||||
$cmds = array();
|
||||
function getControlCommands( $monitor ) {
|
||||
$cmds = array();
|
||||
|
||||
$cmds['Wake'] = "wake";
|
||||
$cmds['Sleep'] = "sleep";
|
||||
$cmds['Reset'] = "reset";
|
||||
$cmds['Wake'] = "wake";
|
||||
$cmds['Sleep'] = "sleep";
|
||||
$cmds['Reset'] = "reset";
|
||||
|
||||
$cmds['PresetSet'] = "presetSet";
|
||||
$cmds['PresetGoto'] = "presetGoto";
|
||||
$cmds['PresetHome'] = "presetHome";
|
||||
$cmds['PresetSet'] = "presetSet";
|
||||
$cmds['PresetGoto'] = "presetGoto";
|
||||
$cmds['PresetHome'] = "presetHome";
|
||||
|
||||
if ( $monitor->CanZoom() )
|
||||
{
|
||||
if ( $monitor->CanZoomCon() )
|
||||
$cmds['ZoomRoot'] = "zoomCon";
|
||||
elseif ( $monitor->CanZoomRel() )
|
||||
$cmds['ZoomRoot'] = "zoomRel";
|
||||
elseif ( $monitor->CanZoomAbs() )
|
||||
$cmds['ZoomRoot'] = "zoomAbs";
|
||||
$cmds['ZoomTele'] = $cmds['ZoomRoot']."Tele";
|
||||
$cmds['ZoomWide'] = $cmds['ZoomRoot']."Wide";
|
||||
$cmds['ZoomStop'] = "zoomStop";
|
||||
$cmds['ZoomAuto'] = "zoomAuto";
|
||||
$cmds['ZoomMan'] = "zoomMan";
|
||||
if ( $monitor->CanZoom() ) {
|
||||
if ( $monitor->CanZoomCon() )
|
||||
$cmds['ZoomRoot'] = "zoomCon";
|
||||
elseif ( $monitor->CanZoomRel() )
|
||||
$cmds['ZoomRoot'] = "zoomRel";
|
||||
elseif ( $monitor->CanZoomAbs() )
|
||||
$cmds['ZoomRoot'] = "zoomAbs";
|
||||
$cmds['ZoomTele'] = $cmds['ZoomRoot']."Tele";
|
||||
$cmds['ZoomWide'] = $cmds['ZoomRoot']."Wide";
|
||||
$cmds['ZoomStop'] = "zoomStop";
|
||||
$cmds['ZoomAuto'] = "zoomAuto";
|
||||
$cmds['ZoomMan'] = "zoomMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanFocus() ) {
|
||||
if ( $monitor->CanFocusCon() )
|
||||
$cmds['FocusRoot'] = "focusCon";
|
||||
elseif ( $monitor->CanFocusRel() )
|
||||
$cmds['FocusRoot'] = "focusRel";
|
||||
elseif ( $monitor->CanFocusAbs() )
|
||||
$cmds['FocusRoot'] = "focusAbs";
|
||||
$cmds['FocusFar'] = $cmds['FocusRoot']."Far";
|
||||
$cmds['FocusNear'] = $cmds['FocusRoot']."Near";
|
||||
$cmds['FocusStop'] = "focusStop";
|
||||
$cmds['FocusAuto'] = "focusAuto";
|
||||
$cmds['FocusMan'] = "focusMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanIris() ) {
|
||||
if ( $monitor->CanIrisCon() )
|
||||
$cmds['IrisRoot'] = "irisCon";
|
||||
elseif ( $monitor->CanIrisRel() )
|
||||
$cmds['IrisRoot'] = "irisRel";
|
||||
elseif ( $monitor->CanIrisAbs() )
|
||||
$cmds['IrisRoot'] = "irisAbs";
|
||||
$cmds['IrisOpen'] = $cmds['IrisRoot']."Open";
|
||||
$cmds['IrisClose'] = $cmds['IrisRoot']."Close";
|
||||
$cmds['IrisStop'] = "irisStop";
|
||||
$cmds['IrisAuto'] = "irisAuto";
|
||||
$cmds['IrisMan'] = "irisMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanWhite() ) {
|
||||
if ( $monitor->CanWhiteCon() )
|
||||
$cmds['WhiteRoot'] = "whiteCon";
|
||||
elseif ( $monitor->CanWhiteRel() )
|
||||
$cmds['WhiteRoot'] = "whiteRel";
|
||||
elseif ( $monitor->CanWhiteAbs() )
|
||||
$cmds['WhiteRoot'] = "whiteAbs";
|
||||
$cmds['WhiteIn'] = $cmds['WhiteRoot']."In";
|
||||
$cmds['WhiteOut'] = $cmds['WhiteRoot']."Out";
|
||||
$cmds['WhiteAuto'] = "whiteAuto";
|
||||
$cmds['WhiteMan'] = "whiteMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanGain() ) {
|
||||
if ( $monitor->CanGainCon() )
|
||||
$cmds['GainRoot'] = "gainCon";
|
||||
elseif ( $monitor->CanGainRel() )
|
||||
$cmds['GainRoot'] = "gainRel";
|
||||
elseif ( $monitor->CanGainAbs() )
|
||||
$cmds['GainRoot'] = "gainAbs";
|
||||
$cmds['GainUp'] = $cmds['GainRoot']."Up";
|
||||
$cmds['GainDown'] = $cmds['GainRoot']."Down";
|
||||
$cmds['GainAuto'] = "gainAuto";
|
||||
$cmds['GainMan'] = "gainMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanMove() ) {
|
||||
if ( $monitor->CanMoveCon() ) {
|
||||
$cmds['MoveRoot'] = "moveCon";
|
||||
$cmds['Center'] = "moveStop";
|
||||
} elseif ( $monitor->CanMoveRel() ) {
|
||||
$cmds['MoveRoot'] = "moveRel";
|
||||
$cmds['Center'] = $cmds['PresetHome'];
|
||||
} elseif ( $monitor->CanMoveAbs() ) {
|
||||
$cmds['MoveRoot'] = "moveAbs";
|
||||
$cmds['Center'] = $cmds['PresetHome'];
|
||||
} else {
|
||||
$cmds['MoveRoot'] = '';
|
||||
}
|
||||
|
||||
if ( $monitor->CanFocus() )
|
||||
{
|
||||
if ( $monitor->CanFocusCon() )
|
||||
$cmds['FocusRoot'] = "focusCon";
|
||||
elseif ( $monitor->CanFocusRel() )
|
||||
$cmds['FocusRoot'] = "focusRel";
|
||||
elseif ( $monitor->CanFocusAbs() )
|
||||
$cmds['FocusRoot'] = "focusAbs";
|
||||
$cmds['FocusFar'] = $cmds['FocusRoot']."Far";
|
||||
$cmds['FocusNear'] = $cmds['FocusRoot']."Near";
|
||||
$cmds['FocusStop'] = "focusStop";
|
||||
$cmds['FocusAuto'] = "focusAuto";
|
||||
$cmds['FocusMan'] = "focusMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanIris() )
|
||||
{
|
||||
if ( $monitor->CanIrisCon() )
|
||||
$cmds['IrisRoot'] = "irisCon";
|
||||
elseif ( $monitor->CanIrisRel() )
|
||||
$cmds['IrisRoot'] = "irisRel";
|
||||
elseif ( $monitor->CanIrisAbs() )
|
||||
$cmds['IrisRoot'] = "irisAbs";
|
||||
$cmds['IrisOpen'] = $cmds['IrisRoot']."Open";
|
||||
$cmds['IrisClose'] = $cmds['IrisRoot']."Close";
|
||||
$cmds['IrisStop'] = "irisStop";
|
||||
$cmds['IrisAuto'] = "irisAuto";
|
||||
$cmds['IrisMan'] = "irisMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanWhite() )
|
||||
{
|
||||
if ( $monitor->CanWhiteCon() )
|
||||
$cmds['WhiteRoot'] = "whiteCon";
|
||||
elseif ( $monitor->CanWhiteRel() )
|
||||
$cmds['WhiteRoot'] = "whiteRel";
|
||||
elseif ( $monitor->CanWhiteAbs() )
|
||||
$cmds['WhiteRoot'] = "whiteAbs";
|
||||
$cmds['WhiteIn'] = $cmds['WhiteRoot']."In";
|
||||
$cmds['WhiteOut'] = $cmds['WhiteRoot']."Out";
|
||||
$cmds['WhiteAuto'] = "whiteAuto";
|
||||
$cmds['WhiteMan'] = "whiteMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanGain() )
|
||||
{
|
||||
if ( $monitor->CanGainCon() )
|
||||
$cmds['GainRoot'] = "gainCon";
|
||||
elseif ( $monitor->CanGainRel() )
|
||||
$cmds['GainRoot'] = "gainRel";
|
||||
elseif ( $monitor->CanGainAbs() )
|
||||
$cmds['GainRoot'] = "gainAbs";
|
||||
$cmds['GainUp'] = $cmds['GainRoot']."Up";
|
||||
$cmds['GainDown'] = $cmds['GainRoot']."Down";
|
||||
$cmds['GainAuto'] = "gainAuto";
|
||||
$cmds['GainMan'] = "gainMan";
|
||||
}
|
||||
|
||||
if ( $monitor->CanMove() )
|
||||
{
|
||||
if ( $monitor->CanMoveCon() )
|
||||
{
|
||||
$cmds['MoveRoot'] = "moveCon";
|
||||
$cmds['Center'] = "moveStop";
|
||||
}
|
||||
elseif ( $monitor->CanMoveRel() )
|
||||
{
|
||||
$cmds['MoveRoot'] = "moveRel";
|
||||
$cmds['Center'] = $cmds['PresetHome'];
|
||||
}
|
||||
elseif ( $monitor->CanMoveAbs() )
|
||||
{
|
||||
$cmds['MoveRoot'] = "moveAbs";
|
||||
$cmds['Center'] = $cmds['PresetHome'];
|
||||
} else {
|
||||
$cmds['MoveRoot'] = '';
|
||||
}
|
||||
|
||||
$cmds['MoveUp'] = $cmds['MoveRoot']."Up";
|
||||
$cmds['MoveDown'] = $cmds['MoveRoot']."Down";
|
||||
$cmds['MoveLeft'] = $cmds['MoveRoot']."Left";
|
||||
$cmds['MoveRight'] = $cmds['MoveRoot']."Right";
|
||||
$cmds['MoveUpLeft'] = $cmds['MoveRoot']."UpLeft";
|
||||
$cmds['MoveUpRight'] = $cmds['MoveRoot']."UpRight";
|
||||
$cmds['MoveDownLeft'] = $cmds['MoveRoot']."DownLeft";
|
||||
$cmds['MoveDownRight'] = $cmds['MoveRoot']."DownRight";
|
||||
}
|
||||
return( $cmds );
|
||||
$cmds['MoveUp'] = $cmds['MoveRoot']."Up";
|
||||
$cmds['MoveDown'] = $cmds['MoveRoot']."Down";
|
||||
$cmds['MoveLeft'] = $cmds['MoveRoot']."Left";
|
||||
$cmds['MoveRight'] = $cmds['MoveRoot']."Right";
|
||||
$cmds['MoveUpLeft'] = $cmds['MoveRoot']."UpLeft";
|
||||
$cmds['MoveUpRight'] = $cmds['MoveRoot']."UpRight";
|
||||
$cmds['MoveDownLeft'] = $cmds['MoveRoot']."DownLeft";
|
||||
$cmds['MoveDownRight'] = $cmds['MoveRoot']."DownRight";
|
||||
}
|
||||
return( $cmds );
|
||||
}
|
||||
|
||||
function controlFocus( $monitor, $cmds )
|
||||
{
|
||||
ob_start();
|
||||
function controlFocus( $monitor, $cmds ) {
|
||||
ob_start();
|
||||
?>
|
||||
<div class="arrowControl focusControls">
|
||||
<div class="arrowLabel"><?php echo translate('Near') ?></div>
|
||||
|
@ -146,24 +133,22 @@ function controlFocus( $monitor, $cmds )
|
|||
<div class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['FocusFar'] ?>',event,0,1)"></div>
|
||||
<div class="arrowLabel"><?php echo translate('Far') ?></div>
|
||||
<?php
|
||||
if ( $monitor->CanAutoFocus() )
|
||||
{
|
||||
if ( $monitor->CanAutoFocus() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Auto') ?>" onclick="controlCmd('<?php echo $cmds['FocusAuto'] ?>')"/>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Man') ?>" onclick="controlCmd('<?php echo $cmds['FocusMan'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function controlZoom( $monitor, $cmds )
|
||||
{
|
||||
global $SLANG;
|
||||
function controlZoom( $monitor, $cmds ) {
|
||||
global $SLANG;
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
?>
|
||||
<div class="arrowControl zoomControls">
|
||||
<div class="arrowLabel"><?php echo translate('Tele') ?></div>
|
||||
|
@ -172,23 +157,21 @@ function controlZoom( $monitor, $cmds )
|
|||
<div class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['ZoomWide'] ?>',event,0,1)"></div>
|
||||
<div class="arrowLabel"><?php echo translate('Wide') ?></div>
|
||||
<?php
|
||||
if ( $monitor->CanAutoZoom() )
|
||||
{
|
||||
if ( $monitor->CanAutoZoom() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Auto') ?>" onclick="controlCmd('<?php echo $cmds['ZoomAuto'] ?>')"/>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Man') ?>" onclick="controlCmd('<?php echo $cmds['ZoomMan'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div><?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function controlIris( $monitor, $cmds )
|
||||
{
|
||||
global $SLANG;
|
||||
function controlIris( $monitor, $cmds ) {
|
||||
global $SLANG;
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
?>
|
||||
<div class="arrowControl irisControls">
|
||||
<div class="arrowLabel"><?php echo translate('Open') ?></div>
|
||||
|
@ -197,24 +180,22 @@ function controlIris( $monitor, $cmds )
|
|||
<div class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['IrisClose'] ?>',event,0,1)"></div>
|
||||
<div class="arrowLabel"><?php echo translate('Close') ?></div>
|
||||
<?php
|
||||
if ( $monitor->CanAutoIris() )
|
||||
{
|
||||
if ( $monitor->CanAutoIris() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Auto') ?>" onclick="controlCmd('<?php echo $cmds['IrisAuto'] ?>')"/>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Man') ?>" onclick="controlCmd('<?php echo $cmds['IrisMan'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function controlWhite( $monitor, $cmds )
|
||||
{
|
||||
global $SLANG;
|
||||
function controlWhite( $monitor, $cmds ) {
|
||||
global $SLANG;
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
?>
|
||||
<div class="arrowControl whiteControls">
|
||||
<div class="arrowLabel"><?php echo translate('In') ?></div>
|
||||
|
@ -223,170 +204,158 @@ function controlWhite( $monitor, $cmds )
|
|||
<div class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['WhiteOut'] ?>',event,0,1)"></div>
|
||||
<div class="arrowLabel"><?php echo translate('Out') ?></div>
|
||||
<?php
|
||||
if ( $monitor->CanAutoWhite() )
|
||||
{
|
||||
if ( $monitor->CanAutoWhite() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Auto') ?>" onclick="controlCmd('<?php echo $cmds['WhiteAuto'] ?>')"/>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Man') ?>" onclick="controlCmd('<?php echo $cmds['WhiteMan'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function controlPanTilt( $monitor, $cmds )
|
||||
{
|
||||
global $SLANG;
|
||||
function controlPanTilt( $monitor, $cmds ) {
|
||||
global $SLANG;
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
?>
|
||||
<div class="pantiltControls">
|
||||
<div class="pantiltLabel"><?php echo translate('PanTilt') ?></div>
|
||||
<div class="pantiltButtons">
|
||||
<?php
|
||||
$hasPan = $monitor->CanPan();
|
||||
$hasTilt = $monitor->CanTilt();
|
||||
$hasDiag = $hasPan && $hasTilt && $monitor->CanMoveDiag();
|
||||
$hasPan = $monitor->CanPan();
|
||||
$hasTilt = $monitor->CanTilt();
|
||||
$hasDiag = $hasPan && $hasTilt && $monitor->CanMoveDiag();
|
||||
?>
|
||||
<div class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpLeft'] ?>',event,-1,-1)"></div>
|
||||
<div class="arrowBtn upBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUp'] ?>',event,0,-1)"></div>
|
||||
<div class="arrowBtn upRightBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpRight'] ?>',event,1,-1)"></div>
|
||||
<div class="arrowBtn leftBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveLeft'] ?>',event,1,0)"></div>
|
||||
<div class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpLeft'] ?>',event,-1,-1)"></div>
|
||||
<div class="arrowBtn upBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUp'] ?>',event,0,-1)"></div>
|
||||
<div class="arrowBtn upRightBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpRight'] ?>',event,1,-1)"></div>
|
||||
<div class="arrowBtn leftBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveLeft'] ?>',event,1,0)"></div>
|
||||
<?php if ( isset($cmds['Center']) ) { ?>
|
||||
<div class="arrowBtn centerBtn" onclick="controlCmd('<?php echo $cmds['Center'] ?>')"></div>
|
||||
<div class="arrowBtn centerBtn" onclick="controlCmd('<?php echo $cmds['Center'] ?>')"></div>
|
||||
<?php } else { ?>
|
||||
<div class="arrowBtn NocenterBtn"></div>
|
||||
<div class="arrowBtn NocenterBtn"></div>
|
||||
<?php } ?>
|
||||
<div class="arrowBtn rightBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveRight'] ?>',event,1,0)"></div>
|
||||
<div class="arrowBtn downLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDownLeft'] ?>',event,-1,1)"></div>
|
||||
<div class="arrowBtn downBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDown'] ?>',event,0,1)"></div>
|
||||
<div class="arrowBtn downRightBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDownRight'] ?>',event,1,1)"></div>
|
||||
<div class="arrowBtn rightBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveRight'] ?>',event,1,0)"></div>
|
||||
<div class="arrowBtn downLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDownLeft'] ?>',event,-1,1)"></div>
|
||||
<div class="arrowBtn downBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDown'] ?>',event,0,1)"></div>
|
||||
<div class="arrowBtn downRightBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDownRight'] ?>',event,1,1)"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function controlPresets( $monitor, $cmds )
|
||||
{
|
||||
global $SLANG;
|
||||
function controlPresets( $monitor, $cmds ) {
|
||||
global $SLANG;
|
||||
|
||||
define( "MAX_PRESETS", "12" );
|
||||
// MAX_PRESETS IS PER LINE
|
||||
define( "MAX_PRESETS", "12" );
|
||||
|
||||
$sql = 'select * from ControlPresets where MonitorId = ?';
|
||||
$labels = array();
|
||||
foreach( dbFetchAll( $sql, NULL, array( $monitor->Id() ) ) as $row )
|
||||
{
|
||||
$labels[$row['Preset']] = $row['Label'];
|
||||
}
|
||||
$sql = 'SELECT * FROM ControlPresets WHERE MonitorId = ?';
|
||||
$labels = array();
|
||||
foreach( dbFetchAll( $sql, NULL, array( $monitor->Id() ) ) as $row ) {
|
||||
$labels[$row['Preset']] = $row['Label'];
|
||||
}
|
||||
|
||||
$presetBreak = (int)(($monitor->NumPresets()+1)/((int)(($monitor->NumPresets()-1)/MAX_PRESETS)+1));
|
||||
$presetBreak = (int)(($monitor->NumPresets()+1)/((int)(($monitor->NumPresets()-1)/MAX_PRESETS)+1));
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
?>
|
||||
<div class="presetControls">
|
||||
<!--<div><?php echo translate('Presets') ?></div>-->
|
||||
<div>
|
||||
<?php
|
||||
for ( $i = 1; $i <= $monitor->NumPresets(); $i++ )
|
||||
{
|
||||
?><input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?$labels[$i]:"" ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/><?php
|
||||
if ( $i && (($i%$presetBreak) == 0) )
|
||||
{
|
||||
for ( $i = 1; $i <= $monitor->NumPresets(); $i++ ) {
|
||||
?>
|
||||
<input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?$labels[$i]:"" ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/>
|
||||
<?php
|
||||
if ( $i && (($i%$presetBreak) == 0) ) {
|
||||
?><br/><?php
|
||||
}
|
||||
}
|
||||
} // end foreach preset
|
||||
?>
|
||||
</div>
|
||||
<div>
|
||||
<?php
|
||||
if ( $monitor->HasHomePreset() )
|
||||
{
|
||||
if ( $monitor->HasHomePreset() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Home') ?>" onclick="controlCmd('<?php echo $cmds['PresetHome'] ?>');"/>
|
||||
<?php
|
||||
}
|
||||
if ( canEdit( 'Monitors') && $monitor->CanSetPresets() )
|
||||
{
|
||||
}
|
||||
if ( canEdit('Monitors') && $monitor->CanSetPresets() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Set') ?>" onclick="createPopup( '?view=controlpreset&mid=<?php echo $monitor->Id() ?>', 'zmPreset', 'preset' );"/>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Set') ?>" onclick="createPopup('?view=controlpreset&mid=<?php echo $monitor->Id() ?>', 'zmPreset', 'preset');"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function controlPower( $monitor, $cmds )
|
||||
{
|
||||
global $SLANG;
|
||||
function controlPower( $monitor, $cmds ) {
|
||||
global $SLANG;
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
?>
|
||||
<div class="powerControls">
|
||||
<div class="powerLabel"><?php echo translate('Control') ?></div>
|
||||
<div>
|
||||
<?php
|
||||
if ( $monitor->CanWake() )
|
||||
{
|
||||
if ( $monitor->CanWake() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Wake') ?>" onclick="controlCmd('<?php echo $cmds['Wake'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
if ( $monitor->CanSleep() )
|
||||
{
|
||||
}
|
||||
if ( $monitor->CanSleep() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Sleep') ?>" onclick="controlCmd('<?php echo $cmds['Sleep'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
if ( $monitor->CanReset() )
|
||||
{
|
||||
}
|
||||
if ( $monitor->CanReset() ) {
|
||||
?>
|
||||
<input type="button" class="ptzTextBtn" value="<?php echo translate('Reset') ?>" onclick="controlCmd('<?php echo $cmds['Reset'] ?>')"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function ptzControls( $monitor )
|
||||
{
|
||||
$cmds = getControlCommands( $monitor );
|
||||
ob_start();
|
||||
function ptzControls( $monitor ) {
|
||||
$cmds = getControlCommands($monitor);
|
||||
ob_start();
|
||||
?>
|
||||
<div class="controlsPanel">
|
||||
<div class="controlsPanel">
|
||||
<?php
|
||||
if ( $monitor->CanFocus() )
|
||||
echo controlFocus( $monitor, $cmds );
|
||||
if ( $monitor->CanZoom() )
|
||||
echo controlZoom( $monitor, $cmds );
|
||||
if ( $monitor->CanIris() )
|
||||
echo controlIris( $monitor, $cmds );
|
||||
if ( $monitor->CanWhite() )
|
||||
echo controlWhite( $monitor, $cmds );
|
||||
if ( $monitor->CanMove() ) {
|
||||
if ( $monitor->CanFocus() )
|
||||
echo controlFocus($monitor, $cmds);
|
||||
if ( $monitor->CanZoom() )
|
||||
echo controlZoom($monitor, $cmds);
|
||||
if ( $monitor->CanIris() )
|
||||
echo controlIris($monitor, $cmds);
|
||||
if ( $monitor->CanWhite() )
|
||||
echo controlWhite($monitor, $cmds);
|
||||
if ( $monitor->CanMove() ) {
|
||||
?>
|
||||
<div class="pantiltPanel">
|
||||
<div class="pantiltPanel">
|
||||
<?php echo controlPanTilt($monitor, $cmds); ?>
|
||||
</div>
|
||||
<?php
|
||||
echo controlPanTilt( $monitor, $cmds );
|
||||
}
|
||||
if ( $monitor->CanWake() || $monitor->CanSleep() || $monitor->CanReset() )
|
||||
echo controlPower($monitor, $cmds);
|
||||
if ( $monitor->HasPresets() )
|
||||
echo controlPresets($monitor, $cmds);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
if ( $monitor->CanWake() || $monitor->CanSleep() || $monitor->CanReset() )
|
||||
echo controlPower( $monitor, $cmds );
|
||||
if ( $monitor->HasPresets() )
|
||||
echo controlPresets( $monitor, $cmds );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
return ob_get_clean();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -732,11 +732,6 @@ function loadintoIframe(iframeid, url){
|
|||
return( ob_get_clean() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function exportFileList( $eid, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc ) {
|
||||
|
||||
if ( (!canView('Events')) or ! $eid ) {
|
||||
|
@ -816,7 +811,7 @@ function exportFileList( $eid, $exportDetail, $exportFrames, $exportImages, $exp
|
|||
}
|
||||
$files = array();
|
||||
}
|
||||
return( array_values( $exportFileList ) );
|
||||
return array_values($exportFileList);
|
||||
}
|
||||
|
||||
function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc, $exportFormat, $exportStructure = false ) {
|
||||
|
@ -900,5 +895,5 @@ function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $expo
|
|||
unlink($monitorPath.'/'.$html_eventMaster);
|
||||
}
|
||||
|
||||
return( '?view=archive%26type='.$exportFormat );
|
||||
return '?view=archive%26type='.$exportFormat;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ var popupSizes = {
|
|||
'onvifprobe': { 'width': 700, 'height': 550 },
|
||||
'optionhelp': { 'width': 400, 'height': 320 },
|
||||
'options': { 'width': 1000, 'height': 660 },
|
||||
'preset': { 'width': 300, 'height': 120 },
|
||||
'preset': { 'width': 300, 'height': 220 },
|
||||
'server': { 'width': 600, 'height': 405 },
|
||||
'settings': { 'width': 220, 'height': 235 },
|
||||
'state': { 'width': 400, 'height': 170 },
|
||||
|
|
|
@ -218,7 +218,9 @@ $html .= htmlSelect( 'Status[]', $status_options,
|
|||
$regexp = '/'.preg_quote($regexp,'/').'/i';
|
||||
}
|
||||
if ( !preg_match($regexp, $Monitor->Source()) ) {
|
||||
continue;
|
||||
if ( !preg_match($regexp, $Monitor->Path()) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,30 +18,26 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canEdit( 'Monitors' ) )
|
||||
{
|
||||
$view = "error";
|
||||
return;
|
||||
if ( !canEdit('Monitors') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
$monitor = dbFetchOne( 'SELECT C.*,M.* FROM Monitors AS M INNER JOIN Controls AS C ON (M.ControlId = C.Id ) WHERE M.Id = ?', NULL, array( $_REQUEST['mid']) );
|
||||
$monitor = dbFetchOne('SELECT C.*,M.* FROM Monitors AS M INNER JOIN Controls AS C ON (M.ControlId = C.Id ) WHERE M.Id = ?', NULL, array( $_REQUEST['mid']) );
|
||||
|
||||
$labels = array();
|
||||
foreach( dbFetchAll( 'SELECT * FROM ControlPresets WHERE MonitorId = ?', NULL, array( $monitor['Id'] ) ) as $row ) {
|
||||
$labels[$row['Preset']] = $row['Label'];
|
||||
$labels[$row['Preset']] = $row['Label'];
|
||||
}
|
||||
|
||||
$presets = array();
|
||||
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ )
|
||||
{
|
||||
$presets[$i] = translate('Preset')." ".$i;
|
||||
if ( !empty($labels[$i]) )
|
||||
{
|
||||
$presets[$i] .= " (".validHtmlStr($labels[$i]).")";
|
||||
}
|
||||
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ ) {
|
||||
$presets[$i] = translate('Preset').' '.$i;
|
||||
if ( !empty($labels[$i]) ) {
|
||||
$presets[$i] .= ' ('.validHtmlStr($labels[$i]).')';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$focusWindow = true;
|
||||
|
||||
xhtmlHeaders(__FILE__, translate('SetPreset') );
|
||||
|
@ -58,10 +54,14 @@ xhtmlHeaders(__FILE__, translate('SetPreset') );
|
|||
<input type="hidden" name="action" value="control"/>
|
||||
<input type="hidden" name="control" value="presetSet"/>
|
||||
<input type="hidden" name="showControls" value="1"/>
|
||||
<p><?php echo buildSelect( "preset", $presets, "updateLabel()" ) ?></p>
|
||||
<p><label for="newLabel"><?php echo translate('NewLabel') ?></label><input type="text" name="newLabel" id="newLabel" value="" size="16"/></p>
|
||||
<p><?php echo buildSelect('preset', $presets, 'updateLabel()' ) ?></p>
|
||||
<p>
|
||||
<label for="newLabel"><?php echo translate('NewLabel') ?></label>
|
||||
<input type="text" name="newLabel" id="newLabel" value="" size="16"/>
|
||||
</p>
|
||||
<div id="contentButtons">
|
||||
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
|
||||
<input type="submit" value="<?php echo translate('Save') ?>"/>
|
||||
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -66,7 +66,10 @@ if ( !empty($_REQUEST['eid']) ) {
|
|||
$Event = new Event( $_REQUEST['eid'] );
|
||||
echo 'Downloading event ' . $_REQUEST['eid'] . ' Resulting file should be approximately ' . human_filesize( $Event->DiskSpace() );
|
||||
} else if ( !empty($_REQUEST['eids']) ) {
|
||||
$total_size = 0;
|
||||
foreach ( $_REQUEST['eids'] as $eid ) {
|
||||
$Event = new Event($eid);
|
||||
$total_size += $Event->DiskSpace();
|
||||
?>
|
||||
<input type="hidden" name="eids[]" value="<?php echo validInt($eid) ?>"/>
|
||||
<?php
|
||||
|
@ -74,7 +77,7 @@ if ( !empty($_REQUEST['eid']) ) {
|
|||
unset( $eid );
|
||||
echo "Downloading " . count($_REQUEST['eids']) . ' events. Resulting file should be approximately ' . human_filesize($total_size);
|
||||
} else {
|
||||
echo '<div class="warning">There are no events found. Resulting download will be empty.</div>';
|
||||
echo '<div class="warning">There are no events found. Resulting download will be empty.</div>';
|
||||
}
|
||||
?>
|
||||
<table id="contentTable" class="minor" cellspacing="0">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) ) {
|
||||
if ( !canView('Events') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
@ -53,16 +53,12 @@ xhtmlHeaders(__FILE__, translate('Export') );
|
|||
<div id="content">
|
||||
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||
<?php
|
||||
if ( !empty($_REQUEST['eid']) )
|
||||
{
|
||||
if ( !empty($_REQUEST['eid']) ) {
|
||||
?>
|
||||
<input type="hidden" name="id" value="<?php echo validInt($_REQUEST['eid']) ?>"/>
|
||||
<?php
|
||||
}
|
||||
elseif ( !empty($_REQUEST['eids']) )
|
||||
{
|
||||
foreach ( $_REQUEST['eids'] as $eid )
|
||||
{
|
||||
} elseif ( !empty($_REQUEST['eids']) ) {
|
||||
foreach ( $_REQUEST['eids'] as $eid ) {
|
||||
?>
|
||||
<input type="hidden" name="eids[]" value="<?php echo validInt($eid) ?>"/>
|
||||
<?php
|
||||
|
@ -70,7 +66,7 @@ elseif ( !empty($_REQUEST['eids']) )
|
|||
unset( $eid );
|
||||
}
|
||||
?>
|
||||
<table id="contentTable" class="minor" cellspacing="0">
|
||||
<table id="contentTable" class="minor">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php echo translate('ExportDetails') ?></th>
|
||||
|
@ -101,7 +97,7 @@ elseif ( !empty($_REQUEST['eids']) )
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button id="exportButton" name="exportButton" value="Export" onclick="exportEvent(this.form);" disabled="disabled"><?php echo translate('Export') ?></button>
|
||||
<button type="button" id="exportButton" name="exportButton" value="Export" onclick="exportEvent(this.form);" disabled="disabled"><?php echo translate('Export') ?></button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
@ -346,17 +346,17 @@ echo htmlSelect( 'filter[Query][sort_asc]', $sort_dirns, $filter->sort_asc() );
|
|||
<div id="actionsTable" class="filterTable">
|
||||
<p>
|
||||
<label><?php echo translate('FilterArchiveEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoArchive]" value="1"<?php if ( !empty($filter->AutoArchive()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
<input type="checkbox" name="filter[AutoArchive]" value="1"<?php if ( $filter->AutoArchive() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
</p>
|
||||
<p><label><?php echo translate('FilterUpdateDiskSpace') ?></label>
|
||||
<input type="checkbox" name="filter[UpdateDiskSpace]" value="1"<?php echo empty($filter->UpdateDiskSpace()) ? '' : ' checked="checked"' ?> onclick="updateButtons(this);"/>
|
||||
<input type="checkbox" name="filter[UpdateDiskSpace]" value="1"<?php echo !$filter->UpdateDiskSpace() ? '' : ' checked="checked"' ?> onclick="updateButtons(this);"/>
|
||||
</p>
|
||||
<?php
|
||||
if ( ZM_OPT_FFMPEG ) {
|
||||
?>
|
||||
<p>
|
||||
<label><?php echo translate('FilterVideoEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoVideo]" value="1"<?php if ( !empty($filter->AutoVideo()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
<input type="checkbox" name="filter[AutoVideo]" value="1"<?php if ( $filter->AutoVideo() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ if ( ZM_OPT_UPLOAD ) {
|
|||
?>
|
||||
<p>
|
||||
<label><?php echo translate('FilterUploadEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoUpload]" value="1"<?php if ( !empty($filter->AutoUpload()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
<input type="checkbox" name="filter[AutoUpload]" value="1"<?php if ( $filter->AutoUpload() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ if ( ZM_OPT_EMAIL ) {
|
|||
?>
|
||||
<p>
|
||||
<label><?php echo translate('FilterEmailEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoEmail]" value="1"<?php if ( !empty($filter->AutoEmail()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
<input type="checkbox" name="filter[AutoEmail]" value="1"<?php if ( $filter->AutoEmail() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ if ( ZM_OPT_MESSAGE ) {
|
|||
?>
|
||||
<p>
|
||||
<label><?php echo translate('FilterMessageEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoMessage]" value="1"<?php if ( !empty($filter->AutoMessage()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
<input type="checkbox" name="filter[AutoMessage]" value="1"<?php if ( $filter->AutoMessage() ) { ?> checked="checked"<?php } ?> onclick="updateButtons( this )"/>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
@ -388,24 +388,24 @@ if ( ZM_OPT_MESSAGE ) {
|
|||
<p>
|
||||
<label><?php echo translate('FilterExecuteEvents') ?></label>
|
||||
|
||||
<input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( !empty($filter->AutoExecute()) ) { ?> checked="checked"<?php } ?>/>
|
||||
<input type="checkbox" name="filter[AutoExecute]" value="1"<?php if ( $filter->AutoExecute() ) { ?> checked="checked"<?php } ?>/>
|
||||
<input type="text" name="filter[AutoExecuteCmd]" value="<?php echo (null !==$filter->AutoExecuteCmd())?$filter->AutoExecuteCmd():'' ?>" maxlength="255" onchange="updateButtons( this )"/>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php echo translate('FilterDeleteEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoDelete]" value="1"<?php if ( !empty($filter->AutoDelete()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this)"/>
|
||||
<input type="checkbox" name="filter[AutoDelete]" value="1"<?php if ( $filter->AutoDelete() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this)"/>
|
||||
</p>
|
||||
<p><label><?php echo translate('FilterMoveEvents') ?></label>
|
||||
<input type="checkbox" name="filter[AutoMove]" value="1"<?php if ( !empty($filter->AutoMove()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);if(this.checked){$j(this.form.elements['filter[AutoMoveTo]']).css('display','inline');}else{this.form.elements['filter[AutoMoveTo]'].hide();};"/>
|
||||
<input type="checkbox" name="filter[AutoMove]" value="1"<?php if ( $filter->AutoMove() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);if(this.checked){$j(this.form.elements['filter[AutoMoveTo]']).css('display','inline');}else{this.form.elements['filter[AutoMoveTo]'].hide();};"/>
|
||||
<?php echo htmlSelect( "filter[AutoMoveTo]", $storageareas, $filter->AutoMoveTo(), $filter->AutoMove() ? null : array('style'=>'display:none;' ) ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<label for="background"><?php echo translate('BackgroundFilter') ?></label>
|
||||
<input type="checkbox" id="filter[Background]" name="filter[Background]" value="1"<?php if ( !empty($filter->Background()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
|
||||
<input type="checkbox" id="filter[Background]" name="filter[Background]" value="1"<?php if ( $filter->Background() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="Concurrent"><?php echo translate('ConcurrentFilter') ?></label>
|
||||
<input type="checkbox" id="filter[Concurrent]" name="filter[Concurrent]" value="1"<?php if ( !empty($filter->Concurrent()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
|
||||
<input type="checkbox" id="filter[Concurrent]" name="filter[Concurrent]" value="1"<?php if ( $filter->Concurrent() ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
|
||||
</p>
|
||||
</div>
|
||||
<hr/>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
function updateLabel() {
|
||||
var presetIndex = $('contentForm').preset.getValue();
|
||||
var form = $('contentForm');
|
||||
var preset_ddm = form.elements['preset'];
|
||||
|
||||
var presetIndex = preset_ddm[preset_ddm.selectedIndex].value;
|
||||
if ( labels[presetIndex] ) {
|
||||
$('contentForm').newLabel.value = labels[presetIndex];
|
||||
form.newLabel.value = labels[presetIndex];
|
||||
} else {
|
||||
$('contentForm').newLabel.value = "";
|
||||
form.newLabel.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', updateLabel );
|
||||
window.addEvent('domready', updateLabel);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
var labels = new Array();
|
||||
<?php
|
||||
foreach ( $labels as $index=>$label )
|
||||
{
|
||||
foreach ( $labels as $index=>$label ) {
|
||||
?>
|
||||
labels[<?php echo validInt($index) ?>] = "<?php echo validJsStr($label) ?>";
|
||||
labels[<?php echo validInt($index) ?>] = '<?php echo validJsStr($label) ?>';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
if ( isset($_REQUEST['eids']) ) {
|
||||
$eidParms = array();
|
||||
foreach ( $_REQUEST['eids'] as $eid )
|
||||
$eidParms[] = "eids[]=".validInt($eid);
|
||||
$eidParms[] = 'eids[]='.validInt($eid);
|
||||
?>
|
||||
var eidParm = '<?php echo join( '&', $eidParms ) ?>';
|
||||
var eidParm = '<?php echo join('&', $eidParms) ?>';
|
||||
<?php
|
||||
} else if (isset($_REQUEST['eid'])) {
|
||||
?>
|
||||
|
|
|
@ -34,7 +34,7 @@ function buildFetchParms( parms ) {
|
|||
fetchParms += '&filter['+key+']='+value;
|
||||
}
|
||||
);
|
||||
return( fetchParms );
|
||||
return fetchParms;
|
||||
}
|
||||
|
||||
function fetchNextLogs() {
|
||||
|
@ -229,24 +229,25 @@ function updateFilterSelectors() {
|
|||
if ( key == 'Level' ) {
|
||||
Object.each(values,
|
||||
function( value, label ) {
|
||||
selector.options[selector.options.length] = new Option( value, label );
|
||||
selector.options[selector.options.length] = new Option(value, label);
|
||||
}
|
||||
);
|
||||
} else if ( key == 'ServerId' ) {
|
||||
Object.each(values,
|
||||
function( value, label ) {
|
||||
selector.options[selector.options.length] = new Option( value, label );
|
||||
selector.options[selector.options.length] = new Option(value, label);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
values.each(
|
||||
function( value ) {
|
||||
selector.options[selector.options.length] = new Option( value );
|
||||
Object.each(values,
|
||||
function( value, label ) {
|
||||
selector.options[selector.options.length] = new Option(value, label);
|
||||
}
|
||||
);
|
||||
}
|
||||
if ( filter[key] )
|
||||
selector.set('value', filter[key]);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -257,11 +258,11 @@ function initPage() {
|
|||
logCodes[''+i] = 'DB'+i;
|
||||
logTable = new HtmlTable( $('logTable'),
|
||||
{
|
||||
zebra: true,
|
||||
sortable: true,
|
||||
sortReverse: true
|
||||
}
|
||||
);
|
||||
zebra: true,
|
||||
sortable: true,
|
||||
sortReverse: true
|
||||
}
|
||||
);
|
||||
logTable.addEvent( 'sort', function( tbody, index ) {
|
||||
var header = tbody.getParent( 'table' ).getElement( 'thead' );
|
||||
var columns = header.getElement( 'tr' ).getElements( 'th' );
|
||||
|
|
|
@ -18,10 +18,9 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'System' ) )
|
||||
{
|
||||
$view = "error";
|
||||
return;
|
||||
if ( !canView('System') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
$focusWindow = true;
|
||||
|
@ -31,92 +30,90 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
|
|||
<body>
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<table class="table">
|
||||
<tr class="row">
|
||||
<td class="col text-center">
|
||||
<div id="logSummary">
|
||||
<?php echo translate('State') ?>: <span id="logState"></span>/
|
||||
<?php echo translate('Total') ?>: <span id="totalLogs"></span>/
|
||||
<?php echo translate('Available') ?>: <span id="availLogs"></span>/
|
||||
<?php echo translate('Displaying') ?>: <span id="displayLogs"></span>/
|
||||
<?php echo translate('Updated') ?>: <span id="lastUpdate"></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row">
|
||||
<table class="table">
|
||||
<tr class="row">
|
||||
<td class="col text-center">
|
||||
<div id="logSummary">
|
||||
<?php echo translate('State') ?>: <span id="logState"></span>/
|
||||
<?php echo translate('Total') ?>: <span id="totalLogs"></span>/
|
||||
<?php echo translate('Available') ?>: <span id="availLogs"></span>/
|
||||
<?php echo translate('Displaying') ?>: <span id="displayLogs"></span>/
|
||||
<?php echo translate('Updated') ?>: <span id="lastUpdate"></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row">
|
||||
<td class="col text-center">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-sm" onclick="expandLog()"> <?php echo translate('More') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="clearLog()"> <?php echo translate('Clear') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="refreshLog()"> <?php echo translate('Refresh') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="exportLog()"> <?php echo translate('Export') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="closeWindow()"> <?php echo translate('Close') ?></button>
|
||||
</div> <!--btn-->
|
||||
</td>
|
||||
</tr>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-sm" onclick="expandLog()"> <?php echo translate('More') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="clearLog()"> <?php echo translate('Clear') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="refreshLog()"> <?php echo translate('Refresh') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="exportLog()"> <?php echo translate('Export') ?></button>
|
||||
<button type="button" class="btn btn-sm" onclick="closeWindow()"> <?php echo translate('Close') ?></button>
|
||||
</div> <!--btn-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div> <!--header-->
|
||||
<div id="content">
|
||||
|
||||
<div id="filters">
|
||||
|
||||
<table cellpadding="5" class="table-condensed">
|
||||
<tr class="row">
|
||||
<td class="col">
|
||||
<?php echo translate('Component') ?>
|
||||
<select class="form-control chosen" id="filter[Component]" onchange="filterLog(this)"><option value="">-----</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('Server') ?>
|
||||
<select class="form-control chosen" id="filter[ServerId]" onchange="filterLog(this)"><option value="">-----</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('Pid') ?>
|
||||
<select class="form-control chosen" id="filter[Pid]" onchange="filterLog(this)"><option value="">-----</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row">
|
||||
<td class="col">
|
||||
<?php echo translate('Level') ?>
|
||||
<select class="form-control chosen" id="filter[Level]" onchange="filterLog(this)"><option value="">---</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('File') ?>
|
||||
<select class="form-control chosen" id="filter[File]" onchange="filterLog(this)"><option value="">------</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('Line') ?>
|
||||
<select class="form-control chosen" id="filter[Line]" onchange="filterLog(this)"><option value="">----</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
</div> <!--header-->
|
||||
<div id="content">
|
||||
<div id="filters">
|
||||
|
||||
</table>
|
||||
<input type="reset" value="<?php echo translate('Reset') ?>" onclick="resetLog()"/>
|
||||
</div>
|
||||
<form name="logForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
||||
<table id="logTable" class="major" cellspacing="0">
|
||||
<thead class="thead-highlight">
|
||||
<tr>
|
||||
<th><?php echo translate('DateTime') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Component') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Server') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Pid') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Level') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Message') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('File') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Line') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="contentButtons">
|
||||
</div>
|
||||
</form>
|
||||
<table class="table-condensed">
|
||||
<tr class="row">
|
||||
<td class="col">
|
||||
<?php echo translate('Component') ?>
|
||||
<select class="form-control chosen" id="filter[Component]" onchange="filterLog(this)"><option value="">-----</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('Server') ?>
|
||||
<select class="form-control chosen" id="filter[ServerId]" onchange="filterLog(this)"><option value="">-----</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('Pid') ?>
|
||||
<select class="form-control chosen" id="filter[Pid]" onchange="filterLog(this)"><option value="">-----</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row">
|
||||
<td class="col">
|
||||
<?php echo translate('Level') ?>
|
||||
<select class="form-control chosen" id="filter[Level]" onchange="filterLog(this)"><option value="">---</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('File') ?>
|
||||
<select class="form-control chosen" id="filter[File]" onchange="filterLog(this)"><option value="">------</option></select>
|
||||
</td>
|
||||
<td class="col">
|
||||
<?php echo translate('Line') ?>
|
||||
<select class="form-control chosen" id="filter[Line]" onchange="filterLog(this)"><option value="">----</option></select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="reset" value="<?php echo translate('Reset') ?>" onclick="resetLog()"/>
|
||||
</div>
|
||||
<form name="logForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
||||
<table id="logTable" class="major">
|
||||
<thead class="thead-highlight">
|
||||
<tr>
|
||||
<th><?php echo translate('DateTime') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Component') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Server') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Pid') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Level') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Message') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('File') ?></th>
|
||||
<th class="table-th-nosort"><?php echo translate('Line') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="contentButtons">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="exportLog" class="overlay">
|
||||
<div class="overlayHeader">
|
||||
<div class="overlayTitle"><?php echo translate('ExportLog') ?></div>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) ) {
|
||||
if ( !canView('Events') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
@ -43,11 +43,15 @@ if ( $archivetype ) {
|
|||
if ( $mimetype ) {
|
||||
$filename = "zmExport.$file_ext";
|
||||
$filename_path = ZM_DIR_EXPORTS.'/'.$filename;
|
||||
Logger::Debug("downloading archive from $filename_path");
|
||||
if ( is_readable($filename_path) ) {
|
||||
header( "Content-type: application/$mimetype" );
|
||||
header( "Content-Disposition: attachment; filename=$filename");
|
||||
header("Content-type: application/$mimetype" );
|
||||
header("Content-Disposition: inline; filename=$filename");
|
||||
header('Content-Length: ' . filesize($filename_path) );
|
||||
set_time_limit(0);
|
||||
readfile( $filename_path );
|
||||
if ( ! @readfile( $filename_path ) ) {
|
||||
Error("Error sending $filename_path");
|
||||
}
|
||||
} else {
|
||||
Error("$filename_path does not exist or is not readable.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue