Further PTZ preset tweaks
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2958 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
1e2ecf0947
commit
93b955813f
|
@ -11,9 +11,8 @@ if ( canView( 'Control', $_REQUEST['id'] ) )
|
||||||
|
|
||||||
$ctrlCommand = buildControlCommand( $monitor );
|
$ctrlCommand = buildControlCommand( $monitor );
|
||||||
|
|
||||||
if ( $_REQUEST['control'] != 'null' )
|
if ( $ctrlCommand )
|
||||||
{
|
{
|
||||||
$ctrlCommand .= " --command=".$_REQUEST['control'];
|
|
||||||
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
||||||
if ( !$socket )
|
if ( !$socket )
|
||||||
ajaxError( "socket_create() failed: ".socket_strerror(socket_last_error()) );
|
ajaxError( "socket_create() failed: ".socket_strerror(socket_last_error()) );
|
||||||
|
|
|
@ -172,17 +172,12 @@ if ( !empty($action) )
|
||||||
$mid = validInt($_REQUEST['mid']);
|
$mid = validInt($_REQUEST['mid']);
|
||||||
if ( $action == "control" )
|
if ( $action == "control" )
|
||||||
{
|
{
|
||||||
$control = validStr($_REQUEST['control']);
|
|
||||||
if ( !empty( $_REQUEST['controlParms'] ) )
|
|
||||||
$control .= $_REQUEST['controlParms'];
|
|
||||||
|
|
||||||
$monitor = dbFetchOne( "select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id) where M.Id = '".dbEscape($mid)."'" );
|
$monitor = dbFetchOne( "select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id) where M.Id = '".dbEscape($mid)."'" );
|
||||||
|
|
||||||
$ctrlCommand = buildControlCommand( $monitor );
|
$ctrlCommand = buildControlCommand( $monitor );
|
||||||
|
|
||||||
if ( $control != 'null' )
|
if ( $ctrlCommand )
|
||||||
{
|
{
|
||||||
$ctrlCommand .= " --command=".$control;
|
|
||||||
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
||||||
if ( $socket < 0 )
|
if ( $socket < 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -388,6 +388,7 @@ function buildControlCommand( $monitor )
|
||||||
{
|
{
|
||||||
// No command, probably in blind spot in middle
|
// No command, probably in blind spot in middle
|
||||||
$_REQUEST['control'] = 'null';
|
$_REQUEST['control'] = 'null';
|
||||||
|
return( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -935,24 +936,26 @@ function buildControlCommand( $monitor )
|
||||||
$_REQUEST['control'] = 'presetGoto';
|
$_REQUEST['control'] = 'presetGoto';
|
||||||
$ctrlCommand .= " --preset=".$matches[1];
|
$ctrlCommand .= " --preset=".$matches[1];
|
||||||
}
|
}
|
||||||
elseif ( $_REQUEST['control'] == "presetGoto" && !empty($_REQUEST['controlParm']) )
|
elseif ( $_REQUEST['control'] == "presetGoto" && !empty($_REQUEST['preset']) )
|
||||||
{
|
{
|
||||||
$ctrlCommand .= " --preset=".$_REQUEST['controlParm'];
|
$ctrlCommand .= " --preset=".$_REQUEST['preset'];
|
||||||
}
|
}
|
||||||
elseif ( $_REQUEST['control'] == "presetSet" )
|
elseif ( $_REQUEST['control'] == "presetSet" )
|
||||||
{
|
{
|
||||||
if ( canEdit( 'Control' ) )
|
if ( canEdit( 'Control' ) )
|
||||||
{
|
{
|
||||||
$sql = "select * from ControlPresets where MonitorId = '".$monitor['Id']."' and Preset = '".$preset."'";
|
$preset = validInt($_REQUEST['preset']);
|
||||||
$row = dbFetchOne( $sql );
|
$newLabel = validJsStr($_REQUEST['newLabel']);
|
||||||
if ( $new_label != $row['Label'] )
|
$row = dbFetchOne( "select * from ControlPresets where MonitorId = '".$monitor['Id']."' and Preset = '".dbEscape($preset)."'" );
|
||||||
|
if ( $newLabel != $row['Label'] )
|
||||||
{
|
{
|
||||||
if ( $new_label )
|
if ( $newLabel )
|
||||||
$sql = "replace into ControlPresets ( MonitorId, Preset, Label ) values ( '".$monitor['Id']."', '".$preset."', '".addslashes($new_label)."' )";
|
$sql = "replace into ControlPresets ( MonitorId, Preset, Label ) values ( '".$monitor['Id']."', '".dbEscape($preset)."', '".dbEscape($newLabel)."' )";
|
||||||
else
|
else
|
||||||
$sql = "delete from ControlPresets where MonitorId = '".$monitor['Id']."' and Preset = '".$preset."'";
|
$sql = "delete from ControlPresets where MonitorId = '".$monitor['Id']."' and Preset = '".dbEscape($preset)."'";
|
||||||
dbQuery( $sql );
|
dbQuery( $sql );
|
||||||
}
|
}
|
||||||
|
$ctrlCommand .= " --preset=".$preset;
|
||||||
}
|
}
|
||||||
$ctrlCommand .= " --preset=".$preset;
|
$ctrlCommand .= " --preset=".$preset;
|
||||||
}
|
}
|
||||||
|
@ -961,5 +964,6 @@ function buildControlCommand( $monitor )
|
||||||
$ctrlCommand .= " --xcoord=$x --ycoord=$y";
|
$ctrlCommand .= " --xcoord=$x --ycoord=$y";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$ctrlCommand .= " --command=".$_REQUEST['control'];
|
||||||
return( $ctrlCommand );
|
return( $ctrlCommand );
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ xhtmlHeaders(__FILE__, $SLANG['SetPreset'] );
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<form name="contentForm" id="contentForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
<form name="contentForm" id="contentForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
||||||
<input type="hidden" name="view" value="<?= $view ?>"/>
|
<input type="hidden" name="view" value="none"/>
|
||||||
<input type="hidden" name="mid" value="<?= $monitor['Id'] ?>"/>
|
<input type="hidden" name="mid" value="<?= $monitor['Id'] ?>"/>
|
||||||
<input type="hidden" name="action" value="control"/>
|
<input type="hidden" name="action" value="control"/>
|
||||||
<input type="hidden" name="control" value="presetSet"/>
|
<input type="hidden" name="control" value="presetSet"/>
|
||||||
|
|
|
@ -150,7 +150,7 @@ function controlPresets( $monitor, $cmds )
|
||||||
?>
|
?>
|
||||||
<div class="presetControls">
|
<div class="presetControls">
|
||||||
<div>
|
<div>
|
||||||
<form method="get" action="<?= $_SERVER['PHP_SELF'] ?>">
|
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
||||||
<div class="hidden">
|
<div class="hidden">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="hidden" name="view" value="<?= $_REQUEST['view'] ?>"/>
|
<input type="hidden" name="view" value="<?= $_REQUEST['view'] ?>"/>
|
||||||
|
@ -164,7 +164,7 @@ function controlPresets( $monitor, $cmds )
|
||||||
for ( $i = 1; $i <= min($monitor['NumPresets'],MAX_PRESETS); $i++ )
|
for ( $i = 1; $i <= min($monitor['NumPresets'],MAX_PRESETS); $i++ )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<input type="submit" class="ptzNumBtn" title="<?= isset($labels[$i])?$labels[$i]:"" ?>" name="controlParm" value="<?= $i ?>"/>
|
<input type="submit" class="ptzNumBtn" title="<?= isset($labels[$i])?$labels[$i]:"" ?>" name="preset" value="<?= $i ?>"/>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue