Bug 380 - Added control preset labels
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2037 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
cd709e4f2c
commit
f6e871932f
|
@ -17,6 +17,16 @@ update Filters set Background = 1 where (AutoArchive = 1 or AutoVideo = 1 or Aut
|
||||||
--
|
--
|
||||||
alter table Monitors add column DefaultView enum ('Events','Control') not null default 'Events' after ReturnDelay;
|
alter table Monitors add column DefaultView enum ('Events','Control') not null default 'Events' after ReturnDelay;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Create new preset labels table
|
||||||
|
--
|
||||||
|
CREATE TABLE `ControlPresets` (
|
||||||
|
`MonitorId` int(10) unsigned NOT NULL default '0',
|
||||||
|
`Preset` int(10) unsigned NOT NULL default '0',
|
||||||
|
`Label` varchar(64) NOT NULL default '',
|
||||||
|
PRIMARY KEY (`MonitorId`,`Preset`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- These are optional, but we might as well do it now
|
-- These are optional, but we might as well do it now
|
||||||
--
|
--
|
||||||
|
|
|
@ -239,7 +239,7 @@ if ( !empty($action) )
|
||||||
{
|
{
|
||||||
if ( $action == "control" )
|
if ( $action == "control" )
|
||||||
{
|
{
|
||||||
$result = mysql_query( "select * from Monitors as M inner join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'" );
|
$result = mysql_query( "select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'" );
|
||||||
if ( !$result )
|
if ( !$result )
|
||||||
die( mysql_error() );
|
die( mysql_error() );
|
||||||
$monitor = mysql_fetch_assoc( $result );
|
$monitor = mysql_fetch_assoc( $result );
|
||||||
|
@ -911,6 +911,26 @@ if ( !empty($action) )
|
||||||
}
|
}
|
||||||
elseif ( $control == "preset_set" )
|
elseif ( $control == "preset_set" )
|
||||||
{
|
{
|
||||||
|
if ( canEdit( 'Control' ) )
|
||||||
|
{
|
||||||
|
$sql = "select * from ControlPresets where MonitorId = '".$monitor['Id']."' and Preset = '".$preset."'";
|
||||||
|
$result = mysql_query( $sql );
|
||||||
|
if ( !$result )
|
||||||
|
die( mysql_error() );
|
||||||
|
$row = mysql_fetch_assoc( $result );
|
||||||
|
mysql_free_result( $result );
|
||||||
|
if ( $new_label != $row['Label'] )
|
||||||
|
{
|
||||||
|
if ( $new_label )
|
||||||
|
$sql = "replace into ControlPresets ( MonitorId, Preset, Label ) values ( '".$monitor['Id']."', '".$preset."', '".addslashes($new_label)."' )";
|
||||||
|
else
|
||||||
|
$sql = "delete from ControlPresets where MonitorId = '".$monitor['Id']."' and Preset = '".$preset."'";
|
||||||
|
$result = mysql_query( $sql );
|
||||||
|
if ( !$result )
|
||||||
|
die( mysql_error() );
|
||||||
|
$refresh_parent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
$ctrl_command .= " --preset ".$preset;
|
$ctrl_command .= " --preset ".$preset;
|
||||||
$view = 'none';
|
$view = 'none';
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,11 +428,22 @@ function controlPreset( command )
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<?php
|
<?php
|
||||||
|
$sql = "select * from ControlPresets where MonitorId = '".$monitor['Id']."'";
|
||||||
|
$result = mysql_query( $sql );
|
||||||
|
if ( !$result )
|
||||||
|
die( mysql_error() );
|
||||||
|
$labels = array();
|
||||||
|
while( $row = mysql_fetch_assoc( $result ) )
|
||||||
|
{
|
||||||
|
$labels[$row['Preset']] = $row['Label'];
|
||||||
|
}
|
||||||
|
mysql_free_result( $result );
|
||||||
|
|
||||||
$preset_break = (int)(($monitor['NumPresets']+1)/((int)(($monitor['NumPresets']-1)/MAX_PRESETS)+1));
|
$preset_break = (int)(($monitor['NumPresets']+1)/((int)(($monitor['NumPresets']-1)/MAX_PRESETS)+1));
|
||||||
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ )
|
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ )
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<input type="button" class="numbutton" value="<?= $i ?>" onClick="controlPreset( '<?= $cmds['PresetGoto'] ?><?=$i?>' );"><?php (($i%$preset_break)==0)?"<br>":" " ?>
|
<input type="button" class="numbutton" title="<?= $labels[$i]?$labels[$i]:"" ?>" value="<?= $i ?>" onClick="controlPreset( '<?= $cmds['PresetGoto'] ?><?=$i?>' );"><?php (($i%$preset_break)==0)?"<br>":" " ?>
|
||||||
<?php
|
<?php
|
||||||
if ( $i && (($i%$preset_break) == 0) )
|
if ( $i && (($i%$preset_break) == 0) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,7 @@ $jws = array(
|
||||||
'montage' => array( 'w'=>10, 'h'=>20 ),
|
'montage' => array( 'w'=>10, 'h'=>20 ),
|
||||||
'optionhelp' => array( 'w'=>320, 'h'=>284 ),
|
'optionhelp' => array( 'w'=>320, 'h'=>284 ),
|
||||||
'options' => array( 'w'=>780, 'h'=>540 ),
|
'options' => array( 'w'=>780, 'h'=>540 ),
|
||||||
'preset' => array( 'w'=>240, 'h'=>90 ),
|
'preset' => array( 'w'=>400, 'h'=>90 ),
|
||||||
'restarting' => array( 'w'=>250, 'h'=>150 ),
|
'restarting' => array( 'w'=>250, 'h'=>150 ),
|
||||||
'settings' => array( 'w'=>200, 'h'=>225 ),
|
'settings' => array( 'w'=>200, 'h'=>225 ),
|
||||||
'state' => array( 'w'=>300, 'h'=>120 ),
|
'state' => array( 'w'=>300, 'h'=>120 ),
|
||||||
|
|
|
@ -134,7 +134,6 @@ foreach ( $tabs as $name=>$value )
|
||||||
<td class="nontab"> </td>
|
<td class="nontab"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
||||||
<form name="control_form" method="post" action="<?= $PHP_SELF ?>" onsubmit="return validateForm( document.control_form )">
|
<form name="control_form" method="post" action="<?= $PHP_SELF ?>" onsubmit="return validateForm( document.control_form )">
|
||||||
<input type="hidden" name="view" value="<?= $view ?>">
|
<input type="hidden" name="view" value="<?= $view ?>">
|
||||||
<input type="hidden" name="tab" value="<?= $tab ?>">
|
<input type="hidden" name="tab" value="<?= $tab ?>">
|
||||||
|
@ -288,6 +287,7 @@ if ( $tab != 'presets' )
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" class="smallhead" width="50%"><?= $zmSlangParameter ?></td><td align="left" class="smallhead" width="50%"><?= $zmSlangValue ?></td>
|
<td align="left" class="smallhead" width="50%"><?= $zmSlangParameter ?></td><td align="left" class="smallhead" width="50%"><?= $zmSlangValue ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -459,7 +459,7 @@ switch ( $tab )
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" align="right"><input type="submit" value="<?= $zmSlangSave ?>" class="form"<?php if ( !canEdit( 'Control' ) ) { ?> disabled<?php } ?>> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow()"></td>
|
<td colspan="2" align="right"><input type="submit" value="<?= $zmSlangSave ?>" class="form"<?php if ( !canEdit( 'Control' ) ) { ?> disabled<?php } ?>> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow()"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -24,16 +24,31 @@ if ( !canEdit( 'Monitors' ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = mysql_query( "select * from Monitors as M inner join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'" );
|
$result = mysql_query( "select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'" );
|
||||||
if ( !$result )
|
if ( !$result )
|
||||||
die( mysql_error() );
|
die( mysql_error() );
|
||||||
$monitor = mysql_fetch_assoc( $result );
|
$monitor = mysql_fetch_assoc( $result );
|
||||||
mysql_free_result( $result );
|
mysql_free_result( $result );
|
||||||
|
|
||||||
|
$sql = "select * from ControlPresets where MonitorId = '".$monitor['Id']."'";
|
||||||
|
$result = mysql_query( $sql );
|
||||||
|
if ( !$result )
|
||||||
|
die( mysql_error() );
|
||||||
|
$labels = array();
|
||||||
|
while( $row = mysql_fetch_assoc( $result ) )
|
||||||
|
{
|
||||||
|
$labels[$row['Preset']] = $row['Label'];
|
||||||
|
}
|
||||||
|
mysql_free_result( $result );
|
||||||
|
|
||||||
$presets = array();
|
$presets = array();
|
||||||
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ )
|
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ )
|
||||||
{
|
{
|
||||||
$presets[$i] = "Preset $i";
|
$presets[$i] = "$zmSlangPreset $i";
|
||||||
|
if ( $labels[$i] )
|
||||||
|
{
|
||||||
|
$presets[$i] .= " (".htmlentities(addslashes($labels[$i])).")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
@ -51,6 +66,27 @@ opener.location.reload(true);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
window.focus();
|
window.focus();
|
||||||
|
var labels = new Array();
|
||||||
|
<?php
|
||||||
|
foreach ( $labels as $index=>$label )
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
labels[<?= $index ?>] = "<?= htmlentities(addslashes($label)) ?>";
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
function updateLabel( form )
|
||||||
|
{
|
||||||
|
var preset_index = form.preset.options[form.preset.selectedIndex].value;
|
||||||
|
if ( labels[preset_index] )
|
||||||
|
{
|
||||||
|
form.new_label.value = labels[preset_index];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
form.new_label.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
function refreshWindow()
|
function refreshWindow()
|
||||||
{
|
{
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
|
@ -62,24 +98,28 @@ function closeWindow()
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
|
||||||
<tr>
|
|
||||||
<td colspan="4" align="center" class="head">ZoneMinder - <?= $zmSlangSetPreset ?></td>
|
|
||||||
</tr>
|
|
||||||
<form name="preset_form" method="post" action="<?= $PHP_SELF ?>">
|
<form name="preset_form" method="post" action="<?= $PHP_SELF ?>">
|
||||||
<input type="hidden" name="view" value="<?= $view ?>">
|
<input type="hidden" name="view" value="<?= $view ?>">
|
||||||
<input type="hidden" name="mid" value="<?= $mid ?>">
|
<input type="hidden" name="mid" value="<?= $mid ?>">
|
||||||
<input type="hidden" name="action" value="control">
|
<input type="hidden" name="action" value="control">
|
||||||
<input type="hidden" name="control" value="preset_set">
|
<input type="hidden" name="control" value="preset_set">
|
||||||
|
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" align="center"><?= buildSelect( "preset", $presets ) ?></td>
|
<td colspan="4" align="center" class="head">ZoneMinder - <?= $zmSlangSetPreset ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><?= buildSelect( "preset", $presets, "updateLabel( this.form )" ) ?></td>
|
||||||
|
<td align="left" class="text"><?= $zmSlangNewLabel ?> <input type="text" name="new_label" value="<?= $new_user['MonitorIds'] ?>" size="16" class="form"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table border="0" cellspacing="0" cellpadding="1" width="100%">
|
<table border="0" cellspacing="0" cellpadding="1" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right"><input type="submit" value="<?= $zmSlangSave ?>" class="form"> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow()"></td>
|
<td align="right"><input type="submit" value="<?= $zmSlangSave ?>" class="form"> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow()"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
|
||||||
</table>
|
</table>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
updateLabel( document.preset_form );
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -340,6 +340,7 @@ $zmSlangInclude = 'Include';
|
||||||
$zmSlangIn = 'In';
|
$zmSlangIn = 'In';
|
||||||
$zmSlangInverted = 'Inverted';
|
$zmSlangInverted = 'Inverted';
|
||||||
$zmSlangIris = 'Iris';
|
$zmSlangIris = 'Iris';
|
||||||
|
$zmSlangLabel = 'Label';
|
||||||
$zmSlangLanguage = 'Language';
|
$zmSlangLanguage = 'Language';
|
||||||
$zmSlangLast = 'Last';
|
$zmSlangLast = 'Last';
|
||||||
$zmSlangLimitResultsPost = 'results only;'; // This is used at the end of the phrase 'Limit to first N results only'
|
$zmSlangLimitResultsPost = 'results only;'; // This is used at the end of the phrase 'Limit to first N results only'
|
||||||
|
@ -437,6 +438,7 @@ $zmSlangNear = 'Near';
|
||||||
$zmSlangNetwork = 'Network';
|
$zmSlangNetwork = 'Network';
|
||||||
$zmSlangNewGroup = 'New Group';
|
$zmSlangNewGroup = 'New Group';
|
||||||
$zmSlangNew = 'New';
|
$zmSlangNew = 'New';
|
||||||
|
$zmSlangNewLabel = 'New Label';
|
||||||
$zmSlangNewPassword = 'New Password';
|
$zmSlangNewPassword = 'New Password';
|
||||||
$zmSlangNewState = 'New State';
|
$zmSlangNewState = 'New State';
|
||||||
$zmSlangNewUser = 'New User';
|
$zmSlangNewUser = 'New User';
|
||||||
|
|
Loading…
Reference in New Issue