Add an input for an Id to assign to the new monitor. List 10 available Ids.

This commit is contained in:
Isaac Connor 2021-09-25 20:54:35 -04:00
parent 43dfeb5b84
commit f40e2be28a
1 changed files with 16 additions and 1 deletions

View File

@ -355,6 +355,7 @@ $codecs = array(
'MJPEG' => translate('MJPEG'), 'MJPEG' => translate('MJPEG'),
); );
$monitors = dbFetchAll('SELECT Id, Name FROM Monitors ORDER BY Name,Sequence ASC');
$controls = ZM\Control::find(null, array('order'=>'lower(Name)')); $controls = ZM\Control::find(null, array('order'=>'lower(Name)'));
xhtmlHeaders(__FILE__, translate('Monitor').' - '.validHtmlStr($monitor->Name())); xhtmlHeaders(__FILE__, translate('Monitor').' - '.validHtmlStr($monitor->Name()));
@ -452,6 +453,21 @@ foreach ( $tabs as $name=>$value ) {
switch ( $name ) { switch ( $name ) {
case 'general' : case 'general' :
{ {
if (!$monitor->Id()) {
$monitor_ids = array();
foreach ($monitors as $m) { $monitor_ids[] = $m['Id']; }
$available_monitor_ids = array_diff(range(min($monitor_ids),max($monitor_ids)), $monitor_ids);
?>
<tr class="Id">
<td class="text-right pr-3"><?php echo translate('Id') ?></td>
<td><input type="number" step="1" min="1" name="newMonitor[Id]" placeholder="leave blank for auto"/><br/>
10 Available Ids:
<?php echo implode(', ', array_slice($available_monitor_ids, 0, 10)); ?>
</td>
</tr>
<?php
} # end if ! $monitor->Id()
?> ?>
<tr class="Name"> <tr class="Name">
<td class="text-right pr-3"><?php echo translate('Name') ?></td> <td class="text-right pr-3"><?php echo translate('Name') ?></td>
@ -559,7 +575,6 @@ switch ( $name ) {
<td class="text-right pr-3"><?php echo translate('LinkedMonitors'); echo makeHelpLink('OPTIONS_LINKED_MONITORS') ?></td> <td class="text-right pr-3"><?php echo translate('LinkedMonitors'); echo makeHelpLink('OPTIONS_LINKED_MONITORS') ?></td>
<td> <td>
<?php <?php
$monitors = dbFetchAll('SELECT Id, Name FROM Monitors ORDER BY Name,Sequence ASC');
$monitor_options = array(); $monitor_options = array();
foreach ( $monitors as $linked_monitor ) { foreach ( $monitors as $linked_monitor ) {
if ( (!$monitor->Id() || ($monitor->Id()!= $linked_monitor['Id'])) && visibleMonitor($linked_monitor['Id']) ) { if ( (!$monitor->Id() || ($monitor->Id()!= $linked_monitor['Id'])) && visibleMonitor($linked_monitor['Id']) ) {