Merge branch 'storageareas' into zma_to_thread
This commit is contained in:
commit
3ce46d3fed
|
@ -316,7 +316,7 @@ private $control_fields = array(
|
||||||
} // end function save
|
} // end function save
|
||||||
|
|
||||||
function zmcControl( $mode=false ) {
|
function zmcControl( $mode=false ) {
|
||||||
if ( (!defined('ZM_SERVER_ID')) or ( ZM_SERVER_ID==$this->{'ServerId'} ) ) {
|
if ( (!defined('ZM_SERVER_ID')) or ( array_key_exists('ServerId', $this) and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) {
|
||||||
if ( $this->{'Type'} == 'Local' ) {
|
if ( $this->{'Type'} == 'Local' ) {
|
||||||
$zmcArgs = '-d '.$this->{'Device'};
|
$zmcArgs = '-d '.$this->{'Device'};
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +371,7 @@ Logger::Debug("sending command to $url");
|
||||||
} // end function zmcControl
|
} // end function zmcControl
|
||||||
|
|
||||||
function zmaControl( $mode=false ) {
|
function zmaControl( $mode=false ) {
|
||||||
if ( (!defined('ZM_SERVER_ID')) or ( ZM_SERVER_ID==$this->{'ServerId'} ) ) {
|
if ( (!defined('ZM_SERVER_ID')) or ( array_key_exists('ServerId', $this) and (ZM_SERVER_ID==$this->{'ServerId'}) ) ) {
|
||||||
if ( $this->{'Function'} == 'None' || $this->{'Function'} == 'Monitor' || $mode == 'stop' ) {
|
if ( $this->{'Function'} == 'None' || $this->{'Function'} == 'Monitor' || $mode == 'stop' ) {
|
||||||
if ( ZM_OPT_CONTROL ) {
|
if ( ZM_OPT_CONTROL ) {
|
||||||
daemonControl( 'stop', 'zmtrack.pl', '-m '.$this->{'Id'} );
|
daemonControl( 'stop', 'zmtrack.pl', '-m '.$this->{'Id'} );
|
||||||
|
|
|
@ -556,7 +556,7 @@ Logger::Debug('coloumns:'.print_r($columns));
|
||||||
$maxSeq = dbFetchOne( 'SELECT max(Sequence) AS MaxSequence FROM Monitors', 'MaxSequence' );
|
$maxSeq = dbFetchOne( 'SELECT max(Sequence) AS MaxSequence FROM Monitors', 'MaxSequence' );
|
||||||
$changes[] = 'Sequence = '.($maxSeq+1);
|
$changes[] = 'Sequence = '.($maxSeq+1);
|
||||||
|
|
||||||
dbQuery( 'INSERT INTO Monitors SET '.implode( ', ', $changes ) );
|
if ( dbQuery( 'INSERT INTO Monitors SET '.implode( ', ', $changes ) ) ) {
|
||||||
$mid = dbInsertId();
|
$mid = dbInsertId();
|
||||||
$zoneArea = $_REQUEST['newMonitor']['Width'] * $_REQUEST['newMonitor']['Height'];
|
$zoneArea = $_REQUEST['newMonitor']['Width'] * $_REQUEST['newMonitor']['Height'];
|
||||||
dbQuery( "insert into Zones set MonitorId = ?, Name = 'All', Type = 'Active', Units = 'Percent', NumCoords = 4, Coords = ?, Area=?, AlarmRGB = 0xff0000, CheckMethod = 'Blobs', MinPixelThreshold = 25, MinAlarmPixels=?, MaxAlarmPixels=?, FilterX = 3, FilterY = 3, MinFilterPixels=?, MaxFilterPixels=?, MinBlobPixels=?, MinBlobs = 1", array( $mid, sprintf( "%d,%d %d,%d %d,%d %d,%d", 0, 0, $_REQUEST['newMonitor']['Width']-1, 0, $_REQUEST['newMonitor']['Width']-1, $_REQUEST['newMonitor']['Height']-1, 0, $_REQUEST['newMonitor']['Height']-1 ), $zoneArea, intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*2)/100) ) );
|
dbQuery( "insert into Zones set MonitorId = ?, Name = 'All', Type = 'Active', Units = 'Percent', NumCoords = 4, Coords = ?, Area=?, AlarmRGB = 0xff0000, CheckMethod = 'Blobs', MinPixelThreshold = 25, MinAlarmPixels=?, MaxAlarmPixels=?, FilterX = 3, FilterY = 3, MinFilterPixels=?, MaxFilterPixels=?, MinBlobPixels=?, MinBlobs = 1", array( $mid, sprintf( "%d,%d %d,%d %d,%d %d,%d", 0, 0, $_REQUEST['newMonitor']['Width']-1, 0, $_REQUEST['newMonitor']['Width']-1, $_REQUEST['newMonitor']['Height']-1, 0, $_REQUEST['newMonitor']['Height']-1 ), $zoneArea, intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*2)/100) ) );
|
||||||
|
@ -568,6 +568,10 @@ Logger::Debug('coloumns:'.print_r($columns));
|
||||||
if ( isset($_COOKIE['zmGroup']) ) {
|
if ( isset($_COOKIE['zmGroup']) ) {
|
||||||
dbQuery( 'INSERT INTO Groups_Monitors (GroupId,MonitorId) VALUES (?,?)', array($_COOKIE['zmGroup'],$mid) );
|
dbQuery( 'INSERT INTO Groups_Monitors (GroupId,MonitorId) VALUES (?,?)', array($_COOKIE['zmGroup'],$mid) );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Error("Error saving new Monitor.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Error("Users with Monitors restrictions cannot create new monitors.");
|
Error("Users with Monitors restrictions cannot create new monitors.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,8 +142,9 @@ function dbQuery( $sql, $params=NULL ) {
|
||||||
}
|
}
|
||||||
} catch(PDOException $e) {
|
} catch(PDOException $e) {
|
||||||
Error( "SQL-ERR '".$e->getMessage()."', statement was '".$sql."' params:" . ($params?implode(',',$params):'') );
|
Error( "SQL-ERR '".$e->getMessage()."', statement was '".$sql."' params:" . ($params?implode(',',$params):'') );
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
return( $result );
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbFetchOne( $sql, $col=false, $params=NULL ) {
|
function dbFetchOne( $sql, $col=false, $params=NULL ) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ monitorData[monitorData.length] = {
|
||||||
'connKey': <?php echo $monitor->connKey() ?>,
|
'connKey': <?php echo $monitor->connKey() ?>,
|
||||||
'width': <?php echo $monitor->Width() ?>,
|
'width': <?php echo $monitor->Width() ?>,
|
||||||
'height':<?php echo $monitor->Height() ?>,
|
'height':<?php echo $monitor->Height() ?>,
|
||||||
'server_url': '<?php echo $monitor->Server()->Url().(ZM_MIN_STREAMING_PORT?':'.(ZM_MIN_STREAMING_PORT+$monitor->Id()):'').$_SERVER['PHP_SELF'] ?>',
|
'server_url': '<?php echo $monitor->Server()->Url().$_SERVER['PHP_SELF'] ?>',
|
||||||
'onclick': function(){createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );}
|
'onclick': function(){createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );}
|
||||||
};
|
};
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -32,6 +32,9 @@ if ( $_REQUEST['id'] ) {
|
||||||
$newServer = array();
|
$newServer = array();
|
||||||
$newServer['Name'] = translate('NewServer');
|
$newServer['Name'] = translate('NewServer');
|
||||||
$newServer['Hostname'] = '';
|
$newServer['Hostname'] = '';
|
||||||
|
$newServer['zmstats'] = '';
|
||||||
|
$newServer['zmaudit'] = '';
|
||||||
|
$newServer['zmtrigger'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$focusWindow = true;
|
$focusWindow = true;
|
||||||
|
|
|
@ -36,6 +36,7 @@ if ( $_REQUEST['id'] ) {
|
||||||
$newStorage['Type'] = 'local';
|
$newStorage['Type'] = 'local';
|
||||||
$newStorage['Scheme'] = 'Medium';
|
$newStorage['Scheme'] = 'Medium';
|
||||||
$newStorage['StorageId'] = '';
|
$newStorage['StorageId'] = '';
|
||||||
|
$newStorage['ServerId'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$type_options = array( 'local' => translate('Local'), 's3fs' => translate('s3fs') );
|
$type_options = array( 'local' => translate('Local'), 's3fs' => translate('s3fs') );
|
||||||
|
|
Loading…
Reference in New Issue