zoneminder/web/ajax/modals/settings.php

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

65 lines
2.9 KiB
PHP
Raw Normal View History

<?php
2020-10-04 05:51:25 +08:00
if ( !canView('Control') ) return;
$monitor = ZM\Monitor::find_one(array('Id'=>$_REQUEST['mid']));
$zmuCommand = getZmuCommand(' -m '.escapeshellarg($_REQUEST['mid']).' -B -C -H -O');
$zmuOutput = exec( $zmuCommand );
if ( $zmuOutput ) {
list($brightness, $contrast, $hue, $colour) = explode(' ', $zmuOutput);
$monitor->Brightness($brightness);
$monitor->Contrast($contrast);
$monitor->Hue($hue);
$monitor->Colour($colour);
}
?>
2020-10-04 05:51:25 +08:00
<div class="modal" id="settingsModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?php echo validHtmlStr($monitor->Name()) ?> - <?php echo translate('Settings') ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form name="contentForm" id="settingsForm" method="post" action="?">
<?php
// We have to manually insert the csrf key into the form when using a modal generated via ajax call
echo getCSRFinputHTML();
?>
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value="settings"/>
<input type="hidden" name="mid" value="<?php echo validInt($_REQUEST['mid']) ?>"/>
<table id="contentTable" class="major">
<tbody>
<tr>
2015-05-10 21:10:30 +08:00
<th scope="row"><?php echo translate('Brightness') ?></th>
<td><input type="number" name="newBrightness" value="<?php echo $monitor->Brightness() ?>" <?php if ( !canView( 'Control' ) ) { ?> disabled="disabled"<?php } ?> /></td>
</tr>
<tr>
2015-05-10 21:10:30 +08:00
<th scope="row"><?php echo translate('Contrast') ?></th>
<td><input type="number" name="newContrast" value="<?php echo $monitor->Contrast() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?> /></td>
</tr>
<tr>
2015-05-10 21:10:30 +08:00
<th scope="row"><?php echo translate('Hue') ?></th>
<td><input type="number" name="newHue" value="<?php echo $monitor->Hue() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?> /></td>
</tr>
<tr>
2015-05-10 21:10:30 +08:00
<th scope="row"><?php echo translate('Colour') ?></th>
<td><input type="number" name="newColour" value="<?php echo $monitor->Colour() ?>" <?php echo canView('Control') ? '' : ' disabled="disabled"' ?> /></td>
</tr>
</tbody>
</table>
2020-10-04 05:51:25 +08:00
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" id="settingsSubmitModal" value="Save"<?php echo canView('Control') ? '' : ' disabled="disabled"' ?>><?php echo translate('Save') ?></button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
2020-10-04 05:51:25 +08:00
</div>