2005-02-24 18:43:29 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web run state view file, $Date$, $Revision$
|
2006-01-17 19:32:47 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
|
2005-02-24 18:43:29 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
2005-03-21 03:47:04 +08:00
|
|
|
if ( !canEdit( 'Monitors' ) )
|
2005-02-24 18:43:29 +08:00
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-11-07 20:05:19 +08:00
|
|
|
$result = mysql_query( "select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'" );
|
2005-02-24 18:43:29 +08:00
|
|
|
if ( !$result )
|
|
|
|
die( mysql_error() );
|
|
|
|
$monitor = mysql_fetch_assoc( $result );
|
2006-01-15 21:09:30 +08:00
|
|
|
mysql_free_result( $result );
|
2005-02-24 18:43:29 +08:00
|
|
|
|
2006-11-07 20:05:19 +08:00
|
|
|
$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 );
|
|
|
|
|
2005-02-24 18:43:29 +08:00
|
|
|
$presets = array();
|
|
|
|
for ( $i = 1; $i <= $monitor['NumPresets']; $i++ )
|
|
|
|
{
|
2006-11-07 20:05:19 +08:00
|
|
|
$presets[$i] = "$zmSlangPreset $i";
|
|
|
|
if ( $labels[$i] )
|
|
|
|
{
|
|
|
|
$presets[$i] .= " (".htmlentities(addslashes($labels[$i])).")";
|
|
|
|
}
|
2005-02-24 18:43:29 +08:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
2005-05-06 20:24:57 +08:00
|
|
|
<title><?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangSetPreset ?></title>
|
2005-02-24 18:43:29 +08:00
|
|
|
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
|
|
|
|
<script type="text/javascript">
|
|
|
|
<?php
|
|
|
|
if ( !empty($refresh_parent) )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
opener.location.reload(true);
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
window.focus();
|
2006-11-07 20:05:19 +08:00
|
|
|
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 = "";
|
|
|
|
}
|
|
|
|
}
|
2005-02-24 18:43:29 +08:00
|
|
|
function refreshWindow()
|
|
|
|
{
|
|
|
|
window.location.reload(true);
|
|
|
|
}
|
|
|
|
function closeWindow()
|
|
|
|
{
|
|
|
|
window.close();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<form name="preset_form" method="post" action="<?= $PHP_SELF ?>">
|
|
|
|
<input type="hidden" name="view" value="<?= $view ?>">
|
|
|
|
<input type="hidden" name="mid" value="<?= $mid ?>">
|
|
|
|
<input type="hidden" name="action" value="control">
|
|
|
|
<input type="hidden" name="control" value="preset_set">
|
2006-11-07 20:05:19 +08:00
|
|
|
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
2005-02-24 18:43:29 +08:00
|
|
|
<tr>
|
2006-11-07 20:05:19 +08:00
|
|
|
<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>
|
2005-02-24 18:43:29 +08:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<table border="0" cellspacing="0" cellpadding="1" width="100%">
|
|
|
|
<tr>
|
|
|
|
<td align="right"><input type="submit" value="<?= $zmSlangSave ?>" class="form"> <input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow()"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2006-11-07 20:05:19 +08:00
|
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
|
|
updateLabel( document.preset_form );
|
|
|
|
</script>
|
2005-02-24 18:43:29 +08:00
|
|
|
</body>
|
|
|
|
</html>
|