zoneminder/web/skins/classic/views/monitors.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
3.4 KiB
PHP
Raw Permalink Normal View History

2017-10-25 07:25:11 +08:00
<?php
//
2021-01-06 00:16:51 +08:00
// ZoneMinder web monitors view file, $Date$, $Revision$
2017-10-25 07:25:11 +08:00
// Copyright (C) 2001-2008 Philip Coombes
//
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canEdit('Monitors') ) {
2017-10-25 07:25:11 +08:00
$view = 'error';
return;
}
$monitors = ZM\Monitor::find(array('Id' => $_REQUEST['mids']));
2017-10-25 07:25:11 +08:00
$monitor = $monitors[0];
$servers = ZM\Server::find();
2017-10-25 07:25:11 +08:00
$ServersById = array();
foreach ( $servers as $S ) {
$ServersById[$S->Id()] = $S;
}
$storage_areas = ZM\Storage::find();
2017-10-25 07:25:11 +08:00
$StorageById = array();
foreach ( $storage_areas as $S ) {
$StorageById[$S->Id()] = $S;
}
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Function'));
2021-01-06 00:16:51 +08:00
getBodyTopHTML();
echo getNavBarHTML();
2017-10-25 07:25:11 +08:00
?>
<div id="page">
2021-01-06 00:16:51 +08:00
<h2 class="pt-2"><?php echo translate('Monitors') ?></h2>
2017-10-25 07:25:11 +08:00
<div id="content">
The following monitors will have these settings update when you click Save:<br/><br/>
<?php echo implode('<br/>', array_map(function($m){return $m->Id().' ' .$m->Name();}, $monitors)); ?>
<form name="contentForm" id="contentForm" method="post" action="?" onsubmit="$j('#contentButtons').hide();return true;">
<input type="hidden" name="view" value="monitors"/>
2017-10-25 07:25:11 +08:00
<input type="hidden" name="action" value="save"/>
<input type="hidden" name="object" value="Monitor"/>
<?php
echo implode(
"\n",
array_map(function($m){
2017-10-25 07:25:11 +08:00
return '<input type="hidden" name="mids[]" value="'.$m->Id().'"/>';
}, $monitors)
2017-10-25 07:25:11 +08:00
);
if ( count($ServersById) > 0 ) { ?>
<p class="Server"><label><?php echo translate('Server')?></label>
<?php echo htmlSelect('newMonitor[ServerId]', array(''=>'None')+$ServersById, $monitor->ServerId()); ?>
</p>
2017-10-25 07:25:11 +08:00
<?php
}
if ( count($StorageById) > 0 ) {
2017-10-25 07:25:11 +08:00
?>
<p class="Storage"><label><?php echo translate('Storage')?></label>
<?php echo htmlSelect('newMonitor[StorageId]', array(''=>'All')+$StorageById, $monitor->StorageId()); ?>
</p>
2017-10-25 07:25:11 +08:00
<?php
}
2017-10-25 07:25:11 +08:00
?>
<p class="Function"><label><?php echo translate('Function') ?></label>
2017-10-25 07:25:11 +08:00
<?php
$options = array();
foreach ( getEnumValues('Monitors', 'Function') as $opt ) {
$options[$opt] = translate('Fn'.$opt);
}
echo htmlSelect('newMonitor[Function]', $options, $monitor->Function());
2017-10-25 07:25:11 +08:00
?>
</p>
<p>
<label for="newMonitor[Enabled]"><?php echo translate('Enabled') ?></label>
<input type="checkbox" name="newMonitor[Enabled]" id="newMonitor[Enabled]" value="1"<?php if ( !empty($monitors[0]->Enabled()) ) { ?> checked="checked"<?php } ?>/>
</p>
<div id="contentButtons">
2018-04-17 23:48:59 +08:00
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
2021-01-06 00:16:51 +08:00
<button type="button" data-on-click="backWindow"><?php echo translate('Cancel') ?></button>
2017-10-25 07:25:11 +08:00
</div>
</form>
</div>
</div>
2021-01-06 00:16:51 +08:00
<?php xhtmlFooter() ?>