2004-10-13 18:39:57 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web monitor groups file, $Date$, $Revision$
|
2006-01-17 19:32:47 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
|
2004-10-13 18:39:57 +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.
|
|
|
|
//
|
|
|
|
|
2006-01-24 00:25:01 +08:00
|
|
|
if ( !canView( 'System' ) )
|
2004-10-13 18:39:57 +08:00
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-24 00:25:01 +08:00
|
|
|
$result = mysql_query( "select * from Groups order by Name" );
|
2004-10-13 18:39:57 +08:00
|
|
|
if ( !$result )
|
|
|
|
die( mysql_error() );
|
|
|
|
$groups = array();
|
2005-11-21 23:30:07 +08:00
|
|
|
$selected = false;
|
2004-10-13 18:39:57 +08:00
|
|
|
while ( $row = mysql_fetch_assoc( $result ) )
|
|
|
|
{
|
2005-11-21 23:30:07 +08:00
|
|
|
if ( $row['Id'] == $cgroup )
|
|
|
|
{
|
|
|
|
$row['selected'] = true;
|
|
|
|
$selected = true;
|
|
|
|
}
|
2004-10-13 18:39:57 +08:00
|
|
|
$groups[] = $row;
|
|
|
|
}
|
2006-01-15 21:09:30 +08:00
|
|
|
mysql_free_result( $result );
|
2004-10-13 18:39:57 +08:00
|
|
|
?>
|
2004-12-29 03:22:23 +08:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2004-10-13 18:39:57 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
2005-05-06 20:24:57 +08:00
|
|
|
<title><?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangGroups ?></title>
|
2004-12-29 03:29:43 +08:00
|
|
|
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
|
|
|
|
<script type="text/javascript">
|
2006-01-24 00:25:01 +08:00
|
|
|
function newWindow(Url,Name,Width,Height)
|
|
|
|
{
|
|
|
|
var Win = window.open(Url,Name,"resizable,width="+Width+",height="+Height);
|
|
|
|
}
|
2004-10-13 18:39:57 +08:00
|
|
|
function closeWindow()
|
|
|
|
{
|
|
|
|
top.window.close();
|
|
|
|
}
|
2006-01-24 00:25:01 +08:00
|
|
|
function newGroup()
|
|
|
|
{
|
|
|
|
newWindow( '<?= $PHP_SELF ?>?view=group', 'zmGroup', <?= $jws['group']['w'] ?>, <?= $jws['group']['h'] ?> );
|
|
|
|
}
|
|
|
|
function editGroup()
|
2004-10-13 18:39:57 +08:00
|
|
|
{
|
2006-01-24 00:25:01 +08:00
|
|
|
for ( var i = 0; i < groups_form.gid.length; i++ )
|
|
|
|
{
|
|
|
|
if ( groups_form.gid[i].checked )
|
|
|
|
{
|
|
|
|
newWindow( '<?= $PHP_SELF ?>?view=group&gid='+groups_form.gid[i].value, 'zmGroup', <?= $jws['group']['w'] ?>, <?= $jws['group']['h'] ?> );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function deleteGroup()
|
|
|
|
{
|
|
|
|
groups_form.view.value='<?= $view ?>';
|
|
|
|
groups_form.action.value='delete';
|
|
|
|
groups_form.submit();
|
|
|
|
|
2004-10-13 18:39:57 +08:00
|
|
|
}
|
2005-11-21 23:30:07 +08:00
|
|
|
function configureButtons(element)
|
2004-10-13 18:39:57 +08:00
|
|
|
{
|
2006-01-24 00:25:01 +08:00
|
|
|
<?php
|
|
|
|
if ( canEdit('System' ) )
|
|
|
|
{
|
|
|
|
?>
|
2005-11-21 23:30:07 +08:00
|
|
|
var form = element.form;
|
|
|
|
if ( element.checked )
|
2004-10-13 18:39:57 +08:00
|
|
|
{
|
2006-01-24 00:25:01 +08:00
|
|
|
form.edit_btn.disabled = (element.value == 0);
|
2005-11-21 23:30:07 +08:00
|
|
|
form.delete_btn.disabled = (element.value == 0);
|
2004-10-13 18:39:57 +08:00
|
|
|
}
|
2006-01-24 00:25:01 +08:00
|
|
|
<?php
|
2004-10-13 18:39:57 +08:00
|
|
|
}
|
2006-01-24 00:25:01 +08:00
|
|
|
?>
|
2004-10-13 18:39:57 +08:00
|
|
|
}
|
|
|
|
window.focus();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2006-01-24 00:25:01 +08:00
|
|
|
<form name="groups_form" method="get" action="<?= $PHP_SELF ?>">
|
2004-10-13 18:39:57 +08:00
|
|
|
<input type="hidden" name="view" value="none">
|
2006-01-24 00:25:01 +08:00
|
|
|
<input type="hidden" name="action" value="cgroup">
|
2006-01-24 18:06:34 +08:00
|
|
|
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#7F7FB2">
|
|
|
|
<tr bgcolor="#FFFFFF"><td class="smallhead"><?= $zmSlangName ?></td><td class="smallhead"><?= $zmSlangMonitorIds ?></td><td class="smallhead"><?= $zmSlangSelect ?></tr>
|
|
|
|
<tr bgcolor="#CCCCCC">
|
|
|
|
<td align="left" class="text" style="white-space: nowrap;"><?= $zmSlangNoGroup ?></td>
|
|
|
|
<td align="left" class="text"><?= $zmSlangAll ?></td>
|
2005-11-21 23:30:07 +08:00
|
|
|
<td align="center"><input class="form-noborder" type="radio" name="gid" value="0"<?= !$selected?" checked":"" ?> onClick="configureButtons( this );"></td>
|
|
|
|
</tr>
|
2004-10-13 18:39:57 +08:00
|
|
|
<?php
|
2006-01-24 00:25:01 +08:00
|
|
|
foreach ( $groups as $group )
|
2004-10-13 18:39:57 +08:00
|
|
|
{
|
|
|
|
?>
|
2006-01-24 18:06:34 +08:00
|
|
|
<tr bgcolor="#FFFFFF">
|
|
|
|
<td align="left" class="text" style="white-space: nowrap;"><?= $group['Name'] ?></td>
|
|
|
|
<td align="left" class="text"><?= monitorIdsToNames( $group['MonitorIds'], 30 ) ?></td>
|
2005-11-21 23:30:07 +08:00
|
|
|
<td align="center"><input class="form-noborder" type="radio" name="gid" value="<?= $group['Id'] ?>"<?= $group['selected']?" checked":"" ?> onClick="configureButtons( this );"></td>
|
2004-10-13 18:39:57 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
2004-10-13 19:11:29 +08:00
|
|
|
}
|
2004-10-13 18:39:57 +08:00
|
|
|
?>
|
2006-01-24 18:06:34 +08:00
|
|
|
<tr bgcolor="#FFFFFF">
|
|
|
|
<td align="right" colspan="3" class="text"><img src="graphics/spacer.gif" width="1" height="4"></td>
|
2004-10-13 18:39:57 +08:00
|
|
|
</tr>
|
2006-01-24 18:06:34 +08:00
|
|
|
<tr bgcolor="#FFFFFF">
|
2004-10-13 18:39:57 +08:00
|
|
|
<td align="right" colspan="3" class="text">
|
2006-01-24 00:25:01 +08:00
|
|
|
<input type="submit" value="<?= $zmSlangApply ?>" class="form" onClick="groups_form.action.value='cgroup'; groups_form.submit();">
|
|
|
|
<input type="button" value="<?= $zmSlangNew ?>" class="form" onClick="newGroup()"<?= canEdit('System')?"":" disabled" ?>>
|
|
|
|
<input type="button" name="edit_btn" value="<?= $zmSlangEdit ?>" class="form" onClick="editGroup()"<?= $selected&&canEdit('System')?"":" disabled" ?>>
|
|
|
|
<input type="button" name="delete_btn" value="<?= $zmSlangDelete ?>" class="form" onClick="deleteGroup()"<?= $selected&&canEdit('System')?"":" disabled" ?>>
|
2004-10-13 18:39:57 +08:00
|
|
|
<input type="button" value="<?= $zmSlangCancel ?>" class="form" onClick="closeWindow();"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2005-01-16 01:46:35 +08:00
|
|
|
</form>
|
2004-10-13 18:39:57 +08:00
|
|
|
</body>
|
|
|
|
</html>
|