Merge branch 'always_show_ptz' into storageareas

This commit is contained in:
Isaac Connor 2016-04-04 11:47:29 -04:00
commit 197ae67313
4 changed files with 57 additions and 77 deletions

View File

@ -962,54 +962,43 @@ function daemonControl( $command, $daemon=false, $args=false )
function zmcControl( $monitor, $mode=false )
{
$row = NULL;
if ( $monitor['Type'] == "Local" )
{
$row = dbFetchOne( "select count(if(Function!='None',1,NULL)) as ActiveCount from Monitors where Device = ?", NULL, array($monitor['Device']) );
$zmcArgs = "-d ".$monitor['Device'];
}
else
{
$row = dbFetchOne( "select count(if(Function!='None',1,NULL)) as ActiveCount from Monitors where Id = ?", NULL, array($monitor['Id']) );
$zmcArgs = "-m ".$monitor['Id'];
}
$activeCount = $row['ActiveCount'];
if ( (!ZM_SERVER) or ( ZM_SERVER==$monitor[ServerId}) ) {
$row = NULL;
if ( $monitor['Type'] == "Local" )
{
$row = dbFetchOne( "select count(if(Function!='None',1,NULL)) as ActiveCount from Monitors where Device = ?", NULL, array($monitor['Device']) );
$zmcArgs = "-d ".$monitor['Device'];
}
else
{
$row = dbFetchOne( "select count(if(Function!='None',1,NULL)) as ActiveCount from Monitors where Id = ?", NULL, array($monitor['Id']) );
$zmcArgs = "-m ".$monitor['Id'];
}
$activeCount = $row['ActiveCount'];
if ( !$activeCount || $mode == "stop" )
{
daemonControl( "stop", "zmc", $zmcArgs );
}
else
{
if ( $mode == "restart" )
if ( !$activeCount || $mode == "stop" )
{
daemonControl( "stop", "zmc", $zmcArgs );
}
daemonControl( "start", "zmc", $zmcArgs );
else
{
if ( $mode == "restart" )
{
daemonControl( "stop", "zmc", $zmcArgs );
}
daemonControl( "start", "zmc", $zmcArgs );
}
}
}
function zmaControl( $monitor, $mode=false )
{
if ( !is_array( $monitor ) )
{
$monitor = dbFetchOne( "select C.*, M.* from Monitors as M left join Controls as C on (M.ControlId = C.Id ) where M.Id=?", NULL, array($monitor) );
}
if ( !$monitor || $monitor['Function'] == 'None' || $monitor['Function'] == 'Monitor' || $mode == "stop" )
{
if ( ZM_OPT_CONTROL )
if ( (!ZM_SERVER) or ( ZM_SERVER==$monitor[ServerId}) ) {
if ( !is_array( $monitor ) )
{
daemonControl( "stop", "zmtrack.pl", "-m ".$monitor['Id'] );
$monitor = dbFetchOne( "select C.*, M.* from Monitors as M left join Controls as C on (M.ControlId = C.Id ) where M.Id=?", NULL, array($monitor) );
}
daemonControl( "stop", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_FRAME_SERVER )
{
daemonControl( "stop", "zmf", "-m ".$monitor['Id'] );
}
}
else
{
if ( $mode == "restart" )
if ( !$monitor || $monitor['Function'] == 'None' || $monitor['Function'] == 'Monitor' || $mode == "stop" )
{
if ( ZM_OPT_CONTROL )
{
@ -1021,18 +1010,33 @@ function zmaControl( $monitor, $mode=false )
daemonControl( "stop", "zmf", "-m ".$monitor['Id'] );
}
}
if ( ZM_OPT_FRAME_SERVER )
else
{
daemonControl( "start", "zmf", "-m ".$monitor['Id'] );
}
daemonControl( "start", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_CONTROL && $monitor['Controllable'] && $monitor['TrackMotion'] && ( $monitor['Function'] == 'Modect' || $monitor['Function'] == 'Mocord' ) )
{
daemonControl( "start", "zmtrack.pl", "-m ".$monitor['Id'] );
}
if ( $mode == "reload" )
{
daemonControl( "reload", "zma", "-m ".$monitor['Id'] );
if ( $mode == "restart" )
{
if ( ZM_OPT_CONTROL )
{
daemonControl( "stop", "zmtrack.pl", "-m ".$monitor['Id'] );
}
daemonControl( "stop", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_FRAME_SERVER )
{
daemonControl( "stop", "zmf", "-m ".$monitor['Id'] );
}
}
if ( ZM_OPT_FRAME_SERVER )
{
daemonControl( "start", "zmf", "-m ".$monitor['Id'] );
}
daemonControl( "start", "zma", "-m ".$monitor['Id'] );
if ( ZM_OPT_CONTROL && $monitor['Controllable'] && $monitor['TrackMotion'] && ( $monitor['Function'] == 'Modect' || $monitor['Function'] == 'Mocord' ) )
{
daemonControl( "start", "zmtrack.pl", "-m ".$monitor['Id'] );
}
if ( $mode == "reload" )
{
daemonControl( "reload", "zma", "-m ".$monitor['Id'] );
}
}
}
}

View File

@ -79,8 +79,8 @@
border: 1px solid #006699;
text-align: center;
padding: 1px;
width: 96px;
height: 96px;
width: 100px;
height: 100px;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .arrowBtn {

View File

@ -243,7 +243,7 @@ function controlPanTilt( $monitor, $cmds )
ob_start();
?>
<div class="pantiltControls">
<div class="pantilLabel"><?php echo translate('PanTilt') ?></div>
<div class="pantiltLabel"><?php echo translate('PanTilt') ?></div>
<div class="pantiltButtons">
<?php
$hasPan = $monitor->CanPan;

View File

@ -33,14 +33,7 @@ if ( ! visibleMonitor( $mid ) ) {
return;
}
$sql = 'SELECT C.*, M.* FROM Monitors AS M LEFT JOIN Controls AS C ON (M.ControlId = C.Id ) WHERE M.Id = ?';
$monitor = new Monitor( $mid );
#dbFetchOne( $sql, NULL, array( $_REQUEST['mid'] ) );
if ( isset($_REQUEST['showControls']) )
$showControls = validInt($_REQUEST['showControls']);
else
$showControls = (canView( 'Control' ) && ($monitor->DefaultView() == 'Control'));
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView( 'Control' ) );
@ -82,23 +75,6 @@ xhtmlHeaders( __FILE__, $monitor->Name()." - ".translate('Feed') );
<div id="closeControl"><a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a></div>
<div id="menuControls">
<?php
if ( $showPtzControls )
{
if ( canView( 'Control' ) )
{
?>
<div id="controlControl"<?php echo $showControls?' class="hidden"':'' ?>><a id="controlLink" href="#" onclick="showPtzControls(); return( false );"><?php echo translate('Control') ?></a></div>
<?php
}
if ( canView( 'Events' ) )
{
?>
<div id="eventsControl"<?php echo $showControls?'':' class="hidden"' ?>><a id="eventsLink" href="#" onclick="showEvents(); return( false );"><?php echo translate('Events') ?></a></div>
<?php
}
}
?>
<?php
if ( canView( 'Control' ) && $monitor->Type() == "Local" )
{
?>
@ -168,7 +144,7 @@ if ( $showPtzControls )
foreach ( getSkinIncludes( 'includes/control_functions.php' ) as $includeFile )
require_once $includeFile;
?>
<div id="ptzControls" class="ptzControls<?php echo $showControls?'':' hidden' ?>">
<div id="ptzControls" class="ptzControls">
<?php echo ptzControls( $monitor ) ?>
</div>
<?php
@ -176,7 +152,7 @@ if ( $showPtzControls )
if ( canView( 'Events' ) )
{
?>
<div id="events"<?php echo $showControls?' class="hidden"':'' ?>>
<div id="events">
<table id="eventList" cellspacing="0">
<thead>
<tr>